@tuprolog/2p-full 3.0.7 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/2p-unify.js CHANGED
@@ -19,66 +19,65 @@
19
19
  'use strict';
20
20
  //region block: imports
21
21
  var imul = Math.imul;
22
- var protoOf = kotlin_kotlin.$_$.u8;
23
- var getBooleanHashCode = kotlin_kotlin.$_$.y7;
24
- var initMetadataForClass = kotlin_kotlin.$_$.d8;
25
- var toString = kotlin_kotlin.$_$.x8;
26
- var hashCode = kotlin_kotlin.$_$.c8;
27
- var equals = kotlin_kotlin.$_$.v7;
28
- var KProperty1 = kotlin_kotlin.$_$.v9;
29
- var getPropertyCallableRef = kotlin_kotlin.$_$.a8;
30
- var asSequence = kotlin_kotlin.$_$.q2;
31
- var plus = kotlin_kotlin.$_$.bb;
32
- var map = kotlin_kotlin.$_$.wa;
33
- var Unit_instance = kotlin_kotlin.$_$.r;
34
- var Companion_getInstance = kotlin_it_unibo_tuprolog_core.$_$.y;
35
- var ArrayList_init_$Create$ = kotlin_kotlin.$_$.v;
36
- var toCollection = kotlin_kotlin.$_$.ib;
37
- var constructCallableReference = kotlin_kotlin.$_$.t7;
38
- var Pair = kotlin_kotlin.$_$.fe;
39
- var lazy = kotlin_kotlin.$_$.re;
40
- var asSequence_0 = kotlin_kotlin.$_$.r2;
41
- var THROW_CCE = kotlin_kotlin.$_$.he;
22
+ var protoOf = kotlin_kotlin.$_$.ba;
23
+ var initMetadataForClass = kotlin_kotlin.$_$.k9;
24
+ var Companion_getInstance = kotlin_it_unibo_tuprolog_core.$_$.z;
25
+ var Unit_instance = kotlin_kotlin.$_$.m1;
26
+ var lazy = kotlin_kotlin.$_$.eg;
27
+ var THROW_CCE = kotlin_kotlin.$_$.sf;
42
28
  var VOID = kotlin_kotlin.$_$.b;
43
- var Companion_instance = kotlin_it_unibo_tuprolog_utils.$_$.a;
44
- var Triple = kotlin_kotlin.$_$.je;
45
- var Some = kotlin_it_unibo_tuprolog_utils.$_$.m;
46
- var zip = kotlin_kotlin.$_$.pb;
47
- var flatMap = kotlin_kotlin.$_$.la;
48
- var sequenceOf = kotlin_kotlin.$_$.db;
49
- var defineProp = kotlin_kotlin.$_$.u7;
50
- var sequenceOf_0 = kotlin_kotlin.$_$.cb;
51
- var initMetadataForCompanion = kotlin_kotlin.$_$.e8;
52
- var getKClass = kotlin_kotlin.$_$.s9;
53
- var ClassCastException_init_$Create$ = kotlin_kotlin.$_$.f1;
54
- var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.j1;
55
- var to = kotlin_kotlin.$_$.ye;
56
- var Companion_getInstance_0 = kotlin_it_unibo_tuprolog_core.$_$.x;
57
- var castTo = kotlin_it_unibo_tuprolog_utils.$_$.f;
58
- var Castable = kotlin_it_unibo_tuprolog_utils.$_$.g;
59
- var collectionSizeOrDefault = kotlin_kotlin.$_$.w2;
60
- var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.u;
61
- var initMetadataForInterface = kotlin_kotlin.$_$.g8;
29
+ var Companion_instance = kotlin_it_unibo_tuprolog_utils.$_$.b;
30
+ var Triple = kotlin_kotlin.$_$.uf;
31
+ var Some = kotlin_it_unibo_tuprolog_utils.$_$.h;
32
+ var initMetadataForInterface = kotlin_kotlin.$_$.n9;
33
+ var getStringHashCode = kotlin_kotlin.$_$.i9;
34
+ var getNumberHashCode = kotlin_kotlin.$_$.g9;
35
+ var equals = kotlin_kotlin.$_$.c9;
36
+ var initMetadataForObject = kotlin_kotlin.$_$.p9;
37
+ var initMetadataForCompanion = kotlin_kotlin.$_$.l9;
38
+ var defineProp = kotlin_kotlin.$_$.b9;
39
+ var toString = kotlin_kotlin.$_$.ea;
40
+ var hashCode = kotlin_kotlin.$_$.j9;
41
+ var getBooleanHashCode = kotlin_kotlin.$_$.f9;
42
+ var constructCallableReference = kotlin_kotlin.$_$.a9;
43
+ var KProperty1 = kotlin_kotlin.$_$.eb;
44
+ var getPropertyCallableRef = kotlin_kotlin.$_$.h9;
45
+ var Var = kotlin_it_unibo_tuprolog_core.$_$.c3;
46
+ var isInterface = kotlin_kotlin.$_$.t9;
47
+ var LinkedHashMap_init_$Create$ = kotlin_kotlin.$_$.v1;
48
+ var KtMap = kotlin_kotlin.$_$.d3;
49
+ var throwUninitializedPropertyAccessException = kotlin_kotlin.$_$.u7;
50
+ var Collection = kotlin_kotlin.$_$.z2;
51
+ var ArrayList_init_$Create$ = kotlin_kotlin.$_$.q1;
52
+ var get_lastIndex = kotlin_kotlin.$_$.b5;
53
+ var Struct = kotlin_it_unibo_tuprolog_core.$_$.b2;
54
+ var HashSet_init_$Create$ = kotlin_kotlin.$_$.t1;
55
+ var Enum = kotlin_kotlin.$_$.if;
56
+ var Cons = kotlin_it_unibo_tuprolog_core.$_$.s1;
57
+ var toMutableList = kotlin_kotlin.$_$.g7;
58
+ var Companion_getInstance_0 = kotlin_it_unibo_tuprolog_core.$_$.y;
59
+ var Companion_instance_0 = kotlin_it_unibo_tuprolog_core.$_$.o;
60
+ var HashMap_init_$Create$ = kotlin_kotlin.$_$.r1;
61
+ var noWhenBranchMatchedException = kotlin_kotlin.$_$.fg;
62
62
  //endregion
63
63
  //region block: pre-declaration
64
- initMetadataForClass(Mgu, 'Mgu');
65
- initMetadataForClass(Merge, 'Merge');
64
+ initMetadataForClass(AbstractWorklistUnificator$hooks$1);
66
65
  function mguWithOccurCheck(term1, term2, occurCheckEnabled, $super) {
67
66
  occurCheckEnabled = occurCheckEnabled === VOID ? true : occurCheckEnabled;
68
- return $super === VOID ? this.m1l(term1, term2, occurCheckEnabled) : $super.m1l.call(this, term1, term2, occurCheckEnabled);
67
+ return $super === VOID ? this.b1t(term1, term2, occurCheckEnabled) : $super.b1t.call(this, term1, term2, occurCheckEnabled);
69
68
  }
70
69
  function mgu(term1, term2) {
71
- return this.m1l(term1, term2, true);
70
+ return this.b1t(term1, term2, true);
72
71
  }
73
72
  function matchWithOccurCheck(term1, term2, occurCheckEnabled) {
74
- return !(this.m1l(term1, term2, occurCheckEnabled) === Companion_getInstance().failed());
73
+ return !(this.b1t(term1, term2, occurCheckEnabled) === Companion_getInstance().failed());
75
74
  }
76
75
  function match(term1, term2) {
77
76
  return this.matchWithOccurCheck(term1, term2, true);
78
77
  }
79
78
  function unifyWithOccurCheck(term1, term2, occurCheckEnabled) {
80
- var substitution = this.m1l(term1, term2, occurCheckEnabled);
81
- return substitution.c13() ? null : term1.getSubstituted(substitution, []);
79
+ var substitution = this.b1t(term1, term2, occurCheckEnabled);
80
+ return substitution.t19() ? null : term1.getSubstituted(substitution, []);
82
81
  }
