occam-verify-cli 1.0.438 → 1.0.448
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.js +42 -39
- package/lib/context/local.js +34 -34
- package/lib/context/release.js +3 -7
- package/lib/context/temporary.js +26 -26
- package/lib/element/assertion/contained.js +45 -45
- package/lib/element/assertion/defined.js +13 -13
- package/lib/element/assertion/property.js +23 -22
- package/lib/element/assertion/satisfies.js +7 -6
- package/lib/element/assertion/subproof.js +20 -17
- package/lib/element/assertion/type.js +3 -2
- package/lib/element/assertion.js +1 -23
- package/lib/element/assumption.js +24 -22
- package/lib/element/axiom.js +27 -30
- package/lib/element/axiomLemmaTheoremConjecture.js +50 -57
- package/lib/element/{statement/combinator → combinator}/bracketed.js +16 -16
- package/lib/element/combinator.js +229 -0
- package/lib/element/conclusion.js +11 -9
- package/lib/element/{term/constructor → constructor}/bracketed.js +5 -5
- package/lib/element/constructor.js +232 -0
- package/lib/element/declaration/combinator.js +2 -16
- package/lib/element/declaration/complexType.js +12 -12
- package/lib/element/declaration/constructor.js +13 -11
- package/lib/element/declaration/simpleType.js +4 -4
- package/lib/element/declaration/typePrefix.js +2 -2
- package/lib/element/declaration/variable.js +3 -3
- package/lib/element/deduction.js +11 -9
- package/lib/element/derivation.js +17 -20
- package/lib/element/equivalence.js +10 -10
- package/lib/element/equivalences.js +5 -5
- package/lib/element/frame.js +32 -38
- package/lib/element/hypothesis.js +16 -57
- package/lib/element/judgement.js +6 -4
- package/lib/element/label.js +8 -8
- package/lib/element/metaLemmaMetatheorem.js +6 -39
- package/lib/element/metaType.js +17 -80
- package/lib/element/metavariable.js +38 -34
- package/lib/element/parameter.js +3 -3
- package/lib/element/premise.js +92 -174
- package/lib/element/proof.js +7 -7
- package/lib/element/proofAssertion.js +203 -0
- package/lib/element/property.js +9 -9
- package/lib/element/propertyRelation.js +13 -13
- package/lib/element/reference.js +16 -17
- package/lib/element/rule.js +46 -46
- package/lib/element/signature.js +11 -11
- package/lib/element/statement.js +18 -18
- package/lib/element/step.js +73 -124
- package/lib/element/subDerivation.js +17 -20
- package/lib/element/subproof.js +16 -24
- package/lib/element/substitution/frame.js +1 -7
- package/lib/element/substitution/reference.js +2 -3
- package/lib/element/substitution/statement.js +44 -15
- package/lib/element/substitution/term.js +10 -57
- package/lib/element/substitution.js +5 -11
- package/lib/element/substitutions.js +29 -29
- package/lib/element/supposition.js +95 -177
- package/lib/element/term.js +21 -34
- package/lib/element/type.js +47 -60
- package/lib/element/typePrefix.js +5 -5
- package/lib/element/variable.js +9 -9
- package/lib/element.js +9 -3
- package/lib/metaTypes.js +63 -0
- package/lib/node/axiomLemmaTheoremConjecture.js +9 -9
- package/lib/node/body/axiom.js +2 -25
- package/lib/node/body/conjecture.js +2 -25
- package/lib/node/body/lemma.js +2 -25
- package/lib/node/body/metaLemma.js +2 -25
- package/lib/node/body/metatheorem.js +2 -25
- package/lib/node/body/rule.js +15 -1
- package/lib/node/body/theorem.js +2 -25
- package/lib/node/body.js +25 -2
- package/lib/node/combinator.js +11 -2
- package/lib/node/constructor.js +11 -2
- package/lib/node/declaration/combinator.js +5 -5
- package/lib/node/declaration/constructor.js +8 -8
- package/lib/node/declaration/property.js +15 -15
- package/lib/node/declaration/simpleType.js +31 -31
- package/lib/node/declaration/variable.js +8 -8
- package/lib/node/equality.js +8 -8
- package/lib/node/frame.js +20 -20
- package/lib/node/header.js +22 -22
- package/lib/node/metaLemmaMetaTheorem.js +16 -16
- package/lib/node/metavariable.js +15 -15
- package/lib/node/property.js +8 -8
- package/lib/node/propertyRelation.js +8 -8
- package/lib/node/rule.js +16 -16
- package/lib/node/statement.js +12 -12
- package/lib/node/step.js +22 -22
- package/lib/node/subDerivation.js +1 -8
- package/lib/node/subproof.js +5 -12
- package/lib/node/substitution/frame.js +19 -19
- package/lib/node/substitution/statement.js +19 -19
- package/lib/node/substitution/term.js +19 -19
- package/lib/node/term.js +35 -35
- package/lib/preamble.js +5 -5
- package/lib/process/instantiate.js +20 -2
- package/lib/process/unify.js +39 -42
- package/lib/process/validate.js +431 -0
- package/lib/process/verify.js +44 -135
- package/lib/types.js +27 -0
- package/lib/utilities/brackets.js +9 -14
- package/lib/utilities/element.js +91 -55
- package/lib/utilities/instance.js +41 -28
- package/lib/utilities/statement.js +2 -2
- package/lib/utilities/string.js +25 -14
- package/lib/utilities/unification.js +237 -0
- package/lib/utilities/validation.js +251 -0
- package/package.json +6 -6
- package/src/context/file.js +40 -34
- package/src/context/local.js +34 -34
- package/src/context/release.js +2 -6
- package/src/context/temporary.js +15 -15
- package/src/element/assertion/contained.js +19 -20
- package/src/element/assertion/defined.js +11 -12
- package/src/element/assertion/property.js +20 -20
- package/src/element/assertion/satisfies.js +6 -6
- package/src/element/assertion/subproof.js +17 -15
- package/src/element/assertion/type.js +2 -2
- package/src/element/assertion.js +0 -2
- package/src/element/assumption.js +22 -19
- package/src/element/axiom.js +33 -37
- package/src/element/axiomLemmaTheoremConjecture.js +54 -73
- package/src/element/{statement/combinator → combinator}/bracketed.js +7 -7
- package/src/element/combinator.js +90 -0
- package/src/element/conclusion.js +12 -10
- package/src/element/{term/constructor → constructor}/bracketed.js +5 -5
- package/src/element/{term/constructor.js → constructor.js} +17 -25
- package/src/element/declaration/combinator.js +1 -22
- package/src/element/declaration/complexType.js +11 -11
- package/src/element/declaration/constructor.js +13 -10
- package/src/element/declaration/simpleType.js +3 -3
- package/src/element/declaration/typePrefix.js +1 -1
- package/src/element/declaration/variable.js +2 -2
- package/src/element/deduction.js +12 -9
- package/src/element/derivation.js +15 -19
- package/src/element/equivalence.js +8 -8
- package/src/element/equivalences.js +4 -4
- package/src/element/frame.js +28 -30
- package/src/element/hypothesis.js +16 -18
- package/src/element/judgement.js +6 -3
- package/src/element/label.js +4 -4
- package/src/element/metaLemmaMetatheorem.js +5 -69
- package/src/element/metaType.js +9 -45
- package/src/element/metavariable.js +34 -31
- package/src/element/parameter.js +2 -2
- package/src/element/premise.js +124 -99
- package/src/element/proof.js +6 -6
- package/src/element/proofAssertion.js +76 -0
- package/src/element/property.js +6 -6
- package/src/element/propertyRelation.js +11 -11
- package/src/element/reference.js +14 -21
- package/src/element/rule.js +39 -38
- package/src/element/signature.js +10 -9
- package/src/element/statement.js +16 -18
- package/src/element/step.js +78 -78
- package/src/element/subDerivation.js +15 -19
- package/src/element/subproof.js +11 -19
- package/src/element/substitution/frame.js +0 -2
- package/src/element/substitution/reference.js +1 -5
- package/src/element/substitution/statement.js +44 -14
- package/src/element/substitution/term.js +10 -13
- package/src/element/substitution.js +3 -5
- package/src/element/substitutions.js +48 -30
- package/src/element/supposition.js +127 -108
- package/src/element/term.js +18 -28
- package/src/element/type.js +42 -36
- package/src/element/typePrefix.js +3 -3
- package/src/element/variable.js +7 -7
- package/src/element.js +3 -1
- package/src/metaTypes.js +55 -0
- package/src/node/axiomLemmaTheoremConjecture.js +6 -6
- package/src/node/body/axiom.js +0 -21
- package/src/node/body/conjecture.js +0 -23
- package/src/node/body/lemma.js +0 -23
- package/src/node/body/metaLemma.js +0 -23
- package/src/node/body/metatheorem.js +0 -23
- package/src/node/body/rule.js +12 -0
- package/src/node/body/theorem.js +0 -23
- package/src/node/body.js +23 -0
- package/src/node/combinator.js +9 -0
- package/src/node/constructor.js +9 -0
- package/src/node/declaration/combinator.js +5 -5
- package/src/node/declaration/constructor.js +8 -8
- package/src/node/declaration/property.js +14 -14
- package/src/node/declaration/simpleType.js +31 -31
- package/src/node/declaration/variable.js +7 -7
- package/src/node/equality.js +7 -7
- package/src/node/frame.js +21 -21
- package/src/node/header.js +22 -22
- package/src/node/metaLemmaMetaTheorem.js +14 -14
- package/src/node/metavariable.js +14 -14
- package/src/node/property.js +7 -7
- package/src/node/propertyRelation.js +7 -7
- package/src/node/rule.js +15 -15
- package/src/node/statement.js +12 -12
- package/src/node/step.js +21 -21
- package/src/node/subDerivation.js +0 -7
- package/src/node/subproof.js +4 -11
- package/src/node/substitution/frame.js +18 -18
- package/src/node/substitution/statement.js +18 -18
- package/src/node/substitution/term.js +18 -18
- package/src/node/term.js +34 -34
- package/src/preamble.js +4 -4
- package/src/process/instantiate.js +12 -0
- package/src/process/unify.js +53 -57
- package/src/process/validate.js +316 -0
- package/src/process/verify.js +50 -138
- package/src/types.js +18 -0
- package/src/utilities/brackets.js +15 -14
- package/src/utilities/element.js +125 -82
- package/src/utilities/instance.js +42 -24
- package/src/utilities/statement.js +2 -2
- package/src/utilities/string.js +38 -24
- package/src/{mixins/step/unify.js → utilities/unification.js} +99 -85
- package/src/{mixins/statement/validate.js → utilities/validation.js} +143 -69
- package/lib/element/statement/combinator.js +0 -105
- package/lib/element/term/constructor.js +0 -172
- package/lib/mixins/statement/validate.js +0 -198
- package/lib/mixins/step/unify.js +0 -228
- package/lib/mixins/term/verify.js +0 -65
- package/src/element/statement/combinator.js +0 -59
- package/src/mixins/term/verify.js +0 -81
package/src/element/rule.js
CHANGED
|
@@ -42,16 +42,16 @@ export default define(class Rule extends Element {
|
|
|
42
42
|
return this.conclusion;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
const
|
|
47
|
-
const
|
|
45
|
+
compareMetavariableName(metavariableName) {
|
|
46
|
+
const comparesToMetavariableName = this.labels.some((label) => {
|
|
47
|
+
const labelComparesToMetavariableName = label.compareMetavariableName(metavariableName);
|
|
48
48
|
|
|
49
|
-
if (
|
|
49
|
+
if (labelComparesToMetavariableName) {
|
|
50
50
|
return true;
|
|
51
51
|
}
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
-
return
|
|
54
|
+
return comparesToMetavariableName;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
verify() {
|
|
@@ -74,16 +74,17 @@ export default define(class Rule extends Element {
|
|
|
74
74
|
|
|
75
75
|
context = localContext; ///
|
|
76
76
|
|
|
77
|
-
const
|
|
77
|
+
const premisesVerify = this.verifyPremises(context);
|
|
78
78
|
|
|
79
|
-
if (
|
|
79
|
+
if (premisesVerify) {
|
|
80
80
|
const conclusionVerifies = this.verifyConclusion(context);
|
|
81
81
|
|
|
82
82
|
if (conclusionVerifies) {
|
|
83
83
|
const proofVerifies = this.verifyProof(context);
|
|
84
84
|
|
|
85
85
|
if (proofVerifies) {
|
|
86
|
-
const rule = this
|
|
86
|
+
const rule = this, ///
|
|
87
|
+
context = this.getContext();
|
|
87
88
|
|
|
88
89
|
context.addRule(rule);
|
|
89
90
|
|
|
@@ -113,22 +114,22 @@ export default define(class Rule extends Element {
|
|
|
113
114
|
return labelsVerify;
|
|
114
115
|
}
|
|
115
116
|
|
|
116
|
-
|
|
117
|
-
const
|
|
118
|
-
const
|
|
117
|
+
verifyPremises(context) {
|
|
118
|
+
const premisesVerify = this.premises.every((premise) => {
|
|
119
|
+
const premiseVerifies = this.verifyPremise(premise, context);
|
|
119
120
|
|
|
120
|
-
if (
|
|
121
|
+
if (premiseVerifies) {
|
|
121
122
|
return true;
|
|
122
123
|
}
|
|
123
124
|
});
|
|
124
125
|
|
|
125
|
-
return
|
|
126
|
+
return premisesVerify;
|
|
126
127
|
}
|
|
127
128
|
|
|
128
|
-
|
|
129
|
-
const
|
|
129
|
+
verifyPremise(premise, context) {
|
|
130
|
+
const premiseVerifies = premise.verify(context);
|
|
130
131
|
|
|
131
|
-
return
|
|
132
|
+
return premiseVerifies;
|
|
132
133
|
}
|
|
133
134
|
|
|
134
135
|
verifyConclusion(context) {
|
|
@@ -164,68 +165,68 @@ export default define(class Rule extends Element {
|
|
|
164
165
|
return statementUnifiesWithConclusion;
|
|
165
166
|
}
|
|
166
167
|
|
|
167
|
-
|
|
168
|
-
let
|
|
168
|
+
unifyStatementAndSubproofOrProofAssertions(statement, subproofOrProofAssertions, context) {
|
|
169
|
+
let statementAndSubproofOrProofAssertionsUnify = false;
|
|
169
170
|
|
|
170
171
|
const { Substitutions } = elements,
|
|
171
172
|
substitutions = Substitutions.fromNothing(),
|
|
172
173
|
statementUnifiesWithConclusion = this.unifyStatementWithConclusion(statement, substitutions, context);
|
|
173
174
|
|
|
174
175
|
if (statementUnifiesWithConclusion) {
|
|
175
|
-
const
|
|
176
|
+
const subproofOrProofAssertionsUnifiesWithPremises = this.unifySubproofOrProofAssertionsWithPremises(subproofOrProofAssertions, substitutions, context);
|
|
176
177
|
|
|
177
|
-
if (
|
|
178
|
+
if (subproofOrProofAssertionsUnifiesWithPremises) {
|
|
178
179
|
const substitutionsResolved = substitutions.areResolved();
|
|
179
180
|
|
|
180
181
|
if (substitutionsResolved) {
|
|
181
|
-
|
|
182
|
+
statementAndSubproofOrProofAssertionsUnify = true;
|
|
182
183
|
}
|
|
183
184
|
}
|
|
184
185
|
}
|
|
185
186
|
|
|
186
|
-
return
|
|
187
|
+
return statementAndSubproofOrProofAssertionsUnify;
|
|
187
188
|
}
|
|
188
189
|
|
|
189
|
-
|
|
190
|
-
let
|
|
190
|
+
unifySubproofOrProofAssertionsWithPremise(subproofOrProofAssertions, premise, substitutions, context) {
|
|
191
|
+
let subproofOrProofAssertionsUnifiesWithPremise = false;
|
|
191
192
|
|
|
192
|
-
if (!
|
|
193
|
+
if (!subproofOrProofAssertionsUnifiesWithPremise) {
|
|
193
194
|
const premiseUnifiesIndependently = premise.unifyIndependently(substitutions, context);
|
|
194
195
|
|
|
195
196
|
if (premiseUnifiesIndependently) {
|
|
196
|
-
|
|
197
|
+
subproofOrProofAssertionsUnifiesWithPremise = true;
|
|
197
198
|
}
|
|
198
199
|
}
|
|
199
200
|
|
|
200
|
-
if (!
|
|
201
|
-
const
|
|
202
|
-
const
|
|
201
|
+
if (!subproofOrProofAssertionsUnifiesWithPremise) {
|
|
202
|
+
const subproofOrProofAssertion = extract(subproofOrProofAssertions, (subproofOrProofAssertion) => {
|
|
203
|
+
const subproofOrProofAssertionUnifies = premise.unifySubproofOrProofAssertion(subproofOrProofAssertion, substitutions, context);
|
|
203
204
|
|
|
204
|
-
if (
|
|
205
|
+
if (subproofOrProofAssertionUnifies) {
|
|
205
206
|
return true;
|
|
206
207
|
}
|
|
207
208
|
}) || null;
|
|
208
209
|
|
|
209
|
-
if (
|
|
210
|
-
|
|
210
|
+
if (subproofOrProofAssertion !== null) {
|
|
211
|
+
subproofOrProofAssertionsUnifiesWithPremise = true;
|
|
211
212
|
}
|
|
212
213
|
}
|
|
213
214
|
|
|
214
|
-
return
|
|
215
|
+
return subproofOrProofAssertionsUnifiesWithPremise;
|
|
215
216
|
}
|
|
216
217
|
|
|
217
|
-
|
|
218
|
-
|
|
218
|
+
unifySubproofOrProofAssertionsWithPremises(subproofOrProofAssertions, substitutions, context) {
|
|
219
|
+
subproofOrProofAssertions = reverse(subproofOrProofAssertions); ///
|
|
219
220
|
|
|
220
|
-
const
|
|
221
|
-
const stepUnifiesWithPremise = this.
|
|
221
|
+
const subproofOrProofAssertionsUnifiesWithPremises = backwardsEvery(this.premises, (premise) => {
|
|
222
|
+
const stepUnifiesWithPremise = this.unifySubproofOrProofAssertionsWithPremise(subproofOrProofAssertions, premise, substitutions, context);
|
|
222
223
|
|
|
223
224
|
if (stepUnifiesWithPremise) {
|
|
224
225
|
return true;
|
|
225
226
|
}
|
|
226
227
|
});
|
|
227
228
|
|
|
228
|
-
return
|
|
229
|
+
return subproofOrProofAssertionsUnifiesWithPremises;
|
|
229
230
|
}
|
|
230
231
|
|
|
231
232
|
toJSON() {
|
package/src/element/signature.js
CHANGED
|
@@ -27,7 +27,7 @@ export default define(class Signature extends Element {
|
|
|
27
27
|
|
|
28
28
|
const signatureString = this.string; ///
|
|
29
29
|
|
|
30
|
-
context.trace(`Verifying the ${signatureString} signature...`);
|
|
30
|
+
context.trace(`Verifying the '${signatureString}' signature...`);
|
|
31
31
|
|
|
32
32
|
verifies = this.terms.every((term) => {
|
|
33
33
|
const termVerifies = term.verify(context, () => {
|
|
@@ -42,13 +42,13 @@ export default define(class Signature extends Element {
|
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
if (verifies) {
|
|
45
|
-
context.debug(`...verified the ${signatureString} signature.`);
|
|
45
|
+
context.debug(`...verified the '${signatureString}' signature.`);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
return verifies;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
|
|
51
|
+
compare(signature, substitutions, generalContext, specificContext) {
|
|
52
52
|
const terms = signature.getTerms(),
|
|
53
53
|
termsA = this.terms, ///
|
|
54
54
|
termsB = terms, ///
|
|
@@ -74,9 +74,10 @@ export default define(class Signature extends Element {
|
|
|
74
74
|
return true;
|
|
75
75
|
}
|
|
76
76
|
}
|
|
77
|
-
})
|
|
77
|
+
}),
|
|
78
|
+
compares = matches; ///
|
|
78
79
|
|
|
79
|
-
return
|
|
80
|
+
return compares;
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
compareSubstitutions(substitutions, context) {
|
|
@@ -85,7 +86,7 @@ export default define(class Signature extends Element {
|
|
|
85
86
|
const signatureString = this.string, ///
|
|
86
87
|
substitutionsString = substitutions.asString();
|
|
87
88
|
|
|
88
|
-
context.trace(`Comparing the '${substitutionsString}' substitutions against the ${signatureString} signature...`);
|
|
89
|
+
context.trace(`Comparing the '${substitutionsString}' substitutions against the '${signatureString}' signature...`);
|
|
89
90
|
|
|
90
91
|
const array = substitutions.getArray(),
|
|
91
92
|
compares = compare(this.terms, array, (term, substitution) => {
|
|
@@ -102,7 +103,7 @@ export default define(class Signature extends Element {
|
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
if (substitutionsCompares) {
|
|
105
|
-
context.debug(`...compared the '${substitutionsString}' substitutions against the ${signatureString} signature.`);
|
|
106
|
+
context.debug(`...compared the '${substitutionsString}' substitutions against the '${signatureString}' signature.`);
|
|
106
107
|
}
|
|
107
108
|
|
|
108
109
|
return substitutionsCompares;
|
|
@@ -114,7 +115,7 @@ export default define(class Signature extends Element {
|
|
|
114
115
|
const signatureString = this.string, ///
|
|
115
116
|
substitutionsString = substitutions.asString();
|
|
116
117
|
|
|
117
|
-
context.trace(`Correlating the '${substitutionsString}' substitutions against the ${signatureString} signature...`);
|
|
118
|
+
context.trace(`Correlating the '${substitutionsString}' substitutions against the '${signatureString}' signature...`);
|
|
118
119
|
|
|
119
120
|
const array = substitutions.getArray(),
|
|
120
121
|
correlates = correlate(this.terms, array, (term, substitution) => {
|
|
@@ -131,7 +132,7 @@ export default define(class Signature extends Element {
|
|
|
131
132
|
}
|
|
132
133
|
|
|
133
134
|
if (substitutionsCorrelates) {
|
|
134
|
-
context.debug(`...correlated the '${substitutionsString}' substitutions against the ${signatureString} signature.`);
|
|
135
|
+
context.debug(`...correlated the '${substitutionsString}' substitutions against the '${signatureString}' signature.`);
|
|
135
136
|
}
|
|
136
137
|
|
|
137
138
|
return substitutionsCorrelates;
|
package/src/element/statement.js
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
import { arrayUtilities } from "necessary";
|
|
4
4
|
|
|
5
5
|
import Element from "../element";
|
|
6
|
-
import validateMixins from "../mixins/statement/validate";
|
|
7
6
|
|
|
8
7
|
import { define } from "../elements";
|
|
9
8
|
import { unifyStatement } from "../process/unify";
|
|
9
|
+
import { validateStatements } from "../utilities/validation";
|
|
10
10
|
import { instantiateStatement } from "../process/instantiate";
|
|
11
11
|
import { STATEMENT_META_TYPE_NAME } from "../metaTypeNames";
|
|
12
12
|
|
|
@@ -47,14 +47,13 @@ export default define(class Statement extends Element {
|
|
|
47
47
|
|
|
48
48
|
context.trace(`Is the '${termString}' term contained in the '${statementString}' statement...`, node);
|
|
49
49
|
|
|
50
|
-
const
|
|
51
|
-
statementNode = node, ///
|
|
50
|
+
const statementNode = node, ///
|
|
52
51
|
statementNodeTermNodes = statementNode.getTermNodes();
|
|
53
52
|
|
|
54
53
|
termContained = statementNodeTermNodes.some((statementNodeTermNode) => { ///
|
|
55
|
-
const
|
|
54
|
+
const statementNodeTermNodeMatches = term.matchNode(statementNodeTermNode);
|
|
56
55
|
|
|
57
|
-
if (
|
|
56
|
+
if (statementNodeTermNodeMatches) {
|
|
58
57
|
return true;
|
|
59
58
|
}
|
|
60
59
|
});
|
|
@@ -75,14 +74,13 @@ export default define(class Statement extends Element {
|
|
|
75
74
|
|
|
76
75
|
context.trace(`Is the '${frameString}' frame contained in the '${statementString}' statement...`, node);
|
|
77
76
|
|
|
78
|
-
const
|
|
79
|
-
statementNode = node,
|
|
77
|
+
const statementNode = node,
|
|
80
78
|
statementNodeFrameNodes = statementNode.getFrameNodes();
|
|
81
79
|
|
|
82
80
|
frameContained = statementNodeFrameNodes.some((statementNodeFrameNode) => { ///
|
|
83
|
-
const
|
|
81
|
+
const statementNodeFrameNodeMatches = frame.matchNode(statementNodeFrameNode);
|
|
84
82
|
|
|
85
|
-
if (
|
|
83
|
+
if (statementNodeFrameNodeMatches) {
|
|
86
84
|
return true;
|
|
87
85
|
}
|
|
88
86
|
});
|
|
@@ -124,11 +122,11 @@ export default define(class Statement extends Element {
|
|
|
124
122
|
|
|
125
123
|
context.trace(`Validating the '${statementString}' statement...`, node);
|
|
126
124
|
|
|
127
|
-
validates =
|
|
125
|
+
validates = validateStatements.some((validateStatement) => {
|
|
128
126
|
const statement = this, ///
|
|
129
|
-
|
|
127
|
+
statementValidates = validateStatement(statement, assignments, stated, context);
|
|
130
128
|
|
|
131
|
-
if (
|
|
129
|
+
if (statementValidates) {
|
|
132
130
|
return true;
|
|
133
131
|
}
|
|
134
132
|
});
|
|
@@ -256,19 +254,19 @@ export default define(class Statement extends Element {
|
|
|
256
254
|
return unifiesIndependently;
|
|
257
255
|
}
|
|
258
256
|
|
|
259
|
-
|
|
260
|
-
let
|
|
257
|
+
compareSubproofOrProofAssertions(subproofOrProofAssertions, context) {
|
|
258
|
+
let comparesToSubproofOrProofAssertions;
|
|
261
259
|
|
|
262
|
-
|
|
260
|
+
comparesToSubproofOrProofAssertions = backwardsSome(subproofOrProofAssertions, (subproofOrProofAssertion) => {
|
|
263
261
|
const statement = this, ///
|
|
264
|
-
|
|
262
|
+
subproofOrProofAssertionComparesToStatement = subproofOrProofAssertion.compareStatement(statement, context);
|
|
265
263
|
|
|
266
|
-
if (
|
|
264
|
+
if (subproofOrProofAssertionComparesToStatement) {
|
|
267
265
|
return true;
|
|
268
266
|
}
|
|
269
267
|
});
|
|
270
268
|
|
|
271
|
-
return
|
|
269
|
+
return comparesToSubproofOrProofAssertions;
|
|
272
270
|
}
|
|
273
271
|
|
|
274
272
|
toJSON() {
|
package/src/element/step.js
CHANGED
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import Element from "../element";
|
|
4
3
|
import elements from "../elements";
|
|
5
|
-
import
|
|
4
|
+
import ProofAssertion from "./proofAssertion";
|
|
6
5
|
import TemporaryContext from "../context/temporary";
|
|
7
6
|
|
|
8
7
|
import { define } from "../elements";
|
|
9
|
-
import {
|
|
8
|
+
import { unifyStatements } from "../utilities/unification";
|
|
10
9
|
import { propertyAssertionFromStatement } from "../utilities/statement";
|
|
11
10
|
|
|
12
|
-
export default define(class Step extends
|
|
11
|
+
export default define(class Step extends ProofAssertion {
|
|
13
12
|
constructor(context, string, node, statement, reference, satisfiesAssertion) {
|
|
14
|
-
super(context, string, node);
|
|
13
|
+
super(context, string, node, statement);
|
|
15
14
|
|
|
16
|
-
this.statement = statement;
|
|
17
15
|
this.reference = reference;
|
|
18
16
|
this.satisfiesAssertion = satisfiesAssertion;
|
|
19
17
|
}
|
|
20
18
|
|
|
21
|
-
getStatement() {
|
|
22
|
-
return this.statement;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
19
|
getReference() {
|
|
26
20
|
return this.reference;
|
|
27
21
|
}
|
|
@@ -49,112 +43,118 @@ export default define(class Step extends Element {
|
|
|
49
43
|
return stated;
|
|
50
44
|
}
|
|
51
45
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
return step;
|
|
56
|
-
}
|
|
46
|
+
compareTermAndPropertyRelation(term, propertyRelation, context) {
|
|
47
|
+
let comparesToTermAndPropertyRelation = false;
|
|
57
48
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const propertyAssertion = propertyAssertionFromStatement(this.statement, context);
|
|
49
|
+
const statement = this.getStatement(),
|
|
50
|
+
propertyAssertion = propertyAssertionFromStatement(statement, context);
|
|
62
51
|
|
|
63
52
|
if (propertyAssertion !== null) {
|
|
64
|
-
|
|
53
|
+
comparesToTermAndPropertyRelation = propertyAssertion.compareTermAndPropertyRelation(term, propertyRelation, context);
|
|
65
54
|
}
|
|
66
55
|
|
|
67
|
-
return
|
|
56
|
+
return comparesToTermAndPropertyRelation;
|
|
68
57
|
}
|
|
69
58
|
|
|
70
|
-
|
|
71
|
-
let
|
|
59
|
+
verify(substitutions, assignments, context) {
|
|
60
|
+
let verifies = false;
|
|
72
61
|
|
|
73
62
|
const temporaryContext = TemporaryContext.fromNothing(context);
|
|
74
63
|
|
|
75
64
|
context = temporaryContext; ///
|
|
76
65
|
|
|
77
|
-
const
|
|
66
|
+
const node = this.getNode(),
|
|
67
|
+
stepString = this.getString(); ///
|
|
78
68
|
|
|
79
|
-
context.trace(`
|
|
69
|
+
context.trace(`Verifying the '${stepString}' step...`, node);
|
|
80
70
|
|
|
81
|
-
|
|
82
|
-
const stated = this.isStated(),
|
|
83
|
-
statementVerifies = this.statement.validate(assignments, stated, context);
|
|
71
|
+
const statement = this.getStatement();
|
|
84
72
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
73
|
+
if (statement === null) {
|
|
74
|
+
context.debug(`Unable to verify the '${stepString}' step because it is nonsense.`, node);
|
|
75
|
+
} else {
|
|
76
|
+
const referenceVerifies = this.verifyReference(context);
|
|
88
77
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
} else if (qualified) {
|
|
92
|
-
const referenceVerifies = this.reference.validate(context);
|
|
78
|
+
if (referenceVerifies) {
|
|
79
|
+
const satisfiesAssertioVeriries = this.verifySatisfiesAssertion(context);
|
|
93
80
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
} else if (satisfied) {
|
|
98
|
-
const stated = true,
|
|
99
|
-
assignments = null,
|
|
100
|
-
satisfiesAssertionVerifies = this.satisfiesAssertion.validate(assignments, stated, context);
|
|
81
|
+
if (satisfiesAssertioVeriries) {
|
|
82
|
+
const stated = this.isStated(),
|
|
83
|
+
statementValidates = statement.validate(assignments, stated, context);
|
|
101
84
|
|
|
102
|
-
if (
|
|
103
|
-
|
|
85
|
+
if (statementValidates) {
|
|
86
|
+
const statementUnifies = unifyStatements.some((unifyStatement) => {
|
|
87
|
+
const statementUnifies = unifyStatement(statement, this.reference, this.satisfiesAssertion, substitutions, context);
|
|
88
|
+
|
|
89
|
+
if (statementUnifies) {
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
if (statementUnifies) {
|
|
95
|
+
const subproofOrProofAssertion = this; ///
|
|
96
|
+
|
|
97
|
+
context.addSubproofOrProofAssertion(subproofOrProofAssertion);
|
|
98
|
+
|
|
99
|
+
this.setContext(context);
|
|
100
|
+
|
|
101
|
+
verifies = true;
|
|
102
|
+
}
|
|
104
103
|
}
|
|
105
|
-
} else {
|
|
106
|
-
validates = true;
|
|
107
104
|
}
|
|
108
105
|
}
|
|
109
|
-
} else {
|
|
110
|
-
context.debug(`Cannot validate the '${stepString}' step because it is nonsense.`, this.node);
|
|
111
106
|
}
|
|
112
107
|
|
|
113
|
-
if (
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
context.debug(`...verified the '${stepString}' step.`, this.node);
|
|
108
|
+
if (verifies) {
|
|
109
|
+
context.debug(`...verified the '${stepString}' step.`, node);
|
|
117
110
|
}
|
|
118
111
|
|
|
119
|
-
return
|
|
112
|
+
return verifies;
|
|
120
113
|
}
|
|
121
114
|
|
|
122
|
-
|
|
123
|
-
let
|
|
124
|
-
|
|
125
|
-
context = this.context;
|
|
126
|
-
|
|
127
|
-
const stepString = this.string; ///
|
|
115
|
+
verifyReference(context) {
|
|
116
|
+
let referenceVeriries;
|
|
128
117
|
|
|
129
|
-
|
|
118
|
+
const node = this.getNode(),
|
|
119
|
+
stepString = this.getString(); ///
|
|
130
120
|
|
|
131
|
-
|
|
132
|
-
const unifies = unifyMixin(this.statement, this.reference, this.satisfiesAssertion, substitutions, context);
|
|
121
|
+
context.trace(`Verifying the '${stepString}' step's reference... `, node);
|
|
133
122
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
123
|
+
if (this.reference !== null) {
|
|
124
|
+
referenceVeriries = this.reference.verify(context);
|
|
125
|
+
} else {
|
|
126
|
+
referenceVeriries = true;
|
|
127
|
+
}
|
|
138
128
|
|
|
139
|
-
if (
|
|
140
|
-
context.debug(`...
|
|
129
|
+
if (referenceVeriries) {
|
|
130
|
+
context.debug(`...verified the '${stepString}' step's reference. `, node);
|
|
141
131
|
}
|
|
142
132
|
|
|
143
|
-
return
|
|
133
|
+
return referenceVeriries;
|
|
144
134
|
}
|
|
145
135
|
|
|
146
|
-
|
|
147
|
-
let
|
|
136
|
+
verifySatisfiesAssertion(context) {
|
|
137
|
+
let satisfiesAssertionVerifies;
|
|
148
138
|
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
leftStatementNode = leftStatement.getNode(),
|
|
152
|
-
rightStatementNode = rightStatement.getNode(),
|
|
153
|
-
statementsEquate = equateStatements(leftStatementNode, rightStatementNode, context);
|
|
139
|
+
const node = this.getNode(),
|
|
140
|
+
stepString = this.getString(); ///
|
|
154
141
|
|
|
155
|
-
|
|
142
|
+
context.trace(`Verifying the '${stepString}' step's satisfies assertion... `, node);
|
|
143
|
+
|
|
144
|
+
if (this.satisfiesAssertion !== null) {
|
|
145
|
+
const stated = true,
|
|
146
|
+
assignments = null;
|
|
147
|
+
|
|
148
|
+
satisfiesAssertionVerifies = this.satisfiesAssertion.validate(assignments, stated, context);
|
|
149
|
+
} else {
|
|
150
|
+
satisfiesAssertionVerifies = true;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
if (satisfiesAssertionVerifies) {
|
|
154
|
+
context.debug(`...verified the '${stepString}' step's satisfies assertion. `, node);
|
|
155
|
+
}
|
|
156
156
|
|
|
157
|
-
return
|
|
157
|
+
return satisfiesAssertionVerifies;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
160
|
unifyWithSatisfiesAssertion(satisfiesAssertion, context) {
|
|
@@ -10,41 +10,37 @@ import { define } from "../elements";
|
|
|
10
10
|
const { last } = arrayUtilities;
|
|
11
11
|
|
|
12
12
|
export default define(class SubDerivation extends Element {
|
|
13
|
-
constructor(context, string, node,
|
|
13
|
+
constructor(context, string, node, subproofOrProofAssertions) {
|
|
14
14
|
super(context, string, node);
|
|
15
15
|
|
|
16
|
-
this.
|
|
16
|
+
this.subproofOrProofAssertions = subproofOrProofAssertions;
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
return this.
|
|
19
|
+
getSubproofOrProofAssertions() {
|
|
20
|
+
return this.subproofOrProofAssertions;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
const
|
|
25
|
-
|
|
23
|
+
getLastProofAssertion() {
|
|
24
|
+
const lastSubproofOrProofAssertion = last(this.subproofOrProofAssertions),
|
|
25
|
+
lastProofAssertion = lastSubproofOrProofAssertion; ///
|
|
26
26
|
|
|
27
|
-
return
|
|
27
|
+
return lastProofAssertion;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
verify(substitutions, context) {
|
|
31
31
|
let verifies;
|
|
32
32
|
|
|
33
|
-
verifies = this.
|
|
33
|
+
verifies = this.subproofOrProofAssertions.every((subproofOrProofAssertion) => { ///
|
|
34
34
|
const assignments = [],
|
|
35
|
-
|
|
35
|
+
subproofOrProofAssertionVarifies = subproofOrProofAssertion.verify(substitutions, assignments, context);
|
|
36
36
|
|
|
37
|
-
if (
|
|
38
|
-
const
|
|
37
|
+
if (subproofOrProofAssertionVarifies) {
|
|
38
|
+
const assignmentsAssigned = assignAssignments(assignments, context);
|
|
39
39
|
|
|
40
|
-
if (
|
|
41
|
-
|
|
40
|
+
if (assignmentsAssigned) {
|
|
41
|
+
context.addSubproofOrProofAssertion(subproofOrProofAssertion);
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
context.addStepOrSubproof(stepOrSubproof);
|
|
45
|
-
|
|
46
|
-
return true;
|
|
47
|
-
}
|
|
43
|
+
return true;
|
|
48
44
|
}
|
|
49
45
|
}
|
|
50
46
|
});
|
package/src/element/subproof.js
CHANGED
|
@@ -22,40 +22,32 @@ export default define(class Subproof extends Element {
|
|
|
22
22
|
return this.subDerivation;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
getLastProofAssertion() { return this.subDerivation.getLastProofAssertion(); }
|
|
26
26
|
|
|
27
27
|
getStatements() {
|
|
28
|
-
const
|
|
28
|
+
const lastProofAssertion = this.getLastProofAssertion(),
|
|
29
29
|
suppositionStatements = this.suppositions.map((supposition) => {
|
|
30
30
|
const suppositionStatement = supposition.getStatement();
|
|
31
31
|
|
|
32
32
|
return suppositionStatement;
|
|
33
33
|
}),
|
|
34
|
-
|
|
34
|
+
lastProofAssertionStatement = lastProofAssertion.getStatement(),
|
|
35
35
|
statements = [
|
|
36
36
|
...suppositionStatements,
|
|
37
|
-
|
|
37
|
+
lastProofAssertionStatement
|
|
38
38
|
];
|
|
39
39
|
|
|
40
40
|
return statements;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
const
|
|
43
|
+
isProofAssertion() {
|
|
44
|
+
const proofAssertion = false;
|
|
45
45
|
|
|
46
|
-
return
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
unify(substitutions, context) {
|
|
50
|
-
let unifies;
|
|
51
|
-
|
|
52
|
-
unifies = true; ///
|
|
53
|
-
|
|
54
|
-
return unifies;
|
|
46
|
+
return proofAssertion;
|
|
55
47
|
}
|
|
56
48
|
|
|
57
49
|
verify(substitutions, assignments, context) {
|
|
58
|
-
let
|
|
50
|
+
let verifies = false;
|
|
59
51
|
|
|
60
52
|
const localContext = LocalContext.fromNothing(context); ///
|
|
61
53
|
|
|
@@ -73,14 +65,14 @@ export default define(class Subproof extends Element {
|
|
|
73
65
|
const subDerivationVerifies = this.subDerivation.verify(substitutions, context);
|
|
74
66
|
|
|
75
67
|
if (subDerivationVerifies) {
|
|
76
|
-
|
|
68
|
+
verifies = true;
|
|
77
69
|
}
|
|
78
70
|
}
|
|
79
71
|
|
|
80
|
-
return
|
|
72
|
+
return verifies;
|
|
81
73
|
}
|
|
82
74
|
|
|
83
|
-
|
|
75
|
+
compareStatement(statement, context) {
|
|
84
76
|
const statementUnifies = false;
|
|
85
77
|
|
|
86
78
|
return statementUnifies;
|