@jakta/jakta-prolog-incarnation 0.0.0-bootstrap
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-core.js +9164 -0
- package/2p-core.js.map +1 -0
- package/2p-dsl-core.js +15 -0
- package/2p-dsl-core.js.map +1 -0
- package/2p-dsl-theory.js +15 -0
- package/2p-dsl-theory.js.map +1 -0
- package/2p-dsl-unify.js +15 -0
- package/2p-dsl-unify.js.map +1 -0
- package/2p-parser-core.js +15 -0
- package/2p-parser-core.js.map +1 -0
- package/2p-parser-impl.js +15 -0
- package/2p-parser-impl.js.map +1 -0
- package/2p-serialize-core.js +15 -0
- package/2p-serialize-core.js.map +1 -0
- package/2p-solve-classic.js +2832 -0
- package/2p-solve-classic.js.map +1 -0
- package/2p-solve.js +13916 -0
- package/2p-solve.js.map +1 -0
- package/2p-theory.js +4837 -0
- package/2p-theory.js.map +1 -0
- package/2p-unify.js +886 -0
- package/2p-unify.js.map +1 -0
- package/2p-utils.js +1361 -0
- package/2p-utils.js.map +1 -0
- package/Kermit-kermit-core.js +15 -0
- package/Kermit-kermit-core.js.map +1 -0
- package/Kermit-kermit.js +19 -0
- package/Kermit-kermit.js.map +1 -0
- package/LICENSE +201 -0
- package/README.md +50 -0
- package/jakta-jakta-api.js +15 -0
- package/jakta-jakta-api.js.map +1 -0
- package/jakta-jakta-core.js +15 -0
- package/jakta-jakta-core.js.map +1 -0
- package/jakta-jakta-dsl.js +15 -0
- package/jakta-jakta-dsl.js.map +1 -0
- package/jakta-jakta-prolog-incarnation.js +30 -0
- package/jakta-jakta-prolog-incarnation.js.map +1 -0
- package/kotlin-kotlin-stdlib.js +8814 -0
- package/kotlin-kotlin-stdlib.js.map +1 -0
- package/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.js +15 -0
- package/kotlin_org_jetbrains_kotlin_kotlin_dom_api_compat.js.map +1 -0
- package/kotlinx-atomicfu.js +15 -0
- package/kotlinx-atomicfu.js.map +1 -0
- package/kotlinx-coroutines-core.js +15 -0
- package/kotlinx-coroutines-core.js.map +1 -0
- package/kt-math.js +10071 -0
- package/kt-math.js.map +1 -0
- package/package.json +9 -0
package/2p-unify.js
ADDED
|
@@ -0,0 +1,886 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof define === 'function' && define.amd)
|
|
3
|
+
define(['exports', './kotlin-kotlin-stdlib.js', './2p-core.js', './2p-utils.js'], factory);
|
|
4
|
+
else if (typeof exports === 'object')
|
|
5
|
+
factory(module.exports, require('./kotlin-kotlin-stdlib.js'), require('./2p-core.js'), require('./2p-utils.js'));
|
|
6
|
+
else {
|
|
7
|
+
if (typeof globalThis['kotlin-kotlin-stdlib'] === 'undefined') {
|
|
8
|
+
throw new Error("Error loading module '2p-unify'. Its dependency 'kotlin-kotlin-stdlib' was not found. Please, check whether 'kotlin-kotlin-stdlib' is loaded prior to '2p-unify'.");
|
|
9
|
+
}
|
|
10
|
+
if (typeof globalThis['2p-core'] === 'undefined') {
|
|
11
|
+
throw new Error("Error loading module '2p-unify'. Its dependency '2p-core' was not found. Please, check whether '2p-core' is loaded prior to '2p-unify'.");
|
|
12
|
+
}
|
|
13
|
+
if (typeof globalThis['2p-utils'] === 'undefined') {
|
|
14
|
+
throw new Error("Error loading module '2p-unify'. Its dependency '2p-utils' was not found. Please, check whether '2p-utils' is loaded prior to '2p-unify'.");
|
|
15
|
+
}
|
|
16
|
+
globalThis['2p-unify'] = factory(typeof globalThis['2p-unify'] === 'undefined' ? {} : globalThis['2p-unify'], globalThis['kotlin-kotlin-stdlib'], globalThis['2p-core'], globalThis['2p-utils']);
|
|
17
|
+
}
|
|
18
|
+
}(function (_, kotlin_kotlin, kotlin_it_unibo_tuprolog_core, kotlin_it_unibo_tuprolog_utils) {
|
|
19
|
+
'use strict';
|
|
20
|
+
//region block: imports
|
|
21
|
+
var imul = Math.imul;
|
|
22
|
+
var KProperty1 = kotlin_kotlin.$_$.f7;
|
|
23
|
+
var getPropertyCallableRef = kotlin_kotlin.$_$.v5;
|
|
24
|
+
var asSequence = kotlin_kotlin.$_$.y1;
|
|
25
|
+
var plus = kotlin_kotlin.$_$.h8;
|
|
26
|
+
var map = kotlin_kotlin.$_$.d8;
|
|
27
|
+
var Unit_instance = kotlin_kotlin.$_$.m;
|
|
28
|
+
var Companion_getInstance = kotlin_it_unibo_tuprolog_core.$_$.o;
|
|
29
|
+
var ArrayList_init_$Create$ = kotlin_kotlin.$_$.o;
|
|
30
|
+
var toCollection = kotlin_kotlin.$_$.o8;
|
|
31
|
+
var constructCallableReference = kotlin_kotlin.$_$.r5;
|
|
32
|
+
var Pair = kotlin_kotlin.$_$.fa;
|
|
33
|
+
var VOID = kotlin_kotlin.$_$.b;
|
|
34
|
+
var lazy = kotlin_kotlin.$_$.na;
|
|
35
|
+
var protoOf = kotlin_kotlin.$_$.n6;
|
|
36
|
+
var asSequence_0 = kotlin_kotlin.$_$.z1;
|
|
37
|
+
var THROW_CCE = kotlin_kotlin.$_$.ha;
|
|
38
|
+
var initMetadataForClass = kotlin_kotlin.$_$.y5;
|
|
39
|
+
var Companion_instance = kotlin_it_unibo_tuprolog_utils.$_$.a;
|
|
40
|
+
var Triple = kotlin_kotlin.$_$.ja;
|
|
41
|
+
var Some = kotlin_it_unibo_tuprolog_utils.$_$.k;
|
|
42
|
+
var zip = kotlin_kotlin.$_$.v8;
|
|
43
|
+
var flatMap = kotlin_kotlin.$_$.v7;
|
|
44
|
+
var sequenceOf = kotlin_kotlin.$_$.j8;
|
|
45
|
+
var to = kotlin_kotlin.$_$.sa;
|
|
46
|
+
var sequenceOf_0 = kotlin_kotlin.$_$.i8;
|
|
47
|
+
var initMetadataForCompanion = kotlin_kotlin.$_$.z5;
|
|
48
|
+
var toString = kotlin_kotlin.$_$.q6;
|
|
49
|
+
var getKClass = kotlin_kotlin.$_$.e7;
|
|
50
|
+
var ClassCastException_init_$Create$ = kotlin_kotlin.$_$.z;
|
|
51
|
+
var Companion_getInstance_0 = kotlin_it_unibo_tuprolog_core.$_$.n;
|
|
52
|
+
var castTo = kotlin_it_unibo_tuprolog_utils.$_$.e;
|
|
53
|
+
var defineProp = kotlin_kotlin.$_$.s5;
|
|
54
|
+
var Castable = kotlin_it_unibo_tuprolog_utils.$_$.f;
|
|
55
|
+
var collectionSizeOrDefault = kotlin_kotlin.$_$.b2;
|
|
56
|
+
var ArrayList_init_$Create$_0 = kotlin_kotlin.$_$.n;
|
|
57
|
+
var IllegalArgumentException_init_$Create$ = kotlin_kotlin.$_$.b1;
|
|
58
|
+
var initMetadataForInterface = kotlin_kotlin.$_$.a6;
|
|
59
|
+
//endregion
|
|
60
|
+
//region block: pre-declaration
|
|
61
|
+
function mguWithOccurCheck(term1, term2, occurCheckEnabled, $super) {
|
|
62
|
+
occurCheckEnabled = occurCheckEnabled === VOID ? true : occurCheckEnabled;
|
|
63
|
+
return $super === VOID ? this.q1g(term1, term2, occurCheckEnabled) : $super.q1g.call(this, term1, term2, occurCheckEnabled);
|
|
64
|
+
}
|
|
65
|
+
function mgu(term1, term2) {
|
|
66
|
+
return this.q1g(term1, term2, true);
|
|
67
|
+
}
|
|
68
|
+
function matchWithOccurCheck(term1, term2, occurCheckEnabled) {
|
|
69
|
+
return !(this.q1g(term1, term2, occurCheckEnabled) === Companion_getInstance().failed());
|
|
70
|
+
}
|
|
71
|
+
function match(term1, term2) {
|
|
72
|
+
return this.matchWithOccurCheck(term1, term2, true);
|
|
73
|
+
}
|
|
74
|
+
function unifyWithOccurCheck(term1, term2, occurCheckEnabled) {
|
|
75
|
+
var substitution = this.q1g(term1, term2, occurCheckEnabled);
|
|
76
|
+
return substitution.mz() ? null : term1.getSubstituted(substitution, []);
|
|
77
|
+
}
|
|
78
|
+
function unify(term1, term2) {
|
|
79
|
+
return this.unifyWithOccurCheck(term1, term2, true);
|
|
80
|
+
}
|
|
81
|
+
function merge(substitution1, substitution2) {
|
|
82
|
+
return this.mergeWithOccurCheck(substitution1, substitution2, true);
|
|
83
|
+
}
|
|
84
|
+
initMetadataForInterface(Unificator, 'Unificator');
|
|
85
|
+
initMetadataForClass(AbstractUnificator, 'AbstractUnificator', VOID, VOID, [Unificator]);
|
|
86
|
+
initMetadataForClass(CachedUnificator, 'CachedUnificator', VOID, VOID, [Unificator]);
|
|
87
|
+
initMetadataForClass(Equation, 'Equation', VOID, VOID, [Castable]);
|
|
88
|
+
initMetadataForClass(Identity, 'Identity', VOID, Equation);
|
|
89
|
+
initMetadataForClass(Assignment, 'Assignment', VOID, Equation);
|
|
90
|
+
initMetadataForClass(Comparison, 'Comparison', VOID, Equation);
|
|
91
|
+
initMetadataForClass(Contradiction, 'Contradiction', VOID, Equation);
|
|
92
|
+
initMetadataForCompanion(Companion);
|
|
93
|
+
initMetadataForClass(Unificator$Companion$naive$1, VOID, VOID, AbstractUnificator);
|
|
94
|
+
initMetadataForClass(Unificator$Companion$strict$1, VOID, VOID, AbstractUnificator);
|
|
95
|
+
initMetadataForCompanion(Companion_0);
|
|
96
|
+
//endregion
|
|
97
|
+
function _get_contextEquations__x0dd77($this) {
|
|
98
|
+
var tmp0 = $this.z1f_1;
|
|
99
|
+
var tmp = KProperty1;
|
|
100
|
+
// Inline function 'kotlin.getValue' call
|
|
101
|
+
getPropertyCallableRef('contextEquations', 1, tmp, AbstractUnificator$_get_contextEquations_$ref_7ajcte(), null);
|
|
102
|
+
return tmp0.c2();
|
|
103
|
+
}
|
|
104
|
+
function occurrenceCheck($this, variable, term) {
|
|
105
|
+
var tmp;
|
|
106
|
+
if (term.du()) {
|
|
107
|
+
tmp = $this.a1g(variable, term);
|
|
108
|
+
} else if (term.nt()) {
|
|
109
|
+
var tmp0 = term.jt();
|
|
110
|
+
var tmp$ret$0;
|
|
111
|
+
$l$block: {
|
|
112
|
+
// Inline function 'kotlin.sequences.any' call
|
|
113
|
+
var _iterator__ex2g4s = tmp0.m();
|
|
114
|
+
while (_iterator__ex2g4s.p()) {
|
|
115
|
+
var element = _iterator__ex2g4s.q();
|
|
116
|
+
if (occurrenceCheck($this, variable, element)) {
|
|
117
|
+
tmp$ret$0 = true;
|
|
118
|
+
break $l$block;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
tmp$ret$0 = false;
|
|
122
|
+
}
|
|
123
|
+
tmp = tmp$ret$0;
|
|
124
|
+
} else {
|
|
125
|
+
tmp = false;
|
|
126
|
+
}
|
|
127
|
+
return tmp;
|
|
128
|
+
}
|
|
129
|
+
function equationsFor($this, term1, term2) {
|
|
130
|
+
var tmp = Companion_instance_0;
|
|
131
|
+
return tmp.b1g(term1, term2, AbstractUnificator$checkTermsEquality$ref($this));
|
|
132
|
+
}
|
|
133
|
+
function equationsFor_0($this, substitution1, substitution2) {
|
|
134
|
+
var tmp = Companion_instance_0;
|
|
135
|
+
var tmp_0 = plus(asSequence(substitution1), asSequence(substitution2));
|
|
136
|
+
return tmp.fromSequence(map(tmp_0, AbstractUnificator$equationsFor$lambda));
|
|
137
|
+
}
|
|
138
|
+
function applySubstitutionToEquations($this, substitution, equations, exceptIndex) {
|
|
139
|
+
var changed = {_v: false};
|
|
140
|
+
var inductionVariable = 0;
|
|
141
|
+
if (inductionVariable < exceptIndex)
|
|
142
|
+
do {
|
|
143
|
+
var i = inductionVariable;
|
|
144
|
+
inductionVariable = inductionVariable + 1 | 0;
|
|
145
|
+
applySubstitutionToEquations$handleIndex(equations, substitution, $this, changed, i);
|
|
146
|
+
}
|
|
147
|
+
while (inductionVariable < exceptIndex);
|
|
148
|
+
var inductionVariable_0 = exceptIndex + 1 | 0;
|
|
149
|
+
var last = equations.s();
|
|
150
|
+
if (inductionVariable_0 < last)
|
|
151
|
+
do {
|
|
152
|
+
var i_0 = inductionVariable_0;
|
|
153
|
+
inductionVariable_0 = inductionVariable_0 + 1 | 0;
|
|
154
|
+
applySubstitutionToEquations$handleIndex(equations, substitution, $this, changed, i_0);
|
|
155
|
+
}
|
|
156
|
+
while (inductionVariable_0 < last);
|
|
157
|
+
return changed._v;
|
|
158
|
+
}
|
|
159
|
+
function mgu_0($this, equations, occurCheckEnabled) {
|
|
160
|
+
var changed = true;
|
|
161
|
+
while (changed) {
|
|
162
|
+
changed = false;
|
|
163
|
+
var eqIterator = equations.g4();
|
|
164
|
+
while (eqIterator.p()) {
|
|
165
|
+
var eq = eqIterator.q();
|
|
166
|
+
if (eq.g1g()) {
|
|
167
|
+
return Companion_getInstance().failed();
|
|
168
|
+
} else if (eq.h1g()) {
|
|
169
|
+
eqIterator.g3();
|
|
170
|
+
changed = true;
|
|
171
|
+
} else if (eq.o1g()) {
|
|
172
|
+
var assignment = eq.j1g();
|
|
173
|
+
if (occurCheckEnabled && occurrenceCheck($this, assignment.m1g_1, eq.f1g())) {
|
|
174
|
+
return Companion_getInstance().failed();
|
|
175
|
+
} else {
|
|
176
|
+
changed = changed || applySubstitutionToEquations($this, assignment.toSubstitution(), equations, eqIterator.u3());
|
|
177
|
+
}
|
|
178
|
+
} else if (eq.i1g()) {
|
|
179
|
+
eqIterator.g3();
|
|
180
|
+
var _iterator__ex2g4s = equationsFor($this, eq.e1g(), eq.f1g()).m();
|
|
181
|
+
insertion: while (_iterator__ex2g4s.p()) {
|
|
182
|
+
var it = _iterator__ex2g4s.q();
|
|
183
|
+
if (it.h1g())
|
|
184
|
+
continue insertion;
|
|
185
|
+
else if (it.g1g())
|
|
186
|
+
return Companion_getInstance().failed();
|
|
187
|
+
else {
|
|
188
|
+
eqIterator.x3(it);
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
changed = true;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
// Inline function 'kotlin.collections.filter' call
|
|
196
|
+
// Inline function 'kotlin.collections.filterTo' call
|
|
197
|
+
var destination = ArrayList_init_$Create$();
|
|
198
|
+
var _iterator__ex2g4s_0 = equations.m();
|
|
199
|
+
while (_iterator__ex2g4s_0.p()) {
|
|
200
|
+
var element = _iterator__ex2g4s_0.q();
|
|
201
|
+
if (element.o1g()) {
|
|
202
|
+
destination.j(element);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return toSubstitution(destination);
|
|
206
|
+
}
|
|
207
|
+
function newDeque($this, items) {
|
|
208
|
+
// Inline function 'kotlin.collections.arrayListOf' call
|
|
209
|
+
var tmp$ret$0 = ArrayList_init_$Create$();
|
|
210
|
+
return toCollection(items, tmp$ret$0);
|
|
211
|
+
}
|
|
212
|
+
function AbstractUnificator$contextEquations$delegate$lambda(this$0) {
|
|
213
|
+
return function () {
|
|
214
|
+
return toEquations(this$0.m8());
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
function AbstractUnificator$_get_contextEquations_$ref_7ajcte() {
|
|
218
|
+
return constructCallableReference(function (p0) {
|
|
219
|
+
return _get_contextEquations__x0dd77(p0);
|
|
220
|
+
}, 1, 0, 25);
|
|
221
|
+
}
|
|
222
|
+
function AbstractUnificator$checkTermsEquality$ref(p0) {
|
|
223
|
+
return constructCallableReference(function (p0_0, p1) {
|
|
224
|
+
return p0.a1g(p0_0, p1);
|
|
225
|
+
}, 2, 0, 26, 'checkTermsEquality', [p0]);
|
|
226
|
+
}
|
|
227
|
+
function AbstractUnificator$equationsFor$lambda(it) {
|
|
228
|
+
// Inline function 'kotlin.collections.toPair' call
|
|
229
|
+
return new Pair(it.b2(), it.c2());
|
|
230
|
+
}
|
|
231
|
+
function applySubstitutionToEquations$handleIndex($equations, $substitution, this$0, changed, i) {
|
|
232
|
+
if ($equations.t(i).g1g() || $equations.t(i).h1g())
|
|
233
|
+
return Unit_instance;
|
|
234
|
+
var currentEq = $equations.t(i);
|
|
235
|
+
var _destruct__k2r9zo = currentEq.apply($substitution).toPair();
|
|
236
|
+
var newLhs = _destruct__k2r9zo.ac();
|
|
237
|
+
var newRhs = _destruct__k2r9zo.bc();
|
|
238
|
+
if (!currentEq.e1g().equals(newLhs) || !currentEq.f1g().equals(newRhs)) {
|
|
239
|
+
var tmp = Companion_instance_0;
|
|
240
|
+
$equations.d4(i, tmp.p1g(newLhs, newRhs, AbstractUnificator$checkTermsEquality$ref(this$0)));
|
|
241
|
+
changed._v = true;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
function AbstractUnificator(context) {
|
|
245
|
+
context = context === VOID ? Companion_getInstance().empty() : context;
|
|
246
|
+
this.y1f_1 = context;
|
|
247
|
+
var tmp = this;
|
|
248
|
+
tmp.z1f_1 = lazy(AbstractUnificator$contextEquations$delegate$lambda(this));
|
|
249
|
+
}
|
|
250
|
+
protoOf(AbstractUnificator).m8 = function () {
|
|
251
|
+
return this.y1f_1;
|
|
252
|
+
};
|
|
253
|
+
protoOf(AbstractUnificator).q1g = function (term1, term2, occurCheckEnabled) {
|
|
254
|
+
if (this.m8().mz())
|
|
255
|
+
return Companion_getInstance().failed();
|
|
256
|
+
var equations = newDeque(this, plus(asSequence_0(_get_contextEquations__x0dd77(this)), equationsFor(this, term1, term2)));
|
|
257
|
+
return mgu_0(this, equations, occurCheckEnabled);
|
|
258
|
+
};
|
|
259
|
+
protoOf(AbstractUnificator).mguWithOccurCheck = function (term1, term2, occurCheckEnabled, $super) {
|
|
260
|
+
return this.mguWithOccurCheck(term1, term2, occurCheckEnabled, ($super == null ? true : $super instanceof AbstractUnificator) ? $super : THROW_CCE());
|
|
261
|
+
};
|
|
262
|
+
protoOf(AbstractUnificator).r1g = function (substitution1, substitution2, occurCheckEnabled) {
|
|
263
|
+
if (this.m8().mz() || substitution1.mz() || substitution2.mz())
|
|
264
|
+
return Companion_getInstance().failed();
|
|
265
|
+
if (!occurCheckEnabled) {
|
|
266
|
+
var quickMerge = this.m8().plus(substitution1).plus(substitution2);
|
|
267
|
+
if (quickMerge.lz()) {
|
|
268
|
+
return quickMerge;
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
var equations = newDeque(this, plus(asSequence_0(_get_contextEquations__x0dd77(this)), equationsFor_0(this, substitution1, substitution2)));
|
|
272
|
+
return mgu_0(this, equations, occurCheckEnabled);
|
|
273
|
+
};
|
|
274
|
+
protoOf(AbstractUnificator).mergeWithOccurCheck = function (substitution1, substitution2, occurCheckEnabled) {
|
|
275
|
+
return this.r1g(substitution1, substitution2, occurCheckEnabled);
|
|
276
|
+
};
|
|
277
|
+
function CachedUnificator(decorated, cacheCapacity) {
|
|
278
|
+
this.s1g_1 = decorated;
|
|
279
|
+
this.t1g_1 = Companion_instance.eo(cacheCapacity);
|
|
280
|
+
}
|
|
281
|
+
protoOf(CachedUnificator).q1g = function (term1, term2, occurCheckEnabled) {
|
|
282
|
+
var mguRequest = new Triple(term1, term2, occurCheckEnabled);
|
|
283
|
+
var cached = this.t1g_1.f2(mguRequest);
|
|
284
|
+
var tmp;
|
|
285
|
+
if (cached instanceof Some) {
|
|
286
|
+
tmp = cached.ho_1;
|
|
287
|
+
} else {
|
|
288
|
+
var mguResult = this.s1g_1.q1g(term1, term2, occurCheckEnabled);
|
|
289
|
+
this.t1g_1.fo(mguRequest, mguResult);
|
|
290
|
+
tmp = mguResult;
|
|
291
|
+
}
|
|
292
|
+
return tmp;
|
|
293
|
+
};
|
|
294
|
+
protoOf(CachedUnificator).mguWithOccurCheck = function (term1, term2, occurCheckEnabled, $super) {
|
|
295
|
+
return this.mguWithOccurCheck(term1, term2, occurCheckEnabled, ($super == null ? true : $super instanceof CachedUnificator) ? $super : THROW_CCE());
|
|
296
|
+
};
|
|
297
|
+
protoOf(CachedUnificator).r1g = function (substitution1, substitution2, occurCheckEnabled) {
|
|
298
|
+
var mguRequest = new Triple(substitution1, substitution2, occurCheckEnabled);
|
|
299
|
+
var cached = this.t1g_1.f2(mguRequest);
|
|
300
|
+
var tmp;
|
|
301
|
+
if (cached instanceof Some) {
|
|
302
|
+
tmp = cached.ho_1;
|
|
303
|
+
} else {
|
|
304
|
+
var mguResult = this.s1g_1.mergeWithOccurCheck(substitution1, substitution2, occurCheckEnabled);
|
|
305
|
+
this.t1g_1.fo(mguRequest, mguResult);
|
|
306
|
+
tmp = mguResult;
|
|
307
|
+
}
|
|
308
|
+
return tmp;
|
|
309
|
+
};
|
|
310
|
+
protoOf(CachedUnificator).mergeWithOccurCheck = function (substitution1, substitution2, occurCheckEnabled) {
|
|
311
|
+
return this.r1g(substitution1, substitution2, occurCheckEnabled);
|
|
312
|
+
};
|
|
313
|
+
function allOfLists($this, lhs, rhs, equalityChecker) {
|
|
314
|
+
var tmp;
|
|
315
|
+
if (equalityChecker === VOID) {
|
|
316
|
+
tmp = Term$equals$ref();
|
|
317
|
+
} else {
|
|
318
|
+
tmp = equalityChecker;
|
|
319
|
+
}
|
|
320
|
+
equalityChecker = tmp;
|
|
321
|
+
var tmp_0 = zip(lhs.unfold(), rhs.unfold());
|
|
322
|
+
return flatMap(tmp_0, Equation$Companion$allOfLists$lambda(equalityChecker));
|
|
323
|
+
}
|
|
324
|
+
function allOfTuples($this, lhs, rhs, equalityChecker) {
|
|
325
|
+
var tmp;
|
|
326
|
+
if (equalityChecker === VOID) {
|
|
327
|
+
tmp = Term$equals$ref();
|
|
328
|
+
} else {
|
|
329
|
+
tmp = equalityChecker;
|
|
330
|
+
}
|
|
331
|
+
equalityChecker = tmp;
|
|
332
|
+
var tmp_0 = zip(lhs.unfold(), rhs.unfold());
|
|
333
|
+
return flatMap(tmp_0, Equation$Companion$allOfTuples$lambda(equalityChecker));
|
|
334
|
+
}
|
|
335
|
+
function Term$equals$ref() {
|
|
336
|
+
return constructCallableReference(function (p0, p1) {
|
|
337
|
+
return p0.equals(p1);
|
|
338
|
+
}, 2, 0, 27, 'equals');
|
|
339
|
+
}
|
|
340
|
+
function Equation$Companion$from$lambda($equalityChecker) {
|
|
341
|
+
return function (it) {
|
|
342
|
+
return Companion_instance_0.u1g(it, $equalityChecker);
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
function Equation$Companion$allOfLists$lambda($equalityChecker) {
|
|
346
|
+
return function (_destruct__k2r9zo) {
|
|
347
|
+
var l = _destruct__k2r9zo.ac();
|
|
348
|
+
var r = _destruct__k2r9zo.bc();
|
|
349
|
+
return l.ut() && r.ut() ? sequenceOf(Companion_instance_0.p1g(l.castToCons().nv(), r.castToCons().nv(), $equalityChecker)) : l.tt() && r.tt() ? sequenceOf(Companion_instance_0.p1g(l.castToList(), r.castToList(), $equalityChecker)) : Companion_instance_0.b1g(l, r, $equalityChecker);
|
|
350
|
+
};
|
|
351
|
+
}
|
|
352
|
+
function Equation$Companion$allOfTuples$lambda($equalityChecker) {
|
|
353
|
+
return function (_destruct__k2r9zo) {
|
|
354
|
+
var l = _destruct__k2r9zo.ac();
|
|
355
|
+
var r = _destruct__k2r9zo.bc();
|
|
356
|
+
return l.st() && r.st() ? sequenceOf(Companion_instance_0.p1g(l.castToTuple().bv(), r.castToTuple().bv(), $equalityChecker)) : Companion_instance_0.b1g(l, r, $equalityChecker);
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
function Equation$Companion$allOf$lambda($equalityChecker) {
|
|
360
|
+
return function (it) {
|
|
361
|
+
return Companion_instance_0.u1g(it, $equalityChecker);
|
|
362
|
+
};
|
|
363
|
+
}
|
|
364
|
+
function Identity(lhs, rhs) {
|
|
365
|
+
Equation.call(this, lhs, rhs);
|
|
366
|
+
this.x1g_1 = lhs;
|
|
367
|
+
this.y1g_1 = rhs;
|
|
368
|
+
}
|
|
369
|
+
protoOf(Identity).e1g = function () {
|
|
370
|
+
return this.x1g_1;
|
|
371
|
+
};
|
|
372
|
+
protoOf(Identity).f1g = function () {
|
|
373
|
+
return this.y1g_1;
|
|
374
|
+
};
|
|
375
|
+
protoOf(Identity).h1g = function () {
|
|
376
|
+
return true;
|
|
377
|
+
};
|
|
378
|
+
protoOf(Identity).toString = function () {
|
|
379
|
+
return 'Identity(lhs=' + this.x1g_1.toString() + ', rhs=' + this.y1g_1.toString() + ')';
|
|
380
|
+
};
|
|
381
|
+
protoOf(Identity).hashCode = function () {
|
|
382
|
+
var result = this.x1g_1.hashCode();
|
|
383
|
+
result = imul(result, 31) + this.y1g_1.hashCode() | 0;
|
|
384
|
+
return result;
|
|
385
|
+
};
|
|
386
|
+
protoOf(Identity).equals = function (other) {
|
|
387
|
+
if (this === other)
|
|
388
|
+
return true;
|
|
389
|
+
if (!(other instanceof Identity))
|
|
390
|
+
return false;
|
|
391
|
+
if (!this.x1g_1.equals(other.x1g_1))
|
|
392
|
+
return false;
|
|
393
|
+
if (!this.y1g_1.equals(other.y1g_1))
|
|
394
|
+
return false;
|
|
395
|
+
return true;
|
|
396
|
+
};
|
|
397
|
+
function Assignment(lhs, rhs) {
|
|
398
|
+
Equation.call(this, lhs, rhs);
|
|
399
|
+
this.m1g_1 = lhs;
|
|
400
|
+
this.n1g_1 = rhs;
|
|
401
|
+
}
|
|
402
|
+
protoOf(Assignment).e1g = function () {
|
|
403
|
+
return this.m1g_1;
|
|
404
|
+
};
|
|
405
|
+
protoOf(Assignment).f1g = function () {
|
|
406
|
+
return this.n1g_1;
|
|
407
|
+
};
|
|
408
|
+
protoOf(Assignment).toSubstitution = function () {
|
|
409
|
+
return Companion_getInstance().unifier(this.m1g_1, this.n1g_1);
|
|
410
|
+
};
|
|
411
|
+
protoOf(Assignment).b1h = function () {
|
|
412
|
+
return to(this.m1g_1, this.n1g_1);
|
|
413
|
+
};
|
|
414
|
+
protoOf(Assignment).toPair = function () {
|
|
415
|
+
return this.b1h();
|
|
416
|
+
};
|
|
417
|
+
protoOf(Assignment).o1g = function () {
|
|
418
|
+
return true;
|
|
419
|
+
};
|
|
420
|
+
protoOf(Assignment).z1g = function () {
|
|
421
|
+
return this;
|
|
422
|
+
};
|
|
423
|
+
protoOf(Assignment).toString = function () {
|
|
424
|
+
return 'Assignment(lhs=' + this.m1g_1.toString() + ', rhs=' + this.n1g_1.toString() + ')';
|
|
425
|
+
};
|
|
426
|
+
protoOf(Assignment).hashCode = function () {
|
|
427
|
+
var result = this.m1g_1.hashCode();
|
|
428
|
+
result = imul(result, 31) + this.n1g_1.hashCode() | 0;
|
|
429
|
+
return result;
|
|
430
|
+
};
|
|
431
|
+
protoOf(Assignment).equals = function (other) {
|
|
432
|
+
if (this === other)
|
|
433
|
+
return true;
|
|
434
|
+
if (!(other instanceof Assignment))
|
|
435
|
+
return false;
|
|
436
|
+
if (!this.m1g_1.equals(other.m1g_1))
|
|
437
|
+
return false;
|
|
438
|
+
if (!this.n1g_1.equals(other.n1g_1))
|
|
439
|
+
return false;
|
|
440
|
+
return true;
|
|
441
|
+
};
|
|
442
|
+
function Comparison(lhs, rhs) {
|
|
443
|
+
Equation.call(this, lhs, rhs);
|
|
444
|
+
this.e1h_1 = lhs;
|
|
445
|
+
this.f1h_1 = rhs;
|
|
446
|
+
}
|
|
447
|
+
protoOf(Comparison).e1g = function () {
|
|
448
|
+
return this.e1h_1;
|
|
449
|
+
};
|
|
450
|
+
protoOf(Comparison).f1g = function () {
|
|
451
|
+
return this.f1h_1;
|
|
452
|
+
};
|
|
453
|
+
protoOf(Comparison).i1g = function () {
|
|
454
|
+
return true;
|
|
455
|
+
};
|
|
456
|
+
protoOf(Comparison).toString = function () {
|
|
457
|
+
return 'Comparison(lhs=' + this.e1h_1.toString() + ', rhs=' + this.f1h_1.toString() + ')';
|
|
458
|
+
};
|
|
459
|
+
protoOf(Comparison).hashCode = function () {
|
|
460
|
+
var result = this.e1h_1.hashCode();
|
|
461
|
+
result = imul(result, 31) + this.f1h_1.hashCode() | 0;
|
|
462
|
+
return result;
|
|
463
|
+
};
|
|
464
|
+
protoOf(Comparison).equals = function (other) {
|
|
465
|
+
if (this === other)
|
|
466
|
+
return true;
|
|
467
|
+
if (!(other instanceof Comparison))
|
|
468
|
+
return false;
|
|
469
|
+
if (!this.e1h_1.equals(other.e1h_1))
|
|
470
|
+
return false;
|
|
471
|
+
if (!this.f1h_1.equals(other.f1h_1))
|
|
472
|
+
return false;
|
|
473
|
+
return true;
|
|
474
|
+
};
|
|
475
|
+
function Contradiction(lhs, rhs) {
|
|
476
|
+
Equation.call(this, lhs, rhs);
|
|
477
|
+
this.i1h_1 = lhs;
|
|
478
|
+
this.j1h_1 = rhs;
|
|
479
|
+
}
|
|
480
|
+
protoOf(Contradiction).e1g = function () {
|
|
481
|
+
return this.i1h_1;
|
|
482
|
+
};
|
|
483
|
+
protoOf(Contradiction).f1g = function () {
|
|
484
|
+
return this.j1h_1;
|
|
485
|
+
};
|
|
486
|
+
protoOf(Contradiction).g1g = function () {
|
|
487
|
+
return true;
|
|
488
|
+
};
|
|
489
|
+
protoOf(Contradiction).toString = function () {
|
|
490
|
+
return 'Contradiction(lhs=' + this.i1h_1.toString() + ', rhs=' + this.j1h_1.toString() + ')';
|
|
491
|
+
};
|
|
492
|
+
protoOf(Contradiction).hashCode = function () {
|
|
493
|
+
var result = this.i1h_1.hashCode();
|
|
494
|
+
result = imul(result, 31) + this.j1h_1.hashCode() | 0;
|
|
495
|
+
return result;
|
|
496
|
+
};
|
|
497
|
+
protoOf(Contradiction).equals = function (other) {
|
|
498
|
+
if (this === other)
|
|
499
|
+
return true;
|
|
500
|
+
if (!(other instanceof Contradiction))
|
|
501
|
+
return false;
|
|
502
|
+
if (!this.i1h_1.equals(other.i1h_1))
|
|
503
|
+
return false;
|
|
504
|
+
if (!this.j1h_1.equals(other.j1h_1))
|
|
505
|
+
return false;
|
|
506
|
+
return true;
|
|
507
|
+
};
|
|
508
|
+
function Companion() {
|
|
509
|
+
}
|
|
510
|
+
protoOf(Companion).p1g = function (lhs, rhs, equalityChecker) {
|
|
511
|
+
var tmp;
|
|
512
|
+
if (lhs.du() && rhs.du()) {
|
|
513
|
+
var tmp_0;
|
|
514
|
+
if (equalityChecker(lhs, rhs)) {
|
|
515
|
+
tmp_0 = new Identity(lhs, rhs);
|
|
516
|
+
} else {
|
|
517
|
+
tmp_0 = new Assignment(lhs.castToVar(), rhs);
|
|
518
|
+
}
|
|
519
|
+
tmp = tmp_0;
|
|
520
|
+
} else if (lhs.du()) {
|
|
521
|
+
tmp = new Assignment(lhs.castToVar(), rhs);
|
|
522
|
+
} else if (rhs.du()) {
|
|
523
|
+
tmp = new Assignment(rhs.castToVar(), lhs);
|
|
524
|
+
} else if (lhs.gu() && rhs.gu()) {
|
|
525
|
+
var tmp_1;
|
|
526
|
+
if (equalityChecker(lhs, rhs)) {
|
|
527
|
+
tmp_1 = new Identity(lhs, rhs);
|
|
528
|
+
} else {
|
|
529
|
+
tmp_1 = new Contradiction(lhs, rhs);
|
|
530
|
+
}
|
|
531
|
+
tmp = tmp_1;
|
|
532
|
+
} else if (lhs.gu() || rhs.gu()) {
|
|
533
|
+
tmp = new Contradiction(lhs, rhs);
|
|
534
|
+
} else if (lhs.nt() && rhs.nt()) {
|
|
535
|
+
var lhsStruct = lhs.castToStruct();
|
|
536
|
+
var rhsStruct = rhs.castToStruct();
|
|
537
|
+
var tmp_2;
|
|
538
|
+
if (!(lhsStruct.bt() === rhsStruct.bt()) || !(lhsStruct.ht() === rhsStruct.ht())) {
|
|
539
|
+
tmp_2 = new Contradiction(lhsStruct, rhsStruct);
|
|
540
|
+
} else {
|
|
541
|
+
tmp_2 = new Comparison(lhsStruct, rhsStruct);
|
|
542
|
+
}
|
|
543
|
+
tmp = tmp_2;
|
|
544
|
+
} else {
|
|
545
|
+
tmp = new Comparison(lhs, rhs);
|
|
546
|
+
}
|
|
547
|
+
return tmp;
|
|
548
|
+
};
|
|
549
|
+
protoOf(Companion).of = function (lhs, rhs, equalityChecker, $super) {
|
|
550
|
+
var tmp;
|
|
551
|
+
if (equalityChecker === VOID) {
|
|
552
|
+
tmp = Term$equals$ref();
|
|
553
|
+
} else {
|
|
554
|
+
tmp = equalityChecker;
|
|
555
|
+
}
|
|
556
|
+
equalityChecker = tmp;
|
|
557
|
+
return $super === VOID ? this.p1g(lhs, rhs, equalityChecker) : $super.p1g.call(this, lhs, rhs, equalityChecker);
|
|
558
|
+
};
|
|
559
|
+
protoOf(Companion).k1h = function (pair, equalityChecker) {
|
|
560
|
+
return this.p1g(pair.first, pair.second, equalityChecker);
|
|
561
|
+
};
|
|
562
|
+
protoOf(Companion).ofPair = function (pair, equalityChecker, $super) {
|
|
563
|
+
var tmp;
|
|
564
|
+
if (equalityChecker === VOID) {
|
|
565
|
+
tmp = Term$equals$ref();
|
|
566
|
+
} else {
|
|
567
|
+
tmp = equalityChecker;
|
|
568
|
+
}
|
|
569
|
+
equalityChecker = tmp;
|
|
570
|
+
return $super === VOID ? this.k1h(pair, equalityChecker) : $super.k1h.call(this, pair, equalityChecker);
|
|
571
|
+
};
|
|
572
|
+
protoOf(Companion).l1h = function (pairs, equalityChecker) {
|
|
573
|
+
return flatMap(pairs, Equation$Companion$from$lambda(equalityChecker));
|
|
574
|
+
};
|
|
575
|
+
protoOf(Companion).fromSequence = function (pairs, equalityChecker, $super) {
|
|
576
|
+
var tmp;
|
|
577
|
+
if (equalityChecker === VOID) {
|
|
578
|
+
tmp = Term$equals$ref();
|
|
579
|
+
} else {
|
|
580
|
+
tmp = equalityChecker;
|
|
581
|
+
}
|
|
582
|
+
equalityChecker = tmp;
|
|
583
|
+
return $super === VOID ? this.l1h(pairs, equalityChecker) : $super.l1h.call(this, pairs, equalityChecker);
|
|
584
|
+
};
|
|
585
|
+
protoOf(Companion).m1h = function (pairs, equalityChecker) {
|
|
586
|
+
return this.l1h(asSequence_0(pairs), equalityChecker);
|
|
587
|
+
};
|
|
588
|
+
protoOf(Companion).fromIterable = function (pairs, equalityChecker, $super) {
|
|
589
|
+
var tmp;
|
|
590
|
+
if (equalityChecker === VOID) {
|
|
591
|
+
tmp = Term$equals$ref();
|
|
592
|
+
} else {
|
|
593
|
+
tmp = equalityChecker;
|
|
594
|
+
}
|
|
595
|
+
equalityChecker = tmp;
|
|
596
|
+
return $super === VOID ? this.m1h(pairs, equalityChecker) : $super.m1h.call(this, pairs, equalityChecker);
|
|
597
|
+
};
|
|
598
|
+
protoOf(Companion).n1h = function (pairs, equalityChecker) {
|
|
599
|
+
return this.l1h(sequenceOf_0(pairs.slice()), equalityChecker);
|
|
600
|
+
};
|
|
601
|
+
protoOf(Companion).from = function (pairs, equalityChecker, $super) {
|
|
602
|
+
var tmp;
|
|
603
|
+
if (equalityChecker === VOID) {
|
|
604
|
+
tmp = Term$equals$ref();
|
|
605
|
+
} else {
|
|
606
|
+
tmp = equalityChecker;
|
|
607
|
+
}
|
|
608
|
+
equalityChecker = tmp;
|
|
609
|
+
return $super === VOID ? this.n1h(pairs, equalityChecker) : $super.n1h.call(this, pairs, equalityChecker);
|
|
610
|
+
};
|
|
611
|
+
protoOf(Companion).u1g = function (pair, equalityChecker) {
|
|
612
|
+
return this.b1g(pair.first, pair.second, equalityChecker);
|
|
613
|
+
};
|
|
614
|
+
protoOf(Companion).allOfPair = function (pair, equalityChecker, $super) {
|
|
615
|
+
var tmp;
|
|
616
|
+
if (equalityChecker === VOID) {
|
|
617
|
+
tmp = Term$equals$ref();
|
|
618
|
+
} else {
|
|
619
|
+
tmp = equalityChecker;
|
|
620
|
+
}
|
|
621
|
+
equalityChecker = tmp;
|
|
622
|
+
return $super === VOID ? this.u1g(pair, equalityChecker) : $super.u1g.call(this, pair, equalityChecker);
|
|
623
|
+
};
|
|
624
|
+
protoOf(Companion).b1g = function (lhs, rhs, equalityChecker) {
|
|
625
|
+
var tmp;
|
|
626
|
+
if (lhs.ct() && rhs.ct()) {
|
|
627
|
+
tmp = sequenceOf(this.p1g(lhs, rhs, equalityChecker));
|
|
628
|
+
} else if (lhs.tt() && rhs.tt()) {
|
|
629
|
+
tmp = allOfLists(this, lhs.castToList(), rhs.castToList(), equalityChecker);
|
|
630
|
+
} else if (lhs.st() && rhs.st()) {
|
|
631
|
+
tmp = allOfTuples(this, lhs.castToTuple(), rhs.castToTuple(), equalityChecker);
|
|
632
|
+
} else if (lhs.nt() && rhs.nt()) {
|
|
633
|
+
var lhsStruct = lhs.castToStruct();
|
|
634
|
+
var rhsStruct = rhs.castToStruct();
|
|
635
|
+
var tmp_0;
|
|
636
|
+
if (lhsStruct.bt() === rhsStruct.bt() && lhsStruct.ht() === rhsStruct.ht()) {
|
|
637
|
+
var tmp_1 = zip(lhsStruct.au(), rhsStruct.au());
|
|
638
|
+
tmp_0 = flatMap(tmp_1, Equation$Companion$allOf$lambda(equalityChecker));
|
|
639
|
+
} else {
|
|
640
|
+
tmp_0 = sequenceOf(this.p1g(lhs, rhs, equalityChecker));
|
|
641
|
+
}
|
|
642
|
+
tmp = tmp_0;
|
|
643
|
+
} else {
|
|
644
|
+
tmp = sequenceOf(this.p1g(lhs, rhs, equalityChecker));
|
|
645
|
+
}
|
|
646
|
+
return tmp;
|
|
647
|
+
};
|
|
648
|
+
protoOf(Companion).allOf = function (lhs, rhs, equalityChecker, $super) {
|
|
649
|
+
var tmp;
|
|
650
|
+
if (equalityChecker === VOID) {
|
|
651
|
+
tmp = Term$equals$ref();
|
|
652
|
+
} else {
|
|
653
|
+
tmp = equalityChecker;
|
|
654
|
+
}
|
|
655
|
+
equalityChecker = tmp;
|
|
656
|
+
return $super === VOID ? this.b1g(lhs, rhs, equalityChecker) : $super.b1g.call(this, lhs, rhs, equalityChecker);
|
|
657
|
+
};
|
|
658
|
+
var Companion_instance_0;
|
|
659
|
+
function Companion_getInstance_1() {
|
|
660
|
+
return Companion_instance_0;
|
|
661
|
+
}
|
|
662
|
+
function Equation(lhs, rhs) {
|
|
663
|
+
this.c1g_1 = lhs;
|
|
664
|
+
this.d1g_1 = rhs;
|
|
665
|
+
}
|
|
666
|
+
protoOf(Equation).e1g = function () {
|
|
667
|
+
return this.c1g_1;
|
|
668
|
+
};
|
|
669
|
+
protoOf(Equation).f1g = function () {
|
|
670
|
+
return this.d1g_1;
|
|
671
|
+
};
|
|
672
|
+
protoOf(Equation).h1g = function () {
|
|
673
|
+
return false;
|
|
674
|
+
};
|
|
675
|
+
protoOf(Equation).o1g = function () {
|
|
676
|
+
return false;
|
|
677
|
+
};
|
|
678
|
+
protoOf(Equation).z1g = function () {
|
|
679
|
+
return null;
|
|
680
|
+
};
|
|
681
|
+
protoOf(Equation).j1g = function () {
|
|
682
|
+
var tmp0_elvis_lhs = this.z1g();
|
|
683
|
+
var tmp;
|
|
684
|
+
if (tmp0_elvis_lhs == null) {
|
|
685
|
+
throw ClassCastException_init_$Create$('Cannot cast ' + toString(this) + ' to ' + getKClass(Assignment).g9());
|
|
686
|
+
} else {
|
|
687
|
+
tmp = tmp0_elvis_lhs;
|
|
688
|
+
}
|
|
689
|
+
return tmp;
|
|
690
|
+
};
|
|
691
|
+
protoOf(Equation).i1g = function () {
|
|
692
|
+
return false;
|
|
693
|
+
};
|
|
694
|
+
protoOf(Equation).g1g = function () {
|
|
695
|
+
return false;
|
|
696
|
+
};
|
|
697
|
+
protoOf(Equation).h1f = function () {
|
|
698
|
+
return Companion_getInstance_0().of('=', [this.e1g(), this.f1g()]);
|
|
699
|
+
};
|
|
700
|
+
protoOf(Equation).toTerm = function () {
|
|
701
|
+
return this.h1f();
|
|
702
|
+
};
|
|
703
|
+
protoOf(Equation).toPair = function () {
|
|
704
|
+
return new Pair(this.e1g(), this.f1g());
|
|
705
|
+
};
|
|
706
|
+
protoOf(Equation).swap = function () {
|
|
707
|
+
return Companion_instance_0.of(this.f1g(), this.e1g());
|
|
708
|
+
};
|
|
709
|
+
protoOf(Equation).a1h = function (substitution, equalityChecker) {
|
|
710
|
+
return Companion_instance_0.p1g(this.e1g().getSubstituted(substitution, []), this.f1g().getSubstituted(substitution, []), equalityChecker);
|
|
711
|
+
};
|
|
712
|
+
protoOf(Equation).apply = function (substitution, equalityChecker, $super) {
|
|
713
|
+
var tmp;
|
|
714
|
+
if (equalityChecker === VOID) {
|
|
715
|
+
tmp = Term$equals$ref();
|
|
716
|
+
} else {
|
|
717
|
+
tmp = equalityChecker;
|
|
718
|
+
}
|
|
719
|
+
equalityChecker = tmp;
|
|
720
|
+
return $super === VOID ? this.a1h(substitution, equalityChecker) : $super.a1h.call(this, substitution, equalityChecker);
|
|
721
|
+
};
|
|
722
|
+
function toEquations(_this__u8e3s4) {
|
|
723
|
+
// Inline function 'kotlin.collections.map' call
|
|
724
|
+
var this_0 = _this__u8e3s4.b1();
|
|
725
|
+
// Inline function 'kotlin.collections.mapTo' call
|
|
726
|
+
var destination = ArrayList_init_$Create$_0(collectionSizeOrDefault(this_0, 10));
|
|
727
|
+
var _iterator__ex2g4s = this_0.m();
|
|
728
|
+
while (_iterator__ex2g4s.p()) {
|
|
729
|
+
var item = _iterator__ex2g4s.q();
|
|
730
|
+
// Inline function 'kotlin.collections.component1' call
|
|
731
|
+
var variable = item.b2();
|
|
732
|
+
// Inline function 'kotlin.collections.component2' call
|
|
733
|
+
var term = item.c2();
|
|
734
|
+
var tmp$ret$2 = new Assignment(variable, term);
|
|
735
|
+
destination.j(tmp$ret$2);
|
|
736
|
+
}
|
|
737
|
+
return destination;
|
|
738
|
+
}
|
|
739
|
+
function toSubstitution(_this__u8e3s4) {
|
|
740
|
+
var tmp = Companion_getInstance();
|
|
741
|
+
var tmp_0 = asSequence_0(_this__u8e3s4);
|
|
742
|
+
return tmp.ofSequence(map(tmp_0, toSubstitution$lambda));
|
|
743
|
+
}
|
|
744
|
+
function toAssignmentPair(_this__u8e3s4) {
|
|
745
|
+
var tmp;
|
|
746
|
+
if (_this__u8e3s4.o1g()) {
|
|
747
|
+
tmp = _this__u8e3s4.j1g().b1h();
|
|
748
|
+
} else if (_this__u8e3s4.e1g().du()) {
|
|
749
|
+
tmp = to(_this__u8e3s4.e1g().castToVar(), _this__u8e3s4.f1g());
|
|
750
|
+
} else if (_this__u8e3s4.f1g().du()) {
|
|
751
|
+
tmp = to(_this__u8e3s4.f1g().castToVar(), _this__u8e3s4.e1g());
|
|
752
|
+
} else {
|
|
753
|
+
throw IllegalArgumentException_init_$Create$('Equation contains no variables: ' + toString(_this__u8e3s4));
|
|
754
|
+
}
|
|
755
|
+
return tmp;
|
|
756
|
+
}
|
|
757
|
+
function toSubstitution$lambda(it) {
|
|
758
|
+
return toAssignmentPair(it);
|
|
759
|
+
}
|
|
760
|
+
function Unificator$Companion$default$delegate$lambda() {
|
|
761
|
+
return Companion_getInstance_2().strict();
|
|
762
|
+
}
|
|
763
|
+
function Unificator$Companion$_get_default_$ref_8i2tx3() {
|
|
764
|
+
return constructCallableReference(function (p0) {
|
|
765
|
+
return p0.q1h();
|
|
766
|
+
}, 1, 0, 28);
|
|
767
|
+
}
|
|
768
|
+
function Unificator$Companion$naive$1($context) {
|
|
769
|
+
AbstractUnificator.call(this, $context);
|
|
770
|
+
}
|
|
771
|
+
protoOf(Unificator$Companion$naive$1).a1g = function (first, second) {
|
|
772
|
+
var tmp;
|
|
773
|
+
if (first.iu() && second.iu()) {
|
|
774
|
+
tmp = first.castToInteger().c2().li(second.castToInteger().c2()) === 0;
|
|
775
|
+
} else if (first.hu() && second.hu()) {
|
|
776
|
+
tmp = first.castToNumeric().xx().ci(second.castToNumeric().xx()) === 0;
|
|
777
|
+
} else {
|
|
778
|
+
tmp = first.equals(second);
|
|
779
|
+
}
|
|
780
|
+
return tmp;
|
|
781
|
+
};
|
|
782
|
+
protoOf(Unificator$Companion$naive$1).mguWithOccurCheck = function (term1, term2, occurCheckEnabled, $super) {
|
|
783
|
+
return this.mguWithOccurCheck(term1, term2, occurCheckEnabled, ($super == null ? true : $super instanceof Unificator$Companion$naive$1) ? $super : THROW_CCE());
|
|
784
|
+
};
|
|
785
|
+
function Unificator$Companion$strict$1($context) {
|
|
786
|
+
AbstractUnificator.call(this, $context);
|
|
787
|
+
}
|
|
788
|
+
protoOf(Unificator$Companion$strict$1).a1g = function (first, second) {
|
|
789
|
+
return first.equals(second);
|
|
790
|
+
};
|
|
791
|
+
protoOf(Unificator$Companion$strict$1).mguWithOccurCheck = function (term1, term2, occurCheckEnabled, $super) {
|
|
792
|
+
return this.mguWithOccurCheck(term1, term2, occurCheckEnabled, ($super == null ? true : $super instanceof Unificator$Companion$strict$1) ? $super : THROW_CCE());
|
|
793
|
+
};
|
|
794
|
+
function Companion_0() {
|
|
795
|
+
Companion_instance_1 = this;
|
|
796
|
+
var tmp = this;
|
|
797
|
+
tmp.o1h_1 = lazy(Unificator$Companion$default$delegate$lambda);
|
|
798
|
+
this.p1h_1 = 32;
|
|
799
|
+
}
|
|
800
|
+
protoOf(Companion_0).q1h = function () {
|
|
801
|
+
var tmp0 = this.o1h_1;
|
|
802
|
+
var tmp = KProperty1;
|
|
803
|
+
// Inline function 'kotlin.getValue' call
|
|
804
|
+
getPropertyCallableRef('default', 1, tmp, Unificator$Companion$_get_default_$ref_8i2tx3(), null);
|
|
805
|
+
return tmp0.c2();
|
|
806
|
+
};
|
|
807
|
+
protoOf(Companion_0).mguWith = function (_this__u8e3s4, other) {
|
|
808
|
+
return this.q1h().mgu(_this__u8e3s4, other);
|
|
809
|
+
};
|
|
810
|
+
protoOf(Companion_0).matches = function (_this__u8e3s4, other) {
|
|
811
|
+
return this.q1h().match(_this__u8e3s4, other);
|
|
812
|
+
};
|
|
813
|
+
protoOf(Companion_0).unifyWith = function (_this__u8e3s4, other) {
|
|
814
|
+
return this.q1h().unify(_this__u8e3s4, other);
|
|
815
|
+
};
|
|
816
|
+
protoOf(Companion_0).mergeWith = function (_this__u8e3s4, other) {
|
|
817
|
+
return this.q1h().merge(_this__u8e3s4, other);
|
|
818
|
+
};
|
|
819
|
+
protoOf(Companion_0).naiveWithContext = function (context) {
|
|
820
|
+
return new Unificator$Companion$naive$1(context);
|
|
821
|
+
};
|
|
822
|
+
protoOf(Companion_0).naive = function () {
|
|
823
|
+
return this.naiveWithContext(Companion_getInstance().empty());
|
|
824
|
+
};
|
|
825
|
+
protoOf(Companion_0).strictWithContext = function (context) {
|
|
826
|
+
return new Unificator$Companion$strict$1(context);
|
|
827
|
+
};
|
|
828
|
+
protoOf(Companion_0).strict = function () {
|
|
829
|
+
return this.strictWithContext(Companion_getInstance().empty());
|
|
830
|
+
};
|
|
831
|
+
protoOf(Companion_0).v1h = function (other, capacity) {
|
|
832
|
+
var tmp;
|
|
833
|
+
if (other instanceof CachedUnificator) {
|
|
834
|
+
tmp = new CachedUnificator(other.s1g_1, capacity);
|
|
835
|
+
} else {
|
|
836
|
+
tmp = new CachedUnificator(other, capacity);
|
|
837
|
+
}
|
|
838
|
+
return tmp;
|
|
839
|
+
};
|
|
840
|
+
protoOf(Companion_0).cached = function (other, capacity, $super) {
|
|
841
|
+
capacity = capacity === VOID ? 32 : capacity;
|
|
842
|
+
return $super === VOID ? this.v1h(other, capacity) : $super.v1h.call(this, other, capacity);
|
|
843
|
+
};
|
|
844
|
+
var Companion_instance_1;
|
|
845
|
+
function Companion_getInstance_2() {
|
|
846
|
+
if (Companion_instance_1 == null)
|
|
847
|
+
new Companion_0();
|
|
848
|
+
return Companion_instance_1;
|
|
849
|
+
}
|
|
850
|
+
function Unificator() {
|
|
851
|
+
}
|
|
852
|
+
//region block: post-declaration
|
|
853
|
+
protoOf(AbstractUnificator).mguWithOccurCheck = mguWithOccurCheck;
|
|
854
|
+
protoOf(AbstractUnificator).mgu = mgu;
|
|
855
|
+
protoOf(AbstractUnificator).matchWithOccurCheck = matchWithOccurCheck;
|
|
856
|
+
protoOf(AbstractUnificator).match = match;
|
|
857
|
+
protoOf(AbstractUnificator).unifyWithOccurCheck = unifyWithOccurCheck;
|
|
858
|
+
protoOf(AbstractUnificator).unify = unify;
|
|
859
|
+
protoOf(AbstractUnificator).merge = merge;
|
|
860
|
+
protoOf(CachedUnificator).mguWithOccurCheck = mguWithOccurCheck;
|
|
861
|
+
protoOf(CachedUnificator).mgu = mgu;
|
|
862
|
+
protoOf(CachedUnificator).matchWithOccurCheck = matchWithOccurCheck;
|
|
863
|
+
protoOf(CachedUnificator).match = match;
|
|
864
|
+
protoOf(CachedUnificator).unifyWithOccurCheck = unifyWithOccurCheck;
|
|
865
|
+
protoOf(CachedUnificator).unify = unify;
|
|
866
|
+
protoOf(CachedUnificator).merge = merge;
|
|
867
|
+
protoOf(Equation).oo = castTo;
|
|
868
|
+
defineProp(protoOf(Equation), 'lhs', function () {
|
|
869
|
+
return this.e1g();
|
|
870
|
+
});
|
|
871
|
+
defineProp(protoOf(Equation), 'rhs', function () {
|
|
872
|
+
return this.f1g();
|
|
873
|
+
});
|
|
874
|
+
defineProp(protoOf(Companion_0), 'default', protoOf(Companion_0).q1h);
|
|
875
|
+
//endregion
|
|
876
|
+
//region block: init
|
|
877
|
+
Companion_instance_0 = new Companion();
|
|
878
|
+
//endregion
|
|
879
|
+
//region block: exports
|
|
880
|
+
_.$_$ = _.$_$ || {};
|
|
881
|
+
_.$_$.a = Companion_getInstance_2;
|
|
882
|
+
//endregion
|
|
883
|
+
return _;
|
|
884
|
+
}));
|
|
885
|
+
|
|
886
|
+
//# sourceMappingURL=2p-unify.js.map
|