83
82
  function unify(term1, term2) {
84
83
  return this.unifyWithOccurCheck(term1, term2, true);
@@ -86,274 +85,211 @@
86
85
  function merge(substitution1, substitution2) {
87
86
  return this.mergeWithOccurCheck(substitution1, substitution2, true);
88
87
  }
88
+ function indexKey(term) {
89
+ return Companion_instance_1.strict(term);
90
+ }
89
91
  initMetadataForInterface(Unificator, 'Unificator');
90
- initMetadataForClass(AbstractUnificator, 'AbstractUnificator', VOID, VOID, [Unificator]);
92
+ initMetadataForClass(AbstractWorklistUnificator, 'AbstractWorklistUnificator', VOID, VOID, [Unificator]);
91
93
  initMetadataForClass(CachedUnificator, 'CachedUnificator', VOID, VOID, [Unificator]);
92
- initMetadataForClass(Equation, 'Equation', VOID, VOID, [Castable]);
93
- initMetadataForClass(Identity, 'Identity', VOID, Equation);
94
- initMetadataForClass(Assignment, 'Assignment', VOID, Equation);
95
- initMetadataForClass(LeftAssignment, 'LeftAssignment', VOID, Assignment);
96
- initMetadataForClass(RightAssignment, 'RightAssignment', VOID, Assignment);
97
- initMetadataForClass(Comparison, 'Comparison', VOID, Equation);
98
- initMetadataForClass(Contradiction, 'Contradiction', VOID, Equation);
99
- initMetadataForCompanion(Companion);
100
- initMetadataForClass(Unificator$Companion$naive$1, VOID, VOID, AbstractUnificator);
101
- initMetadataForClass(Unificator$Companion$strict$1, VOID, VOID, AbstractUnificator);
102
- initMetadataForCompanion(Companion_0);
103
- //endregion
104
- function Mgu(term1, term2, occurCheckEnabled) {
105
- this.k1k_1 = term1;
106
- this.l1k_1 = term2;
107
- this.m1k_1 = occurCheckEnabled;
108
- }
109
- protoOf(Mgu).toString = function () {
110
- return 'Mgu(term1=' + this.k1k_1.toString() + ', term2=' + this.l1k_1.toString() + ', occurCheckEnabled=' + this.m1k_1 + ')';
111
- };
112
- protoOf(Mgu).hashCode = function () {
113
- var result = this.k1k_1.hashCode();
114
- result = imul(result, 31) + this.l1k_1.hashCode() | 0;
115
- result = imul(result, 31) + getBooleanHashCode(this.m1k_1) | 0;
116
- return result;
117
- };
118
- protoOf(Mgu).equals = function (other) {
119
- if (this === other)
120
- return true;
121
- if (!(other instanceof Mgu))
122
- return false;
123
- if (!this.k1k_1.equals(other.k1k_1))
124
- return false;
125
- if (!this.l1k_1.equals(other.l1k_1))
126
- return false;
127
- if (!(this.m1k_1 === other.m1k_1))
128
- return false;
129
- return true;
130
- };
131
- function Merge(substitution1, substitution2, occurCheckEnabled) {
132
- this.n1k_1 = substitution1;
133
- this.o1k_1 = substitution2;
134
- this.p1k_1 = occurCheckEnabled;
94
+ function unifyInto(store, term1, term2, occurCheckEnabled, $super) {
95
+ occurCheckEnabled = occurCheckEnabled === VOID ? false : occurCheckEnabled;
96
+ return $super === VOID ? this.i1t(store, term1, term2, occurCheckEnabled) : $super.i1t.call(this, store, term1, term2, occurCheckEnabled);
135
97
  }
136
- protoOf(Merge).toString = function () {
137
- return 'Merge(substitution1=' + toString(this.n1k_1) + ', substitution2=' + toString(this.o1k_1) + ', occurCheckEnabled=' + this.p1k_1 + ')';
138
- };
139
- protoOf(Merge).hashCode = function () {
140
- var result = hashCode(this.n1k_1);
141
- result = imul(result, 31) + hashCode(this.o1k_1) | 0;
142
- result = imul(result, 31) + getBooleanHashCode(this.p1k_1) | 0;
143
- return result;
144
- };
145
- protoOf(Merge).equals = function (other) {
146
- if (this === other)
147
- return true;
148
- if (!(other instanceof Merge))
149
- return false;
150
- if (!equals(this.n1k_1, other.n1k_1))
151
- return false;
152
- if (!equals(this.o1k_1, other.o1k_1))
153
- return false;
154
- if (!(this.p1k_1 === other.p1k_1))
155
- return false;
156
- return true;
157
- };
158
- function _get_contextEquations__x0dd77($this) {
159
- var tmp0 = $this.r1k_1;
160
- var tmp = KProperty1;
161
- // Inline function 'kotlin.getValue' call
162
- getPropertyCallableRef('contextEquations', 1, tmp, AbstractUnificator$_get_contextEquations_$ref_7ajcte(), null);
163
- return tmp0.f1();
164
- }
165
- function occurrenceCheck($this, variable, term) {
98
+ initMetadataForInterface(IncrementalUnificator, 'IncrementalUnificator', VOID, VOID, [Unificator]);
99
+ initMetadataForClass(IndexKey, 'IndexKey');
100
+ initMetadataForClass(OfAtom, 'OfAtom', VOID, IndexKey);
101
+ initMetadataForClass(OfInteger, 'OfInteger', VOID, IndexKey);
102
+ initMetadataForClass(OfNumber, 'OfNumber', VOID, IndexKey);
103
+ initMetadataForClass(OfStruct, 'OfStruct', VOID, IndexKey);
104
+ initMetadataForObject(Wildcard, 'Wildcard', VOID, IndexKey);
105
+ initMetadataForCompanion(Companion);
106
+ initMetadataForClass(MergeRequest, 'MergeRequest');
107
+ initMetadataForClass(MguRequest, 'MguRequest');
108
+ function replace(lhs, rhs, $super) {
109
+ lhs = lhs === VOID ? this.v1t() : lhs;
110
+ rhs = rhs === VOID ? this.w1t() : rhs;
166
111
  var tmp;
167
- if (term.tx()) {
168
- tmp = $this.s1k(variable, term);
169
- } else if (term.dx()) {
170
- var tmp0 = term.zw();
171
- var tmp$ret$0;
172
- $l$block: {
173
- // Inline function 'kotlin.sequences.any' call
174
- var _iterator__ex2g4s = tmp0.n();
175
- while (_iterator__ex2g4s.q()) {
176
- var element = _iterator__ex2g4s.r();
177
- if (occurrenceCheck($this, variable, element)) {
178
- tmp$ret$0 = true;
179
- break $l$block;
180
- }
181
- }
182
- tmp$ret$0 = false;
183
- }
184
- tmp = tmp$ret$0;
112
+ if ($super === VOID) {
113
+ this.x1t(lhs, rhs);
114
+ tmp = Unit_instance;
185
115
  } else {
186
- tmp = false;
116
+ tmp = $super.x1t.call(this, lhs, rhs);
187
117
  }
188
118
  return tmp;
189
119
  }
190
- function equationsFor($this, term1, term2) {
191
- var tmp = Companion_instance_0;
192
- return tmp.t1k(term1, term2, AbstractUnificator$checkTermsEquality$ref($this));
120
+ initMetadataForInterface(UnificationStep, 'UnificationStep');
121
+ initMetadataForClass(Unificator$Companion$naive$1, VOID, VOID, AbstractWorklistUnificator, [IncrementalUnificator]);
122
+ initMetadataForClass(Unificator$Companion$strict$1, VOID, VOID, AbstractWorklistUnificator, [IncrementalUnificator]);
123
+ initMetadataForCompanion(Companion_0);
124
+ initMetadataForClass(Bindings, 'Bindings');
125
+ initMetadataForClass(ComparedPair, 'ComparedPair');
126
+ initMetadataForClass(MutableUnificationStep, 'MutableUnificationStep', VOID, VOID, [UnificationStep]);
127
+ initMetadataForClass(StepVerdict, 'StepVerdict', VOID, Enum);
128
+ initMetadataForClass(SubstitutionMaterializer, 'SubstitutionMaterializer');
129
+ initMetadataForClass(UnificationRun, 'UnificationRun');
130
+ //endregion
131
+ function _get_contextHasCycles__5tvlf7($this) {
132
+ return $this.d1s_1.f1();
193
133
  }
194
- function equationsFor_0($this, substitution1, substitution2) {
195
- var tmp = Companion_instance_0;
196
- var tmp_0 = plus(asSequence(substitution1), asSequence(substitution2));
197
- return tmp.fromSequence(map(tmp_0, AbstractUnificator$equationsFor$lambda));
134
+ function _get_baseContext__9mqvkd($this) {
135
+ return $this.e1s_1.f1();
198
136
  }
199
- function applySubstitutionToEquations($this, substitution, equations, exceptIndex) {
200
- var changed = {_v: false};
201
- var inductionVariable = 0;
202
- if (inductionVariable < exceptIndex)
203
- do {
204
- var i = inductionVariable;
205
- inductionVariable = inductionVariable + 1 | 0;
206
- applySubstitutionToEquations$handleIndex(equations, substitution, $this, changed, i);
207
- }
208
- while (inductionVariable < exceptIndex);
209
- var inductionVariable_0 = exceptIndex + 1 | 0;
210
- var last = equations.s();
211
- if (inductionVariable_0 < last)
212
- do {
213
- var i_0 = inductionVariable_0;
214
- inductionVariable_0 = inductionVariable_0 + 1 | 0;
215
- applySubstitutionToEquations$handleIndex(equations, substitution, $this, changed, i_0);
216
- }
217
- while (inductionVariable_0 < last);
218
- return changed._v;
137
+ function newRun($this, base, request) {
138
+ var occursCheck = request.f1s();
139
+ if (base.t19() || (occursCheck && (base === $this.x8() ? _get_contextHasCycles__5tvlf7($this) : hasCycles(base))))
140
+ return null;
141
+ return new UnificationRun($this.c1s_1, new Bindings(base === $this.x8() ? _get_baseContext__9mqvkd($this) : base), occursCheck, request);
219
142
  }
220
- function mgu_0($this, request, equations, occurCheckEnabled) {
221
- var changed = true;
222
- while (changed) {
223
- changed = false;
224
- var eqIterator = equations.g2();
225
- while (eqIterator.q()) {
226
- var eq = $this.u1k(request, eqIterator.r());
227
- if (eq.z1k()) {
228
- return Companion_getInstance().failed();
229
- } else if (eq.a1l()) {
230
- eqIterator.l3();
231
- changed = true;
232
- } else if (eq.j1l()) {
233
- var assignment = eq.castToAssignment();
234
- if (occurCheckEnabled && occurrenceCheck($this, assignment.h1l(), assignment.i1l())) {
235
- return Companion_getInstance().failed();
236
- } else {
237
- changed = changed || applySubstitutionToEquations($this, assignment.g1l(), equations, eqIterator.z3());
238
- }
239
- } else if (eq.b1l()) {
240
- eqIterator.l3();
241
- var _iterator__ex2g4s = equationsFor($this, eq.x1k(), eq.y1k()).n();
242
- $l$loop: while (_iterator__ex2g4s.q()) {
243
- var it = _iterator__ex2g4s.r();
244
- var subEq = it.z1k() || it.a1l() ? $this.u1k(request, it) : it;
245
- if (subEq.a1l())
246
- continue $l$loop;
247
- else if (subEq.z1k())
248
- return Companion_getInstance().failed();
249
- else {
250
- eqIterator.c4(subEq);
251
- }
252
- }
253
- changed = true;
254
- }
255
- }
256
- }
257
- // Inline function 'kotlin.collections.filter' call
258
- // Inline function 'kotlin.collections.filterTo' call
259
- var destination = ArrayList_init_$Create$();
260
- var _iterator__ex2g4s_0 = equations.n();
261
- while (_iterator__ex2g4s_0.q()) {
262
- var element = _iterator__ex2g4s_0.r();
263
- if (element.j1l()) {
264
- destination.l(element);
265
- }
266
- }
267
- return $this.k1l(request, toSubstitution(destination));
268
- }
269
- function newDeque($this, items) {
270
- // Inline function 'kotlin.collections.arrayListOf' call
271
- var tmp$ret$0 = ArrayList_init_$Create$();
272
- return toCollection(items, tmp$ret$0);
143
+ function AbstractWorklistUnificator$hooks$1(this$0) {
144
+ this.g1s_1 = this$0;
273
145
  }
274
- function AbstractUnificator$contextEquations$delegate$lambda(this$0) {
146
+ protoOf(AbstractWorklistUnificator$hooks$1).h1s = function (first, second) {
147
+ return this.g1s_1.h1s(first, second);
148
+ };
149
+ protoOf(AbstractWorklistUnificator$hooks$1).i1s = function (step) {
150
+ return this.g1s_1.i1s(step);
151
+ };
152
+ function AbstractWorklistUnificator$lazyContextHasCycles$lambda(this$0) {
275
153
  return function () {
276
- return toEquations(this$0.v8());
154
+ return hasCycles(this$0.x8());
277
155
  };
278
156
  }
279
- function AbstractUnificator$_get_contextEquations_$ref_7ajcte() {
280
- return constructCallableReference(function (p0) {
281
- return _get_contextEquations__x0dd77(p0);
282
- }, 1, 0, 28);
283
- }
284
- function AbstractUnificator$checkTermsEquality$ref(p0) {
285
- return constructCallableReference(function (p0_0, p1) {
286
- return p0.s1k(p0_0, p1);
287
- }, 2, 0, 29, 'checkTermsEquality', [p0]);
288
- }
289
- function AbstractUnificator$equationsFor$lambda(it) {
290
- // Inline function 'kotlin.collections.toPair' call
291
- return new Pair(it.e1(), it.f1());
292
- }
293
- function applySubstitutionToEquations$handleIndex($equations, $substitution, this$0, changed, i) {
294
- if ($equations.t(i).z1k() || $equations.t(i).a1l())
295
- return Unit_instance;
296
- var currentEq = $equations.t(i);
297
- var _destruct__k2r9zo = currentEq.apply($substitution).toPair();
298
- var newLhs = _destruct__k2r9zo.zd();
299
- var newRhs = _destruct__k2r9zo.ae();
300
- if (!currentEq.x1k().equals(newLhs) || !currentEq.y1k().equals(newRhs)) {
301
- var tmp = Companion_instance_0;
302
- $equations.i3(i, tmp.l1l(newLhs, newRhs, AbstractUnificator$checkTermsEquality$ref(this$0)));
303
- changed._v = true;
304
- }
157
+ function AbstractWorklistUnificator$lazyBaseContext$lambda(this$0) {
158
+ return function () {
159
+ var tmp;
160
+ if (this$0.x8().t19() || this$0.x8().s() < 2) {
161
+ tmp = this$0.x8();
162
+ } else {
163
+ var bindings = new Bindings(Companion_getInstance().empty());
164
+ // Inline function 'kotlin.collections.iterator' call
165
+ var _iterator__ex2g4s = this$0.x8().d1().n();
166
+ while (_iterator__ex2g4s.q()) {
167
+ var _destruct__k2r9zo = _iterator__ex2g4s.r();
168
+ // Inline function 'kotlin.collections.component1' call
169
+ var variable = _destruct__k2r9zo.e1();
170
+ // Inline function 'kotlin.collections.component2' call
171
+ var term = _destruct__k2r9zo.f1();
172
+ bindings.m1s(variable, term);
173
+ }
174
+ tmp = (new SubstitutionMaterializer(bindings)).q1s();
175
+ }
176
+ return tmp;
177
+ };
305
178
  }
306
- function AbstractUnificator(context) {
307
- this.q1k_1 = context;
179
+ function AbstractWorklistUnificator(context) {
180
+ this.b1s_1 = context;
308
181
  var tmp = this;
309
- tmp.r1k_1 = lazy(AbstractUnificator$contextEquations$delegate$lambda(this));
182
+ tmp.c1s_1 = new AbstractWorklistUnificator$hooks$1(this);
183
+ var tmp_0 = this;
184
+ tmp_0.d1s_1 = lazy(AbstractWorklistUnificator$lazyContextHasCycles$lambda(this));
185
+ var tmp_1 = this;
186
+ tmp_1.e1s_1 = lazy(AbstractWorklistUnificator$lazyBaseContext$lambda(this));
310
187
  }
311
- protoOf(AbstractUnificator).v8 = function () {
312
- return this.q1k_1;
188
+ protoOf(AbstractWorklistUnificator).x8 = function () {
189
+ return this.b1s_1;
190
+ };
191
+ protoOf(AbstractWorklistUnificator).h1s = function (first, second) {
192
+ return first.equals(second);
193
+ };
194
+ protoOf(AbstractWorklistUnificator).i1s = function (step) {
195
+ return Unit_instance;
313
196
  };
314
- protoOf(AbstractUnificator).k1l = function (request, result) {
197
+ protoOf(AbstractWorklistUnificator).r1s = function (request, result) {
315
198
  return result;
316
199
  };
317
- protoOf(AbstractUnificator).u1k = function (request, equation) {
318
- return equation;
319
- };
320
- protoOf(AbstractUnificator).m1l = function (term1, term2, occurCheckEnabled) {
321
- if (this.v8().c13())
322
- return Companion_getInstance().failed();
323
- var equations = newDeque(this, plus(asSequence_0(_get_contextEquations__x0dd77(this)), equationsFor(this, term1, term2)));
324
- return mgu_0(this, new Mgu(term1, term2, occurCheckEnabled), equations, occurCheckEnabled);
325
- };
326
- protoOf(AbstractUnificator).mguWithOccurCheck = function (term1, term2, occurCheckEnabled, $super) {
327
- return this.mguWithOccurCheck(term1, term2, occurCheckEnabled, ($super == null ? true : $super instanceof AbstractUnificator) ? $super : THROW_CCE());
328
- };
329
- protoOf(AbstractUnificator).n1l = function (substitution1, substitution2, occurCheckEnabled) {
330
- if (this.v8().c13() || substitution1.c13() || substitution2.c13())
331
- return Companion_getInstance().failed();
332
- if (!occurCheckEnabled) {
333
- var quickMerge = this.v8().plus(substitution1).plus(substitution2);
334
- if (quickMerge.b13()) {
335
- return quickMerge;
200
+ protoOf(AbstractWorklistUnificator).s1s = function (store, term1, term2, occurCheckEnabled) {
201
+ if (this.x8().t19() || (occurCheckEnabled && _get_contextHasCycles__5tvlf7(this)))
202
+ return false;
203
+ var run = new UnificationRun(this.c1s_1, new Bindings(_get_baseContext__9mqvkd(this), store), occurCheckEnabled, new MguRequest(term1, term2, occurCheckEnabled));
204
+ run.z1s(term1, term2);
205
+ return run.a1t();
206
+ };
207
+ protoOf(AbstractWorklistUnificator).b1t = function (term1, term2, occurCheckEnabled) {
208
+ var request = new MguRequest(term1, term2, occurCheckEnabled);
209
+ var tmp0_elvis_lhs = newRun(this, this.x8(), request);
210
+ var tmp;
211
+ if (tmp0_elvis_lhs == null) {
212
+ return this.r1s(request, Companion_getInstance().failed());
213
+ } else {
214
+ tmp = tmp0_elvis_lhs;
215
+ }
216
+ var run = tmp;
217
+ run.z1s(term1, term2);
218
+ return this.r1s(request, run.c1t());
219
+ };
220
+ protoOf(AbstractWorklistUnificator).mguWithOccurCheck = function (term1, term2, occurCheckEnabled, $super) {
221
+ return this.mguWithOccurCheck(term1, term2, occurCheckEnabled, ($super == null ? true : $super instanceof AbstractWorklistUnificator) ? $super : THROW_CCE());
222
+ };
223
+ protoOf(AbstractWorklistUnificator).d1t = function (substitution1, substitution2, occurCheckEnabled) {
224
+ var request = new MergeRequest(substitution1, substitution2, occurCheckEnabled);
225
+ var tmp;
226
+ if (substitution1.t19() || substitution2.t19() || this.x8().t19()) {
227
+ tmp = null;
228
+ } else if (this.x8().i()) {
229
+ tmp = newRun(this, substitution1, request);
230
+ } else {
231
+ var tmp0_safe_receiver = newRun(this, this.x8(), request);
232
+ var tmp_0;
233
+ if (tmp0_safe_receiver == null) {
234
+ tmp_0 = null;
235
+ } else {
236
+ // Inline function 'kotlin.takeIf' call
237
+ var tmp_1;
238
+ if (tmp0_safe_receiver.e1t(substitution1)) {
239
+ tmp_1 = tmp0_safe_receiver;
240
+ } else {
241
+ tmp_1 = null;
242
+ }
243
+ tmp_0 = tmp_1;
244
+ }
245
+ tmp = tmp_0;
246
+ }
247
+ var tmp1_safe_receiver = tmp;
248
+ var tmp_2;
249
+ if (tmp1_safe_receiver == null) {
250
+ tmp_2 = null;
251
+ } else {
252
+ // Inline function 'kotlin.takeIf' call
253
+ var tmp_3;
254
+ if (tmp1_safe_receiver.e1t(substitution2)) {
255
+ tmp_3 = tmp1_safe_receiver;
256
+ } else {
257
+ tmp_3 = null;
336
258
  }
259
+ tmp_2 = tmp_3;
337
260
  }
338
- var equations = newDeque(this, plus(asSequence_0(_get_contextEquations__x0dd77(this)), equationsFor_0(this, substitution1, substitution2)));
339
- return mgu_0(this, new Merge(substitution1, substitution2, occurCheckEnabled), equations, occurCheckEnabled);
261
+ var tmp2_elvis_lhs = tmp_2;
262
+ var tmp_4;
263
+ if (tmp2_elvis_lhs == null) {
264
+ return this.r1s(request, Companion_getInstance().failed());
265
+ } else {
266
+ tmp_4 = tmp2_elvis_lhs;
267
+ }
268
+ var run = tmp_4;
269
+ return this.r1s(request, run.c1t());
340
270
  };
341
- protoOf(AbstractUnificator).mergeWithOccurCheck = function (substitution1, substitution2, occurCheckEnabled) {
342
- return this.n1l(substitution1, substitution2, occurCheckEnabled);
271
+ protoOf(AbstractWorklistUnificator).mergeWithOccurCheck = function (substitution1, substitution2, occurCheckEnabled) {
272
+ return this.d1t(substitution1, substitution2, occurCheckEnabled);
343
273
  };
344
274
  function CachedUnificator(decorated, cacheCapacity) {
345
- this.o1l_1 = decorated;
346
- this.p1l_1 = Companion_instance.cr(cacheCapacity);
275
+ this.f1t_1 = decorated;
276
+ this.g1t_1 = Companion_instance.sx(cacheCapacity);
347
277
  }
348
- protoOf(CachedUnificator).m1l = function (term1, term2, occurCheckEnabled) {
278
+ protoOf(CachedUnificator).h1t = function (term) {
279
+ return this.f1t_1.indexKey(term);
280
+ };
281
+ protoOf(CachedUnificator).indexKey = function (term) {
282
+ return this.h1t(term);
283
+ };
284
+ protoOf(CachedUnificator).b1t = function (term1, term2, occurCheckEnabled) {
349
285
  var mguRequest = new Triple(term1, term2, occurCheckEnabled);
350
- var cached = this.p1l_1.j2(mguRequest);
286
+ var cached = this.g1t_1.j2(mguRequest);
351
287
  var tmp;
352
288
  if (cached instanceof Some) {
353
- tmp = cached.fr_1;
289
+ tmp = cached.vx_1;
354
290
  } else {
355
- var mguResult = this.o1l_1.m1l(term1, term2, occurCheckEnabled);
356
- this.p1l_1.dr(mguRequest, mguResult);
291
+ var mguResult = this.f1t_1.b1t(term1, term2, occurCheckEnabled);
292
+ this.g1t_1.tx(mguRequest, mguResult);
357
293
  tmp = mguResult;
358
294
  }
359
295
  return tmp;
@@ -361,804 +297,995 @@
361
297
  protoOf(CachedUnificator).mguWithOccurCheck = function (term1, term2, occurCheckEnabled, $super) {
362
298
  return this.mguWithOccurCheck(term1, term2, occurCheckEnabled, ($super == null ? true : $super instanceof CachedUnificator) ? $super : THROW_CCE());
363
299
  };
364
- protoOf(CachedUnificator).n1l = function (substitution1, substitution2, occurCheckEnabled) {
300
+ protoOf(CachedUnificator).d1t = function (substitution1, substitution2, occurCheckEnabled) {
365
301
  var mguRequest = new Triple(substitution1, substitution2, occurCheckEnabled);
366
- var cached = this.p1l_1.j2(mguRequest);
302
+ var cached = this.g1t_1.j2(mguRequest);
367
303
  var tmp;
368
304
  if (cached instanceof Some) {
369
- tmp = cached.fr_1;
305
+ tmp = cached.vx_1;
370
306
  } else {
371
- var mguResult = this.o1l_1.mergeWithOccurCheck(substitution1, substitution2, occurCheckEnabled);
372
- this.p1l_1.dr(mguRequest, mguResult);
307
+ var mguResult = this.f1t_1.mergeWithOccurCheck(substitution1, substitution2, occurCheckEnabled);
308
+ this.g1t_1.tx(mguRequest, mguResult);
373
309
  tmp = mguResult;
374
310
  }
375
311
  return tmp;
376
312
  };
377
313
  protoOf(CachedUnificator).mergeWithOccurCheck = function (substitution1, substitution2, occurCheckEnabled) {
378
- return this.n1l(substitution1, substitution2, occurCheckEnabled);
314
+ return this.d1t(substitution1, substitution2, occurCheckEnabled);
379
315
  };
380
- function allOfLists($this, lhs, rhs, equalityChecker) {
381
- var tmp;
382
- if (equalityChecker === VOID) {
383
- tmp = Term$equals$ref();
384
- } else {
385
- tmp = equalityChecker;
386
- }
387
- equalityChecker = tmp;
388
- var tmp_0 = zip(lhs.unfold(), rhs.unfold());
389
- return flatMap(tmp_0, Equation$Companion$allOfLists$lambda(equalityChecker));
390
- }
391
- function allOfTuples($this, lhs, rhs, equalityChecker) {
392
- var tmp;
393
- if (equalityChecker === VOID) {
394
- tmp = Term$equals$ref();
395
- } else {
396
- tmp = equalityChecker;
397
- }
398
- equalityChecker = tmp;
399
- var tmp_0 = zip(lhs.unfold(), rhs.unfold());
400
- return flatMap(tmp_0, Equation$Companion$allOfTuples$lambda(equalityChecker));
401
- }
402
- function Term$equals$ref() {
403
- return constructCallableReference(function (p0, p1) {
404
- return p0.equals(p1);
405
- }, 2, 0, 30, 'equals');
406
- }
407
- function Equation$Companion$from$lambda($equalityChecker) {
408
- return function (it) {
409
- return Companion_instance_0.q1l(it, $equalityChecker);
410
- };
411
- }
412
- function Equation$Companion$allOfLists$lambda($equalityChecker) {
413
- return function (_destruct__k2r9zo) {
414
- var l = _destruct__k2r9zo.zd();
415
- var r = _destruct__k2r9zo.ae();
416
- return l.kx() && r.kx() ? sequenceOf(Companion_instance_0.l1l(l.castToCons().dz(), r.castToCons().dz(), $equalityChecker)) : l.jx() && r.jx() ? sequenceOf(Companion_instance_0.l1l(l.castToList(), r.castToList(), $equalityChecker)) : Companion_instance_0.t1k(l, r, $equalityChecker);
417
- };
316
+ function IncrementalUnificator() {
418
317
  }
419
- function Equation$Companion$allOfTuples$lambda($equalityChecker) {
420
- return function (_destruct__k2r9zo) {
421
- var l = _destruct__k2r9zo.zd();
422
- var r = _destruct__k2r9zo.ae();
423
- return l.ix() && r.ix() ? sequenceOf(Companion_instance_0.l1l(l.castToTuple().ry(), r.castToTuple().ry(), $equalityChecker)) : Companion_instance_0.t1k(l, r, $equalityChecker);
424
- };
318
+ function OfAtom(value) {
319
+ IndexKey.call(this);
320
+ this.j1t_1 = value;
425
321
  }
426
- function Equation$Companion$allOf$lambda($equalityChecker) {
427
- return function (it) {
428
- return Companion_instance_0.q1l(it, $equalityChecker);
429
- };
430
- }
431
- function Identity(lhs, rhs) {
432
- Equation.call(this, lhs, rhs);
433
- this.t1l_1 = lhs;
434
- this.u1l_1 = rhs;
435
- }
436
- protoOf(Identity).x1k = function () {
437
- return this.t1l_1;
438
- };
439
- protoOf(Identity).y1k = function () {
440
- return this.u1l_1;
441
- };
442
- protoOf(Identity).a1l = function () {
322
+ protoOf(OfAtom).k1t = function () {
443
323
  return true;
444
324
  };
445
- protoOf(Identity).v1l = function () {
446
- return this;
447
- };
448
- protoOf(Identity).asIdentity = function () {
449
- return this.v1l();
450
- };
451
- protoOf(Identity).w1l = function (lhs, rhs) {
452
- return this.x1l(lhs, rhs);
453
- };
454
- protoOf(Identity).x1l = function (lhs, rhs) {
455
- return new Identity(lhs, rhs);
325
+ protoOf(OfAtom).toString = function () {
326
+ return 'OfAtom(value=' + this.j1t_1 + ')';
456
327
  };
457
- protoOf(Identity).toString = function () {
458
- return 'Identity(lhs=' + this.t1l_1.toString() + ', rhs=' + this.u1l_1.toString() + ')';
328
+ protoOf(OfAtom).hashCode = function () {
329
+ return getStringHashCode(this.j1t_1);
459
330
  };
460
- protoOf(Identity).hashCode = function () {
461
- var result = this.t1l_1.hashCode();
462
- result = imul(result, 31) + this.u1l_1.hashCode() | 0;
463
- return result;
464
- };
465
- protoOf(Identity).equals = function (other) {
331
+ protoOf(OfAtom).equals = function (other) {
466
332
  if (this === other)
467
333
  return true;
468
- if (!(other instanceof Identity))
334
+ if (!(other instanceof OfAtom))
469
335
  return false;
470
- if (!this.t1l_1.equals(other.t1l_1))
471
- return false;
472
- if (!this.u1l_1.equals(other.u1l_1))
336
+ if (!(this.j1t_1 === other.j1t_1))
473
337
  return false;
474
338
  return true;
475
339
  };
476
- function Assignment(lhs, rhs) {
477
- Equation.call(this, lhs, rhs);
478
- this.e1l_1 = lhs;
479
- this.f1l_1 = rhs;
340
+ function OfInteger(value) {
341
+ IndexKey.call(this);
342
+ this.l1t_1 = value;
480
343
  }
481
- protoOf(Assignment).x1k = function () {
482
- return this.e1l_1;
483
- };
484
- protoOf(Assignment).y1k = function () {
485
- return this.f1l_1;
486
- };
487
- protoOf(Assignment).j1l = function () {
344
+ protoOf(OfInteger).k1t = function () {
488
345
  return true;
489
346
  };
490
- protoOf(Assignment).b1m = function () {
491
- return this;
492
- };
493
- protoOf(Assignment).asAssignment = function () {
494
- return this.b1m();
495
- };
496
- protoOf(Assignment).c1m = function () {
497
- return new Pair(this.h1l(), this.i1l());
347
+ protoOf(OfInteger).toString = function () {
348
+ return 'OfInteger(value=' + this.l1t_1.toString() + ')';
498
349
  };
499
- protoOf(Assignment).toAssignmentPair = function () {
500
- return this.c1m();
350
+ protoOf(OfInteger).hashCode = function () {
351
+ return this.l1t_1.hashCode();
501
352
  };
502
- protoOf(Assignment).g1l = function () {
503
- return Companion_getInstance().unifier(this.h1l(), this.i1l());
504
- };
505
- protoOf(Assignment).toSubstitution = function () {
506
- return this.g1l();
353
+ protoOf(OfInteger).equals = function (other) {
354
+ if (this === other)
355
+ return true;
356
+ if (!(other instanceof OfInteger))
357
+ return false;
358
+ if (!this.l1t_1.equals(other.l1t_1))
359
+ return false;
360
+ return true;
507
361
  };
508
- function LeftAssignment(lhs, rhs) {
509
- Assignment.call(this, lhs, rhs);
510
- this.h1m_1 = lhs;
511
- this.i1m_1 = rhs;
512
- this.j1m_1 = this.h1m_1;
513
- this.k1m_1 = this.i1m_1;
362
+ function OfNumber(value) {
363
+ IndexKey.call(this);
364
+ this.m1t_1 = value;
514
365
  }
515
- protoOf(LeftAssignment).x1k = function () {
516
- return this.h1m_1;
517
- };
518
- protoOf(LeftAssignment).y1k = function () {
519
- return this.i1m_1;
520
- };
521
- protoOf(LeftAssignment).h1l = function () {
522
- return this.j1m_1;
523
- };
524
- protoOf(LeftAssignment).i1l = function () {
525
- return this.k1m_1;
526
- };
527
- protoOf(LeftAssignment).y1l = function () {
366
+ protoOf(OfNumber).k1t = function () {
528
367
  return true;
529
368
  };
530
- protoOf(LeftAssignment).l1m = function () {
531
- return this;
532
- };
533
- protoOf(LeftAssignment).asLeftAssignment = function () {
534
- return this.l1m();
535
- };
536
- protoOf(LeftAssignment).w1l = function (lhs, rhs) {
537
- return this.m1m(lhs.castToVar(), rhs);
538
- };
539
- protoOf(LeftAssignment).n1m = function () {
540
- return new Pair(this.h1m_1, this.i1m_1);
541
- };
542
- protoOf(LeftAssignment).toPair = function () {
543
- return this.n1m();
544
- };
545
- protoOf(LeftAssignment).m1m = function (lhs, rhs) {
546
- return new LeftAssignment(lhs, rhs);
547
- };
548
- protoOf(LeftAssignment).toString = function () {
549
- return 'LeftAssignment(lhs=' + this.h1m_1.toString() + ', rhs=' + this.i1m_1.toString() + ')';
369
+ protoOf(OfNumber).toString = function () {
370
+ return 'OfNumber(value=' + this.m1t_1 + ')';
550
371
  };
551
- protoOf(LeftAssignment).hashCode = function () {
552
- var result = this.h1m_1.hashCode();
553
- result = imul(result, 31) + this.i1m_1.hashCode() | 0;
554
- return result;
372
+ protoOf(OfNumber).hashCode = function () {
373
+ return getNumberHashCode(this.m1t_1);
555
374
  };
556
- protoOf(LeftAssignment).equals = function (other) {
375
+ protoOf(OfNumber).equals = function (other) {
557
376
  if (this === other)
558
377
  return true;
559
- if (!(other instanceof LeftAssignment))
560
- return false;
561
- if (!this.h1m_1.equals(other.h1m_1))
378
+ if (!(other instanceof OfNumber))
562
379
  return false;
563
- if (!this.i1m_1.equals(other.i1m_1))
380
+ if (!equals(this.m1t_1, other.m1t_1))
564
381
  return false;
565
382
  return true;
566
383
  };
567
- function RightAssignment(lhs, rhs) {
568
- Assignment.call(this, lhs, rhs);
569
- this.s1m_1 = lhs;
570
- this.t1m_1 = rhs;
571
- this.u1m_1 = this.t1m_1;
572
- this.v1m_1 = this.s1m_1;
384
+ function OfStruct(functor, arity) {
385
+ IndexKey.call(this);
386
+ this.n1t_1 = functor;
387
+ this.o1t_1 = arity;
573
388
  }
574
- protoOf(RightAssignment).x1k = function () {
575
- return this.s1m_1;
576
- };
577
- protoOf(RightAssignment).y1k = function () {
578
- return this.t1m_1;
579
- };
580
- protoOf(RightAssignment).h1l = function () {
581
- return this.u1m_1;
582
- };
583
- protoOf(RightAssignment).i1l = function () {
584
- return this.v1m_1;
585
- };
586
- protoOf(RightAssignment).z1l = function () {
389
+ protoOf(OfStruct).k1t = function () {
587
390
  return true;
588
391
  };
589
- protoOf(RightAssignment).w1m = function () {
590
- return this;
591
- };
592
- protoOf(RightAssignment).asRightAssignment = function () {
593
- return this.w1m();
594
- };
595
- protoOf(RightAssignment).w1l = function (lhs, rhs) {
596
- return this.x1m(lhs, rhs.castToVar());
392
+ protoOf(OfStruct).toString = function () {
393
+ return 'OfStruct(functor=' + this.n1t_1 + ', arity=' + this.o1t_1 + ')';
597
394
  };
598
- protoOf(RightAssignment).n1m = function () {
599
- return new Pair(this.s1m_1, this.t1m_1);
600
- };
601
- protoOf(RightAssignment).toPair = function () {
602
- return this.n1m();
603
- };
604
- protoOf(RightAssignment).x1m = function (lhs, rhs) {
605
- return new RightAssignment(lhs, rhs);
606
- };
607
- protoOf(RightAssignment).toString = function () {
608
- return 'RightAssignment(lhs=' + this.s1m_1.toString() + ', rhs=' + this.t1m_1.toString() + ')';
609
- };
610
- protoOf(RightAssignment).hashCode = function () {
611
- var result = this.s1m_1.hashCode();
612
- result = imul(result, 31) + this.t1m_1.hashCode() | 0;
395
+ protoOf(OfStruct).hashCode = function () {
396
+ var result = getStringHashCode(this.n1t_1);
397
+ result = imul(result, 31) + this.o1t_1 | 0;
613
398
  return result;
614
399
  };
615
- protoOf(RightAssignment).equals = function (other) {
400
+ protoOf(OfStruct).equals = function (other) {
616
401
  if (this === other)
617
402
  return true;
618
- if (!(other instanceof RightAssignment))
403
+ if (!(other instanceof OfStruct))
619
404
  return false;
620
- if (!this.s1m_1.equals(other.s1m_1))
405
+ if (!(this.n1t_1 === other.n1t_1))
621
406
  return false;
622
- if (!this.t1m_1.equals(other.t1m_1))
407
+ if (!(this.o1t_1 === other.o1t_1))
623
408
  return false;
624
409
  return true;
625
410
  };
626
- function Comparison(lhs, rhs) {
627
- Equation.call(this, lhs, rhs);
628
- this.a1n_1 = lhs;
629
- this.b1n_1 = rhs;
411
+ function Wildcard() {
412
+ Wildcard_instance = this;
413
+ IndexKey.call(this);
630
414
  }
631
- protoOf(Comparison).x1k = function () {
632
- return this.a1n_1;
415
+ protoOf(Wildcard).k1t = function () {
416
+ return false;
633
417
  };
634
- protoOf(Comparison).y1k = function () {
635
- return this.b1n_1;
418
+ protoOf(Wildcard).toString = function () {
419
+ return 'Wildcard';
636
420
  };
637
- protoOf(Comparison).b1l = function () {
638
- return true;
421
+ protoOf(Wildcard).hashCode = function () {
422
+ return -1410060530;
639
423
  };
640
- protoOf(Comparison).c1n = function () {
641
- return this;
424
+ protoOf(Wildcard).equals = function (other) {
425
+ if (this === other)
426
+ return true;
427
+ if (!(other instanceof Wildcard))
428
+ return false;
429
+ return true;
642
430
  };
643
- protoOf(Comparison).asComparison = function () {
644
- return this.c1n();
431
+ var Wildcard_instance;
432
+ function Wildcard_getInstance() {
433
+ if (Wildcard_instance == null)
434
+ new Wildcard();
435
+ return Wildcard_instance;
436
+ }
437
+ function Companion() {
438
+ }
439
+ protoOf(Companion).strict = function (term) {
440
+ var tmp;
441
+ if (term.t14()) {
442
+ tmp = Wildcard_getInstance();
443
+ } else if (term.s13()) {
444
+ tmp = new OfAtom(term.castToAtom().f1());
445
+ } else if (term.xo()) {
446
+ tmp = new OfInteger(term.castToInteger().f1());
447
+ } else if (term.y14()) {
448
+ tmp = new OfNumber(term.castToReal().f1().toDouble());
449
+ } else if (term.d14()) {
450
+ // Inline function 'kotlin.let' call
451
+ var it = term.castToStruct();
452
+ tmp = new OfStruct(it.x13(), it.r13());
453
+ } else {
454
+ tmp = Wildcard_getInstance();
455
+ }
456
+ return tmp;
645
457
  };
646
- protoOf(Comparison).w1l = function (lhs, rhs) {
647
- return this.x1l(lhs, rhs);
458
+ protoOf(Companion).numbersByValue = function (term) {
459
+ return term.x14() ? new OfNumber(term.castToNumeric().b18().toDouble()) : this.strict(term);
648
460
  };
649
- protoOf(Comparison).x1l = function (lhs, rhs) {
650
- return new Comparison(lhs, rhs);
461
+ var Companion_instance_1;
462
+ function Companion_getInstance_1() {
463
+ return Companion_instance_1;
464
+ }
465
+ function IndexKey() {
466
+ }
467
+ function MergeRequest(substitution1, substitution2, occurCheckEnabled) {
468
+ this.p1t_1 = substitution1;
469
+ this.q1t_1 = substitution2;
470
+ this.r1t_1 = occurCheckEnabled;
471
+ }
472
+ protoOf(MergeRequest).f1s = function () {
473
+ return this.r1t_1;
651
474
  };
652
- protoOf(Comparison).toString = function () {
653
- return 'Comparison(lhs=' + this.a1n_1.toString() + ', rhs=' + this.b1n_1.toString() + ')';
475
+ protoOf(MergeRequest).toString = function () {
476
+ return 'MergeRequest(substitution1=' + toString(this.p1t_1) + ', substitution2=' + toString(this.q1t_1) + ', occurCheckEnabled=' + this.r1t_1 + ')';
654
477
  };
655
- protoOf(Comparison).hashCode = function () {
656
- var result = this.a1n_1.hashCode();
657
- result = imul(result, 31) + this.b1n_1.hashCode() | 0;
478
+ protoOf(MergeRequest).hashCode = function () {
479
+ var result = hashCode(this.p1t_1);
480
+ result = imul(result, 31) + hashCode(this.q1t_1) | 0;
481
+ result = imul(result, 31) + getBooleanHashCode(this.r1t_1) | 0;
658
482
  return result;
659
483
  };
660
- protoOf(Comparison).equals = function (other) {
484
+ protoOf(MergeRequest).equals = function (other) {
661
485
  if (this === other)
662
486
  return true;
663
- if (!(other instanceof Comparison))
487
+ if (!(other instanceof MergeRequest))
488
+ return false;
489
+ if (!equals(this.p1t_1, other.p1t_1))
664
490
  return false;
665
- if (!this.a1n_1.equals(other.a1n_1))
491
+ if (!equals(this.q1t_1, other.q1t_1))
666
492
  return false;
667
- if (!this.b1n_1.equals(other.b1n_1))
493
+ if (!(this.r1t_1 === other.r1t_1))
668
494
  return false;
669
495
  return true;
670
496
  };
671
- function Contradiction(lhs, rhs) {
672
- Equation.call(this, lhs, rhs);
673
- this.f1n_1 = lhs;
674
- this.g1n_1 = rhs;
497
+ function MguRequest(term1, term2, occurCheckEnabled) {
498
+ this.s1t_1 = term1;
499
+ this.t1t_1 = term2;
500
+ this.u1t_1 = occurCheckEnabled;
675
501
  }
676
- protoOf(Contradiction).x1k = function () {
677
- return this.f1n_1;
502
+ protoOf(MguRequest).f1s = function () {
503
+ return this.u1t_1;
678
504
  };
679
- protoOf(Contradiction).y1k = function () {
680
- return this.g1n_1;
505
+ protoOf(MguRequest).toString = function () {
506
+ return 'MguRequest(term1=' + this.s1t_1.toString() + ', term2=' + this.t1t_1.toString() + ', occurCheckEnabled=' + this.u1t_1 + ')';
681
507
  };
682
- protoOf(Contradiction).z1k = function () {
683
- return true;
684
- };
685
- protoOf(Contradiction).h1n = function () {
686
- return this;
687
- };
688
- protoOf(Contradiction).asContradiction = function () {
689
- return this.h1n();
690
- };
691
- protoOf(Contradiction).w1l = function (lhs, rhs) {
692
- return this.x1l(lhs, rhs);
693
- };
694
- protoOf(Contradiction).g1l = function () {
695
- return Companion_getInstance().failed();
696
- };
697
- protoOf(Contradiction).toSubstitution = function () {
698
- return this.g1l();
699
- };
700
- protoOf(Contradiction).x1l = function (lhs, rhs) {
701
- return new Contradiction(lhs, rhs);
702
- };
703
- protoOf(Contradiction).toString = function () {
704
- return 'Contradiction(lhs=' + this.f1n_1.toString() + ', rhs=' + this.g1n_1.toString() + ')';
705
- };
706
- protoOf(Contradiction).hashCode = function () {
707
- var result = this.f1n_1.hashCode();
708
- result = imul(result, 31) + this.g1n_1.hashCode() | 0;
508
+ protoOf(MguRequest).hashCode = function () {
509
+ var result = this.s1t_1.hashCode();
510
+ result = imul(result, 31) + this.t1t_1.hashCode() | 0;
511
+ result = imul(result, 31) + getBooleanHashCode(this.u1t_1) | 0;
709
512
  return result;
710
513
  };
711
- protoOf(Contradiction).equals = function (other) {
514
+ protoOf(MguRequest).equals = function (other) {
712
515
  if (this === other)
713
516
  return true;
714
- if (!(other instanceof Contradiction))
517
+ if (!(other instanceof MguRequest))
518
+ return false;
519
+ if (!this.s1t_1.equals(other.s1t_1))
715
520
  return false;
716
- if (!this.f1n_1.equals(other.f1n_1))
521
+ if (!this.t1t_1.equals(other.t1t_1))
717
522
  return false;
718
- if (!this.g1n_1.equals(other.g1n_1))
523
+ if (!(this.u1t_1 === other.u1t_1))
719
524
  return false;
720
525
  return true;
721
526
  };
722
- function Companion() {
527
+ function UnificationStep() {
723
528
  }
724
- protoOf(Companion).l1l = function (lhs, rhs, equalityChecker) {
725
- var tmp;
726
- if (lhs.tx() && rhs.tx()) {
727
- var tmp_0;
728
- if (equalityChecker(lhs, rhs)) {
729
- tmp_0 = new Identity(lhs, rhs);
730
- } else {
731
- tmp_0 = new LeftAssignment(lhs.castToVar(), rhs);
732
- }
733
- tmp = tmp_0;
734
- } else if (lhs.tx()) {
735
- tmp = new LeftAssignment(lhs.castToVar(), rhs);
736
- } else if (rhs.tx()) {
737
- tmp = new RightAssignment(lhs, rhs.castToVar());
738
- } else if (lhs.wx() && rhs.wx()) {
739
- var tmp_1;
740
- if (equalityChecker(lhs, rhs)) {
741
- tmp_1 = new Identity(lhs, rhs);
742
- } else {
743
- tmp_1 = new Contradiction(lhs, rhs);
744
- }
745
- tmp = tmp_1;
746
- } else if (lhs.wx() || rhs.wx()) {
747
- tmp = new Contradiction(lhs, rhs);
748
- } else if (lhs.dx() && rhs.dx()) {
749
- var lhsStruct = lhs.castToStruct();
750
- var rhsStruct = rhs.castToStruct();
751
- var tmp_2;
752
- if (!(lhsStruct.rw() === rhsStruct.rw()) || !(lhsStruct.xw() === rhsStruct.xw())) {
753
- tmp_2 = new Contradiction(lhsStruct, rhsStruct);
754
- } else {
755
- tmp_2 = new Comparison(lhsStruct, rhsStruct);
756
- }
757
- tmp = tmp_2;
758
- } else {
759
- tmp = new Comparison(lhs, rhs);
760
- }
761
- return tmp;
762
- };
763
- protoOf(Companion).of = function (lhs, rhs, equalityChecker, $super) {
764
- var tmp;
765
- if (equalityChecker === VOID) {
766
- tmp = Term$equals$ref();
767
- } else {
768
- tmp = equalityChecker;
769
- }
770
- equalityChecker = tmp;
771
- return $super === VOID ? this.l1l(lhs, rhs, equalityChecker) : $super.l1l.call(this, lhs, rhs, equalityChecker);
529
+ function Unificator$Companion$default$delegate$lambda() {
530
+ return Companion_getInstance_2().strict();
531
+ }
532
+ function Unificator$Companion$_get_default_$ref_8i2tx3() {
533
+ return constructCallableReference(function (p0) {
534
+ return p0.q10();
535
+ }, 1, 0, 5);
536
+ }
537
+ function Unificator$Companion$naive$1($context) {
538
+ AbstractWorklistUnificator.call(this, $context);
539
+ }
540
+ protoOf(Unificator$Companion$naive$1).i1t = function (store, term1, term2, occurCheckEnabled) {
541
+ return this.s1s(store, term1, term2, occurCheckEnabled);
772
542
  };
773
- protoOf(Companion).i1n = function (pair, equalityChecker) {
774
- return this.l1l(pair.first, pair.second, equalityChecker);
543
+ protoOf(Unificator$Companion$naive$1).unifyInto = function (store, term1, term2, occurCheckEnabled, $super) {
544
+ return this.unifyInto(store, term1, term2, occurCheckEnabled, ($super == null ? true : $super instanceof Unificator$Companion$naive$1) ? $super : THROW_CCE());
775
545
  };
776
- protoOf(Companion).ofPair = function (pair, equalityChecker, $super) {
546
+ protoOf(Unificator$Companion$naive$1).h1s = function (first, second) {
777
547
  var tmp;
778
- if (equalityChecker === VOID) {
779
- tmp = Term$equals$ref();
548
+ if (first.xo() && second.xo()) {
549
+ tmp = first.castToInteger().f1().bo(second.castToInteger().f1()) === 0;
550
+ } else if (first.x14() && second.x14()) {
551
+ tmp = first.castToNumeric().b18().en(second.castToNumeric().b18()) === 0;
780
552
  } else {
781
- tmp = equalityChecker;
553
+ tmp = first.equals(second);
782
554
  }
783
- equalityChecker = tmp;
784
- return $super === VOID ? this.i1n(pair, equalityChecker) : $super.i1n.call(this, pair, equalityChecker);
555
+ return tmp;
785
556
  };
786
- protoOf(Companion).j1n = function (pairs, equalityChecker) {
787
- return flatMap(pairs, Equation$Companion$from$lambda(equalityChecker));
557
+ protoOf(Unificator$Companion$naive$1).h1t = function (term) {
558
+ return Companion_instance_1.numbersByValue(term);
788
559
  };
789
- protoOf(Companion).fromSequence = function (pairs, equalityChecker, $super) {
790
- var tmp;
791
- if (equalityChecker === VOID) {
792
- tmp = Term$equals$ref();
793
- } else {
794
- tmp = equalityChecker;
795
- }
796
- equalityChecker = tmp;
797
- return $super === VOID ? this.j1n(pairs, equalityChecker) : $super.j1n.call(this, pairs, equalityChecker);
560
+ protoOf(Unificator$Companion$naive$1).indexKey = function (term) {
561
+ return this.h1t(term);
798
562
  };
799
- protoOf(Companion).k1n = function (pairs, equalityChecker) {
800
- return this.j1n(asSequence_0(pairs), equalityChecker);
563
+ protoOf(Unificator$Companion$naive$1).mguWithOccurCheck = function (term1, term2, occurCheckEnabled, $super) {
564
+ return this.mguWithOccurCheck(term1, term2, occurCheckEnabled, ($super == null ? true : $super instanceof Unificator$Companion$naive$1) ? $super : THROW_CCE());
801
565
  };
802
- protoOf(Companion).fromIterable = function (pairs, equalityChecker, $super) {
803
- var tmp;
804
- if (equalityChecker === VOID) {
805
- tmp = Term$equals$ref();
806
- } else {
807
- tmp = equalityChecker;
808
- }
809
- equalityChecker = tmp;
810
- return $super === VOID ? this.k1n(pairs, equalityChecker) : $super.k1n.call(this, pairs, equalityChecker);
566
+ function Unificator$Companion$strict$1($context) {
567
+ AbstractWorklistUnificator.call(this, $context);
568
+ }
569
+ protoOf(Unificator$Companion$strict$1).i1t = function (store, term1, term2, occurCheckEnabled) {
570
+ return this.s1s(store, term1, term2, occurCheckEnabled);
811
571
  };
812
- protoOf(Companion).l1n = function (pairs, equalityChecker) {
813
- return this.j1n(sequenceOf_0(pairs.slice()), equalityChecker);
572
+ protoOf(Unificator$Companion$strict$1).unifyInto = function (store, term1, term2, occurCheckEnabled, $super) {
573
+ return this.unifyInto(store, term1, term2, occurCheckEnabled, ($super == null ? true : $super instanceof Unificator$Companion$strict$1) ? $super : THROW_CCE());
814
574
  };
815
- protoOf(Companion).from = function (pairs, equalityChecker, $super) {
816
- var tmp;
817
- if (equalityChecker === VOID) {
818
- tmp = Term$equals$ref();
819
- } else {
820
- tmp = equalityChecker;
821
- }
822
- equalityChecker = tmp;
823
- return $super === VOID ? this.l1n(pairs, equalityChecker) : $super.l1n.call(this, pairs, equalityChecker);
575
+ protoOf(Unificator$Companion$strict$1).mguWithOccurCheck = function (term1, term2, occurCheckEnabled, $super) {
576
+ return this.mguWithOccurCheck(term1, term2, occurCheckEnabled, ($super == null ? true : $super instanceof Unificator$Companion$strict$1) ? $super : THROW_CCE());
824
577
  };
825
- protoOf(Companion).q1l = function (pair, equalityChecker) {
826
- return this.t1k(pair.first, pair.second, equalityChecker);
578
+ function Companion_0() {
579
+ Companion_instance_2 = this;
580
+ var tmp = this;
581
+ tmp.y1t_1 = lazy(Unificator$Companion$default$delegate$lambda);
582
+ this.z1t_1 = 32;
583
+ }
584
+ protoOf(Companion_0).q10 = function () {
585
+ var tmp0 = this.y1t_1;
586
+ var tmp = KProperty1;
587
+ // Inline function 'kotlin.getValue' call
588
+ getPropertyCallableRef('default', 1, tmp, Unificator$Companion$_get_default_$ref_8i2tx3(), null);
589
+ return tmp0.f1();
827
590
  };
828
- protoOf(Companion).allOfPair = function (pair, equalityChecker, $super) {
829
- var tmp;
830
- if (equalityChecker === VOID) {
831
- tmp = Term$equals$ref();
832
- } else {
833
- tmp = equalityChecker;
834
- }
835
- equalityChecker = tmp;
836
- return $super === VOID ? this.q1l(pair, equalityChecker) : $super.q1l.call(this, pair, equalityChecker);
591
+ protoOf(Companion_0).mguWith = function (_this__u8e3s4, other) {
592
+ return this.q10().mgu(_this__u8e3s4, other);
837
593
  };
838
- protoOf(Companion).t1k = function (lhs, rhs, equalityChecker) {
839
- var tmp;
840
- if (lhs.sw() && rhs.sw()) {
841
- tmp = sequenceOf(this.l1l(lhs, rhs, equalityChecker));
842
- } else if (lhs.jx() && rhs.jx()) {
843
- tmp = allOfLists(this, lhs.castToList(), rhs.castToList(), equalityChecker);
844
- } else if (lhs.ix() && rhs.ix()) {
845
- tmp = allOfTuples(this, lhs.castToTuple(), rhs.castToTuple(), equalityChecker);
846
- } else if (lhs.dx() && rhs.dx()) {
847
- var lhsStruct = lhs.castToStruct();
848
- var rhsStruct = rhs.castToStruct();
849
- var tmp_0;
850
- if (lhsStruct.rw() === rhsStruct.rw() && lhsStruct.xw() === rhsStruct.xw()) {
851
- var tmp_1 = zip(lhsStruct.qx(), rhsStruct.qx());
852
- tmp_0 = flatMap(tmp_1, Equation$Companion$allOf$lambda(equalityChecker));
853
- } else {
854
- tmp_0 = sequenceOf(this.l1l(lhs, rhs, equalityChecker));
855
- }
856
- tmp = tmp_0;
857
- } else {
858
- tmp = sequenceOf(this.l1l(lhs, rhs, equalityChecker));
859
- }
860
- return tmp;
594
+ protoOf(Companion_0).matches = function (_this__u8e3s4, other) {
595
+ return this.q10().match(_this__u8e3s4, other);
861
596
  };
862
- protoOf(Companion).allOf = function (lhs, rhs, equalityChecker, $super) {
863
- var tmp;
864
- if (equalityChecker === VOID) {
865
- tmp = Term$equals$ref();
866
- } else {
867
- tmp = equalityChecker;
868
- }
869
- equalityChecker = tmp;
870
- return $super === VOID ? this.t1k(lhs, rhs, equalityChecker) : $super.t1k.call(this, lhs, rhs, equalityChecker);
597
+ protoOf(Companion_0).unifyWith = function (_this__u8e3s4, other) {
598
+ return this.q10().unify(_this__u8e3s4, other);
871
599
  };
872
- var Companion_instance_0;
873
- function Companion_getInstance_1() {
874
- return Companion_instance_0;
875
- }
876
- function Equation(lhs, rhs) {
877
- this.v1k_1 = lhs;
878
- this.w1k_1 = rhs;
879
- }
880
- protoOf(Equation).x1k = function () {
881
- return this.v1k_1;
600
+ protoOf(Companion_0).mergeWith = function (_this__u8e3s4, other) {
601
+ return this.q10().merge(_this__u8e3s4, other);
882
602
  };
883
- protoOf(Equation).y1k = function () {
884
- return this.w1k_1;
603
+ protoOf(Companion_0).naiveWithContext = function (context) {
604
+ return new Unificator$Companion$naive$1(context);
885
605
  };
886
- protoOf(Equation).a1l = function () {
887
- return false;
606
+ protoOf(Companion_0).naive = function () {
607
+ return this.naiveWithContext(Companion_getInstance().empty());
888
608
  };
889
- protoOf(Equation).asIdentity = function () {
890
- return null;
609
+ protoOf(Companion_0).strictWithContext = function (context) {
610
+ return new Unificator$Companion$strict$1(context);
611
+ };
612
+ protoOf(Companion_0).strict = function () {
613
+ return this.strictWithContext(Companion_getInstance().empty());
891
614
  };
892
- protoOf(Equation).castToIdentity = function () {
893
- var tmp0_elvis_lhs = this.asIdentity();
615
+ protoOf(Companion_0).i1u = function (other, capacity) {
894
616
  var tmp;
895
- if (tmp0_elvis_lhs == null) {
896
- throw ClassCastException_init_$Create$('Cannot cast ' + toString(this) + ' to ' + getKClass(Identity).p9());
617
+ if (other instanceof CachedUnificator) {
618
+ tmp = new CachedUnificator(other.f1t_1, capacity);
897
619
  } else {
898
- tmp = tmp0_elvis_lhs;
620
+ tmp = new CachedUnificator(other, capacity);
899
621
  }
900
622
  return tmp;
901
623
  };
902
- protoOf(Equation).j1l = function () {
903
- return false;
904
- };
905
- protoOf(Equation).asAssignment = function () {
906
- return null;
624
+ protoOf(Companion_0).cached = function (other, capacity, $super) {
625
+ capacity = capacity === VOID ? 32 : capacity;
626
+ return $super === VOID ? this.i1u(other, capacity) : $super.i1u.call(this, other, capacity);
907
627
  };
908
- protoOf(Equation).castToAssignment = function () {
909
- var tmp0_elvis_lhs = this.asAssignment();
628
+ var Companion_instance_2;
629
+ function Companion_getInstance_2() {
630
+ if (Companion_instance_2 == null)
631
+ new Companion_0();
632
+ return Companion_instance_2;
633
+ }
634
+ function Unificator() {
635
+ }
636
+ function compress($this, from, to) {
637
+ var current = from;
638
+ while (!current.equals(to)) {
639
+ var tmp = $this.y1a(current);
640
+ var next = (!(tmp == null) ? isInterface(tmp, Var) : false) ? tmp : THROW_CCE();
641
+ $this.m1s(current, to);
642
+ current = next;
643
+ }
644
+ }
645
+ function Bindings(base, store) {
646
+ store = store === VOID ? null : store;
647
+ this.j1s_1 = base;
648
+ this.k1s_1 = store;
649
+ this.l1s_1 = null;
650
+ }
651
+ protoOf(Bindings).y1a = function (variable) {
910
652
  var tmp;
911
- if (tmp0_elvis_lhs == null) {
912
- throw ClassCastException_init_$Create$('Cannot cast ' + toString(this) + ' to ' + getKClass(Assignment).p9());
653
+ if (!(this.k1s_1 == null)) {
654
+ tmp = this.k1s_1.get(variable);
913
655
  } else {
914
- tmp = tmp0_elvis_lhs;
656
+ var tmp0_safe_receiver = this.l1s_1;
657
+ tmp = tmp0_safe_receiver == null ? null : tmp0_safe_receiver.j2(variable);
915
658
  }
916
- return tmp;
659
+ var tmp1_elvis_lhs = tmp;
660
+ return tmp1_elvis_lhs == null ? this.j1s_1.j2(variable) : tmp1_elvis_lhs;
917
661
  };
918
- protoOf(Equation).y1l = function () {
919
- return false;
920
- };
921
- protoOf(Equation).asLeftAssignment = function () {
922
- return null;
923
- };
924
- protoOf(Equation).castToLeftAssignment = function () {
925
- var tmp0_elvis_lhs = this.asLeftAssignment();
662
+ protoOf(Bindings).m1s = function (variable, term) {
663
+ if (!(this.k1s_1 == null))
664
+ return this.k1s_1.bind(variable, term);
665
+ var tmp0_elvis_lhs = this.l1s_1;
926
666
  var tmp;
927
667
  if (tmp0_elvis_lhs == null) {
928
- throw ClassCastException_init_$Create$('Cannot cast ' + toString(this) + ' to ' + getKClass(LeftAssignment).p9());
668
+ // Inline function 'kotlin.also' call
669
+ var this_0 = LinkedHashMap_init_$Create$();
670
+ this.l1s_1 = this_0;
671
+ tmp = this_0;
929
672
  } else {
930
673
  tmp = tmp0_elvis_lhs;
931
674
  }
932
- return tmp;
675
+ var map = tmp;
676
+ // Inline function 'kotlin.collections.set' call
677
+ map.q4(variable, term);
678
+ };
679
+ protoOf(Bindings).j1u = function (action) {
680
+ var tmp0_safe_receiver = this.l1s_1;
681
+ if (tmp0_safe_receiver == null)
682
+ null;
683
+ else {
684
+ // Inline function 'kotlin.collections.forEach' call
685
+ // Inline function 'kotlin.collections.iterator' call
686
+ var _iterator__ex2g4s = tmp0_safe_receiver.d1().n();
687
+ while (_iterator__ex2g4s.q()) {
688
+ var element = _iterator__ex2g4s.r();
689
+ // Inline function 'kotlin.collections.component1' call
690
+ var variable = element.e1();
691
+ // Inline function 'kotlin.collections.component2' call
692
+ var term = element.f1();
693
+ // Inline function 'kotlin.collections.contains' call
694
+ // Inline function 'kotlin.collections.containsKey' call
695
+ var this_0 = this.j1s_1;
696
+ if (!(isInterface(this_0, KtMap) ? this_0 : THROW_CCE()).h2(variable))
697
+ action(variable, term);
698
+ }
699
+ }
933
700
  };
934
- protoOf(Equation).z1l = function () {
935
- return false;
701
+ protoOf(Bindings).k1u = function (term) {
702
+ if (!isInterface(term, Var))
703
+ return term;
704
+ var current = term;
705
+ var hops = 0;
706
+ $l$loop: while (true) {
707
+ var next = this.y1a(current);
708
+ if (!(!(next == null) ? isInterface(next, Var) : false))
709
+ break $l$loop;
710
+ current = next;
711
+ hops = hops + 1 | 0;
712
+ }
713
+ if (hops > 1 && this.k1s_1 == null) {
714
+ compress(this, term, current);
715
+ }
716
+ return current;
936
717
  };
937
- protoOf(Equation).asRightAssignment = function () {
938
- return null;
718
+ protoOf(Bindings).l1u = function (term) {
719
+ return this.m1u(this.k1u(term));
939
720
  };
940
- protoOf(Equation).castToRightAssignment = function () {
941
- var tmp0_elvis_lhs = this.asRightAssignment();
721
+ protoOf(Bindings).m1u = function (representative) {
722
+ var tmp0_safe_receiver = isInterface(representative, Var) ? representative : null;
942
723
  var tmp;
943
- if (tmp0_elvis_lhs == null) {
944
- throw ClassCastException_init_$Create$('Cannot cast ' + toString(this) + ' to ' + getKClass(RightAssignment).p9());
724
+ if (tmp0_safe_receiver == null) {
725
+ tmp = null;
945
726
  } else {
946
- tmp = tmp0_elvis_lhs;
727
+ // Inline function 'kotlin.let' call
728
+ tmp = this.y1a(tmp0_safe_receiver);
947
729
  }
948
- return tmp;
730
+ var tmp1_elvis_lhs = tmp;
731
+ return tmp1_elvis_lhs == null ? representative : tmp1_elvis_lhs;
949
732
  };
950
- protoOf(Equation).b1l = function () {
951
- return false;
952
- };
953
- protoOf(Equation).asComparison = function () {
954
- return null;
955
- };
956
- protoOf(Equation).castToComparison = function () {
957
- var tmp0_elvis_lhs = this.asComparison();
733
+ function ComparedPair(lhs, rhs) {
734
+ this.n1u_1 = lhs;
735
+ this.o1u_1 = rhs;
736
+ }
737
+ protoOf(ComparedPair).equals = function (other) {
958
738
  var tmp;
959
- if (tmp0_elvis_lhs == null) {
960
- throw ClassCastException_init_$Create$('Cannot cast ' + toString(this) + ' to ' + getKClass(Comparison).p9());
739
+ var tmp_0;
740
+ if (other instanceof ComparedPair) {
741
+ tmp_0 = this.n1u_1 === other.n1u_1;
961
742
  } else {
962
- tmp = tmp0_elvis_lhs;
743
+ tmp_0 = false;
963
744
  }
964
- return tmp;
965
- };
966
- protoOf(Equation).z1k = function () {
967
- return false;
968
- };
969
- protoOf(Equation).asContradiction = function () {
970
- return null;
971
- };
972
- protoOf(Equation).castToContradiction = function () {
973
- var tmp0_elvis_lhs = this.asContradiction();
974
- var tmp;
975
- if (tmp0_elvis_lhs == null) {
976
- throw ClassCastException_init_$Create$('Cannot cast ' + toString(this) + ' to ' + getKClass(Contradiction).p9());
745
+ if (tmp_0) {
746
+ tmp = this.o1u_1 === other.o1u_1;
977
747
  } else {
978
- tmp = tmp0_elvis_lhs;
748
+ tmp = false;
979
749
  }
980
750
  return tmp;
981
751
  };
982
- protoOf(Equation).clone = function (lhs, rhs, $super) {
983
- lhs = lhs === VOID ? this.x1k() : lhs;
984
- rhs = rhs === VOID ? this.y1k() : rhs;
985
- return $super === VOID ? this.w1l(lhs, rhs) : $super.w1l.call(this, lhs, rhs);
986
- };
987
- protoOf(Equation).toContradiction = function () {
988
- return new Contradiction(this.x1k(), this.y1k());
752
+ protoOf(ComparedPair).hashCode = function () {
753
+ return imul(31, this.n1u_1.hashCode()) + this.o1u_1.hashCode() | 0;
989
754
  };
990
- protoOf(Equation).toAssignmentPair = function () {
991
- var tmp;
992
- if (this.x1k().tx()) {
993
- tmp = to(this.x1k().castToVar(), this.y1k());
994
- } else if (this.y1k().tx()) {
995
- tmp = to(this.y1k().castToVar(), this.x1k());
996
- } else {
997
- throw IllegalArgumentException_init_$Create$('Equation contains no variables: ' + toString(this));
755
+ function MutableUnificationStep(request) {
756
+ this.p1u_1 = request;
757
+ this.s1u_1 = StepVerdict_PROCEED_getInstance();
758
+ }
759
+ protoOf(MutableUnificationStep).v1t = function () {
760
+ var tmp = this.q1u_1;
761
+ if (!(tmp == null))
762
+ return tmp;
763
+ else {
764
+ throwUninitializedPropertyAccessException('lhs');
998
765
  }
999
- return tmp;
1000
766
  };
1001
- protoOf(Equation).toSubstitution = function () {
1002
- var tmp;
1003
- if (this.x1k().tx()) {
1004
- tmp = Companion_getInstance().unifier(this.x1k().castToVar(), this.y1k());
1005
- } else if (this.y1k().tx()) {
1006
- tmp = Companion_getInstance().unifier(this.y1k().castToVar(), this.x1k());
1007
- } else {
1008
- throw IllegalArgumentException_init_$Create$('Equation contains no variables: ' + toString(this));
767
+ protoOf(MutableUnificationStep).w1t = function () {
768
+ var tmp = this.r1u_1;
769
+ if (!(tmp == null))
770
+ return tmp;
771
+ else {
772
+ throwUninitializedPropertyAccessException('rhs');
1009
773
  }
1010
- return tmp;
1011
774
  };
1012
- protoOf(Equation).t1j = function () {
1013
- return Companion_getInstance_0().of('=', [this.x1k(), this.y1k()]);
775
+ protoOf(MutableUnificationStep).t1u = function (lhs, rhs) {
776
+ this.q1u_1 = lhs;
777
+ this.r1u_1 = rhs;
778
+ this.s1u_1 = StepVerdict_PROCEED_getInstance();
1014
779
  };
1015
- protoOf(Equation).toTerm = function () {
1016
- return this.t1j();
780
+ protoOf(MutableUnificationStep).x1t = function (lhs, rhs) {
781
+ this.q1u_1 = lhs;
782
+ this.r1u_1 = rhs;
783
+ this.s1u_1 = StepVerdict_REPLACED_getInstance();
1017
784
  };
1018
- protoOf(Equation).toPair = function () {
1019
- return new Pair(this.x1k(), this.y1k());
785
+ protoOf(MutableUnificationStep).replace = function (lhs, rhs, $super) {
786
+ return this.replace(lhs, rhs, ($super == null ? true : $super instanceof MutableUnificationStep) ? $super : THROW_CCE());
1020
787
  };
1021
- protoOf(Equation).swap = function () {
1022
- return Companion_instance_0.of(this.y1k(), this.x1k());
788
+ protoOf(MutableUnificationStep).u1u = function () {
789
+ this.s1u_1 = StepVerdict_ACCEPTED_getInstance();
1023
790
  };
1024
- protoOf(Equation).a1m = function (substitution, equalityChecker) {
1025
- return Companion_instance_0.l1l(this.x1k().getSubstituted(substitution, []), this.y1k().getSubstituted(substitution, []), equalityChecker);
791
+ protoOf(MutableUnificationStep).accept = function () {
792
+ return this.u1u();
1026
793
  };
1027
- protoOf(Equation).apply = function (substitution, equalityChecker, $super) {
794
+ protoOf(MutableUnificationStep).v1u = function () {
795
+ this.s1u_1 = StepVerdict_REJECTED_getInstance();
796
+ };
797
+ protoOf(MutableUnificationStep).reject = function () {
798
+ return this.v1u();
799
+ };
800
+ function hasCycles(_this__u8e3s4) {
801
+ var bindings = new Bindings(_this__u8e3s4);
802
+ var tmp0 = _this__u8e3s4.d1();
803
+ var tmp$ret$0;
804
+ $l$block_0: {
805
+ // Inline function 'kotlin.collections.any' call
806
+ var tmp;
807
+ if (isInterface(tmp0, Collection)) {
808
+ tmp = tmp0.i();
809
+ } else {
810
+ tmp = false;
811
+ }
812
+ if (tmp) {
813
+ tmp$ret$0 = false;
814
+ break $l$block_0;
815
+ }
816
+ var _iterator__ex2g4s = tmp0.n();
817
+ while (_iterator__ex2g4s.q()) {
818
+ var element = _iterator__ex2g4s.r();
819
+ // Inline function 'kotlin.collections.component1' call
820
+ var variable = element.e1();
821
+ // Inline function 'kotlin.collections.component2' call
822
+ var term = element.f1();
823
+ if (occurs(bindings, variable, term)) {
824
+ tmp$ret$0 = true;
825
+ break $l$block_0;
826
+ }
827
+ }
828
+ tmp$ret$0 = false;
829
+ }
830
+ return tmp$ret$0;
831
+ }
832
+ function occurs(_this__u8e3s4, variable, term) {
833
+ var pending = ArrayList_init_$Create$();
834
+ pending.l(term);
835
+ var visited = null;
836
+ $l$loop_0: while (true) {
837
+ // Inline function 'kotlin.collections.isNotEmpty' call
838
+ if (!!pending.i()) {
839
+ break $l$loop_0;
840
+ }
841
+ var current = pending.q3(get_lastIndex(pending));
842
+ if (isInterface(current, Var)) {
843
+ if (current.equals(variable))
844
+ return true;
845
+ var tmp0_elvis_lhs = _this__u8e3s4.y1a(current);
846
+ var tmp;
847
+ if (tmp0_elvis_lhs == null) {
848
+ continue $l$loop_0;
849
+ } else {
850
+ tmp = tmp0_elvis_lhs;
851
+ }
852
+ var value = tmp;
853
+ var tmp1_elvis_lhs = visited;
854
+ var tmp_0;
855
+ if (tmp1_elvis_lhs == null) {
856
+ // Inline function 'kotlin.also' call
857
+ var this_0 = HashSet_init_$Create$();
858
+ visited = this_0;
859
+ tmp_0 = this_0;
860
+ } else {
861
+ tmp_0 = tmp1_elvis_lhs;
862
+ }
863
+ var seen = tmp_0;
864
+ if (seen.l(current)) {
865
+ pending.l(value);
866
+ }
867
+ } else {
868
+ if (isInterface(current, Struct)) {
869
+ var inductionVariable = 0;
870
+ var last = current.r13();
871
+ if (inductionVariable < last)
872
+ do {
873
+ var i = inductionVariable;
874
+ inductionVariable = inductionVariable + 1 | 0;
875
+ var arg = current.get(i);
876
+ var tmp_1;
877
+ if (isInterface(arg, Var)) {
878
+ tmp_1 = arg.equals(variable);
879
+ } else {
880
+ tmp_1 = false;
881
+ }
882
+ if (tmp_1)
883
+ return true;
884
+ }
885
+ while (inductionVariable < last);
886
+ var inductionVariable_0 = current.r13() - 1 | 0;
887
+ if (0 <= inductionVariable_0)
888
+ do {
889
+ var i_0 = inductionVariable_0;
890
+ inductionVariable_0 = inductionVariable_0 + -1 | 0;
891
+ var arg_0 = current.get(i_0);
892
+ var tmp_2;
893
+ if (isInterface(arg_0, Var)) {
894
+ tmp_2 = true;
895
+ } else {
896
+ var tmp_3;
897
+ if (isInterface(arg_0, Struct)) {
898
+ tmp_3 = arg_0.r13() > 0;
899
+ } else {
900
+ tmp_3 = false;
901
+ }
902
+ tmp_2 = tmp_3;
903
+ }
904
+ if (tmp_2) {
905
+ pending.l(arg_0);
906
+ }
907
+ }
908
+ while (0 <= inductionVariable_0);
909
+ }
910
+ }
911
+ }
912
+ return false;
913
+ }
914
+ var static_init_called;
915
+ function static_init() {
916
+ if (static_init_called)
917
+ return Unit_instance;
918
+ static_init_called = true;
919
+ StepVerdict_PROCEED_instance = new StepVerdict('PROCEED', 0);
920
+ StepVerdict_REPLACED_instance = new StepVerdict('REPLACED', 1);
921
+ StepVerdict_ACCEPTED_instance = new StepVerdict('ACCEPTED', 2);
922
+ StepVerdict_REJECTED_instance = new StepVerdict('REJECTED', 3);
923
+ }
924
+ var StepVerdict_PROCEED_instance;
925
+ var StepVerdict_REPLACED_instance;
926
+ var StepVerdict_ACCEPTED_instance;
927
+ var StepVerdict_REJECTED_instance;
928
+ function StepVerdict(name, ordinal) {
929
+ Enum.call(this, name, ordinal);
930
+ }
931
+ function StepVerdict_PROCEED_getInstance() {
932
+ static_init();
933
+ return StepVerdict_PROCEED_instance;
934
+ }
935
+ function StepVerdict_REPLACED_getInstance() {
936
+ static_init();
937
+ return StepVerdict_REPLACED_instance;
938
+ }
939
+ function StepVerdict_ACCEPTED_getInstance() {
940
+ static_init();
941
+ return StepVerdict_ACCEPTED_instance;
942
+ }
943
+ function StepVerdict_REJECTED_getInstance() {
944
+ static_init();
945
+ return StepVerdict_REJECTED_instance;
946
+ }
947
+ function resolveVariable($this, variable) {
948
+ var tmp0_safe_receiver = $this.o1s_1.j2(variable);
949
+ if (tmp0_safe_receiver == null)
950
+ null;
951
+ else {
952
+ // Inline function 'kotlin.let' call
953
+ return tmp0_safe_receiver;
954
+ }
955
+ var tmp1_elvis_lhs = $this.n1s_1.y1a(variable);
1028
956
  var tmp;
1029
- if (equalityChecker === VOID) {
1030
- tmp = Term$equals$ref();
957
+ if (tmp1_elvis_lhs == null) {
958
+ return variable;
1031
959
  } else {
1032
- tmp = equalityChecker;
960
+ tmp = tmp1_elvis_lhs;
1033
961
  }
1034
- equalityChecker = tmp;
1035
- return $super === VOID ? this.a1m(substitution, equalityChecker) : $super.a1m.call(this, substitution, equalityChecker);
1036
- };
1037
- function toEquations(_this__u8e3s4) {
1038
- // Inline function 'kotlin.collections.map' call
1039
- var this_0 = _this__u8e3s4.d1();
1040
- // Inline function 'kotlin.collections.mapTo' call
1041
- var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
1042
- var _iterator__ex2g4s = this_0.n();
1043
- while (_iterator__ex2g4s.q()) {
1044
- var item = _iterator__ex2g4s.r();
1045
- // Inline function 'kotlin.collections.component1' call
1046
- var variable = item.e1();
1047
- // Inline function 'kotlin.collections.component2' call
1048
- var term = item.f1();
1049
- var tmp$ret$2 = new LeftAssignment(variable, term);
1050
- destination.l(tmp$ret$2);
962
+ var value = tmp;
963
+ var tmp_0;
964
+ if (!isInterface(value, Var)) {
965
+ tmp_0 = value.a15();
966
+ } else {
967
+ tmp_0 = false;
1051
968
  }
1052
- return destination;
969
+ if (tmp_0)
970
+ return value;
971
+ if (!$this.p1s_1.l(variable))
972
+ return variable;
973
+ var result = resolve($this, value);
974
+ $this.p1s_1.j3(variable);
975
+ // Inline function 'kotlin.collections.set' call
976
+ $this.o1s_1.q4(variable, result);
977
+ return result;
1053
978
  }
1054
- function toSubstitution(_this__u8e3s4) {
1055
- var tmp = Companion_getInstance();
1056
- var tmp_0 = asSequence_0(_this__u8e3s4);
1057
- return tmp.ofSequence(map(tmp_0, toSubstitution$lambda));
979
+ function resolve($this, term) {
980
+ var tmp;
981
+ if (isInterface(term, Var)) {
982
+ tmp = resolveVariable($this, term);
983
+ } else {
984
+ if (term.a15()) {
985
+ tmp = term;
986
+ } else {
987
+ if (isInterface(term, Cons)) {
988
+ tmp = resolveList($this, term);
989
+ } else {
990
+ if (isInterface(term, Struct)) {
991
+ tmp = resolveStruct($this, term);
992
+ } else {
993
+ tmp = term;
994
+ }
995
+ }
996
+ }
997
+ }
998
+ return tmp;
1058
999
  }
1059
- function toSubstitution$lambda(it) {
1060
- return it.toAssignmentPair();
1000
+ function resolveStruct($this, struct) {
1001
+ var args = null;
1002
+ var inductionVariable = 0;
1003
+ var last = struct.r13();
1004
+ if (inductionVariable < last)
1005
+ do {
1006
+ var i = inductionVariable;
1007
+ inductionVariable = inductionVariable + 1 | 0;
1008
+ var arg = struct.get(i);
1009
+ var resolvedArg = resolve($this, arg);
1010
+ if (!(resolvedArg === arg)) {
1011
+ var tmp0_elvis_lhs = args;
1012
+ var tmp;
1013
+ if (tmp0_elvis_lhs == null) {
1014
+ // Inline function 'kotlin.also' call
1015
+ var this_0 = toMutableList(struct.y13());
1016
+ args = this_0;
1017
+ tmp = this_0;
1018
+ } else {
1019
+ tmp = tmp0_elvis_lhs;
1020
+ }
1021
+ var newArgs = tmp;
1022
+ newArgs.i3(i, resolvedArg);
1023
+ }
1024
+ }
1025
+ while (inductionVariable < last);
1026
+ var tmp1_safe_receiver = args;
1027
+ var tmp_0;
1028
+ if (tmp1_safe_receiver == null) {
1029
+ tmp_0 = null;
1030
+ } else {
1031
+ // Inline function 'kotlin.let' call
1032
+ tmp_0 = withTagsOf($this, Companion_getInstance_0().ofList(struct.x13(), tmp1_safe_receiver), struct);
1033
+ }
1034
+ var tmp2_elvis_lhs = tmp_0;
1035
+ return tmp2_elvis_lhs == null ? struct : tmp2_elvis_lhs;
1061
1036
  }
1062
- function Unificator$Companion$default$delegate$lambda() {
1063
- return Companion_getInstance_2().strict();
1037
+ function resolveList($this, list) {
1038
+ var cells = ArrayList_init_$Create$();
1039
+ var heads = ArrayList_init_$Create$();
1040
+ var changed = false;
1041
+ var current = list;
1042
+ $l$loop: while (isInterface(current, Cons)) {
1043
+ var head = resolve($this, current.s15());
1044
+ changed = changed || !(head === current.s15());
1045
+ cells.l(current);
1046
+ heads.l(head);
1047
+ current = current.i16();
1048
+ }
1049
+ var result = resolve($this, current);
1050
+ if (!changed && result === current)
1051
+ return list;
1052
+ var inductionVariable = get_lastIndex(cells);
1053
+ if (0 <= inductionVariable)
1054
+ do {
1055
+ var i = inductionVariable;
1056
+ inductionVariable = inductionVariable + -1 | 0;
1057
+ result = withTagsOf($this, Companion_instance_0.of(heads.t(i), result), cells.t(i));
1058
+ }
1059
+ while (0 <= inductionVariable);
1060
+ return result;
1064
1061
  }
1065
- function Unificator$Companion$_get_default_$ref_8i2tx3() {
1066
- return constructCallableReference(function (p0) {
1067
- return p0.o1n();
1068
- }, 1, 0, 31);
1062
+ function withTagsOf($this, $receiver, original) {
1063
+ return original.gz().i() ? $receiver : $receiver.resetTags(original.gz());
1069
1064
  }
1070
- function Unificator$Companion$naive$1($context) {
1071
- AbstractUnificator.call(this, $context);
1065
+ function SubstitutionMaterializer$materialize$lambda($result) {
1066
+ return function (variable, term) {
1067
+ // Inline function 'kotlin.collections.set' call
1068
+ $result.q4(variable, term);
1069
+ return Unit_instance;
1070
+ };
1071
+ }
1072
+ function SubstitutionMaterializer(bindings) {
1073
+ this.n1s_1 = bindings;
1074
+ this.o1s_1 = HashMap_init_$Create$();
1075
+ this.p1s_1 = HashSet_init_$Create$();
1072
1076
  }
1073
- protoOf(Unificator$Companion$naive$1).s1k = function (first, second) {
1077
+ protoOf(SubstitutionMaterializer).q1s = function () {
1078
+ var base = this.n1s_1.j1s_1;
1079
+ var result = LinkedHashMap_init_$Create$();
1080
+ this.n1s_1.j1u(SubstitutionMaterializer$materialize$lambda(result));
1081
+ if (result.i())
1082
+ return base;
1083
+ if (base.i() && result.s() === 1)
1084
+ return Companion_getInstance().unifierMap(result);
1085
+ // Inline function 'kotlin.collections.iterator' call
1086
+ var _iterator__ex2g4s = result.d1().n();
1087
+ while (_iterator__ex2g4s.q()) {
1088
+ var _destruct__k2r9zo = _iterator__ex2g4s.r();
1089
+ // Inline function 'kotlin.collections.component1' call
1090
+ var variable = _destruct__k2r9zo.e1();
1091
+ // Inline function 'kotlin.collections.component2' call
1092
+ var term = _destruct__k2r9zo.f1();
1093
+ if (isInterface(term, Var)) {
1094
+ this.n1s_1.k1u(variable);
1095
+ }
1096
+ }
1097
+ var _iterator__ex2g4s_0 = result.d1().n();
1098
+ while (_iterator__ex2g4s_0.q()) {
1099
+ var entry = _iterator__ex2g4s_0.r();
1100
+ entry.u7(resolveVariable(this, entry.e1()));
1101
+ }
1102
+ var resolvedBindings = Companion_getInstance().unifierMap(result);
1103
+ return base.i() ? resolvedBindings : base.plus(resolvedBindings);
1104
+ };
1105
+ function unify_0($this, originalLhs, originalRhs) {
1106
+ var lhsRepresentative = $this.u1s_1.k1u(originalLhs);
1107
+ var rhsRepresentative = $this.u1s_1.k1u(originalRhs);
1108
+ var lhs = $this.u1s_1.m1u(lhsRepresentative);
1109
+ var rhs = $this.u1s_1.m1u(rhsRepresentative);
1110
+ $this.x1s_1.t1u(lhs, rhs);
1111
+ $this.t1s_1.i1s($this.x1s_1);
1112
+ switch ($this.x1s_1.s1u_1.n2_1) {
1113
+ case 2:
1114
+ return true;
1115
+ case 3:
1116
+ return false;
1117
+ case 1:
1118
+ lhsRepresentative = $this.u1s_1.k1u($this.x1s_1.v1t());
1119
+ rhsRepresentative = $this.u1s_1.k1u($this.x1s_1.w1t());
1120
+ lhs = $this.u1s_1.m1u(lhsRepresentative);
1121
+ rhs = $this.u1s_1.m1u(rhsRepresentative);
1122
+ break;
1123
+ case 0:
1124
+ break;
1125
+ default:
1126
+ noWhenBranchMatchedException();
1127
+ break;
1128
+ }
1074
1129
  var tmp;
1075
- if (first.yx() && second.yx()) {
1076
- tmp = first.castToInteger().f1().jl(second.castToInteger().f1()) === 0;
1077
- } else if (first.xx() && second.xx()) {
1078
- tmp = first.castToNumeric().n11().al(second.castToNumeric().n11()) === 0;
1130
+ if (lhs === rhs) {
1131
+ tmp = true;
1079
1132
  } else {
1080
- tmp = first.equals(second);
1133
+ if (isInterface(lhs, Var)) {
1134
+ var tmp_0;
1135
+ var tmp_1;
1136
+ if (isInterface(rhs, Var)) {
1137
+ tmp_1 = $this.t1s_1.h1s(lhs, rhs);
1138
+ } else {
1139
+ tmp_1 = false;
1140
+ }
1141
+ if (tmp_1) {
1142
+ tmp_0 = true;
1143
+ } else {
1144
+ tmp_0 = bind($this, lhs, rhs);
1145
+ }
1146
+ tmp = tmp_0;
1147
+ } else {
1148
+ if (isInterface(rhs, Var)) {
1149
+ tmp = bind($this, rhs, lhs);
1150
+ } else {
1151
+ if (lhs.w14() || rhs.w14()) {
1152
+ tmp = (lhs.w14() && rhs.w14() && $this.t1s_1.h1s(lhs, rhs));
1153
+ } else {
1154
+ tmp = decompose($this, lhs.castToStruct(), rhs.castToStruct(), lhsRepresentative, rhsRepresentative);
1155
+ }
1156
+ }
1157
+ }
1081
1158
  }
1082
1159
  return tmp;
1083
- };
1084
- protoOf(Unificator$Companion$naive$1).mguWithOccurCheck = function (term1, term2, occurCheckEnabled, $super) {
1085
- return this.mguWithOccurCheck(term1, term2, occurCheckEnabled, ($super == null ? true : $super instanceof Unificator$Companion$naive$1) ? $super : THROW_CCE());
1086
- };
1087
- function Unificator$Companion$strict$1($context) {
1088
- AbstractUnificator.call(this, $context);
1089
1160
  }
1090
- protoOf(Unificator$Companion$strict$1).s1k = function (first, second) {
1091
- return first.equals(second);
1092
- };
1093
- protoOf(Unificator$Companion$strict$1).mguWithOccurCheck = function (term1, term2, occurCheckEnabled, $super) {
1094
- return this.mguWithOccurCheck(term1, term2, occurCheckEnabled, ($super == null ? true : $super instanceof Unificator$Companion$strict$1) ? $super : THROW_CCE());
1095
- };
1096
- function Companion_0() {
1097
- Companion_instance_1 = this;
1098
- var tmp = this;
1099
- tmp.m1n_1 = lazy(Unificator$Companion$default$delegate$lambda);
1100
- this.n1n_1 = 32;
1161
+ function decompose($this, lhs, rhs, lhsRepresentative, rhsRepresentative) {
1162
+ if (!(lhs.r13() === rhs.r13()) || !(lhs.x13() === rhs.x13()))
1163
+ return false;
1164
+ var tmp;
1165
+ var tmp_0;
1166
+ if (!$this.v1s_1) {
1167
+ var tmp_1;
1168
+ if (isInterface(lhsRepresentative, Var)) {
1169
+ tmp_1 = true;
1170
+ } else {
1171
+ tmp_1 = isInterface(rhsRepresentative, Var);
1172
+ }
1173
+ tmp_0 = tmp_1;
1174
+ } else {
1175
+ tmp_0 = false;
1176
+ }
1177
+ if (tmp_0) {
1178
+ tmp = !firstComparison($this, lhs, rhs);
1179
+ } else {
1180
+ tmp = false;
1181
+ }
1182
+ if (tmp) {
1183
+ return true;
1184
+ }
1185
+ var inductionVariable = lhs.r13() - 1 | 0;
1186
+ if (0 <= inductionVariable)
1187
+ do {
1188
+ var i = inductionVariable;
1189
+ inductionVariable = inductionVariable + -1 | 0;
1190
+ $this.z1s(lhs.get(i), rhs.get(i));
1191
+ }
1192
+ while (0 <= inductionVariable);
1193
+ return true;
1101
1194
  }
1102
- protoOf(Companion_0).o1n = function () {
1103
- var tmp0 = this.m1n_1;
1104
- var tmp = KProperty1;
1105
- // Inline function 'kotlin.getValue' call
1106
- getPropertyCallableRef('default', 1, tmp, Unificator$Companion$_get_default_$ref_8i2tx3(), null);
1107
- return tmp0.f1();
1108
- };
1109
- protoOf(Companion_0).mguWith = function (_this__u8e3s4, other) {
1110
- return this.o1n().mgu(_this__u8e3s4, other);
1111
- };
1112
- protoOf(Companion_0).matches = function (_this__u8e3s4, other) {
1113
- return this.o1n().match(_this__u8e3s4, other);
1114
- };
1115
- protoOf(Companion_0).unifyWith = function (_this__u8e3s4, other) {
1116
- return this.o1n().unify(_this__u8e3s4, other);
1117
- };
1118
- protoOf(Companion_0).mergeWith = function (_this__u8e3s4, other) {
1119
- return this.o1n().merge(_this__u8e3s4, other);
1120
- };
1121
- protoOf(Companion_0).naiveWithContext = function (context) {
1122
- return new Unificator$Companion$naive$1(context);
1123
- };
1124
- protoOf(Companion_0).naive = function () {
1125
- return this.naiveWithContext(Companion_getInstance().empty());
1126
- };
1127
- protoOf(Companion_0).strictWithContext = function (context) {
1128
- return new Unificator$Companion$strict$1(context);
1129
- };
1130
- protoOf(Companion_0).strict = function () {
1131
- return this.strictWithContext(Companion_getInstance().empty());
1132
- };
1133
- protoOf(Companion_0).t1n = function (other, capacity) {
1195
+ function firstComparison($this, lhs, rhs) {
1196
+ var tmp0_elvis_lhs = $this.y1s_1;
1134
1197
  var tmp;
1135
- if (other instanceof CachedUnificator) {
1136
- tmp = new CachedUnificator(other.o1l_1, capacity);
1198
+ if (tmp0_elvis_lhs == null) {
1199
+ // Inline function 'kotlin.also' call
1200
+ var this_0 = HashSet_init_$Create$();
1201
+ $this.y1s_1 = this_0;
1202
+ tmp = this_0;
1137
1203
  } else {
1138
- tmp = new CachedUnificator(other, capacity);
1204
+ tmp = tmp0_elvis_lhs;
1139
1205
  }
1140
- return tmp;
1141
- };
1142
- protoOf(Companion_0).cached = function (other, capacity, $super) {
1143
- capacity = capacity === VOID ? 32 : capacity;
1144
- return $super === VOID ? this.t1n(other, capacity) : $super.t1n.call(this, other, capacity);
1145
- };
1146
- var Companion_instance_1;
1147
- function Companion_getInstance_2() {
1148
- if (Companion_instance_1 == null)
1149
- new Companion_0();
1150
- return Companion_instance_1;
1206
+ return tmp.l(new ComparedPair(lhs, rhs));
1151
1207
  }
1152
- function Unificator() {
1208
+ function bind($this, variable, term) {
1209
+ var tmp;
1210
+ var tmp_0;
1211
+ if ($this.v1s_1) {
1212
+ tmp_0 = !isInterface(term, Var);
1213
+ } else {
1214
+ tmp_0 = false;
1215
+ }
1216
+ if (tmp_0) {
1217
+ tmp = occurs($this.u1s_1, variable, term);
1218
+ } else {
1219
+ tmp = false;
1220
+ }
1221
+ if (tmp)
1222
+ return false;
1223
+ $this.u1s_1.m1s(variable, term);
1224
+ return true;
1225
+ }
1226
+ function UnificationRun(hooks, bindings, occursCheck, request) {
1227
+ this.t1s_1 = hooks;
1228
+ this.u1s_1 = bindings;
1229
+ this.v1s_1 = occursCheck;
1230
+ this.w1s_1 = ArrayList_init_$Create$();
1231
+ this.x1s_1 = new MutableUnificationStep(request);
1232
+ this.y1s_1 = null;
1153
1233
  }
1234
+ protoOf(UnificationRun).z1s = function (lhs, rhs) {
1235
+ this.w1s_1.l(lhs);
1236
+ this.w1s_1.l(rhs);
1237
+ };
1238
+ protoOf(UnificationRun).e1t = function (substitution) {
1239
+ // Inline function 'kotlin.collections.iterator' call
1240
+ var _iterator__ex2g4s = substitution.d1().n();
1241
+ while (_iterator__ex2g4s.q()) {
1242
+ var _destruct__k2r9zo = _iterator__ex2g4s.r();
1243
+ // Inline function 'kotlin.collections.component1' call
1244
+ var variable = _destruct__k2r9zo.e1();
1245
+ // Inline function 'kotlin.collections.component2' call
1246
+ var term = _destruct__k2r9zo.f1();
1247
+ var representative = this.u1s_1.k1u(variable);
1248
+ var tmp;
1249
+ if (isInterface(representative, Var)) {
1250
+ tmp = this.u1s_1.y1a(representative) == null;
1251
+ } else {
1252
+ tmp = false;
1253
+ }
1254
+ if (tmp) {
1255
+ var value = this.u1s_1.l1u(term);
1256
+ if (!value.equals(representative) && !bind(this, representative, value))
1257
+ return false;
1258
+ } else {
1259
+ this.z1s(variable, term);
1260
+ }
1261
+ }
1262
+ return true;
1263
+ };
1264
+ protoOf(UnificationRun).c1t = function () {
1265
+ return this.a1t() ? (new SubstitutionMaterializer(this.u1s_1)).q1s() : Companion_getInstance().failed();
1266
+ };
1267
+ protoOf(UnificationRun).a1t = function () {
1268
+ $l$loop: while (true) {
1269
+ // Inline function 'kotlin.collections.isNotEmpty' call
1270
+ if (!!this.w1s_1.i()) {
1271
+ break $l$loop;
1272
+ }
1273
+ var rhs = this.w1s_1.q3(get_lastIndex(this.w1s_1));
1274
+ var lhs = this.w1s_1.q3(get_lastIndex(this.w1s_1));
1275
+ if (!unify_0(this, lhs, rhs))
1276
+ return false;
1277
+ }
1278
+ return true;
1279
+ };
1154
1280
  //region block: post-declaration
1155
- protoOf(AbstractUnificator).mguWithOccurCheck = mguWithOccurCheck;
1156
- protoOf(AbstractUnificator).mgu = mgu;
1157
- protoOf(AbstractUnificator).matchWithOccurCheck = matchWithOccurCheck;
1158
- protoOf(AbstractUnificator).match = match;
1159
- protoOf(AbstractUnificator).unifyWithOccurCheck = unifyWithOccurCheck;
1160
- protoOf(AbstractUnificator).unify = unify;
1161
- protoOf(AbstractUnificator).merge = merge;
1281
+ protoOf(AbstractWorklistUnificator).mguWithOccurCheck = mguWithOccurCheck;
1282
+ protoOf(AbstractWorklistUnificator).mgu = mgu;
1283
+ protoOf(AbstractWorklistUnificator).matchWithOccurCheck = matchWithOccurCheck;
1284
+ protoOf(AbstractWorklistUnificator).match = match;
1285
+ protoOf(AbstractWorklistUnificator).unifyWithOccurCheck = unifyWithOccurCheck;
1286
+ protoOf(AbstractWorklistUnificator).unify = unify;
1287
+ protoOf(AbstractWorklistUnificator).merge = merge;
1288
+ protoOf(AbstractWorklistUnificator).indexKey = indexKey;
1162
1289
  protoOf(CachedUnificator).mguWithOccurCheck = mguWithOccurCheck;
1163
1290
  protoOf(CachedUnificator).mgu = mgu;
1164
1291
  protoOf(CachedUnificator).matchWithOccurCheck = matchWithOccurCheck;
@@ -1166,45 +1293,25 @@
1166
1293
  protoOf(CachedUnificator).unifyWithOccurCheck = unifyWithOccurCheck;
1167
1294
  protoOf(CachedUnificator).unify = unify;
1168
1295
  protoOf(CachedUnificator).merge = merge;
1169
- protoOf(Equation).mr = castTo;
1170
- defineProp(protoOf(Equation), 'lhs', function () {
1171
- return this.x1k();
1172
- });
1173
- defineProp(protoOf(Equation), 'rhs', function () {
1174
- return this.y1k();
1175
- });
1176
- defineProp(protoOf(Equation), 'isIdentity', function () {
1177
- return this.a1l();
1178
- });
1179
- defineProp(protoOf(Equation), 'isAssignment', function () {
1180
- return this.j1l();
1181
- });
1182
- defineProp(protoOf(Equation), 'isLeftAssignment', function () {
1183
- return this.y1l();
1184
- });
1185
- defineProp(protoOf(Equation), 'isRightAssignment', function () {
1186
- return this.z1l();
1187
- });
1188
- defineProp(protoOf(Equation), 'isComparison', function () {
1189
- return this.b1l();
1190
- });
1191
- defineProp(protoOf(Equation), 'isContradiction', function () {
1192
- return this.z1k();
1193
- });
1194
- defineProp(protoOf(Assignment), 'variable', function () {
1195
- return this.h1l();
1196
- });
1197
- defineProp(protoOf(Assignment), 'term', function () {
1198
- return this.i1l();
1296
+ defineProp(protoOf(IndexKey), 'isExact', function () {
1297
+ return this.k1t();
1199
1298
  });
1200
- defineProp(protoOf(Companion_0), 'default', protoOf(Companion_0).o1n);
1299
+ protoOf(Unificator$Companion$naive$1).unifyInto = unifyInto;
1300
+ protoOf(Unificator$Companion$strict$1).unifyInto = unifyInto;
1301
+ defineProp(protoOf(Companion_0), 'default', protoOf(Companion_0).q10);
1302
+ protoOf(MutableUnificationStep).replace = replace;
1201
1303
  //endregion
1202
1304
  //region block: init
1203
- Companion_instance_0 = new Companion();
1305
+ Companion_instance_1 = new Companion();
1204
1306
  //endregion
1205
1307
  //region block: exports
1206
1308
  _.$_$ = _.$_$ || {};
1207
- _.$_$.a = Companion_getInstance_2;
1309
+ _.$_$.a = Companion_instance_1;
1310
+ _.$_$.b = Wildcard_getInstance;
1311
+ _.$_$.c = Companion_getInstance_2;
1312
+ _.$_$.d = CachedUnificator;
1313
+ _.$_$.e = IncrementalUnificator;
1314
+ _.$_$.f = OfStruct;
1208
1315
  //endregion
1209
1316
  return _;
1210
1317
  }));