occam-verify-cli 1.0.437 → 1.0.444
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 +38 -35
- package/lib/context/local.js +10 -10
- package/lib/context/release.js +6 -6
- package/lib/context/temporary.js +14 -14
- 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 +9 -12
- package/lib/element/axiomLemmaTheoremConjecture.js +32 -32
- 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 +5 -8
- 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 +3 -3
- package/lib/element/judgement.js +6 -4
- package/lib/element/label.js +16 -18
- package/lib/element/metaLemmaMetatheorem.js +5 -5
- package/lib/element/metaType.js +17 -80
- package/lib/element/metavariable.js +34 -34
- package/lib/element/parameter.js +3 -3
- package/lib/element/premise.js +43 -52
- package/lib/element/property.js +9 -9
- package/lib/element/propertyRelation.js +13 -13
- package/lib/element/reference.js +14 -17
- package/lib/element/rule.js +26 -50
- package/lib/element/signature.js +11 -11
- package/lib/element/statement.js +54 -56
- package/lib/element/step.js +79 -51
- package/lib/element/subDerivation.js +7 -10
- package/lib/element/subproof.js +6 -14
- 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 +63 -55
- 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 +27 -3
- package/lib/metaTypes.js +52 -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/subproof.js +8 -8
- 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 +4 -4
- package/lib/utilities/element.js +100 -61
- package/lib/utilities/instance.js +18 -18
- package/lib/utilities/statement.js +11 -16
- package/lib/utilities/string.js +21 -10
- package/lib/utilities/unification.js +237 -0
- package/lib/utilities/validation.js +251 -0
- package/package.json +6 -6
- package/src/context/file.js +37 -31
- package/src/context/local.js +8 -8
- package/src/context/release.js +9 -6
- package/src/context/temporary.js +11 -11
- 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 +7 -11
- package/src/element/axiomLemmaTheoremConjecture.js +36 -36
- 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 +4 -8
- 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 +2 -2
- package/src/element/judgement.js +6 -3
- package/src/element/label.js +14 -21
- package/src/element/metaLemmaMetatheorem.js +4 -3
- package/src/element/metaType.js +9 -45
- package/src/element/metavariable.js +29 -31
- package/src/element/parameter.js +2 -2
- package/src/element/premise.js +56 -62
- package/src/element/property.js +6 -6
- package/src/element/propertyRelation.js +11 -11
- package/src/element/reference.js +12 -21
- package/src/element/rule.js +28 -72
- package/src/element/signature.js +10 -9
- package/src/element/statement.js +69 -56
- package/src/element/step.js +89 -51
- package/src/element/subDerivation.js +6 -10
- package/src/element/subproof.js +4 -12
- 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 +88 -70
- 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 +15 -1
- package/src/metaTypes.js +42 -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/subproof.js +7 -7
- 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 +10 -6
- package/src/utilities/element.js +138 -91
- package/src/utilities/instance.js +18 -18
- package/src/utilities/statement.js +27 -28
- package/src/utilities/string.js +34 -20
- package/src/{mixins/step/unify.js → utilities/unification.js} +82 -68
- package/src/utilities/validation.js +369 -0
- package/lib/element/statement/combinator.js +0 -105
- package/lib/element/term/constructor.js +0 -172
- package/lib/mixins/statement/verify.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/statement/verify.js +0 -295
- package/src/mixins/term/verify.js +0 -81
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 verifyMixins from "../mixins/statement/verify";
|
|
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
|
|
|
@@ -23,36 +23,43 @@ export default define(class Statement extends Element {
|
|
|
23
23
|
const singular = this.isSingular();
|
|
24
24
|
|
|
25
25
|
if (singular) {
|
|
26
|
-
|
|
26
|
+
const node = this.getNode();
|
|
27
|
+
|
|
28
|
+
metavariableName = node.getMetavariableName();
|
|
27
29
|
}
|
|
28
30
|
|
|
29
31
|
return metavariableName;
|
|
30
32
|
}
|
|
31
33
|
|
|
32
|
-
isSingular() {
|
|
34
|
+
isSingular() {
|
|
35
|
+
const node = this.getNode(),
|
|
36
|
+
singular = node.isSingular();
|
|
37
|
+
|
|
38
|
+
return singular;
|
|
39
|
+
}
|
|
33
40
|
|
|
34
41
|
isTermContained(term, context) {
|
|
35
42
|
let termContained;
|
|
36
43
|
|
|
37
|
-
const
|
|
38
|
-
|
|
44
|
+
const node = this.getNode(),
|
|
45
|
+
termString = term.getString(),
|
|
46
|
+
statementString = this.getString(); ///
|
|
39
47
|
|
|
40
|
-
context.trace(`Is the '${termString}' term contained in the '${statementString}' statement...`,
|
|
48
|
+
context.trace(`Is the '${termString}' term contained in the '${statementString}' statement...`, node);
|
|
41
49
|
|
|
42
|
-
const
|
|
43
|
-
statementNode = this.node,
|
|
50
|
+
const statementNode = node, ///
|
|
44
51
|
statementNodeTermNodes = statementNode.getTermNodes();
|
|
45
52
|
|
|
46
53
|
termContained = statementNodeTermNodes.some((statementNodeTermNode) => { ///
|
|
47
|
-
const
|
|
54
|
+
const statementNodeTermNodeMatches = term.matchNode(statementNodeTermNode);
|
|
48
55
|
|
|
49
|
-
if (
|
|
56
|
+
if (statementNodeTermNodeMatches) {
|
|
50
57
|
return true;
|
|
51
58
|
}
|
|
52
59
|
});
|
|
53
60
|
|
|
54
61
|
if (termContained) {
|
|
55
|
-
context.debug(`...the '${termString}' term is contained in the '${statementString}' statement.`,
|
|
62
|
+
context.debug(`...the '${termString}' term is contained in the '${statementString}' statement.`, node);
|
|
56
63
|
}
|
|
57
64
|
|
|
58
65
|
return termContained;
|
|
@@ -61,25 +68,25 @@ export default define(class Statement extends Element {
|
|
|
61
68
|
isFrameContained(frame, context) {
|
|
62
69
|
let frameContained;
|
|
63
70
|
|
|
64
|
-
const
|
|
65
|
-
|
|
71
|
+
const node = this.getNode(),
|
|
72
|
+
frameString = frame.getString(),
|
|
73
|
+
statementString = this.getString(); ///
|
|
66
74
|
|
|
67
|
-
context.trace(`Is the '${frameString}' frame contained in the '${statementString}' statement...`,
|
|
75
|
+
context.trace(`Is the '${frameString}' frame contained in the '${statementString}' statement...`, node);
|
|
68
76
|
|
|
69
|
-
const
|
|
70
|
-
statementNode = this.node,
|
|
77
|
+
const statementNode = node,
|
|
71
78
|
statementNodeFrameNodes = statementNode.getFrameNodes();
|
|
72
79
|
|
|
73
80
|
frameContained = statementNodeFrameNodes.some((statementNodeFrameNode) => { ///
|
|
74
|
-
const
|
|
81
|
+
const statementNodeFrameNodeMatches = frame.matchNode(statementNodeFrameNode);
|
|
75
82
|
|
|
76
|
-
if (
|
|
83
|
+
if (statementNodeFrameNodeMatches) {
|
|
77
84
|
return true;
|
|
78
85
|
}
|
|
79
86
|
});
|
|
80
87
|
|
|
81
88
|
if (frameContained) {
|
|
82
|
-
context.debug(`...the '${frameString}' frame is contained in the '${statementString}' statement.`,
|
|
89
|
+
context.debug(`...the '${frameString}' frame is contained in the '${statementString}' statement.`, node);
|
|
83
90
|
}
|
|
84
91
|
|
|
85
92
|
return frameContained;
|
|
@@ -91,8 +98,9 @@ export default define(class Statement extends Element {
|
|
|
91
98
|
const singular = this.isSingular();
|
|
92
99
|
|
|
93
100
|
if (singular) {
|
|
94
|
-
const
|
|
95
|
-
|
|
101
|
+
const node = this.getNode(),
|
|
102
|
+
metavariableA = metavariable, ///
|
|
103
|
+
singularMetavariableNode = node.getSingularMetavariableNode(),
|
|
96
104
|
metavariableName = singularMetavariableNode.getMetavariableName();
|
|
97
105
|
|
|
98
106
|
metavariable = context.findMetavariableByMetavariableName(metavariableName)
|
|
@@ -106,63 +114,64 @@ export default define(class Statement extends Element {
|
|
|
106
114
|
return metavariableEqualToMetavariable;
|
|
107
115
|
}
|
|
108
116
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
verify(assignments, stated, context) {
|
|
112
|
-
let verifies;
|
|
117
|
+
validate(assignments, stated, context) {
|
|
118
|
+
let validates;
|
|
113
119
|
|
|
114
|
-
const
|
|
120
|
+
const node = this.getNode(),
|
|
121
|
+
statementString = this.getString(); ///
|
|
115
122
|
|
|
116
|
-
context.trace(`
|
|
123
|
+
context.trace(`Validating the '${statementString}' statement...`, node);
|
|
117
124
|
|
|
118
|
-
|
|
125
|
+
validates = validateStatements.some((validateStatement) => {
|
|
119
126
|
const statement = this, ///
|
|
120
|
-
|
|
127
|
+
statementValidates = validateStatement(statement, assignments, stated, context);
|
|
121
128
|
|
|
122
|
-
if (
|
|
129
|
+
if (statementValidates) {
|
|
123
130
|
return true;
|
|
124
131
|
}
|
|
125
132
|
});
|
|
126
133
|
|
|
127
|
-
if (
|
|
134
|
+
if (validates) {
|
|
128
135
|
const statement = this; ///
|
|
129
136
|
|
|
130
137
|
context.addStatement(statement);
|
|
131
138
|
|
|
132
|
-
context.debug(`...
|
|
139
|
+
context.debug(`...validated the '${statementString}' statement.`, node);
|
|
133
140
|
}
|
|
134
141
|
|
|
135
|
-
return
|
|
142
|
+
return validates;
|
|
136
143
|
}
|
|
137
144
|
|
|
138
|
-
|
|
139
|
-
let
|
|
145
|
+
validateGivenMetaType(metaType, assignments, stated, context) {
|
|
146
|
+
let validatesGivenMetaType = false;
|
|
140
147
|
|
|
141
|
-
const
|
|
142
|
-
|
|
148
|
+
const node = this.getNode(),
|
|
149
|
+
metaTypeString = metaType.getString(),
|
|
150
|
+
statementString = this.getString(); ///
|
|
143
151
|
|
|
144
|
-
context.trace(`
|
|
152
|
+
context.trace(`Validating the '${statementString}' statement given the '${metaTypeString}' meta-type...`, node);
|
|
145
153
|
|
|
146
154
|
const metaTypeName = metaType.getName();
|
|
147
155
|
|
|
148
156
|
if (metaTypeName === STATEMENT_META_TYPE_NAME) {
|
|
149
|
-
const
|
|
157
|
+
const validates = this.validate(assignments, stated, context)
|
|
150
158
|
|
|
151
|
-
|
|
159
|
+
validatesGivenMetaType = validates; ///
|
|
152
160
|
}
|
|
153
161
|
|
|
154
|
-
if (
|
|
155
|
-
context.debug(`...
|
|
162
|
+
if (validatesGivenMetaType) {
|
|
163
|
+
context.debug(`...validated the '${statementString}' statement given the '${metaTypeString}' meta-type.`, node);
|
|
156
164
|
}
|
|
157
165
|
|
|
158
|
-
return
|
|
166
|
+
return validatesGivenMetaType;
|
|
159
167
|
}
|
|
160
168
|
|
|
161
169
|
unifySubproof(subproof, substitutions, generalContext, specificContext) {
|
|
162
170
|
let subproofUnifies = false;
|
|
163
171
|
|
|
164
|
-
const
|
|
165
|
-
|
|
172
|
+
const node = this.getNode(),
|
|
173
|
+
context = specificContext, ///
|
|
174
|
+
statementNode = node,
|
|
166
175
|
subproofAssertionNode = statementNode.getSubproofAssertionNode(),
|
|
167
176
|
assertionNode = subproofAssertionNode; ///
|
|
168
177
|
|
|
@@ -219,11 +228,12 @@ export default define(class Statement extends Element {
|
|
|
219
228
|
let unifiesIndependently = false;
|
|
220
229
|
|
|
221
230
|
const context = specificContext, ///
|
|
222
|
-
statementString = this.
|
|
231
|
+
statementString = this.getString(); ///
|
|
223
232
|
|
|
224
233
|
context.trace(`Unifying the '${statementString}' statement independently...`);
|
|
225
234
|
|
|
226
|
-
const
|
|
235
|
+
const node = this.getNode(),
|
|
236
|
+
statementNode = node, ///
|
|
227
237
|
definedAssertionNode = statementNode.getDefinedAssertionNode(),
|
|
228
238
|
containedAssertionNode = statementNode.getContainedAssertionNode();
|
|
229
239
|
|
|
@@ -244,23 +254,23 @@ export default define(class Statement extends Element {
|
|
|
244
254
|
return unifiesIndependently;
|
|
245
255
|
}
|
|
246
256
|
|
|
247
|
-
|
|
248
|
-
let
|
|
257
|
+
compareStepsOrSubproofs(stepsOrSubproofs, context) {
|
|
258
|
+
let comparesToStepsOrSubproofs;
|
|
249
259
|
|
|
250
|
-
|
|
260
|
+
comparesToStepsOrSubproofs = backwardsSome(stepsOrSubproofs, (stepOrSubproof) => {
|
|
251
261
|
const statement = this, ///
|
|
252
|
-
|
|
262
|
+
stepOrSubproofComparesToStatement = stepOrSubproof.compareStatement(statement, context);
|
|
253
263
|
|
|
254
|
-
if (
|
|
264
|
+
if (stepOrSubproofComparesToStatement) {
|
|
255
265
|
return true;
|
|
256
266
|
}
|
|
257
267
|
});
|
|
258
268
|
|
|
259
|
-
return
|
|
269
|
+
return comparesToStepsOrSubproofs;
|
|
260
270
|
}
|
|
261
271
|
|
|
262
272
|
toJSON() {
|
|
263
|
-
const string = this.
|
|
273
|
+
const string = this.getString(),
|
|
264
274
|
json = {
|
|
265
275
|
string
|
|
266
276
|
};
|
|
@@ -273,8 +283,11 @@ export default define(class Statement extends Element {
|
|
|
273
283
|
static fromJSON(json, context) {
|
|
274
284
|
const { string } = json,
|
|
275
285
|
statmentNode = instantiateStatement(string, context),
|
|
276
|
-
node = statmentNode
|
|
277
|
-
|
|
286
|
+
node = statmentNode; ///,
|
|
287
|
+
|
|
288
|
+
context = null;
|
|
289
|
+
|
|
290
|
+
const statement = new Statement(context, string, node);
|
|
278
291
|
|
|
279
292
|
return statement;
|
|
280
293
|
}
|
package/src/element/step.js
CHANGED
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
import Element from "../element";
|
|
4
4
|
import elements from "../elements";
|
|
5
|
-
import unifyMixins from "../mixins/step/unify";
|
|
6
5
|
import TemporaryContext from "../context/temporary";
|
|
7
6
|
|
|
8
7
|
import { define } from "../elements";
|
|
8
|
+
import { instantiateStep } from "../process/instantiate";
|
|
9
|
+
import { unifyStatements } from "../utilities/unification";
|
|
9
10
|
import { equateStatements } from "../process/equate";
|
|
11
|
+
import { stepFromStepNode } from "../utilities/element";
|
|
10
12
|
import { propertyAssertionFromStatement } from "../utilities/statement";
|
|
11
13
|
|
|
12
14
|
export default define(class Step extends Element {
|
|
@@ -55,16 +57,16 @@ export default define(class Step extends Element {
|
|
|
55
57
|
return step;
|
|
56
58
|
}
|
|
57
59
|
|
|
58
|
-
|
|
59
|
-
let
|
|
60
|
+
compareTermAndPropertyRelation(term, propertyRelation, context) {
|
|
61
|
+
let comparesToTermAndPropertyRelation = false;
|
|
60
62
|
|
|
61
63
|
const propertyAssertion = propertyAssertionFromStatement(this.statement, context);
|
|
62
64
|
|
|
63
65
|
if (propertyAssertion !== null) {
|
|
64
|
-
|
|
66
|
+
comparesToTermAndPropertyRelation = propertyAssertion.compareTermAndPropertyRelation(term, propertyRelation, context);
|
|
65
67
|
}
|
|
66
68
|
|
|
67
|
-
return
|
|
69
|
+
return comparesToTermAndPropertyRelation;
|
|
68
70
|
}
|
|
69
71
|
|
|
70
72
|
verify(substitutions, assignments, context) {
|
|
@@ -74,77 +76,102 @@ export default define(class Step extends Element {
|
|
|
74
76
|
|
|
75
77
|
context = temporaryContext; ///
|
|
76
78
|
|
|
77
|
-
const
|
|
79
|
+
const node = this.getNode(),
|
|
80
|
+
stepString = this.getString(); ///
|
|
78
81
|
|
|
79
|
-
context.trace(`Verifying the '${stepString}' step...`,
|
|
82
|
+
context.trace(`Verifying the '${stepString}' step...`, node);
|
|
80
83
|
|
|
81
|
-
if (this.statement
|
|
82
|
-
|
|
83
|
-
|
|
84
|
+
if (this.statement === null) {
|
|
85
|
+
context.debug(`Unable to verify the '${stepString}' step because it is nonsense.`, node);
|
|
86
|
+
} else {
|
|
87
|
+
const referenceVerifies = this.verifyReference(context);
|
|
84
88
|
|
|
85
|
-
if (
|
|
86
|
-
const
|
|
87
|
-
satisfied = this.isSatisfied();
|
|
89
|
+
if (referenceVerifies) {
|
|
90
|
+
const satisfiesAssertioVeriries = this.verifySatisfiesAssertion(context);
|
|
88
91
|
|
|
89
|
-
if (
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
const referenceVerifies = this.reference.verify(context);
|
|
92
|
+
if (satisfiesAssertioVeriries) {
|
|
93
|
+
const stated = this.isStated(),
|
|
94
|
+
statementValidates = this.statement.validate(assignments, stated, context);
|
|
93
95
|
|
|
94
|
-
if (
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
96
|
+
if (statementValidates) {
|
|
97
|
+
const statementUnifies = unifyStatements.some((unifyStatement) => {
|
|
98
|
+
const statementUnifies = unifyStatement(this.statement, this.reference, this.satisfiesAssertion, substitutions, context);
|
|
99
|
+
|
|
100
|
+
if (statementUnifies) {
|
|
101
|
+
return true;
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
if (statementUnifies) {
|
|
106
|
+
const { Step } = elements,
|
|
107
|
+
step = Step.fromStatement(this.statement, context),
|
|
108
|
+
stepOrSubproof = step; ///
|
|
109
|
+
|
|
110
|
+
context.addStepOrSubproof(stepOrSubproof);
|
|
111
|
+
|
|
112
|
+
this.setContext(context);
|
|
101
113
|
|
|
102
|
-
|
|
103
|
-
|
|
114
|
+
verifies = true;
|
|
115
|
+
}
|
|
104
116
|
}
|
|
105
|
-
} else {
|
|
106
|
-
verifies = true;
|
|
107
117
|
}
|
|
108
118
|
}
|
|
109
|
-
} else {
|
|
110
|
-
context.debug(`Cannot verify the '${stepString}' step because it is nonsense.`, this.node);
|
|
111
119
|
}
|
|
112
120
|
|
|
113
121
|
if (verifies) {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
context.debug(`...verified the '${stepString}' step.`, this.node);
|
|
122
|
+
context.debug(`...verified the '${stepString}' step.`, node);
|
|
117
123
|
}
|
|
118
124
|
|
|
119
125
|
return verifies;
|
|
120
126
|
}
|
|
121
127
|
|
|
122
|
-
|
|
123
|
-
let
|
|
128
|
+
verifyReference(context) {
|
|
129
|
+
let referenceVeriries;
|
|
124
130
|
|
|
125
|
-
|
|
131
|
+
const node = this.getNode(),
|
|
132
|
+
stepString = this.getString(); ///
|
|
126
133
|
|
|
127
|
-
|
|
134
|
+
context.trace(`Verifying the '${stepString}' step's reference... `, node);
|
|
128
135
|
|
|
129
|
-
|
|
136
|
+
if (this.reference !== null) {
|
|
137
|
+
referenceVeriries = this.reference.verify(context);
|
|
138
|
+
} else {
|
|
139
|
+
referenceVeriries = true;
|
|
140
|
+
}
|
|
130
141
|
|
|
131
|
-
|
|
132
|
-
|
|
142
|
+
if (referenceVeriries) {
|
|
143
|
+
context.debug(`...verified the '${stepString}' step's reference. `, node);
|
|
144
|
+
}
|
|
133
145
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
146
|
+
return referenceVeriries;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
verifySatisfiesAssertion(context) {
|
|
150
|
+
let satisfiesAssertionVerifies;
|
|
151
|
+
|
|
152
|
+
const node = this.getNode(),
|
|
153
|
+
stepString = this.getString(); ///
|
|
138
154
|
|
|
139
|
-
|
|
140
|
-
|
|
155
|
+
context.trace(`Verifying the '${stepString}' step's satisfies assertion... `, node);
|
|
156
|
+
|
|
157
|
+
if (this.satisfiesAssertion !== null) {
|
|
158
|
+
const stated = true,
|
|
159
|
+
assignments = null;
|
|
160
|
+
|
|
161
|
+
satisfiesAssertionVerifies = this.satisfiesAssertion.validate(assignments, stated, context);
|
|
162
|
+
} else {
|
|
163
|
+
satisfiesAssertionVerifies = true;
|
|
141
164
|
}
|
|
142
165
|
|
|
143
|
-
|
|
166
|
+
if (satisfiesAssertionVerifies) {
|
|
167
|
+
context.debug(`...verified the '${stepString}' step's satisfies assertion. `, node);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
return satisfiesAssertionVerifies;
|
|
144
171
|
}
|
|
145
172
|
|
|
146
|
-
|
|
147
|
-
let
|
|
173
|
+
compareStatment(statement, context) {
|
|
174
|
+
let comparesToStatement;
|
|
148
175
|
|
|
149
176
|
const leftStatement = statement, ///
|
|
150
177
|
rightStatement = this.statement, ///
|
|
@@ -152,9 +179,9 @@ export default define(class Step extends Element {
|
|
|
152
179
|
rightStatementNode = rightStatement.getNode(),
|
|
153
180
|
statementsEquate = equateStatements(leftStatementNode, rightStatementNode, context);
|
|
154
181
|
|
|
155
|
-
|
|
182
|
+
comparesToStatement = statementsEquate; ///
|
|
156
183
|
|
|
157
|
-
return
|
|
184
|
+
return comparesToStatement;
|
|
158
185
|
}
|
|
159
186
|
|
|
160
187
|
unifyWithSatisfiesAssertion(satisfiesAssertion, context) {
|
|
@@ -191,4 +218,15 @@ export default define(class Step extends Element {
|
|
|
191
218
|
}
|
|
192
219
|
|
|
193
220
|
static name = "Step";
|
|
221
|
+
|
|
222
|
+
static fromStatement(statement, context) {
|
|
223
|
+
const statementString = statement.getString(),
|
|
224
|
+
stepString = statementString, ///
|
|
225
|
+
string = `${stepString}
|
|
226
|
+
`,
|
|
227
|
+
stepNode = instantiateStep(string, context),
|
|
228
|
+
step = stepFromStepNode(stepNode, context);
|
|
229
|
+
|
|
230
|
+
return step;;
|
|
231
|
+
}
|
|
194
232
|
});
|
|
@@ -32,19 +32,15 @@ export default define(class SubDerivation extends Element {
|
|
|
32
32
|
|
|
33
33
|
verifies = this.stepsOrSubproofs.every((stepOrSubproof) => { ///
|
|
34
34
|
const assignments = [],
|
|
35
|
-
|
|
35
|
+
stepOrSubproofVarifies = stepOrSubproof.verify(substitutions, assignments, context);
|
|
36
36
|
|
|
37
|
-
if (
|
|
38
|
-
const
|
|
37
|
+
if (stepOrSubproofVarifies) {
|
|
38
|
+
const assignmentsAssigned = assignAssignments(assignments, context);
|
|
39
39
|
|
|
40
|
-
if (
|
|
41
|
-
|
|
40
|
+
if (assignmentsAssigned) {
|
|
41
|
+
context.addStepOrSubproof(stepOrSubproof);
|
|
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
|
@@ -46,16 +46,8 @@ export default define(class Subproof extends Element {
|
|
|
46
46
|
return sStep;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
unify(substitutions, context) {
|
|
50
|
-
let unifies;
|
|
51
|
-
|
|
52
|
-
unifies = true; ///
|
|
53
|
-
|
|
54
|
-
return unifies;
|
|
55
|
-
}
|
|
56
|
-
|
|
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;
|
|
@@ -33,8 +33,6 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
33
33
|
|
|
34
34
|
isMetavariableEqualToMetavariable(metavariable) { return this.metavariable.isEqualTo(metavariable); }
|
|
35
35
|
|
|
36
|
-
matchParameter(parameter) { return this.metavariable.matchParameter(parameter); }
|
|
37
|
-
|
|
38
36
|
verify(context) {
|
|
39
37
|
let verifies = false;
|
|
40
38
|
|
|
@@ -22,11 +22,7 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
22
22
|
return this.metavariable;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
isReferenceEqualToReference(reference) {
|
|
26
|
-
const referenceEqualToReference = this.reference.isEqualTo(reference);
|
|
27
|
-
|
|
28
|
-
return referenceEqualToReference;
|
|
29
|
-
}
|
|
25
|
+
isReferenceEqualToReference(reference) { return this.reference.isEqualTo(reference); }
|
|
30
26
|
|
|
31
27
|
static name = "ReferenceSubstitution";
|
|
32
28
|
|
|
@@ -43,18 +43,16 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
43
43
|
return replacementNode;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return simple;
|
|
46
|
+
setStatement(statement) {
|
|
47
|
+
this.statement = statement;
|
|
50
48
|
}
|
|
51
49
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const statementEqualToStatement = this.statement.isEqualTo(statement);
|
|
50
|
+
setMetavariable(metavariable) {
|
|
51
|
+
this.metavariable = metavariable;
|
|
52
|
+
}
|
|
56
53
|
|
|
57
|
-
|
|
54
|
+
setSubstitution(substitution) {
|
|
55
|
+
this.substitution = substitution;
|
|
58
56
|
}
|
|
59
57
|
|
|
60
58
|
isMetavariableEqualToMetavariable(metavariable) { return this.metavariable.isEqualTo(metavariable); }
|
|
@@ -75,7 +73,19 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
75
73
|
return substitutionEqualToSubstitution;
|
|
76
74
|
}
|
|
77
75
|
|
|
78
|
-
|
|
76
|
+
isStatementEqualToStatement(statement, context) {
|
|
77
|
+
statement = stripBracketsFromStatement(statement, context); ///
|
|
78
|
+
|
|
79
|
+
const statementEqualToStatement = this.statement.isEqualTo(statement);
|
|
80
|
+
|
|
81
|
+
return statementEqualToStatement;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
isSimple() {
|
|
85
|
+
const simple = (this.substitution === null);
|
|
86
|
+
|
|
87
|
+
return simple;
|
|
88
|
+
}
|
|
79
89
|
|
|
80
90
|
unifyStatement(statement, context) {
|
|
81
91
|
let substitution = null;
|
|
@@ -205,8 +215,17 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
205
215
|
statement = stripBracketsFromStatement(statement, context); ///
|
|
206
216
|
|
|
207
217
|
const string = stringFromStatementAndMetavariable(statement, metavariable),
|
|
208
|
-
statementSubstitutionNode = instantiateStatementSubstitution(string, context)
|
|
209
|
-
|
|
218
|
+
statementSubstitutionNode = instantiateStatementSubstitution(string, context);
|
|
219
|
+
|
|
220
|
+
context = {
|
|
221
|
+
nodeAsString: () => string
|
|
222
|
+
};
|
|
223
|
+
|
|
224
|
+
const statementSubstitution = statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, context);
|
|
225
|
+
|
|
226
|
+
statementSubstitution.setStatement(statement);
|
|
227
|
+
|
|
228
|
+
statementSubstitution.setMetavariable(metavariable);
|
|
210
229
|
|
|
211
230
|
return statementSubstitution;
|
|
212
231
|
}
|
|
@@ -215,8 +234,19 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
215
234
|
statement = stripBracketsFromStatement(statement, context); ///
|
|
216
235
|
|
|
217
236
|
const string = stringFromStatementMetavariableAndSubstitution(statement, metavariable, substitution, context),
|
|
218
|
-
statementSubstitutionNode = instantiateStatementSubstitution(string, context)
|
|
219
|
-
|
|
237
|
+
statementSubstitutionNode = instantiateStatementSubstitution(string, context);
|
|
238
|
+
|
|
239
|
+
context = {
|
|
240
|
+
nodeAsString: () => string
|
|
241
|
+
};
|
|
242
|
+
|
|
243
|
+
const statementSubstitution = statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, context);
|
|
244
|
+
|
|
245
|
+
statementSubstitution.setStatement(statement);
|
|
246
|
+
|
|
247
|
+
statementSubstitution.setMetavariable(metavariable);
|
|
248
|
+
|
|
249
|
+
statementSubstitution.setSubstitution(substitution);
|
|
220
250
|
|
|
221
251
|
return statementSubstitution;
|
|
222
252
|
}
|