occam-verify-cli 1.0.809 → 1.0.816
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/bounded.js +6 -6
- package/lib/context/branching.js +3 -3
- package/lib/context/ephemeral.js +7 -3
- package/lib/context/file/nominal.js +16 -16
- package/lib/context/liminal.js +26 -30
- package/lib/context/synoptic.js +62 -2
- package/lib/context.js +66 -54
- package/lib/element/assertion/defined.js +12 -11
- package/lib/element/assertion/satisfies.js +15 -11
- package/lib/element/assertion.js +5 -5
- package/lib/element/assumption/metaLevel.js +3 -3
- package/lib/element/conclusion.js +11 -8
- package/lib/element/deduction.js +11 -8
- package/lib/element/frame.js +6 -14
- package/lib/element/label.js +5 -8
- package/lib/element/metavariable.js +17 -17
- package/lib/element/procedureCall.js +10 -6
- package/lib/element/proofAssertion/premise.js +27 -27
- package/lib/element/proofAssertion/step.js +25 -5
- package/lib/element/proofAssertion/supposition.js +27 -27
- package/lib/element/proofAssertion.js +10 -10
- package/lib/element/reference.js +9 -13
- package/lib/element/rule.js +41 -43
- package/lib/element/signature.js +8 -8
- package/lib/element/statement.js +35 -45
- package/lib/element/subproof.js +4 -4
- package/lib/element/substitution/frame.js +16 -11
- package/lib/element/substitution/reference.js +15 -10
- package/lib/element/substitution/statement.js +55 -51
- package/lib/element/substitution/term.js +17 -12
- package/lib/element/substitution.js +35 -29
- package/lib/element/term.js +18 -16
- package/lib/element/topLevelAssertion/axiom.js +5 -3
- package/lib/element/topLevelAssertion.js +36 -38
- package/lib/element/variable.js +7 -7
- package/lib/node/frame.js +1 -9
- package/lib/node/statement.js +1 -9
- package/lib/node/term.js +10 -19
- package/lib/process/assign.js +23 -31
- package/lib/utilities/element.js +33 -5
- package/lib/utilities/equivalence.js +4 -4
- package/lib/utilities/equivalences.js +30 -15
- package/lib/utilities/string.js +2 -2
- package/lib/utilities/substitutions.js +16 -15
- package/lib/utilities/unification.js +133 -124
- package/package.json +1 -1
- package/src/context/bounded.js +5 -5
- package/src/context/branching.js +2 -2
- package/src/context/ephemeral.js +10 -2
- package/src/context/file/nominal.js +15 -15
- package/src/context/liminal.js +29 -35
- package/src/context/synoptic.js +81 -1
- package/src/context.js +88 -69
- package/src/element/assertion/defined.js +17 -16
- package/src/element/assertion/satisfies.js +17 -10
- package/src/element/assertion.js +8 -8
- package/src/element/assumption/metaLevel.js +4 -2
- package/src/element/conclusion.js +12 -7
- package/src/element/deduction.js +12 -7
- package/src/element/frame.js +7 -20
- package/src/element/label.js +3 -5
- package/src/element/metavariable.js +27 -27
- package/src/element/procedureCall.js +14 -9
- package/src/element/proofAssertion/premise.js +41 -41
- package/src/element/proofAssertion/step.js +37 -7
- package/src/element/proofAssertion/supposition.js +41 -41
- package/src/element/proofAssertion.js +10 -9
- package/src/element/reference.js +9 -13
- package/src/element/rule.js +57 -61
- package/src/element/signature.js +7 -7
- package/src/element/statement.js +54 -68
- package/src/element/subproof.js +3 -3
- package/src/element/substitution/frame.js +18 -8
- package/src/element/substitution/reference.js +16 -7
- package/src/element/substitution/statement.js +78 -67
- package/src/element/substitution/term.js +19 -10
- package/src/element/substitution.js +45 -35
- package/src/element/term.js +28 -26
- package/src/element/topLevelAssertion/axiom.js +5 -2
- package/src/element/topLevelAssertion.js +49 -53
- package/src/element/variable.js +6 -6
- package/src/node/frame.js +0 -12
- package/src/node/statement.js +0 -12
- package/src/node/term.js +14 -28
- package/src/process/assign.js +35 -46
- package/src/utilities/element.js +32 -4
- package/src/utilities/equivalence.js +3 -4
- package/src/utilities/equivalences.js +31 -19
- package/src/utilities/string.js +2 -2
- package/src/utilities/substitutions.js +17 -15
- package/src/utilities/unification.js +145 -119
|
@@ -5,6 +5,7 @@ import Assertion from "../assertion";
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
6
|
import { instantiate } from "../../utilities/context";
|
|
7
7
|
import { instantiateDefinedAssertion } from "../../process/instantiate";
|
|
8
|
+
import { separateGroundedTermsAndDefinedVariables } from "../../utilities/equivalences";
|
|
8
9
|
import { termFromTermAndSubstitutions, frameFromFrameAndSubstitutions } from "../../utilities/substitutions";
|
|
9
10
|
import { termFromJDefinedAssertionNode, frameFromJDefinedAssertionNode, negatedFromJDefinedAssertionNode, definedAssertionFromStatementNode } from "../../utilities/element";
|
|
10
11
|
|
|
@@ -101,10 +102,10 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
101
102
|
context.debug(`The '${termString}' term is not singular.`);
|
|
102
103
|
} else {
|
|
103
104
|
const term = this.term.validate(context, (term) => {
|
|
104
|
-
|
|
105
|
+
const validatesForwards = true;
|
|
105
106
|
|
|
106
|
-
|
|
107
|
-
|
|
107
|
+
return validatesForwards;
|
|
108
|
+
});
|
|
108
109
|
|
|
109
110
|
if (term !== null) {
|
|
110
111
|
this.term = term; ///
|
|
@@ -249,15 +250,15 @@ function validateWhenDerived(term, frame, negated, generalContext, specificConte
|
|
|
249
250
|
const context = specificContext; ///
|
|
250
251
|
|
|
251
252
|
if (term !== null) {
|
|
252
|
-
const
|
|
253
|
-
|
|
254
|
-
|
|
253
|
+
const variableIdentifier = term.getVariableIdentifier(),
|
|
254
|
+
declaredDariable = context.findDeclaredVariableByVariableIdentifier(variableIdentifier),
|
|
255
|
+
declaredDariableDefined = isVariableDefined(declaredDariable, context);
|
|
255
256
|
|
|
256
|
-
if (!negated &&
|
|
257
|
+
if (!negated && declaredDariableDefined) {
|
|
257
258
|
validatesWhenDerived = true;
|
|
258
259
|
}
|
|
259
260
|
|
|
260
|
-
if (negated && !
|
|
261
|
+
if (negated && !declaredDariableDefined) {
|
|
261
262
|
validatesWhenDerived = true;
|
|
262
263
|
}
|
|
263
264
|
}
|
|
@@ -265,13 +266,13 @@ function validateWhenDerived(term, frame, negated, generalContext, specificConte
|
|
|
265
266
|
if (frame!== null) {
|
|
266
267
|
const metavariableName = frame.getMetavariableName(),
|
|
267
268
|
declaredMetavariable = context.findDeclaredMetavariableByMetavariableName(metavariableName),
|
|
268
|
-
|
|
269
|
+
declaredMetavariableDefined = isMetavariableDefined(declaredMetavariable, context);
|
|
269
270
|
|
|
270
|
-
if (!negated &&
|
|
271
|
+
if (!negated && declaredMetavariableDefined) {
|
|
271
272
|
validatesWhenDerived = true;
|
|
272
273
|
}
|
|
273
274
|
|
|
274
|
-
if (negated && !
|
|
275
|
+
if (negated && !declaredMetavariableDefined) {
|
|
275
276
|
validatesWhenDerived = true;
|
|
276
277
|
}
|
|
277
278
|
}
|
|
@@ -284,12 +285,12 @@ function isVariableDefined(variable, context) {
|
|
|
284
285
|
groundedTerms = [],
|
|
285
286
|
definedVariables = [];
|
|
286
287
|
|
|
287
|
-
|
|
288
|
+
separateGroundedTermsAndDefinedVariables(equivalences, groundedTerms, definedVariables, context);
|
|
288
289
|
|
|
289
290
|
const variableMatchesDefinedVariable = definedVariables.some((definedVariable) => {
|
|
290
|
-
const
|
|
291
|
+
const definedVariableComparesToVariable = definedVariable.compareVariable(variable);
|
|
291
292
|
|
|
292
|
-
if (
|
|
293
|
+
if (definedVariableComparesToVariable === variable) {
|
|
293
294
|
return true;
|
|
294
295
|
}
|
|
295
296
|
}),
|
|
@@ -299,8 +300,8 @@ function isVariableDefined(variable, context) {
|
|
|
299
300
|
}
|
|
300
301
|
|
|
301
302
|
function isMetavariableDefined(metavariable, context) {
|
|
302
|
-
const
|
|
303
|
-
judgementPresent = context.
|
|
303
|
+
const metavariableNode = metavariable.getNode(),
|
|
304
|
+
judgementPresent = context.isJudgementPresentByMetavariableNode(metavariableNode),
|
|
304
305
|
metavariableDefined = judgementPresent; ///
|
|
305
306
|
|
|
306
307
|
return metavariableDefined
|
|
@@ -113,13 +113,13 @@ export default define(class SatisfiesAssertion extends Assertion {
|
|
|
113
113
|
return referenceVerifies;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
|
|
117
|
-
let
|
|
116
|
+
unifyStepAndSubproofOrProofAssertions(step, subproofOrProofAssertions, context) {
|
|
117
|
+
let stepAndSubproofOrProofAssertionsUnify = false;
|
|
118
118
|
|
|
119
|
-
const
|
|
119
|
+
const steptString = step.getString(),
|
|
120
120
|
satisfiesAssertionString = this.getString(); ///
|
|
121
121
|
|
|
122
|
-
context.trace(`Unifying the '${
|
|
122
|
+
context.trace(`Unifying the '${steptString}' step with the '${satisfiesAssertionString}' satisfies assertion...`);
|
|
123
123
|
|
|
124
124
|
this.signature.validate(context);
|
|
125
125
|
|
|
@@ -132,9 +132,9 @@ export default define(class SatisfiesAssertion extends Assertion {
|
|
|
132
132
|
if (axiomComparesToSignature) {
|
|
133
133
|
const substitutionsB = substitutions; ///
|
|
134
134
|
|
|
135
|
-
|
|
135
|
+
stepAndSubproofOrProofAssertionsUnify = unifyStepAndSubproofOrProofAssertions(step, subproofOrProofAssertions, context);
|
|
136
136
|
|
|
137
|
-
if (
|
|
137
|
+
if (stepAndSubproofOrProofAssertionsUnify) {
|
|
138
138
|
const substitutionsA = substitutions, ///
|
|
139
139
|
substitutionsCorrelate = substitutionsA.correlateSubstitutions(substitutionsB);
|
|
140
140
|
|
|
@@ -144,17 +144,17 @@ export default define(class SatisfiesAssertion extends Assertion {
|
|
|
144
144
|
|
|
145
145
|
context.trace(`THe signature's ${substitutionsBString} substitutions do not correlate with the unification's ${substitutionsAString} substitutions.`);
|
|
146
146
|
|
|
147
|
-
|
|
147
|
+
stepAndSubproofOrProofAssertionsUnify = false;
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
if (
|
|
154
|
-
context.debug(`...unified the '${
|
|
153
|
+
if (stepAndSubproofOrProofAssertionsUnify) {
|
|
154
|
+
context.debug(`...unified the '${steptString}' step with the '${satisfiesAssertionString}' satisfies assertion.`);
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
-
return
|
|
157
|
+
return stepAndSubproofOrProofAssertionsUnify;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
static name = "SatisfiesAssertion";
|
|
@@ -180,6 +180,13 @@ export default define(class SatisfiesAssertion extends Assertion {
|
|
|
180
180
|
return satisfiesAssertion;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
+
static fromStep(step, context) {
|
|
184
|
+
const statementNode = step.getStatementNode(),
|
|
185
|
+
satisfiesAssertion = satisfiesAssertionFromStatementNode(statementNode, context);
|
|
186
|
+
|
|
187
|
+
return satisfiesAssertion;
|
|
188
|
+
}
|
|
189
|
+
|
|
183
190
|
static fromStatement(statement, context) {
|
|
184
191
|
const statementNode = statement.getNode(),
|
|
185
192
|
satisfiesAssertion = satisfiesAssertionFromStatementNode(statementNode, context);
|
package/src/element/assertion.js
CHANGED
|
@@ -18,14 +18,6 @@ export default class Assertion extends Element {
|
|
|
18
18
|
return assertionNodeMatches;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
-
findValidAssertion(context) {
|
|
22
|
-
const assertionNode = this.getAssertionNode(),
|
|
23
|
-
assertion = context.findAssertionByAssertionNode(assertionNode),
|
|
24
|
-
validAssertion = assertion; ///
|
|
25
|
-
|
|
26
|
-
return validAssertion;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
21
|
isEqualTo(assertion) {
|
|
30
22
|
const assertionNode = assertion.getNode(),
|
|
31
23
|
assertionNodeMatches = this.matchAssertionNode(assertionNode),
|
|
@@ -34,6 +26,14 @@ export default class Assertion extends Element {
|
|
|
34
26
|
return equalTo;
|
|
35
27
|
}
|
|
36
28
|
|
|
29
|
+
findValidAssertion(context) {
|
|
30
|
+
const assertionNode = this.getAssertionNode(),
|
|
31
|
+
assertion = context.findAssertionByAssertionNode(assertionNode),
|
|
32
|
+
validAssertion = assertion; ///
|
|
33
|
+
|
|
34
|
+
return validAssertion;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
37
|
toJSON() {
|
|
38
38
|
const { name } = this.constructor,
|
|
39
39
|
string = this.getString(),
|
|
@@ -233,12 +233,14 @@ export default define(class MetaLevelAssumption extends Element {
|
|
|
233
233
|
return metaLevelAssumption;
|
|
234
234
|
}
|
|
235
235
|
|
|
236
|
-
static
|
|
236
|
+
static fromStep(step, context) {
|
|
237
237
|
let metaLevelAssumption;
|
|
238
238
|
|
|
239
239
|
ablate((context) => {
|
|
240
240
|
instantiate((context) => {
|
|
241
|
-
const
|
|
241
|
+
const statement = step.getStatement(),
|
|
242
|
+
reference = step.getReference(),
|
|
243
|
+
metaLevelAssumptionString = metaLevelAssumptionStringFromStatementAndReference(statement, reference),
|
|
242
244
|
string = metaLevelAssumptionString, ///
|
|
243
245
|
metaLevelAssumptionNode = instantiateMetaLevelAssumption(string, context);
|
|
244
246
|
|
|
@@ -101,13 +101,13 @@ export default define(class Conclusion extends Element {
|
|
|
101
101
|
return statementValidates;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
let
|
|
104
|
+
unifyStep(step, context) {
|
|
105
|
+
let stepUnifies = false;
|
|
106
106
|
|
|
107
|
-
const
|
|
107
|
+
const stepString = step.getString(),
|
|
108
108
|
conclusionString = this.getString(); ///
|
|
109
109
|
|
|
110
|
-
context.trace(`Unifying the '${
|
|
110
|
+
context.trace(`Unifying the '${stepString}' step with the '${conclusionString}' conclusion...`);
|
|
111
111
|
|
|
112
112
|
const specificContext = context; ///
|
|
113
113
|
|
|
@@ -117,13 +117,18 @@ export default define(class Conclusion extends Element {
|
|
|
117
117
|
|
|
118
118
|
context = specificContext; ///
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
const statement = step.getStatement(),
|
|
121
|
+
statementUnifies = this.statement.unifyStatement(statement, generalContext, specificContext);
|
|
121
122
|
|
|
122
123
|
if (statementUnifies) {
|
|
123
|
-
|
|
124
|
+
stepUnifies = true;
|
|
124
125
|
}
|
|
125
126
|
|
|
126
|
-
|
|
127
|
+
if (stepUnifies) {
|
|
128
|
+
context.debug(`...unified the '${stepString}' step with the '${conclusionString}' conclusion.`);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return stepUnifies;
|
|
127
132
|
}
|
|
128
133
|
|
|
129
134
|
toJSON() {
|
package/src/element/deduction.js
CHANGED
|
@@ -101,13 +101,13 @@ export default define(class Deduction extends Element {
|
|
|
101
101
|
return statementValidates;
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
let
|
|
104
|
+
unifyStep(step, context) {
|
|
105
|
+
let stepUnifies = false;
|
|
106
106
|
|
|
107
|
-
const
|
|
107
|
+
const stepString = step.getString(),
|
|
108
108
|
deductionString = this.getString(); ///
|
|
109
109
|
|
|
110
|
-
context.trace(`Unifying the '${
|
|
110
|
+
context.trace(`Unifying the '${stepString}' step with the '${deductionString}' deduction...`);
|
|
111
111
|
|
|
112
112
|
const specificContext = context; ///
|
|
113
113
|
|
|
@@ -117,13 +117,18 @@ export default define(class Deduction extends Element {
|
|
|
117
117
|
|
|
118
118
|
context = specificContext; ///
|
|
119
119
|
|
|
120
|
-
|
|
120
|
+
const statement = step.getStatement(),
|
|
121
|
+
statementUnifies = this.statement.unifyStatement(statement, generalContext, specificContext);
|
|
121
122
|
|
|
122
123
|
if (statementUnifies) {
|
|
123
|
-
|
|
124
|
+
stepUnifies = true;
|
|
124
125
|
}
|
|
125
126
|
|
|
126
|
-
|
|
127
|
+
if (stepUnifies) {
|
|
128
|
+
context.debug(`...unified the '${stepString}' step with the '${deductionString}' deduction.`);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
return stepUnifies;
|
|
127
132
|
}
|
|
128
133
|
|
|
129
134
|
unifyDeduction(deduction, substitutions, generalContext, specificContext) {
|
package/src/element/frame.js
CHANGED
|
@@ -40,8 +40,13 @@ export default define(class Frame extends Element {
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
getMetavariableName() {
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
let metavariableName = null;
|
|
44
|
+
|
|
45
|
+
const singular = this.isSingular();
|
|
46
|
+
|
|
47
|
+
if (singular) {
|
|
48
|
+
metavariableName = this.metavariable.getName();
|
|
49
|
+
}
|
|
45
50
|
|
|
46
51
|
return metavariableName;
|
|
47
52
|
}
|
|
@@ -101,24 +106,6 @@ export default define(class Frame extends Element {
|
|
|
101
106
|
return comparesToParamter;
|
|
102
107
|
}
|
|
103
108
|
|
|
104
|
-
compareMetavariableName(metavariableName) {
|
|
105
|
-
let comparesToMetavariableName = false;
|
|
106
|
-
|
|
107
|
-
const singular = this.isSingular();
|
|
108
|
-
|
|
109
|
-
if (singular) {
|
|
110
|
-
const metavariableNameA = metavariableName ///
|
|
111
|
-
|
|
112
|
-
metavariableName = this.getMetavariableName();
|
|
113
|
-
|
|
114
|
-
const metavariableNameB = metavariableName; ///
|
|
115
|
-
|
|
116
|
-
comparesToMetavariableName = (metavariableNameA === metavariableNameB);
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
return comparesToMetavariableName;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
109
|
findValidFrame(context) {
|
|
123
110
|
const frameNode = this.getFrameNode(),
|
|
124
111
|
frame = context.findFrameByFrameNode(frameNode),
|
package/src/element/label.js
CHANGED
|
@@ -26,8 +26,6 @@ export default define(class Label extends Element {
|
|
|
26
26
|
return labelNode;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
getMetavariableName() { return this.metavariable.getName(); }
|
|
30
|
-
|
|
31
29
|
getMetavariableNode() { return this.metavariable.getNode(); }
|
|
32
30
|
|
|
33
31
|
matchLabelNode(labelNode) {
|
|
@@ -38,6 +36,8 @@ export default define(class Label extends Element {
|
|
|
38
36
|
return labelNodeMatches;
|
|
39
37
|
}
|
|
40
38
|
|
|
39
|
+
matchMetavariableNode(metavariableNode) { return this.metavariable.matchMetavariableNode(metavariableNode); }
|
|
40
|
+
|
|
41
41
|
compareReference(reference) {
|
|
42
42
|
const metavariable = reference.getMetavariable(),
|
|
43
43
|
metavariableComparesToMetavariable = this.compareMetavariable(metavariable),
|
|
@@ -46,9 +46,7 @@ export default define(class Label extends Element {
|
|
|
46
46
|
return comparesToReference;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
compareMetavariable(metavariable) { return this.metavariable.
|
|
50
|
-
|
|
51
|
-
compareMetavariableName(metavariableName) { return this.metavariable.compareMetavariableName(metavariableName); }
|
|
49
|
+
compareMetavariable(metavariable) { return this.metavariable.compareMetavariable(metavariable); }
|
|
52
50
|
|
|
53
51
|
verify() {
|
|
54
52
|
let verifies = false;
|
|
@@ -82,7 +82,7 @@ export default define(class Metavariable extends Element {
|
|
|
82
82
|
return metavariableNodeMatches;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
compareMetavariable(metavariable) {
|
|
86
86
|
const metavariableName = metavariable.getName(),
|
|
87
87
|
comparesToMetavariableName = this.compareMetavariableName(metavariableName),
|
|
88
88
|
comparesToMetavariable = comparesToMetavariableName; ///
|
|
@@ -97,6 +97,14 @@ export default define(class Metavariable extends Element {
|
|
|
97
97
|
return comparesToMetavariableName;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
+
findValidMetavariable(context) {
|
|
101
|
+
const metavariableNode = this.getMetavariableNode(),
|
|
102
|
+
metavariable = context.findMetavariableByMetavariableNode(metavariableNode),
|
|
103
|
+
validMetavariable = metavariable; ///
|
|
104
|
+
|
|
105
|
+
return validMetavariable;
|
|
106
|
+
}
|
|
107
|
+
|
|
100
108
|
verify(context) {
|
|
101
109
|
let verifies = false;
|
|
102
110
|
|
|
@@ -164,14 +172,6 @@ export default define(class Metavariable extends Element {
|
|
|
164
172
|
return typeVerifies;
|
|
165
173
|
}
|
|
166
174
|
|
|
167
|
-
findValidMetavariable(context) {
|
|
168
|
-
const metavariableNode = this.getMetavariableNode(),
|
|
169
|
-
metavariable = context.findMetavariableByMetavariableNode(metavariableNode),
|
|
170
|
-
validMetavariable = metavariable; ///
|
|
171
|
-
|
|
172
|
-
return validMetavariable;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
175
|
validate(strict, context) {
|
|
176
176
|
if (context === undefined) {
|
|
177
177
|
context = strict; ///
|
|
@@ -332,13 +332,14 @@ export default define(class Metavariable extends Element {
|
|
|
332
332
|
|
|
333
333
|
context.trace(`Unifying the '${frameString}' frame with the '${metavariableString}' metavariable...`);
|
|
334
334
|
|
|
335
|
-
const
|
|
335
|
+
const metavariable = this, ///
|
|
336
|
+
frameMetavariableUnifies = this.unifyFrameMetavariable(frame, generalContext, specificContext);
|
|
336
337
|
|
|
337
338
|
if (frameMetavariableUnifies) {
|
|
338
339
|
frameUnifies = true;
|
|
339
340
|
} else {
|
|
340
|
-
const
|
|
341
|
-
substitution = context.
|
|
341
|
+
const metavariableNode = metavariable.getNode(),
|
|
342
|
+
substitution = context.findSubstitutionByMetavariableNode(metavariableNode);
|
|
342
343
|
|
|
343
344
|
if (substitution !== null) {
|
|
344
345
|
const substitutionFrameComparesToFrame = substitution.compareFrame(frame, context);
|
|
@@ -353,7 +354,6 @@ export default define(class Metavariable extends Element {
|
|
|
353
354
|
}
|
|
354
355
|
} else {
|
|
355
356
|
const { FrameSubstitution } = elements,
|
|
356
|
-
metavariable = this, ///
|
|
357
357
|
frameSubstitution = FrameSubstitution.fromFrameAndMetavariable(frame, metavariable, context);
|
|
358
358
|
|
|
359
359
|
frameSubstitution.validate(generalContext, specificContext);
|
|
@@ -387,15 +387,15 @@ export default define(class Metavariable extends Element {
|
|
|
387
387
|
if (statementMetavariableUnifies) {
|
|
388
388
|
statementUnifies = true;
|
|
389
389
|
} else {
|
|
390
|
-
const
|
|
390
|
+
const metavariableNode = metavariable.getNode(),
|
|
391
391
|
substitutionPresent = (substitution !== null) ?
|
|
392
|
-
context.
|
|
393
|
-
context.
|
|
392
|
+
context.isSubstitutionPresentByMetavariableNodeAndSubstitution(metavariableNode, substitution) :
|
|
393
|
+
context.isSubstitutionPresentByMetavariableNode(metavariableNode);
|
|
394
394
|
|
|
395
395
|
if (substitutionPresent) {
|
|
396
396
|
substitution = (substitution !== null) ?
|
|
397
|
-
context.
|
|
398
|
-
context.
|
|
397
|
+
context.findSubstitutionByMetavariableNodeAndSubstitution(metavariableNode, substitution) :
|
|
398
|
+
context.findSubstitutionByMetavariableNode(metavariableNode);
|
|
399
399
|
|
|
400
400
|
const substitutionComparesToStatement = substitution.compareStatement(statement, context);
|
|
401
401
|
|
|
@@ -435,13 +435,14 @@ export default define(class Metavariable extends Element {
|
|
|
435
435
|
|
|
436
436
|
context.trace(`Unifying the '${referenceString}' reference with the '${metavariableString}' metavariable...`);
|
|
437
437
|
|
|
438
|
-
const
|
|
438
|
+
const metavariable = this, ///
|
|
439
|
+
referenceMetavariableUnifies = this.unifyReferenceMetavariable(reference, generalContext, specificContext);
|
|
439
440
|
|
|
440
441
|
if (referenceMetavariableUnifies) {
|
|
441
442
|
referenceUnifies = true;
|
|
442
443
|
} else {
|
|
443
|
-
const
|
|
444
|
-
substitution = context.
|
|
444
|
+
const metavariableNode = metavariable.getNode(),
|
|
445
|
+
substitution = context.findSubstitutionByMetavariableNode(metavariableNode);
|
|
445
446
|
|
|
446
447
|
if (substitution !== null) {
|
|
447
448
|
const substitutionReferenceComparesToReference = substitution.compareReference(reference, context);
|
|
@@ -456,7 +457,6 @@ export default define(class Metavariable extends Element {
|
|
|
456
457
|
}
|
|
457
458
|
} else {
|
|
458
459
|
const { ReferenceSubstitution } = elements,
|
|
459
|
-
metavariable = this, ///
|
|
460
460
|
referenceSubstitution = ReferenceSubstitution.fromReferenceAndMetavariable(reference, metavariable, context);
|
|
461
461
|
|
|
462
462
|
referenceSubstitution.validate(generalContext, specificContext);
|
|
@@ -512,10 +512,10 @@ export default define(class Metavariable extends Element {
|
|
|
512
512
|
specificContextFilePath = specificContext.getFilePath();
|
|
513
513
|
|
|
514
514
|
if (generalContextFilePath === specificContextFilePath) {
|
|
515
|
-
const
|
|
516
|
-
|
|
515
|
+
const metavariableNode = this.getMetavariableNode(), ///
|
|
516
|
+
metavariableNodeMatches = frame.matchMetavariableNode(metavariableNode);
|
|
517
517
|
|
|
518
|
-
if (
|
|
518
|
+
if (metavariableNodeMatches) {
|
|
519
519
|
frameMetavariableUnifies = true;
|
|
520
520
|
} else {
|
|
521
521
|
const frameSingular = frame.isSingular();
|
|
@@ -587,8 +587,8 @@ export default define(class Metavariable extends Element {
|
|
|
587
587
|
specificContextFilePath = specificContext.getFilePath();
|
|
588
588
|
|
|
589
589
|
if (generalContextFilePath === specificContextFilePath) {
|
|
590
|
-
const
|
|
591
|
-
statementMetavariableComparesToMetvariable = statement.
|
|
590
|
+
const metavariableNode = this.getMetavariableNode(),
|
|
591
|
+
statementMetavariableComparesToMetvariable = statement.matchMetavariableNode(metavariableNode);
|
|
592
592
|
|
|
593
593
|
if (statementMetavariableComparesToMetvariable) {
|
|
594
594
|
statementMetavariableUnifies = true;
|
|
@@ -83,13 +83,22 @@ export default define(class ProcedureCall extends Element {
|
|
|
83
83
|
context.trace(`Unifying the '${procedureCallString}' procedure call independently...`);
|
|
84
84
|
|
|
85
85
|
const procedureName = this.getProcedureName(),
|
|
86
|
-
|
|
86
|
+
primitives = this.findPrimitives(context),
|
|
87
|
+
procedure = context.findProcedureByProcedureName(procedureName),
|
|
88
|
+
terms = termsFromPrimitives(primitives);
|
|
89
|
+
|
|
90
|
+
let term = null;
|
|
87
91
|
|
|
88
92
|
try {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
+
term = await evaluate(procedure, terms);
|
|
94
|
+
} catch (exception) {
|
|
95
|
+
const message = exception.getMessage();
|
|
96
|
+
|
|
97
|
+
context.info(message);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
if (term !== null) {
|
|
101
|
+
const boolean = term.isBoolean();
|
|
93
102
|
|
|
94
103
|
if (!boolean) {
|
|
95
104
|
context.info(`The '${procedureCallString}' procedure call did not return a boolean.`);
|
|
@@ -100,10 +109,6 @@ export default define(class ProcedureCall extends Element {
|
|
|
100
109
|
unifiesIndependently = true;
|
|
101
110
|
}
|
|
102
111
|
}
|
|
103
|
-
} catch (exception) {
|
|
104
|
-
const message = exception.getMessage();
|
|
105
|
-
|
|
106
|
-
context.info(message);
|
|
107
112
|
}
|
|
108
113
|
|
|
109
114
|
if (unifiesIndependently) {
|
|
@@ -136,6 +136,47 @@ export default define(class Premise extends ProofAssertion {
|
|
|
136
136
|
return procedureCallValidates;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
+
async unifyIndependently(context) {
|
|
140
|
+
let unifiesIndependently = false;
|
|
141
|
+
|
|
142
|
+
const premiseString = this.getString(); ///
|
|
143
|
+
|
|
144
|
+
context.trace(`Unifying the '${premiseString}' premise independently...`);
|
|
145
|
+
|
|
146
|
+
const statement = this.getStatement(),
|
|
147
|
+
procedureCall = this.getProcedureCall();
|
|
148
|
+
|
|
149
|
+
if (statement !== null) {
|
|
150
|
+
const specificContext = context; ///
|
|
151
|
+
|
|
152
|
+
context = this.getContext();
|
|
153
|
+
|
|
154
|
+
const generalContext = context; ///
|
|
155
|
+
|
|
156
|
+
context = specificContext; ///
|
|
157
|
+
|
|
158
|
+
const statementUnifiesIndependently = statement.unifyIndependently(generalContext, specificContext);
|
|
159
|
+
|
|
160
|
+
if (statementUnifiesIndependently) {
|
|
161
|
+
unifiesIndependently = true;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
if (procedureCall !== null) {
|
|
166
|
+
const procedureCallResolvedIndependently = await procedureCall.unifyIndependently(context);
|
|
167
|
+
|
|
168
|
+
if (procedureCallResolvedIndependently) {
|
|
169
|
+
unifiesIndependently = true;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
if (unifiesIndependently) {
|
|
174
|
+
context.debug(`...unified the '${premiseString}' premise independenly.`);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
return unifiesIndependently;
|
|
178
|
+
}
|
|
179
|
+
|
|
139
180
|
unifySubproofOrProofAssertion(subproofOrProofAssertion, context) {
|
|
140
181
|
let subproofOrProofAssertionUnifies;
|
|
141
182
|
|
|
@@ -243,47 +284,6 @@ export default define(class Premise extends ProofAssertion {
|
|
|
243
284
|
return subproofUnifies;
|
|
244
285
|
}
|
|
245
286
|
|
|
246
|
-
async unifyIndependently(context) {
|
|
247
|
-
let unifiesIndependently = false;
|
|
248
|
-
|
|
249
|
-
const premiseString = this.getString(); ///
|
|
250
|
-
|
|
251
|
-
context.trace(`Unifying the '${premiseString}' premise independently...`);
|
|
252
|
-
|
|
253
|
-
const statement = this.getStatement(),
|
|
254
|
-
procedureCall = this.getProcedureCall();
|
|
255
|
-
|
|
256
|
-
if (statement !== null) {
|
|
257
|
-
const specificContext = context; ///
|
|
258
|
-
|
|
259
|
-
context = this.getContext();
|
|
260
|
-
|
|
261
|
-
const generalContext = context; ///
|
|
262
|
-
|
|
263
|
-
context = specificContext; ///
|
|
264
|
-
|
|
265
|
-
const statementUnifiesIndependently = statement.unifyIndependently(generalContext, specificContext);
|
|
266
|
-
|
|
267
|
-
if (statementUnifiesIndependently) {
|
|
268
|
-
unifiesIndependently = true;
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
if (procedureCall !== null) {
|
|
273
|
-
const procedureCallResolvedIndependently = await procedureCall.unifyIndependently(context);
|
|
274
|
-
|
|
275
|
-
if (procedureCallResolvedIndependently) {
|
|
276
|
-
unifiesIndependently = true;
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
if (unifiesIndependently) {
|
|
281
|
-
context.debug(`...unified the '${premiseString}' premise independenly.`);
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
return unifiesIndependently;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
287
|
toJSON() {
|
|
288
288
|
const context = this.getContext();
|
|
289
289
|
|