occam-nominal 1.0.430 → 1.0.432
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/lib/context/file/nominal.js +1 -5
- package/lib/context/mnemic.js +6 -44
- package/lib/context.js +1 -13
- package/lib/element/assertion/signature.js +10 -5
- package/lib/element/constructor/bracketed.js +1 -6
- package/lib/element/equality.js +4 -13
- package/lib/element/equivalence.js +49 -37
- package/lib/element/fact/step.js +2 -2
- package/lib/element/signature.js +33 -29
- package/lib/element/term.js +11 -11
- package/lib/process/equate.js +53 -19
- package/lib/process/unification.js +1 -2
- package/lib/process/unify.js +63 -60
- package/lib/utilities/brackets.js +17 -13
- package/lib/utilities/equivalences.js +6 -6
- package/lib/utilities/string.js +7 -3
- package/package.json +5 -5
- package/src/context/file/nominal.js +0 -7
- package/src/context/mnemic.js +3 -69
- package/src/context.js +0 -21
- package/src/element/assertion/signature.js +11 -5
- package/src/element/constructor/bracketed.js +0 -8
- package/src/element/equality.js +4 -18
- package/src/element/equivalence.js +68 -49
- package/src/element/fact/step.js +1 -1
- package/src/element/signature.js +36 -35
- package/src/element/term.js +10 -12
- package/src/process/equate.js +79 -27
- package/src/process/unification.js +0 -2
- package/src/process/unify.js +94 -83
- package/src/utilities/brackets.js +22 -14
- package/src/utilities/equivalences.js +3 -3
- package/src/utilities/string.js +8 -2
package/src/element/equality.js
CHANGED
|
@@ -78,20 +78,6 @@ export default define(class Equality extends Element {
|
|
|
78
78
|
return equalTo;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
isReflexive() {
|
|
82
|
-
let reflexive = false;
|
|
83
|
-
|
|
84
|
-
if (!this.negated) {
|
|
85
|
-
const leftTermEqualToRightTerm = this.leftTerm.isEqualTo(this.rightTerm);
|
|
86
|
-
|
|
87
|
-
if (leftTermEqualToRightTerm) {
|
|
88
|
-
reflexive = true;
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
return reflexive;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
81
|
findEquality(context) {
|
|
96
82
|
const equalityNode = this.getEqualityNode(),
|
|
97
83
|
equality = context.findEqualityByEqualityNode(equalityNode);
|
|
@@ -248,14 +234,14 @@ export default define(class Equality extends Element {
|
|
|
248
234
|
return;
|
|
249
235
|
}
|
|
250
236
|
|
|
251
|
-
const
|
|
252
|
-
negated = this.isNegated(),
|
|
253
|
-
reflexive = this.isReflexive();
|
|
237
|
+
const negated = this.isNegated();
|
|
254
238
|
|
|
255
|
-
if (negated
|
|
239
|
+
if (negated) {
|
|
256
240
|
return;
|
|
257
241
|
}
|
|
258
242
|
|
|
243
|
+
const equality = this; ///
|
|
244
|
+
|
|
259
245
|
const equalityAssignment = equalityAssignmentFromEquality(equality, context);
|
|
260
246
|
|
|
261
247
|
context.addAssignment(equalityAssignment);
|
|
@@ -5,12 +5,12 @@ import { arrayUtilities } from "necessary";
|
|
|
5
5
|
|
|
6
6
|
import { define } from "../elements";
|
|
7
7
|
import { instantiate } from "../utilities/context";
|
|
8
|
+
import { stripBracketsFromTerm } from "../utilities/brackets";
|
|
8
9
|
import { instantiateEquivalence } from "../process/instantiate";
|
|
9
|
-
import { stripBracketsFromTermNode } from "../utilities/brackets";
|
|
10
10
|
import { equivalenceStringFromTerms } from "../utilities/string";
|
|
11
11
|
import { equivalenceFromEquivalenceNode } from "../utilities/element";
|
|
12
12
|
|
|
13
|
-
const { compress } = arrayUtilities;
|
|
13
|
+
const { first, second, compress } = arrayUtilities;
|
|
14
14
|
|
|
15
15
|
export default define(class Equivalence extends Element {
|
|
16
16
|
constructor(context, string, node, breakPoint, terms) {
|
|
@@ -87,9 +87,9 @@ export default define(class Equivalence extends Element {
|
|
|
87
87
|
|
|
88
88
|
isDisjointFrom(equivalence) {
|
|
89
89
|
const disjointFrom = equivalence.everyTerm((term) => {
|
|
90
|
-
const
|
|
90
|
+
const termEquates = this.equateTerm(term);
|
|
91
91
|
|
|
92
|
-
if (!
|
|
92
|
+
if (!termEquates) {
|
|
93
93
|
return true;
|
|
94
94
|
}
|
|
95
95
|
});
|
|
@@ -113,63 +113,42 @@ export default define(class Equivalence extends Element {
|
|
|
113
113
|
return implicitlyGrounded;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
equateTerm(term) {
|
|
117
|
+
const termA = term, ///
|
|
118
|
+
termEquates = this.someTerm((term) => {
|
|
119
|
+
const termB = term, ///
|
|
120
|
+
termAEqualToTermB = termA.isEqualTo(termB);
|
|
118
121
|
|
|
119
|
-
|
|
120
|
-
|
|
122
|
+
if (termAEqualToTermB) {
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
121
126
|
|
|
122
|
-
|
|
127
|
+
return termEquates;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
equateTerms(terms) {
|
|
131
|
+
const termsEquate = terms.every((term) => {
|
|
132
|
+
const termEquates = this.equateTerm(term);
|
|
133
|
+
|
|
134
|
+
if (termEquates) {
|
|
123
135
|
return true;
|
|
124
136
|
}
|
|
125
137
|
});
|
|
126
138
|
|
|
127
|
-
return
|
|
139
|
+
return termsEquate;
|
|
128
140
|
}
|
|
129
141
|
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
const termNodeMatches =
|
|
142
|
+
matchTermNode(termNode) {
|
|
143
|
+
const termNodeMatches = this.terms.some((term) => {
|
|
144
|
+
const termNodeMatches = term.matchTermNode(termNode);
|
|
133
145
|
|
|
134
146
|
if (termNodeMatches) {
|
|
135
147
|
return true;
|
|
136
148
|
}
|
|
137
149
|
});
|
|
138
150
|
|
|
139
|
-
return
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
someTerm(callback) { return this.terms.some(callback); }
|
|
143
|
-
|
|
144
|
-
everyTerm(callback) { return this.terms.every(callback); }
|
|
145
|
-
|
|
146
|
-
compareTerm(term) {
|
|
147
|
-
const termA = term, ///
|
|
148
|
-
comparesToTerm = this.someTerm((term) => {
|
|
149
|
-
const termB = term, ///
|
|
150
|
-
termAEqualToTermB = termA.isEqualTo(termB);
|
|
151
|
-
|
|
152
|
-
if (termAEqualToTermB) {
|
|
153
|
-
return true;
|
|
154
|
-
}
|
|
155
|
-
});
|
|
156
|
-
|
|
157
|
-
return comparesToTerm;
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
someOtherTerm(term, callback) {
|
|
161
|
-
const termA = term, ///
|
|
162
|
-
terms = this.terms.filter((term) => {
|
|
163
|
-
const termB = term, ///
|
|
164
|
-
termAEqualToTermB = termA.isEqualTo(termB);
|
|
165
|
-
|
|
166
|
-
if (!termAEqualToTermB) {
|
|
167
|
-
return true;
|
|
168
|
-
}
|
|
169
|
-
}),
|
|
170
|
-
result = terms.some(callback);
|
|
171
|
-
|
|
172
|
-
return result;
|
|
151
|
+
return termNodeMatches;
|
|
173
152
|
}
|
|
174
153
|
|
|
175
154
|
combineTerms(terms) {
|
|
@@ -209,14 +188,54 @@ export default define(class Equivalence extends Element {
|
|
|
209
188
|
return equivalence;
|
|
210
189
|
}
|
|
211
190
|
|
|
191
|
+
someOtherTerm(term, callback) {
|
|
192
|
+
const termA = term, ///
|
|
193
|
+
terms = this.terms.filter((term) => {
|
|
194
|
+
const termB = term, ///
|
|
195
|
+
termAEqualToTermB = termA.isEqualTo(termB);
|
|
196
|
+
|
|
197
|
+
if (!termAEqualToTermB) {
|
|
198
|
+
return true;
|
|
199
|
+
}
|
|
200
|
+
}),
|
|
201
|
+
result = terms.some(callback);
|
|
202
|
+
|
|
203
|
+
return result;
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
someTerm(callback) { return this.terms.some(callback); }
|
|
207
|
+
|
|
208
|
+
everyTerm(callback) { return this.terms.every(callback); }
|
|
209
|
+
|
|
212
210
|
static name = "Equivalence";
|
|
213
211
|
|
|
214
212
|
static fromEquality(equality, context) {
|
|
215
213
|
let equivalence;
|
|
216
214
|
|
|
215
|
+
let terms;
|
|
216
|
+
|
|
217
|
+
terms = equality.getTerms();
|
|
218
|
+
|
|
219
|
+
terms = terms.map((term) => { ///
|
|
220
|
+
term = stripBracketsFromTerm(term, context);
|
|
221
|
+
|
|
222
|
+
return term;
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
const firstTerm = first(terms),
|
|
226
|
+
secondTerm = second(terms),
|
|
227
|
+
firstTermEqualToSecondTerm = firstTerm.isEqualTo(secondTerm);
|
|
228
|
+
|
|
229
|
+
if (firstTermEqualToSecondTerm) {
|
|
230
|
+
const term = firstTerm; ///
|
|
231
|
+
|
|
232
|
+
terms = [
|
|
233
|
+
term
|
|
234
|
+
];
|
|
235
|
+
}
|
|
236
|
+
|
|
217
237
|
instantiate((context) => {
|
|
218
|
-
const
|
|
219
|
-
equivalenceString = equivalenceStringFromTerms(terms),
|
|
238
|
+
const equivalenceString = equivalenceStringFromTerms(terms),
|
|
220
239
|
string = equivalenceString, ///
|
|
221
240
|
equivalenceNode = instantiateEquivalence(string, context);
|
|
222
241
|
|
package/src/element/fact/step.js
CHANGED
|
@@ -216,7 +216,7 @@ export default define(class Step extends Fact {
|
|
|
216
216
|
|
|
217
217
|
context.trace(`Validating the '${stepString}' step's '${signatureAssertionString}' signature assertion...`);
|
|
218
218
|
|
|
219
|
-
|
|
219
|
+
declare((state) => {
|
|
220
220
|
signatureAssertionValidates = this.signatureAssertion.validate(state, context, (signatureAssertion, contwext) => {
|
|
221
221
|
let validates;
|
|
222
222
|
|
package/src/element/signature.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
import { Element, breakPointUtilities } from "occam-languages";
|
|
3
|
+
import { Element, breakPointUtilities, continuationUtilities } from "occam-languages";
|
|
5
4
|
|
|
6
5
|
import { define } from "../elements";
|
|
7
6
|
import { declare } from "../utilities/state";
|
|
8
7
|
import { all, every } from "../utilities/continuation";
|
|
8
|
+
import { termsStringFromTerms } from "../utilities/string";
|
|
9
9
|
import { instantiateSignature } from "../process/instantiate";
|
|
10
10
|
import { attempt, reconcile, serialise, unserialise, instantiate } from "../utilities/context";
|
|
11
11
|
|
|
12
|
-
const {
|
|
12
|
+
const { asynchronousEvery } = continuationUtilities,
|
|
13
13
|
{ breakPointFromJSON, breakPointToBreakPointJSON } = breakPointUtilities;
|
|
14
14
|
|
|
15
15
|
export default define(class Signature extends Element {
|
|
@@ -173,49 +173,50 @@ export default define(class Signature extends Element {
|
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
unifyTerms(terms, context, continuation) {
|
|
176
|
-
let termsUnify;
|
|
176
|
+
let termsUnify = false;
|
|
177
177
|
|
|
178
|
-
|
|
178
|
+
const quoted = true,
|
|
179
|
+
termsString = termsStringFromTerms(terms, quoted),
|
|
180
|
+
signatureString = this.getString();
|
|
179
181
|
|
|
180
|
-
|
|
181
|
-
specificSignature = signature, ///
|
|
182
|
-
generalSignatureString = generalSignature.getString(),
|
|
183
|
-
specificSignatureString = specificSignature.getString();
|
|
182
|
+
context.trace(`Unifying the ${termsString} terms with the '${signatureString}' signature...`);
|
|
184
183
|
|
|
185
|
-
|
|
184
|
+
const generalTerms = this.terms, ///
|
|
185
|
+
specificTerms = terms, //
|
|
186
|
+
generalTermsLength = generalTerms.length,
|
|
187
|
+
specificTermsLength = specificTerms.length;
|
|
186
188
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
specificSignatureContext = specificSignature.getContext(),
|
|
191
|
-
generalTerms = generalSignatureTerms, ///
|
|
192
|
-
specificTerms = specificSignatureTerms, ///
|
|
193
|
-
generalContext = generalSignatureContext, ///
|
|
194
|
-
specificContext = specificSignatureContext; ///
|
|
189
|
+
if (generalTermsLength !== specificTermsLength) {
|
|
190
|
+
return continuation(termsUnify);
|
|
191
|
+
}
|
|
195
192
|
|
|
196
|
-
|
|
193
|
+
const specificContext = context; ///
|
|
197
194
|
|
|
198
|
-
|
|
199
|
-
match(generalTerms, specificTerms, (generalTerm, specificTerm) => {
|
|
200
|
-
let termUnifies;
|
|
195
|
+
context = this.getContext();
|
|
201
196
|
|
|
202
|
-
|
|
197
|
+
const generalContext = context; ///
|
|
203
198
|
|
|
204
|
-
|
|
205
|
-
return true;
|
|
206
|
-
}
|
|
207
|
-
});
|
|
199
|
+
let index = -1;
|
|
208
200
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
}, specificContext);
|
|
201
|
+
return reconcile((specificContext) => {
|
|
202
|
+
return asynchronousEvery(generalTerms, (generalTerm, continuation) => {
|
|
203
|
+
index++;
|
|
213
204
|
|
|
214
|
-
|
|
215
|
-
context.debug(`...unified the '${specificSignatureString}' signature with the '${generalSignatureString}' signature.`);
|
|
216
|
-
}
|
|
205
|
+
const specificTerm = specificTerms[index];
|
|
217
206
|
|
|
218
|
-
|
|
207
|
+
generalTerm.unifyTerm(specificTerm, generalContext, specificContext, continuation);
|
|
208
|
+
}, (termsUnify) => {
|
|
209
|
+
if (termsUnify) {
|
|
210
|
+
specificContext.commit();
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
if (termsUnify) {
|
|
214
|
+
context.debug(`...unified the ${termsString} terms with the '${signatureString}' signature.`);
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
return continuation(termsUnify);
|
|
218
|
+
});
|
|
219
|
+
}, specificContext);
|
|
219
220
|
}
|
|
220
221
|
|
|
221
222
|
toJSON() {
|
package/src/element/term.js
CHANGED
|
@@ -346,11 +346,9 @@ export default define(class Term extends Element {
|
|
|
346
346
|
// return term;
|
|
347
347
|
// }
|
|
348
348
|
|
|
349
|
-
unifyTerm(term, generalContext, specificContext) {
|
|
349
|
+
unifyTerm(term, generalContext, specificContext, continuation) {
|
|
350
350
|
let termUnifies = false;
|
|
351
351
|
|
|
352
|
-
debugger
|
|
353
|
-
|
|
354
352
|
const context = specificContext, ///
|
|
355
353
|
generalTerm = this, ///
|
|
356
354
|
specificTerm = term,
|
|
@@ -359,17 +357,17 @@ export default define(class Term extends Element {
|
|
|
359
357
|
|
|
360
358
|
context.trace(`Unifying the '${specifixTermString}' term with the '${generalTermString}' term...`);
|
|
361
359
|
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
}
|
|
360
|
+
return unifyTermIntrinsically(generalTerm, specificTerm, generalContext, specificContext, (termUnifiesIntrinsically) => {
|
|
361
|
+
if (termUnifiesIntrinsically) {
|
|
362
|
+
termUnifies = true;
|
|
363
|
+
}
|
|
367
364
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
365
|
+
if (termUnifies) {
|
|
366
|
+
context.debug(`...unified the '${specifixTermString}' term with the '${generalTermString}' term.`);
|
|
367
|
+
}
|
|
371
368
|
|
|
372
|
-
|
|
369
|
+
return continuation(termUnifies);
|
|
370
|
+
});
|
|
373
371
|
}
|
|
374
372
|
|
|
375
373
|
toJSON() {
|
package/src/process/equate.js
CHANGED
|
@@ -4,7 +4,8 @@ import { queryUtilities } from "occam-query";
|
|
|
4
4
|
|
|
5
5
|
import ZipPass from "../pass/zip";
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { stripBracketsFromTermNode } from "../utilities/brackets";
|
|
8
|
+
import { findEquivalenceByTermNode } from "../utilities/equivalences";
|
|
8
9
|
|
|
9
10
|
const { nodeQuery } = queryUtilities;
|
|
10
11
|
|
|
@@ -18,25 +19,48 @@ class EquationalPass extends ZipPass {
|
|
|
18
19
|
run: (leftTermNode, rightTermNode, context) => {
|
|
19
20
|
let success = false;
|
|
20
21
|
|
|
22
|
+
leftTermNode = stripBracketsFromTermNode(leftTermNode); ///
|
|
23
|
+
rightTermNode = stripBracketsFromTermNode(rightTermNode); ///
|
|
24
|
+
|
|
21
25
|
if (!success) {
|
|
22
|
-
const
|
|
23
|
-
|
|
26
|
+
const equivalences = context.getEquivalences(),
|
|
27
|
+
leftEquivalence = findEquivalenceByTermNode(equivalences, leftTermNode),
|
|
28
|
+
rightEquivalence = findEquivalenceByTermNode(equivalences, rightTermNode);
|
|
24
29
|
|
|
25
|
-
if (
|
|
26
|
-
|
|
30
|
+
if (!success) {
|
|
31
|
+
if ((leftEquivalence !== null) && (rightEquivalence !== null) && (leftEquivalence === rightEquivalence)) {
|
|
32
|
+
success = true;
|
|
33
|
+
}
|
|
27
34
|
}
|
|
28
|
-
}
|
|
29
35
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
if (!success) {
|
|
37
|
+
if (leftEquivalence !== null) {
|
|
38
|
+
success = leftEquivalence.someOtherTerm(leftTerm, (otherTerm) => {
|
|
39
|
+
const leftTerm = otherTerm, ///
|
|
40
|
+
leftTermNode = leftTerm.getNode(),
|
|
41
|
+
rightTermNode = rightTerm.getNode(),
|
|
42
|
+
descended = descend(leftTermNode, rightTermNode, context);
|
|
43
|
+
|
|
44
|
+
if (descended) {
|
|
45
|
+
return true;
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (!success) {
|
|
52
|
+
if (rightEquivalence !== null) {
|
|
53
|
+
success = rightEquivalence.someOtherTerm(rightTerm, (otherTerm) => {
|
|
54
|
+
const rightTerm = otherTerm, ///
|
|
55
|
+
leftTermNode = leftTerm.getNode(),
|
|
56
|
+
rightTermNode = rightTerm.getNode(),
|
|
57
|
+
descended = descend(leftTermNode, rightTermNode, context);
|
|
58
|
+
|
|
59
|
+
if (descended) {
|
|
60
|
+
return true;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
40
64
|
}
|
|
41
65
|
}
|
|
42
66
|
|
|
@@ -45,13 +69,7 @@ class EquationalPass extends ZipPass {
|
|
|
45
69
|
leftTermNodeMatchesRightTermNode = leftTermNode.match(rightTermNode, depth);
|
|
46
70
|
|
|
47
71
|
if (leftTermNodeMatchesRightTermNode) {
|
|
48
|
-
const
|
|
49
|
-
rightNonTerminalNode = rightTermNode, ///
|
|
50
|
-
leftNonTerminalNodeChildNodes = leftNonTerminalNode.getChildNodes(),
|
|
51
|
-
rightNonTerminalNodeChildNodes = rightNonTerminalNode.getChildNodes(),
|
|
52
|
-
leftChildNodes = leftNonTerminalNodeChildNodes, ///
|
|
53
|
-
rightChildNodes = rightNonTerminalNodeChildNodes, ///
|
|
54
|
-
descended = equationalPass.descend(leftChildNodes, rightChildNodes, context);
|
|
72
|
+
const descended = descend(leftTermNode, rightTermNode, context);
|
|
55
73
|
|
|
56
74
|
if (descended) {
|
|
57
75
|
success = true;
|
|
@@ -68,7 +86,12 @@ class EquationalPass extends ZipPass {
|
|
|
68
86
|
const equationalPass = new EquationalPass();
|
|
69
87
|
|
|
70
88
|
export function equateTerms(leftTerm, rightTerm, context) {
|
|
71
|
-
let termsEquate;
|
|
89
|
+
let termsEquate = false;
|
|
90
|
+
|
|
91
|
+
const leftTermString = leftTerm.getString(),
|
|
92
|
+
rightTermString = rightTerm.getString();
|
|
93
|
+
|
|
94
|
+
context.trace(`Equating the '${leftTermString}' and '${rightTermString}' terms...`);
|
|
72
95
|
|
|
73
96
|
const leftTermNode = leftTerm.getNode(),
|
|
74
97
|
rightTermNode = rightTerm.getNode(),
|
|
@@ -76,13 +99,24 @@ export function equateTerms(leftTerm, rightTerm, context) {
|
|
|
76
99
|
specificNode = rightTermNode, ///
|
|
77
100
|
success = equationalPass.run(generalNode, specificNode, context);
|
|
78
101
|
|
|
79
|
-
|
|
102
|
+
if (success) {
|
|
103
|
+
termsEquate = true;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (termsEquate) {
|
|
107
|
+
context.debug(`...equated the '${leftTermString}' and '${rightTermString}' terms.`);
|
|
108
|
+
}
|
|
80
109
|
|
|
81
110
|
return termsEquate;
|
|
82
111
|
}
|
|
83
112
|
|
|
84
113
|
export function equateStatements(leftStatement, rightStatement, context) {
|
|
85
|
-
let statementsEquate;
|
|
114
|
+
let statementsEquate = false;
|
|
115
|
+
|
|
116
|
+
const leftStatementString = leftStatement.getString(),
|
|
117
|
+
rightStatementString = rightStatement.getString();
|
|
118
|
+
|
|
119
|
+
context.trace(`Equating the '${leftStatementString}' and '${rightStatementString}' statements...`);
|
|
86
120
|
|
|
87
121
|
const leftStatementNode = leftStatement.getNode(),
|
|
88
122
|
rightStatementNode = rightStatement.getNode(),
|
|
@@ -90,7 +124,25 @@ export function equateStatements(leftStatement, rightStatement, context) {
|
|
|
90
124
|
specificNode = rightStatementNode, ///
|
|
91
125
|
success = equationalPass.run(generalNode, specificNode, context);
|
|
92
126
|
|
|
93
|
-
|
|
127
|
+
if (success) {
|
|
128
|
+
statementsEquate = true;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (statementsEquate) {
|
|
132
|
+
context.debug(`...equated the '${leftStatementString}' and '${rightStatementString}' statements.`);
|
|
133
|
+
}
|
|
94
134
|
|
|
95
135
|
return statementsEquate;
|
|
96
136
|
}
|
|
137
|
+
|
|
138
|
+
function descend(leftTermNode, rightTermNode, context) {
|
|
139
|
+
const leftNonTerminalNode = leftTermNode, ///
|
|
140
|
+
rightNonTerminalNode = rightTermNode, ///
|
|
141
|
+
leftNonTerminalNodeChildNodes = leftNonTerminalNode.getChildNodes(),
|
|
142
|
+
rightNonTerminalNodeChildNodes = rightNonTerminalNode.getChildNodes(),
|
|
143
|
+
leftChildNodes = leftNonTerminalNodeChildNodes, ///
|
|
144
|
+
rightChildNodes = rightNonTerminalNodeChildNodes, ///
|
|
145
|
+
descended = equationalPass.descend(leftChildNodes, rightChildNodes, context);
|
|
146
|
+
|
|
147
|
+
return descended;
|
|
148
|
+
}
|
|
@@ -127,8 +127,6 @@ function unifyStepWithSignatureAssertion(step, context, continuation) {
|
|
|
127
127
|
context.trace(`Unifying the '${stepString}' step with the '${signatureAssertionString}' signature assertion...`);
|
|
128
128
|
|
|
129
129
|
return signatureAssertion.unifyStepAndFactOrSubproofs(step, factOrSubproofs, context, (stepAndFactOrSubproofsUnify) => {
|
|
130
|
-
let stepUnifiesWithSignatureAssertion = false;
|
|
131
|
-
|
|
132
130
|
if (stepAndFactOrSubproofsUnify) {
|
|
133
131
|
stepUnifiesWithSignatureAssertion = true;
|
|
134
132
|
}
|