occam-verify-cli 1.0.609 → 1.0.612
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/ephemeral.js +2 -2
- package/lib/context/file/nominal.js +17 -47
- package/lib/context/liminal.js +36 -39
- package/lib/context/scoped.js +8 -8
- package/lib/context.js +76 -48
- package/lib/element/assertion/contained.js +8 -1
- package/lib/element/assertion/defined.js +11 -4
- package/lib/element/assertion/property.js +8 -1
- package/lib/element/assertion/satisfies.js +8 -1
- package/lib/element/assertion/subproof.js +8 -1
- package/lib/element/assertion/type.js +8 -1
- package/lib/element/assumption.js +11 -11
- package/lib/element/combinator/bracketed.js +8 -1
- package/lib/element/constructor/bracketed.js +8 -1
- package/lib/element/declaration/combinator.js +8 -1
- package/lib/element/declaration/complexType.js +8 -1
- package/lib/element/declaration/constructor.js +32 -25
- package/lib/element/declaration/metavariable.js +9 -9
- package/lib/element/declaration/simpleType.js +8 -1
- package/lib/element/declaration/typePrefix.js +8 -1
- package/lib/element/declaration/variable.js +16 -9
- package/lib/element/frame.js +28 -23
- package/lib/element/judgement.js +4 -4
- package/lib/element/metavariable.js +25 -11
- package/lib/element/proofAssertion/premise.js +8 -1
- package/lib/element/proofAssertion/step.js +8 -1
- package/lib/element/proofAssertion/supposition.js +8 -1
- package/lib/element/reference.js +13 -1
- package/lib/element/statement.js +16 -1
- package/lib/element/substitution/frame.js +18 -11
- package/lib/element/substitution/reference.js +18 -11
- package/lib/element/substitution/statement.js +26 -13
- package/lib/element/substitution/term.js +11 -10
- package/lib/element/substitution.js +15 -8
- package/lib/element/variable.js +6 -5
- package/lib/process/unify.js +2 -2
- package/lib/utilities/element.js +3 -3
- package/lib/utilities/substitutions.js +15 -16
- package/lib/utilities/unification.js +30 -15
- package/package.json +2 -2
- package/src/context/ephemeral.js +1 -1
- package/src/context/file/nominal.js +15 -25
- package/src/context/liminal.js +31 -35
- package/src/context/scoped.js +6 -5
- package/src/context.js +68 -40
- package/src/element/assertion/contained.js +7 -0
- package/src/element/assertion/defined.js +13 -3
- package/src/element/assertion/property.js +7 -0
- package/src/element/assertion/satisfies.js +7 -0
- package/src/element/assertion/subproof.js +7 -0
- package/src/element/assertion/type.js +7 -0
- package/src/element/assumption.js +2 -2
- package/src/element/combinator/bracketed.js +7 -0
- package/src/element/constructor/bracketed.js +7 -0
- package/src/element/declaration/combinator.js +7 -0
- package/src/element/declaration/complexType.js +7 -0
- package/src/element/declaration/constructor.js +31 -24
- package/src/element/declaration/metavariable.js +6 -6
- package/src/element/declaration/simpleType.js +7 -0
- package/src/element/declaration/typePrefix.js +7 -0
- package/src/element/declaration/variable.js +13 -6
- package/src/element/frame.js +28 -26
- package/src/element/judgement.js +1 -1
- package/src/element/metavariable.js +28 -11
- package/src/element/proofAssertion/premise.js +7 -0
- package/src/element/proofAssertion/step.js +7 -0
- package/src/element/proofAssertion/supposition.js +7 -0
- package/src/element/reference.js +14 -0
- package/src/element/statement.js +18 -0
- package/src/element/substitution/frame.js +10 -14
- package/src/element/substitution/reference.js +10 -14
- package/src/element/substitution/statement.js +13 -15
- package/src/element/substitution/term.js +8 -13
- package/src/element/substitution.js +12 -6
- package/src/element/variable.js +4 -2
- package/src/process/unify.js +1 -1
- package/src/utilities/element.js +2 -2
- package/src/utilities/substitutions.js +13 -16
- package/src/utilities/unification.js +2 -4
package/src/element/judgement.js
CHANGED
|
@@ -31,7 +31,7 @@ export default define(class Judgement extends Element {
|
|
|
31
31
|
|
|
32
32
|
getMetavariable() { return this.frame.getMetavariable(); }
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
matchMetavariableName(metavariableName) { return this.frame.matchMetavariableName(metavariableName); }
|
|
35
35
|
|
|
36
36
|
validate(assignments, stated, context) {
|
|
37
37
|
let validates = false;
|
|
@@ -39,6 +39,20 @@ export default define(class Metavariable extends Element {
|
|
|
39
39
|
this.metaType = metaType;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
getMetavariableNode() {
|
|
43
|
+
const node = this.getNode(),
|
|
44
|
+
metavarialbeNode = node; ///
|
|
45
|
+
|
|
46
|
+
return metavarialbeNode;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
getMetavariableName() {
|
|
50
|
+
const metavarialbeNode = this.getMetavariableNode(),
|
|
51
|
+
metavariableName = metavarialbeNode.getMetavariableName();
|
|
52
|
+
|
|
53
|
+
return metavariableName;
|
|
54
|
+
}
|
|
55
|
+
|
|
42
56
|
compare(metavariable) {
|
|
43
57
|
const name = metavariable.getName(),
|
|
44
58
|
comparesToMetavariable = (this.name === name);
|
|
@@ -112,13 +126,13 @@ export default define(class Metavariable extends Element {
|
|
|
112
126
|
|
|
113
127
|
context.trace(`Unifying the '${frameString}' frame with the '${metavariableString}' metavariable...`);
|
|
114
128
|
|
|
115
|
-
const
|
|
116
|
-
frameMetavariableUnifies = this.unifyFrameMetavariable(frame, generalContext, specificContext);
|
|
129
|
+
const frameMetavariableUnifies = this.unifyFrameMetavariable(frame, generalContext, specificContext);
|
|
117
130
|
|
|
118
131
|
if (frameMetavariableUnifies) {
|
|
119
132
|
frameUnifies = true;
|
|
120
133
|
} else {
|
|
121
|
-
const
|
|
134
|
+
const metavariableName = this.getMetavariableName(),
|
|
135
|
+
simpleSubstitution = context.findSimpleSubstitutionByMetavariableName(metavariableName);
|
|
122
136
|
|
|
123
137
|
if (simpleSubstitution !== null) {
|
|
124
138
|
const substitution = simpleSubstitution, ///
|
|
@@ -129,6 +143,7 @@ export default define(class Metavariable extends Element {
|
|
|
129
143
|
}
|
|
130
144
|
} else {
|
|
131
145
|
const { FrameSubstitution } = elements,
|
|
146
|
+
metavariable = this, ///
|
|
132
147
|
frameSubstitution = FrameSubstitution.fromFrameAndMetavariable(frame, metavariable, context),
|
|
133
148
|
framesubstitutionValidates = frameSubstitution.validate(generalContext, specificContext);
|
|
134
149
|
|
|
@@ -169,10 +184,11 @@ export default define(class Metavariable extends Element {
|
|
|
169
184
|
if (statementMetavariableUnifies) {
|
|
170
185
|
statementUnifies = true;
|
|
171
186
|
} else {
|
|
172
|
-
const
|
|
187
|
+
const metavariableName = metavariable.getName(),
|
|
188
|
+
substitutionPresent = context.isSubstitutionPresentByMetavariableNameAndSubstitution(metavariableName, substitution);
|
|
173
189
|
|
|
174
190
|
if (substitutionPresent) {
|
|
175
|
-
substitution = context.
|
|
191
|
+
substitution = context.findSubstitutionByMetavariableNameAndSubstitution(metavariableName, substitution); ///
|
|
176
192
|
|
|
177
193
|
const substitutionComparesToStatement = substitution.compareStatement(statement, context);
|
|
178
194
|
|
|
@@ -221,16 +237,16 @@ export default define(class Metavariable extends Element {
|
|
|
221
237
|
|
|
222
238
|
context.trace(`Unifying the '${referenceString}' reference with the '${metavariableString}' metavariable...`);
|
|
223
239
|
|
|
224
|
-
const
|
|
225
|
-
referenceMetavariableUnifies = this.unifyReferenceMetavariable(reference, generalContext, specificContext);
|
|
240
|
+
const referenceMetavariableUnifies = this.unifyReferenceMetavariable(reference, generalContext, specificContext);
|
|
226
241
|
|
|
227
242
|
if (referenceMetavariableUnifies) {
|
|
228
243
|
referenceUnifies = true;
|
|
229
244
|
} else {
|
|
230
|
-
const
|
|
245
|
+
const metavariableName = this.getMetavariableName(),
|
|
246
|
+
simpleSubstitutionPresent = context.isSimpleSubstitutionPresentByMetavariableName(metavariableName);
|
|
231
247
|
|
|
232
248
|
if (simpleSubstitutionPresent) {
|
|
233
|
-
const simpleSubstitution = context.
|
|
249
|
+
const simpleSubstitution = context.findSimpleSubstitutionByMetavariableName(metavariableName),
|
|
234
250
|
substitution = simpleSubstitution, ///
|
|
235
251
|
substitutionReferenceEqualToReference = substitution.isReferenceEqualToReference(reference);
|
|
236
252
|
|
|
@@ -239,6 +255,7 @@ export default define(class Metavariable extends Element {
|
|
|
239
255
|
}
|
|
240
256
|
} else {
|
|
241
257
|
const { ReferenceSubstitution } = elements,
|
|
258
|
+
metavariable = this, ///
|
|
242
259
|
referenceSubstitution = ReferenceSubstitution.fromReferenceAndMetavariable(reference, metavariable, context),
|
|
243
260
|
substitution = referenceSubstitution; ///
|
|
244
261
|
|
|
@@ -295,8 +312,8 @@ export default define(class Metavariable extends Element {
|
|
|
295
312
|
specificContextFilePath = specificContext.getFilePath();
|
|
296
313
|
|
|
297
314
|
if (generalContextFilePath === specificContextFilePath) {
|
|
298
|
-
const
|
|
299
|
-
frameMetavariableComparesToMetvariable = frame.
|
|
315
|
+
const metavariableName = this.getMetavariableName(), ///
|
|
316
|
+
frameMetavariableComparesToMetvariable = frame.matchMetavariableName(metavariableName);
|
|
300
317
|
|
|
301
318
|
if (frameMetavariableComparesToMetvariable) {
|
|
302
319
|
frameMetavariableUnifies = true;
|
|
@@ -17,6 +17,13 @@ export default define(class Premise extends ProofAssertion {
|
|
|
17
17
|
return this.procedureCall;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
getPremiseNode() {
|
|
21
|
+
const node = this.getNode(),
|
|
22
|
+
premiseNode = node; ///
|
|
23
|
+
|
|
24
|
+
return premiseNode;
|
|
25
|
+
}
|
|
26
|
+
|
|
20
27
|
isStated() {
|
|
21
28
|
const stated = true; ///
|
|
22
29
|
|
|
@@ -27,6 +27,13 @@ export default define(class Step extends ProofAssertion {
|
|
|
27
27
|
return this.satisfiesAssertion;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
getStepNode() {
|
|
31
|
+
const node = this.getNode(),
|
|
32
|
+
stepNode = node; ///
|
|
33
|
+
|
|
34
|
+
return stepNode;
|
|
35
|
+
}
|
|
36
|
+
|
|
30
37
|
isSatisfied() {
|
|
31
38
|
const satisfied = (this.satisfiesAssertion !== null);
|
|
32
39
|
|
|
@@ -17,6 +17,13 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
17
17
|
return this.procedureCall;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
getSuppositionNode() {
|
|
21
|
+
const node = this.getNode(),
|
|
22
|
+
suppositionNode = node; ///
|
|
23
|
+
|
|
24
|
+
return suppositionNode;
|
|
25
|
+
}
|
|
26
|
+
|
|
20
27
|
isStated() {
|
|
21
28
|
const stated = true; ///
|
|
22
29
|
|
package/src/element/reference.js
CHANGED
|
@@ -53,6 +53,20 @@ export default define(class Reference extends Element {
|
|
|
53
53
|
return equalTo;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
matchMetavariableName(metavariableName) {
|
|
57
|
+
let metavariableNameMatches = false;
|
|
58
|
+
|
|
59
|
+
const metavariableNameA = metavariableName ///
|
|
60
|
+
|
|
61
|
+
metavariableName = this.getMetavariableName();
|
|
62
|
+
|
|
63
|
+
const metavariableNameB = metavariableName; ///
|
|
64
|
+
|
|
65
|
+
metavariableNameMatches = (metavariableNameA === metavariableNameB);
|
|
66
|
+
|
|
67
|
+
return metavariableNameMatches;
|
|
68
|
+
}
|
|
69
|
+
|
|
56
70
|
isValid(context) {
|
|
57
71
|
const assertionNode = this.getReferenceNode(),
|
|
58
72
|
assertionPresent = context.isReferencePresentByReferenceNode(assertionNode),
|
package/src/element/statement.js
CHANGED
|
@@ -49,6 +49,24 @@ export default define(class Statement extends Element {
|
|
|
49
49
|
return equalTo;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
matchMetavariableName(metavariableName) {
|
|
53
|
+
let metavariableNameMatches = false;
|
|
54
|
+
|
|
55
|
+
const singular = this.isSingular();
|
|
56
|
+
|
|
57
|
+
if (singular) {
|
|
58
|
+
const metavariableNameA = metavariableName ///
|
|
59
|
+
|
|
60
|
+
metavariableName = this.getMetavariableName();
|
|
61
|
+
|
|
62
|
+
const metavariableNameB = metavariableName; ///
|
|
63
|
+
|
|
64
|
+
metavariableNameMatches = (metavariableNameA === metavariableNameB);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return metavariableNameMatches;
|
|
68
|
+
}
|
|
69
|
+
|
|
52
70
|
isValid(context) {
|
|
53
71
|
const statementNode = this.getStatementNode(),
|
|
54
72
|
statementPresent = context.isStatementPresentByStatementNode(statementNode),
|
|
@@ -24,6 +24,13 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
24
24
|
return this.replacementFrame;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
getFrameSubstitutionNode() {
|
|
28
|
+
const node = this.getNode(),
|
|
29
|
+
frameSubstitutionNode = node; ///
|
|
30
|
+
|
|
31
|
+
return frameSubstitutionNode;
|
|
32
|
+
}
|
|
33
|
+
|
|
27
34
|
getTargetNode() {
|
|
28
35
|
const targetFrameNode = this.targetFrame.getNode(),
|
|
29
36
|
tergetNode = targetFrameNode; ///
|
|
@@ -38,20 +45,9 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
38
45
|
return replacementNode;
|
|
39
46
|
}
|
|
40
47
|
|
|
41
|
-
|
|
42
|
-
let metavariable = null;
|
|
43
|
-
|
|
44
|
-
const targetFrameNode = this.targetFrame.getNode(),
|
|
45
|
-
metavariableName = targetFrameNode.getMetavariableName();
|
|
48
|
+
matchMetavariableName(metavariableName) { return this.targetFrame.matchMetavariableName(metavariableName); }
|
|
46
49
|
|
|
47
|
-
|
|
48
|
-
const context = generalContext; ///
|
|
49
|
-
|
|
50
|
-
metavariable = context.findMetavariableByMetavariableName(metavariableName);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return metavariable;
|
|
54
|
-
}
|
|
50
|
+
getMetavariableName() { return this.targetFrame.getMetavariableName(); }
|
|
55
51
|
|
|
56
52
|
isTrivial() {
|
|
57
53
|
const targetFrameEqualToReplacementFrame = this.targetFrame.isEqualTo(this.replacementFrame),
|
|
@@ -156,7 +152,7 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
156
152
|
replacementFrameValidates = this.replacementFrame.validate(assignments, stated, context);
|
|
157
153
|
|
|
158
154
|
if (replacementFrameValidates) {
|
|
159
|
-
context.debug(`...validated the '${frameSubstitutionString}' frame subtitution's '${replacementFrameString}' replacement frame
|
|
155
|
+
context.debug(`...validated the '${frameSubstitutionString}' frame subtitution's '${replacementFrameString}' replacement frame.`);
|
|
160
156
|
}
|
|
161
157
|
|
|
162
158
|
return replacementFrameValidates;
|
|
@@ -24,6 +24,13 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
24
24
|
return this.replacementReference;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
+
getReferenceSubstitutionNode() {
|
|
28
|
+
const node = this.getNode(),
|
|
29
|
+
referenceSubstitution = node; ///
|
|
30
|
+
|
|
31
|
+
return referenceSubstitution;
|
|
32
|
+
}
|
|
33
|
+
|
|
27
34
|
getTargetNode() {
|
|
28
35
|
const targetReferenceNode = this.targetReference.getNode(),
|
|
29
36
|
tergetNode = targetReferenceNode; ///
|
|
@@ -38,20 +45,9 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
38
45
|
return replacementNode;
|
|
39
46
|
}
|
|
40
47
|
|
|
41
|
-
|
|
42
|
-
let metavariable = null;
|
|
43
|
-
|
|
44
|
-
const targetReferenceNode = this.targetReference.getNode(),
|
|
45
|
-
metavariableName = targetReferenceNode.getMetavariableName();
|
|
48
|
+
getMetavariableName() { return this.targetReference.getMetavariableName(); }
|
|
46
49
|
|
|
47
|
-
|
|
48
|
-
const context = generalContext; ///
|
|
49
|
-
|
|
50
|
-
metavariable = context.findMetavariableByMetavariableName(metavariableName);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return metavariable;
|
|
54
|
-
}
|
|
50
|
+
matchMetavariableName(metavariableName) { return this.targetReference.matchMetavariableName(metavariableName); }
|
|
55
51
|
|
|
56
52
|
isTrivial() {
|
|
57
53
|
const targetReferenceEqualToReplacementReference = this.targetReference.isEqualTo(this.replacementReference),
|
|
@@ -150,7 +146,7 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
150
146
|
replacementReferenceValidates = this.replacementReference.validate(context);
|
|
151
147
|
|
|
152
148
|
if (replacementReferenceValidates) {
|
|
153
|
-
context.debug(`...validated the '${referenceSubstitutionString}' reference subtitution's '${replacementReferenceString}' replacement reference
|
|
149
|
+
context.debug(`...validated the '${referenceSubstitutionString}' reference subtitution's '${replacementReferenceString}' replacement reference.`);
|
|
154
150
|
}
|
|
155
151
|
|
|
156
152
|
return replacementReferenceValidates;
|
|
@@ -37,21 +37,15 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
37
37
|
return this.replacementStatement;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
getStatementSubstitutionNode() {
|
|
41
|
+
const node = this.getNode(),
|
|
42
|
+
statementSubstitutionNode = node; ///
|
|
42
43
|
|
|
43
|
-
|
|
44
|
-
metavariableName = targetStatementNode.getMetavariableName();
|
|
45
|
-
|
|
46
|
-
if (metavariableName !== null) {
|
|
47
|
-
const context = generalContext; ///
|
|
48
|
-
|
|
49
|
-
metavariable = context.findMetavariableByMetavariableName(metavariableName);
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
return metavariable;
|
|
44
|
+
return statementSubstitutionNode;
|
|
53
45
|
}
|
|
54
46
|
|
|
47
|
+
getMtavariableName() { return this.targetStatement.getMtavariableName(); }
|
|
48
|
+
|
|
55
49
|
getTargetNode() {
|
|
56
50
|
const targetStatementNode = this.targetStatement.getNode(),
|
|
57
51
|
targetNode = targetStatementNode; ///
|
|
@@ -72,6 +66,10 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
72
66
|
return simple;
|
|
73
67
|
}
|
|
74
68
|
|
|
69
|
+
getMetavariableName() { return this.targetStatement.getMetavariableName(); }
|
|
70
|
+
|
|
71
|
+
matchMetavariableName(metavariableName) { return this.targetStatement.matchMetavariableName(metavariableName); }
|
|
72
|
+
|
|
75
73
|
compareStatement(statement, context) {
|
|
76
74
|
statement = stripBracketsFromStatement(statement, context); ///
|
|
77
75
|
|
|
@@ -190,7 +188,7 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
190
188
|
replacementStatementValidates = this.replacementStatement.validate(assignments, stated, context);
|
|
191
189
|
|
|
192
190
|
if (replacementStatementValidates) {
|
|
193
|
-
context.debug(`...validated the '${statementSubstitutionString}' statement subtitution's '${replacementStatementString}' replacement statement
|
|
191
|
+
context.debug(`...validated the '${statementSubstitutionString}' statement subtitution's '${replacementStatementString}' replacement statement.`);
|
|
194
192
|
}
|
|
195
193
|
|
|
196
194
|
return replacementStatementValidates;
|
|
@@ -248,11 +246,11 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
248
246
|
|
|
249
247
|
context = generalContext; ///
|
|
250
248
|
|
|
251
|
-
const
|
|
249
|
+
const metavariableName = this.getMetavariableName();
|
|
252
250
|
|
|
253
251
|
context = specificContext; ///
|
|
254
252
|
|
|
255
|
-
const simpleSubstitution = context.
|
|
253
|
+
const simpleSubstitution = context.findSimpleSubstitutionByMetavariableName(metavariableName);
|
|
256
254
|
|
|
257
255
|
context = this.getContext();
|
|
258
256
|
|
|
@@ -25,6 +25,13 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
25
25
|
return this.replacementTerm;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
getTermSubstitutionNode() {
|
|
29
|
+
const node = this.getNode(),
|
|
30
|
+
termSubstitutionNode = node; ///
|
|
31
|
+
|
|
32
|
+
return termSubstitutionNode;
|
|
33
|
+
}
|
|
34
|
+
|
|
28
35
|
getTargetNode() {
|
|
29
36
|
const targetTermNode = this.targetTerm.getNode(),
|
|
30
37
|
tergetNode = targetTermNode; ///
|
|
@@ -39,19 +46,7 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
39
46
|
return replacementNode;
|
|
40
47
|
}
|
|
41
48
|
|
|
42
|
-
|
|
43
|
-
let variable = null;
|
|
44
|
-
|
|
45
|
-
const targetTermNode = this.targetTerm.getNode(),
|
|
46
|
-
variableIdentifier = targetTermNode.getVariableIdentifier();
|
|
47
|
-
|
|
48
|
-
if (variableIdentifier !== null) {
|
|
49
|
-
const context = specificContext; ///
|
|
50
|
-
variable = context.findVariableByVariableIdentifier(variableIdentifier);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return variable;
|
|
54
|
-
}
|
|
49
|
+
getVariableIdentifier() { return this.targetTerm.getVariableIdentifier(); }
|
|
55
50
|
|
|
56
51
|
isTrivial() {
|
|
57
52
|
const targetTermEqualToReplacementTerm = this.targetTerm.isEqualTo(this.replacementTerm),
|
|
@@ -25,12 +25,6 @@ export default class Substitution extends Element {
|
|
|
25
25
|
return primitive;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
getMetavariable(context) {
|
|
29
|
-
const metavariable = null;
|
|
30
|
-
|
|
31
|
-
return metavariable;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
28
|
getSubstitutionNode() {
|
|
35
29
|
const node = this.getNode(),
|
|
36
30
|
substitutionNode = node; ///
|
|
@@ -38,6 +32,18 @@ export default class Substitution extends Element {
|
|
|
38
32
|
return substitutionNode;
|
|
39
33
|
}
|
|
40
34
|
|
|
35
|
+
getNetavariableName() {
|
|
36
|
+
const metavariableName = null;
|
|
37
|
+
|
|
38
|
+
return metavariableName;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
getVariableIdentifier() {
|
|
42
|
+
const variableIdentifier = null;
|
|
43
|
+
|
|
44
|
+
return variableIdentifier;
|
|
45
|
+
}
|
|
46
|
+
|
|
41
47
|
matchSubstitutionNode(substitutionNode) {
|
|
42
48
|
const substitutionNodeA = substitutionNode; ///
|
|
43
49
|
|
package/src/element/variable.js
CHANGED
|
@@ -113,7 +113,7 @@ export default define(class Variable extends Element {
|
|
|
113
113
|
return typeValidates;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
unifyTerm(term,
|
|
116
|
+
unifyTerm(term, generalContext, specificContext) {
|
|
117
117
|
let termUnifies = false;
|
|
118
118
|
|
|
119
119
|
const context = specificContext, ///
|
|
@@ -127,7 +127,9 @@ export default define(class Variable extends Element {
|
|
|
127
127
|
|
|
128
128
|
variable = this; ///
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
const variableIdentifier = variable.getIdentifier();
|
|
131
|
+
|
|
132
|
+
substitution = context.findSubstitutionByVariableIdentifier(variableIdentifier);
|
|
131
133
|
|
|
132
134
|
if (substitution !== null) {
|
|
133
135
|
const substitutionComparesToTerm = substitution.compareTerm(term, context);
|
package/src/process/unify.js
CHANGED
|
@@ -69,7 +69,7 @@ class MetaLevelPass extends ZipPass {
|
|
|
69
69
|
|
|
70
70
|
const substitutionNode = statementNode.getSubstitutionNode(),
|
|
71
71
|
substitution = (substitutionNode !== null) ?
|
|
72
|
-
context.findSubstitutionBySubstitutionNode(substitutionNode
|
|
72
|
+
context.findSubstitutionBySubstitutionNode(substitutionNode) :
|
|
73
73
|
null;
|
|
74
74
|
|
|
75
75
|
context = specificContext; ///
|
package/src/utilities/element.js
CHANGED
|
@@ -621,7 +621,7 @@ export function variableDeclarationFromVariableDeclarationNode(variableDeclarati
|
|
|
621
621
|
variableNode = variableDeclarationNode.getVariableNode(),
|
|
622
622
|
type = typeFromTypeNode(typeNode, context),
|
|
623
623
|
variable = variableFromVariableNode(variableNode, context),
|
|
624
|
-
variableDeclaration = new VariableDeclaration(context, string, node,
|
|
624
|
+
variableDeclaration = new VariableDeclaration(context, string, node, type, variable, provisional);
|
|
625
625
|
|
|
626
626
|
return variableDeclaration;
|
|
627
627
|
}
|
|
@@ -708,7 +708,7 @@ export function metavariableDeclarationFromMetavariableDeclarationNode(metavaria
|
|
|
708
708
|
string = context.nodeAsString(node),
|
|
709
709
|
metaType = metaTypeFromMetavariableDeclarationNode(metavariableDeclarationNode, context),
|
|
710
710
|
metavariable = metavariableFromMetavariableDeclarationNode(metavariableDeclarationNode, context),
|
|
711
|
-
metavariableDeclaration = new MetavariableDeclaration(context, string, node,
|
|
711
|
+
metavariableDeclaration = new MetavariableDeclaration(context, string, node, metaType, metavariable);
|
|
712
712
|
|
|
713
713
|
return metavariableDeclaration;
|
|
714
714
|
}
|
|
@@ -16,7 +16,7 @@ export function termFromTermAndSubstitutions(term, generalContext, specificConte
|
|
|
16
16
|
variable = generalContext.findVariableByVariableIdentifier(variableIdentifier);
|
|
17
17
|
|
|
18
18
|
if (variable !== null) {
|
|
19
|
-
const substitution = specificContext.
|
|
19
|
+
const substitution = specificContext.findSubstitutionByVariableIdentifier(variableIdentifier);
|
|
20
20
|
|
|
21
21
|
if (substitution !== null) {
|
|
22
22
|
const termSubstitution = substitution, ///
|
|
@@ -43,7 +43,7 @@ export function frameFromFrameAndSubstitutions(frame, generalContext, specificCo
|
|
|
43
43
|
metavariable = generalContext.findMetavariableByMetavariableName(metavariableName);
|
|
44
44
|
|
|
45
45
|
if (metavariable !== null) {
|
|
46
|
-
const substitution = specificContext.
|
|
46
|
+
const substitution = specificContext.findSubstitutionByMetavariableName(metavariableName);
|
|
47
47
|
|
|
48
48
|
if (substitution !== null) {
|
|
49
49
|
const frameSubstitution = substitution, ///
|
|
@@ -77,7 +77,7 @@ export function statementFromStatementAndSubstitutions(statement, generalContext
|
|
|
77
77
|
|
|
78
78
|
specificContext = context; ///
|
|
79
79
|
|
|
80
|
-
substitution = specificContext.findSubstitutionBySubstitutionNode(substitutionNode
|
|
80
|
+
substitution = specificContext.findSubstitutionBySubstitutionNode(substitutionNode);
|
|
81
81
|
|
|
82
82
|
context = generalContext; ///
|
|
83
83
|
|
|
@@ -91,8 +91,8 @@ export function statementFromStatementAndSubstitutions(statement, generalContext
|
|
|
91
91
|
|
|
92
92
|
if (metavariable !== null) {
|
|
93
93
|
substitution = (substitution !== null) ?
|
|
94
|
-
specificContext.
|
|
95
|
-
specificContext.
|
|
94
|
+
specificContext.findSubstitutionByMetavariableNameAndSubstitution(metavariableName, substitution) :
|
|
95
|
+
specificContext.findSubstitutionByMetavariableName(metavariableName);
|
|
96
96
|
|
|
97
97
|
if (substitution !== null) {
|
|
98
98
|
const statementSubstitution = substitution, ///
|
|
@@ -107,25 +107,22 @@ export function statementFromStatementAndSubstitutions(statement, generalContext
|
|
|
107
107
|
return statement;
|
|
108
108
|
}
|
|
109
109
|
|
|
110
|
-
export function
|
|
111
|
-
const
|
|
110
|
+
export function metavariableNamesFromSubstitutions(substitutions) {
|
|
111
|
+
const metavariableNames = [];
|
|
112
112
|
|
|
113
113
|
substitutions.forEach((substitution) => {
|
|
114
|
-
const
|
|
115
|
-
metavariable = substitution.getMetavariable(generalContext, specificContext);
|
|
114
|
+
const metavariableName = substitution.getMetavariableName();
|
|
116
115
|
|
|
117
|
-
if (
|
|
118
|
-
|
|
116
|
+
if (metavariableName !== null) {
|
|
117
|
+
metavariableNames.push(metavariableName);
|
|
119
118
|
}
|
|
120
119
|
});
|
|
121
120
|
|
|
122
|
-
compress(
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
if (!metavariableComparesToMetavariableB) {
|
|
121
|
+
compress(metavariableNames, (metavariableNameA, metavariableNameB) => {
|
|
122
|
+
if (metavariableNameB !== metavariableNameB) {
|
|
126
123
|
return true;
|
|
127
124
|
}
|
|
128
125
|
});
|
|
129
126
|
|
|
130
|
-
return
|
|
127
|
+
return metavariableNames;
|
|
131
128
|
}
|
|
@@ -144,9 +144,7 @@ async function unifyStatementWithTopLevelAssertion(statement, reference, satisfi
|
|
|
144
144
|
let statementUnifiesWithTopLevelAssertion = false;
|
|
145
145
|
|
|
146
146
|
if (reference !== null) {
|
|
147
|
-
const
|
|
148
|
-
topLevelAssertion = context.findTopLevelAssertionByReference(reference),
|
|
149
|
-
generalSubstitutions = substitutions; ///
|
|
147
|
+
const topLevelAssertion = context.findTopLevelAssertionByReference(reference);
|
|
150
148
|
|
|
151
149
|
if (topLevelAssertion !== null) {
|
|
152
150
|
const statementString = statement.getString(),
|
|
@@ -155,7 +153,7 @@ async function unifyStatementWithTopLevelAssertion(statement, reference, satisfi
|
|
|
155
153
|
context.trace(`Unifying the '${statementString}' statement with the '${topLevelAssertionString}' top level assertion...`);
|
|
156
154
|
|
|
157
155
|
const subproofOrProofAssertions = context.getSubproofOrProofAssertions(),
|
|
158
|
-
statementAndSubproofOrProofAssertionsUnify = topLevelAssertion.unifyStatementAndSubproofOrProofAssertions(statement, subproofOrProofAssertions, context);
|
|
156
|
+
statementAndSubproofOrProofAssertionsUnify = await topLevelAssertion.unifyStatementAndSubproofOrProofAssertions(statement, subproofOrProofAssertions, context);
|
|
159
157
|
|
|
160
158
|
if (statementAndSubproofOrProofAssertionsUnify) {
|
|
161
159
|
const metavariable = reference.getMetavariable();
|