occam-verify-cli 1.0.809 → 1.0.814
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 +3 -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 +8 -8
- 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 +4 -4
- 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 +15 -10
- package/lib/element/substitution.js +29 -31
- package/lib/element/term.js +1 -16
- package/lib/element/topLevelAssertion/axiom.js +5 -3
- package/lib/element/topLevelAssertion.js +36 -38
- package/lib/element/variable.js +6 -6
- package/lib/node/frame.js +1 -9
- package/lib/node/statement.js +1 -9
- package/lib/node/term.js +1 -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 +28 -13
- 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 +2 -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 +8 -8
- 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 +3 -3
- 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 +15 -6
- package/src/element/substitution.js +38 -41
- package/src/element/term.js +0 -26
- package/src/element/topLevelAssertion/axiom.js +5 -2
- package/src/element/topLevelAssertion.js +49 -53
- package/src/element/variable.js +5 -5
- package/src/node/frame.js +0 -12
- package/src/node/statement.js +0 -12
- package/src/node/term.js +0 -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 +29 -17
- package/src/utilities/string.js +2 -2
- package/src/utilities/substitutions.js +17 -15
- package/src/utilities/unification.js +145 -119
|
@@ -249,11 +249,11 @@ function validateWhenDerived(term, frame, negated, generalContext, specificConte
|
|
|
249
249
|
const context = specificContext; ///
|
|
250
250
|
|
|
251
251
|
if (term !== null) {
|
|
252
|
-
const
|
|
253
|
-
|
|
254
|
-
|
|
252
|
+
const variableIdentifier = term.getVariableIdentifier(),
|
|
253
|
+
declaredDariable = context.findDeclaredVariableByVariableIdentifier(variableIdentifier),
|
|
254
|
+
declaredDariableDefined = isVariableDefined(declaredDariable, context);
|
|
255
255
|
|
|
256
|
-
if (!negated &&
|
|
256
|
+
if (!negated && declaredDariableDefined) {
|
|
257
257
|
validatesWhenDerived = true;
|
|
258
258
|
}
|
|
259
259
|
|
|
@@ -287,9 +287,9 @@ function isVariableDefined(variable, context) {
|
|
|
287
287
|
equivalences.separateGroundedTermsAndDefinedVariables(groundedTerms, definedVariables, context);
|
|
288
288
|
|
|
289
289
|
const variableMatchesDefinedVariable = definedVariables.some((definedVariable) => {
|
|
290
|
-
const
|
|
290
|
+
const definedVariableComparesToVariable = definedVariable.compareVariable(variable);
|
|
291
291
|
|
|
292
|
-
if (
|
|
292
|
+
if (definedVariableComparesToVariable === variable) {
|
|
293
293
|
return true;
|
|
294
294
|
}
|
|
295
295
|
}),
|
|
@@ -299,8 +299,8 @@ function isVariableDefined(variable, context) {
|
|
|
299
299
|
}
|
|
300
300
|
|
|
301
301
|
function isMetavariableDefined(metavariable, context) {
|
|
302
|
-
const
|
|
303
|
-
judgementPresent = context.
|
|
302
|
+
const metavariableNode = metavariable.getNode(),
|
|
303
|
+
judgementPresent = context.isJudgementPresentByMetavariableNode(metavariableNode),
|
|
304
304
|
metavariableDefined = judgementPresent; ///
|
|
305
305
|
|
|
306
306
|
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
|
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { arrayUtilities } from "necessary";
|
|
3
4
|
import { asynchronousUtilities } from "occam-languages";
|
|
4
5
|
|
|
5
6
|
import elements from "../../elements";
|
|
6
7
|
import ProofAssertion from "../proofAssertion";
|
|
7
8
|
|
|
8
9
|
import { define } from "../../elements";
|
|
9
|
-
import {
|
|
10
|
+
import { unifySteps } from "../../utilities/unification";
|
|
10
11
|
import { derive, attempt, reconcile } from "../../utilities/context";
|
|
11
12
|
|
|
12
|
-
const { asyncSome } = asynchronousUtilities
|
|
13
|
+
const { asyncSome } = asynchronousUtilities,
|
|
14
|
+
{ backwardsSome } = arrayUtilities;
|
|
13
15
|
|
|
14
16
|
export default define(class Step extends ProofAssertion {
|
|
15
17
|
constructor(context, string, node, statement, reference, satisfiesAssertion) {
|
|
@@ -34,6 +36,13 @@ export default define(class Step extends ProofAssertion {
|
|
|
34
36
|
return stepNode;
|
|
35
37
|
}
|
|
36
38
|
|
|
39
|
+
getStatementNode() {
|
|
40
|
+
const statement = this.getStatement(),
|
|
41
|
+
statementNode = statement.getNode();
|
|
42
|
+
|
|
43
|
+
return statementNode;
|
|
44
|
+
}
|
|
45
|
+
|
|
37
46
|
isSatisfied() {
|
|
38
47
|
const satisfied = (this.satisfiesAssertion !== null);
|
|
39
48
|
|
|
@@ -46,6 +55,13 @@ export default define(class Step extends ProofAssertion {
|
|
|
46
55
|
return qualified;
|
|
47
56
|
}
|
|
48
57
|
|
|
58
|
+
isUnqualified() {
|
|
59
|
+
const qualified = this.isQualified(),
|
|
60
|
+
unqualified = !qualified;
|
|
61
|
+
|
|
62
|
+
return unqualified;
|
|
63
|
+
}
|
|
64
|
+
|
|
49
65
|
compareTermAndPropertyRelation(term, propertyRelation, context) {
|
|
50
66
|
let comparesToTermAndPropertyRelation = false;
|
|
51
67
|
|
|
@@ -60,6 +76,22 @@ export default define(class Step extends ProofAssertion {
|
|
|
60
76
|
return comparesToTermAndPropertyRelation;
|
|
61
77
|
}
|
|
62
78
|
|
|
79
|
+
compareSubproofOrProofAssertions(subproofOrProofAssertions, context) {
|
|
80
|
+
let comparesToSubproofOrProofAssertions;
|
|
81
|
+
|
|
82
|
+
const step = this; ///
|
|
83
|
+
|
|
84
|
+
comparesToSubproofOrProofAssertions = backwardsSome(subproofOrProofAssertions, (subproofOrProofAssertion) => {
|
|
85
|
+
const subproofOrProofAssertionComparesToStatement = subproofOrProofAssertion.compareStep(step, context);
|
|
86
|
+
|
|
87
|
+
if (subproofOrProofAssertionComparesToStatement) {
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
return comparesToSubproofOrProofAssertions;
|
|
93
|
+
}
|
|
94
|
+
|
|
63
95
|
async verify(context) {
|
|
64
96
|
let verifies = false;
|
|
65
97
|
|
|
@@ -207,15 +239,13 @@ export default define(class Step extends ProofAssertion {
|
|
|
207
239
|
|
|
208
240
|
context.trace(`Unifying the '${stepString}' step...`);
|
|
209
241
|
|
|
210
|
-
const
|
|
211
|
-
reference = this.getReference(),
|
|
212
|
-
satisfiesAssertion = this.getSatisfiesAssertion();
|
|
242
|
+
const step = this; ///
|
|
213
243
|
|
|
214
|
-
await asyncSome(
|
|
244
|
+
await asyncSome(unifySteps, async (unifyStep) => {
|
|
215
245
|
let statementUnifies;
|
|
216
246
|
|
|
217
247
|
await reconcile(async (context) => {
|
|
218
|
-
statementUnifies = await
|
|
248
|
+
statementUnifies = await unifyStep(step, context);
|
|
219
249
|
}, context);
|
|
220
250
|
|
|
221
251
|
if (statementUnifies) {
|