occam-verify-cli 1.0.438 → 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 +7 -10
- 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 +8 -8
- 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 +49 -58
- 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 +21 -21
- package/lib/element/signature.js +11 -11
- package/lib/element/statement.js +18 -18
- package/lib/element/step.js +83 -55
- 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 +9 -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 +91 -55
- package/lib/utilities/instance.js +18 -18
- package/lib/utilities/statement.js +2 -2
- 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 +6 -10
- 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 +4 -4
- 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 +55 -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 +17 -16
- package/src/element/signature.js +10 -9
- package/src/element/statement.js +16 -18
- package/src/element/step.js +93 -55
- 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 +3 -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 +125 -82
- package/src/utilities/instance.js +18 -18
- package/src/utilities/statement.js +2 -2
- package/src/utilities/string.js +34 -20
- package/src/{mixins/step/unify.js → utilities/unification.js} +82 -68
- 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
|
@@ -6,7 +6,6 @@ import TemporaryContext from "../context/temporary";
|
|
|
6
6
|
import assignAssignments from "../process/assign";
|
|
7
7
|
|
|
8
8
|
import { define } from "../elements";
|
|
9
|
-
import { subproofAssertionFromStatement } from "../utilities/statement";
|
|
10
9
|
import { termsFromJSON, framesFromJSON, statementFromJSON, procedureCallFromJSON, termsToTermsJSON, framesToFramesJSON, statementToStatementJSON, procedureCallToProcedureCallJSON } from "../utilities/json";
|
|
11
10
|
|
|
12
11
|
export default define(class Supposition extends Element {
|
|
@@ -32,81 +31,69 @@ export default define(class Supposition extends Element {
|
|
|
32
31
|
|
|
33
32
|
context = temporaryContext; ///
|
|
34
33
|
|
|
35
|
-
const
|
|
34
|
+
const node = this.getNode(),
|
|
35
|
+
suppositionString = this.getString(); ///
|
|
36
36
|
|
|
37
|
-
context.trace(`Verifying the '${suppositionString}' supposition...`,
|
|
37
|
+
context.trace(`Verifying the '${suppositionString}' supposition...`, node);
|
|
38
38
|
|
|
39
|
-
if (
|
|
40
|
-
|
|
41
|
-
} else
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
if ((this.statement === null) && (this.procedureCall === null)) {
|
|
40
|
+
context.debug(`Unable to verify the '${suppositionString}' supposition because it is nonsense.`, node);
|
|
41
|
+
} else {
|
|
42
|
+
if (this.statement !== null) {
|
|
43
|
+
const stated = true,
|
|
44
|
+
assignments = [],
|
|
45
|
+
statementValidates = this.statement.validate(assignments, stated, context);
|
|
45
46
|
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
if (statementValidates) {
|
|
48
|
+
const assignmentsAssigned = assignAssignments(assignments, context);
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
if (assignmentsAssigned) {
|
|
51
|
+
const { Step } = elements,
|
|
52
|
+
step = Step.fromStatement(this.statement, context),
|
|
53
|
+
stepOrSubproof = step; ///
|
|
53
54
|
|
|
54
|
-
|
|
55
|
+
context.addStepOrSubproof(stepOrSubproof);
|
|
55
56
|
|
|
56
|
-
|
|
57
|
+
verifies = true;
|
|
58
|
+
}
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
|
-
} else if (this.procedureCall !== null) {
|
|
60
|
-
const stated = true,
|
|
61
|
-
assignments = null,
|
|
62
|
-
procedureCallVerifies = this.procedureCall.verify(assignments, stated, context);
|
|
63
61
|
|
|
64
|
-
if (
|
|
65
|
-
|
|
62
|
+
if (this.procedureCall !== null) {
|
|
63
|
+
const stated = true,
|
|
64
|
+
assignments = null,
|
|
65
|
+
procedureCallVerifies = this.procedureCall.verify(assignments, stated, context);
|
|
66
|
+
|
|
67
|
+
if (procedureCallVerifies) {
|
|
68
|
+
verifies = true;
|
|
69
|
+
}
|
|
66
70
|
}
|
|
67
|
-
} else {
|
|
68
|
-
context.debug(`Unable to verify the '${suppositionString}' supposition because it is nonsense.`, this.node);
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
if (verifies) {
|
|
72
|
-
this.context
|
|
74
|
+
this.setContext(context);
|
|
73
75
|
|
|
74
|
-
context.debug(`...verified the '${suppositionString}' supposition.`,
|
|
76
|
+
context.debug(`...verified the '${suppositionString}' supposition.`, node);
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
return verifies;
|
|
78
80
|
}
|
|
79
81
|
|
|
80
|
-
|
|
81
|
-
let
|
|
82
|
+
unifyIndependently(substitutions, context) {
|
|
83
|
+
let unifiesIndependently = false;
|
|
82
84
|
|
|
83
|
-
const
|
|
84
|
-
|
|
85
|
-
generalSuppositionString = this.string, ///
|
|
86
|
-
specificSuppositionString = specificSupposition.getString();
|
|
85
|
+
const node = this.getNode(),
|
|
86
|
+
suppositionString = this.getString();
|
|
87
87
|
|
|
88
|
-
context.trace(`Unifying the '${
|
|
88
|
+
context.trace(`Unifying the '${suppositionString}' supposition independently...`, node);
|
|
89
89
|
|
|
90
|
-
const
|
|
91
|
-
statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
90
|
+
const specificContext = context; ///
|
|
92
91
|
|
|
93
|
-
|
|
92
|
+
context = this.getContext();
|
|
94
93
|
|
|
95
|
-
|
|
96
|
-
context.debug(`...unified the '${specificSuppositionString}' supposition with the '${generalSuppositionString}' supposition.`, this.node);
|
|
97
|
-
}
|
|
94
|
+
const generalContext = context; ///
|
|
98
95
|
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
unifyIndependently(substitutions, context) {
|
|
103
|
-
let unifiesIndependently = false;
|
|
104
|
-
|
|
105
|
-
const suppositionString = this.string, ///
|
|
106
|
-
generalContext = this.context, ///
|
|
107
|
-
specificContext = context; ///
|
|
108
|
-
|
|
109
|
-
context.trace(`Unifying the '${suppositionString}' supposition independently...`, this.node);
|
|
96
|
+
context = specificContext; ///
|
|
110
97
|
|
|
111
98
|
if (this.statement !== null) {
|
|
112
99
|
const statementUnifiesIndependently = this.statement.unifyIndependently(substitutions, generalContext, specificContext);
|
|
@@ -125,7 +112,7 @@ export default define(class Supposition extends Element {
|
|
|
125
112
|
}
|
|
126
113
|
|
|
127
114
|
if (unifiesIndependently) {
|
|
128
|
-
context.debug(`...unified the '${suppositionString}' supposition independenly.`,
|
|
115
|
+
context.debug(`...unified the '${suppositionString}' supposition independenly.`, node);
|
|
129
116
|
}
|
|
130
117
|
|
|
131
118
|
return unifiesIndependently;
|
|
@@ -167,19 +154,6 @@ export default define(class Supposition extends Element {
|
|
|
167
154
|
return stepOrSubproofUnifies;
|
|
168
155
|
}
|
|
169
156
|
|
|
170
|
-
unifyStep(step, substitutions, context) {
|
|
171
|
-
let stepUnifies;
|
|
172
|
-
|
|
173
|
-
context = step.getContext();
|
|
174
|
-
|
|
175
|
-
const statement = step.getStatement(),
|
|
176
|
-
statementUnifies = this.unifyStatement(statement, substitutions, context);
|
|
177
|
-
|
|
178
|
-
stepUnifies = statementUnifies; ///
|
|
179
|
-
|
|
180
|
-
return stepUnifies;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
157
|
unifySubproof(subproof, substitutions, context) {
|
|
184
158
|
let subproofUnifies = false;
|
|
185
159
|
|
|
@@ -190,14 +164,22 @@ export default define(class Supposition extends Element {
|
|
|
190
164
|
|
|
191
165
|
context.trace(`Unifying the '${subproofString}' subproof with the supposition's '${suppositionStatementString}' statement...`);
|
|
192
166
|
|
|
167
|
+
const specificContext = context; ///
|
|
168
|
+
|
|
169
|
+
context = this.getContext();
|
|
170
|
+
|
|
171
|
+
const generalContext = context; ///
|
|
172
|
+
|
|
173
|
+
context = specificContext; ///
|
|
174
|
+
|
|
193
175
|
if (this.statement !== null) {
|
|
194
|
-
const
|
|
195
|
-
|
|
176
|
+
const node = this.getNode(),
|
|
177
|
+
assertionNode = node, ///
|
|
178
|
+
assertion = context.findAssertionByAssertionNode(assertionNode);
|
|
196
179
|
|
|
197
|
-
if (
|
|
198
|
-
const generalContext = this.context, ///
|
|
199
|
-
specificContext = context; ///
|
|
180
|
+
if (assertion !== null) {}
|
|
200
181
|
|
|
182
|
+
if (subproofAssertion !== null) {
|
|
201
183
|
subproofUnifies = subproofAssertion.unifySubproof(subproof, substitutions, generalContext, specificContext);
|
|
202
184
|
}
|
|
203
185
|
}
|
|
@@ -209,6 +191,19 @@ export default define(class Supposition extends Element {
|
|
|
209
191
|
return subproofUnifies;
|
|
210
192
|
}
|
|
211
193
|
|
|
194
|
+
unifyStep(step, substitutions, context) {
|
|
195
|
+
let stepUnifies;
|
|
196
|
+
|
|
197
|
+
context = step.getContext();
|
|
198
|
+
|
|
199
|
+
const statement = step.getStatement(),
|
|
200
|
+
statementUnifies = this.unifyStatement(statement, substitutions, context);
|
|
201
|
+
|
|
202
|
+
stepUnifies = statementUnifies; ///
|
|
203
|
+
|
|
204
|
+
return stepUnifies;
|
|
205
|
+
}
|
|
206
|
+
|
|
212
207
|
unifyStatement(statement, substitutions, context) {
|
|
213
208
|
let statementUnifies;
|
|
214
209
|
|
|
@@ -232,6 +227,29 @@ export default define(class Supposition extends Element {
|
|
|
232
227
|
return statementUnifies;
|
|
233
228
|
}
|
|
234
229
|
|
|
230
|
+
unifySupposition(supposition, substitutions, generalContext, specificContext) {
|
|
231
|
+
let suppositionUnifies;
|
|
232
|
+
|
|
233
|
+
const node = this.getNode(),
|
|
234
|
+
context = specificContext, ///
|
|
235
|
+
specificSupposition = supposition, ///
|
|
236
|
+
generalSuppositionString = this.getString(), ///
|
|
237
|
+
specificSuppositionString = specificSupposition.getString();
|
|
238
|
+
|
|
239
|
+
context.trace(`Unifying the '${specificSuppositionString}' supposition with the '${generalSuppositionString}' supposition...`, node);
|
|
240
|
+
|
|
241
|
+
const statement = specificSupposition.getStatement(),
|
|
242
|
+
statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
243
|
+
|
|
244
|
+
suppositionUnifies = statementUnifies; ///
|
|
245
|
+
|
|
246
|
+
if (suppositionUnifies) {
|
|
247
|
+
context.debug(`...unified the '${specificSuppositionString}' supposition with the '${generalSuppositionString}' supposition.`, node);
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
return suppositionUnifies;
|
|
251
|
+
}
|
|
252
|
+
|
|
235
253
|
toJSON() {
|
|
236
254
|
let frames,
|
|
237
255
|
terms;
|
package/src/element/term.js
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import { arrayUtilities } from "necessary";
|
|
4
4
|
|
|
5
5
|
import Element from "../element";
|
|
6
|
-
import verifyMixins from "../mixins/term/verify";
|
|
7
6
|
|
|
8
7
|
import { define } from "../elements";
|
|
8
|
+
import { validateTerms } from "../utilities/validation";
|
|
9
9
|
import { instantiateTerm } from "../process/instantiate";
|
|
10
10
|
import { typeFromJSON, typeToTypeJSON } from "../utilities/json";
|
|
11
11
|
|
|
@@ -30,10 +30,8 @@ export default define(class Term extends Element {
|
|
|
30
30
|
|
|
31
31
|
isProvisional() { return this.type.isProvisional(); }
|
|
32
32
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
isEqualToVariable(variable) {
|
|
36
|
-
let variableNodeMathces = false;
|
|
33
|
+
compareVariable(variable) {
|
|
34
|
+
let comparesToVaraible = false;
|
|
37
35
|
|
|
38
36
|
const singular = this.isSingular();
|
|
39
37
|
|
|
@@ -45,19 +43,11 @@ export default define(class Term extends Element {
|
|
|
45
43
|
matches = variableNodeA.match(variableNodeB);
|
|
46
44
|
|
|
47
45
|
if (matches) {
|
|
48
|
-
|
|
46
|
+
comparesToVaraible = true;
|
|
49
47
|
}
|
|
50
48
|
}
|
|
51
49
|
|
|
52
|
-
return
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
isEqualTo(term) {
|
|
56
|
-
const termNode = term.getNode(),
|
|
57
|
-
matches = this.node.match(termNode),
|
|
58
|
-
equalTo = matches; ///
|
|
59
|
-
|
|
60
|
-
return equalTo;
|
|
50
|
+
return comparesToVaraible;
|
|
61
51
|
}
|
|
62
52
|
|
|
63
53
|
isGrounded(definedVariables, context) {
|
|
@@ -95,31 +85,31 @@ export default define(class Term extends Element {
|
|
|
95
85
|
return implicitlyGrounded;
|
|
96
86
|
}
|
|
97
87
|
|
|
98
|
-
|
|
99
|
-
let
|
|
88
|
+
validate(context, verifyAhead) {
|
|
89
|
+
let validates;
|
|
100
90
|
|
|
101
91
|
const termString = this.string; ///
|
|
102
92
|
|
|
103
|
-
context.trace(`
|
|
93
|
+
context.trace(`Validating the '${termString}' term...`);
|
|
104
94
|
|
|
105
|
-
|
|
95
|
+
validates = validateTerms.some((validateTerm) => { ///
|
|
106
96
|
const term = this, ///
|
|
107
|
-
|
|
97
|
+
termValidates = validateTerm(term, context, verifyAhead);
|
|
108
98
|
|
|
109
|
-
if (
|
|
99
|
+
if (termValidates) {
|
|
110
100
|
return true;
|
|
111
101
|
}
|
|
112
102
|
});
|
|
113
103
|
|
|
114
|
-
if (
|
|
104
|
+
if (validates) {
|
|
115
105
|
const term = this; ///
|
|
116
106
|
|
|
117
107
|
context.addTerm(term);
|
|
118
108
|
|
|
119
|
-
context.debug(`...
|
|
109
|
+
context.debug(`...validated the '${termString}' term.`);
|
|
120
110
|
}
|
|
121
111
|
|
|
122
|
-
return
|
|
112
|
+
return validates;
|
|
123
113
|
}
|
|
124
114
|
|
|
125
115
|
verifyGivenType(type, generalContext, specificContext) {
|
|
@@ -128,10 +118,10 @@ export default define(class Term extends Element {
|
|
|
128
118
|
const typeString = type.getString(),
|
|
129
119
|
termString = this.getString(); ///
|
|
130
120
|
|
|
131
|
-
specificContext.trace(`
|
|
121
|
+
specificContext.trace(`Validating the '${termString}' term given the '${typeString}' type...`);
|
|
132
122
|
|
|
133
123
|
const context = specificContext, ///
|
|
134
|
-
|
|
124
|
+
validates = this.validate(context, () => {
|
|
135
125
|
let verifiesAhead;
|
|
136
126
|
|
|
137
127
|
const typeEqualToOrSubTypeOfGivenTypeType = this.type.isEqualToOrSubTypeOf(type);
|
|
@@ -143,10 +133,10 @@ export default define(class Term extends Element {
|
|
|
143
133
|
return verifiesAhead;
|
|
144
134
|
});
|
|
145
135
|
|
|
146
|
-
verifiesGivenType =
|
|
136
|
+
verifiesGivenType = validates; ///
|
|
147
137
|
|
|
148
138
|
if (verifiesGivenType) {
|
|
149
|
-
specificContext.debug(`...
|
|
139
|
+
specificContext.debug(`...validated the '${termString}' term given the '${typeString}' type.`);
|
|
150
140
|
}
|
|
151
141
|
|
|
152
142
|
return verifiesGivenType;
|
package/src/element/type.js
CHANGED
|
@@ -5,13 +5,13 @@ import { arrayUtilities } from "necessary";
|
|
|
5
5
|
import Element from "../element";
|
|
6
6
|
|
|
7
7
|
import { define } from "../elements";
|
|
8
|
-
import {
|
|
8
|
+
import { baseTypeFromNothing } from "../types";
|
|
9
9
|
import { typeStringFromTypeNameTypePrefixNameAndSuperTypes } from "../utilities/string";
|
|
10
10
|
import { superTypesFromJSON, propertiesFromJSON, superTypesToSuperTypesJSON, propertiesToPropertiesJSON } from "../utilities/json";
|
|
11
11
|
|
|
12
12
|
const { push, first } = arrayUtilities;
|
|
13
13
|
|
|
14
|
-
class Type extends Element {
|
|
14
|
+
export default define(class Type extends Element {
|
|
15
15
|
constructor(context, string, node, name, prefixName, superTypes, properties, provisional) {
|
|
16
16
|
super(context, string, node);
|
|
17
17
|
this.name = name;
|
|
@@ -129,7 +129,8 @@ class Type extends Element {
|
|
|
129
129
|
|
|
130
130
|
if (superTypesLength === 1) {
|
|
131
131
|
const firstSuperType = first(this.superTypes),
|
|
132
|
-
superType = firstSuperType
|
|
132
|
+
superType = firstSuperType, ///
|
|
133
|
+
baseType = baseTypeFromNothing();
|
|
133
134
|
|
|
134
135
|
if (superType === baseType) {
|
|
135
136
|
basic = true;
|
|
@@ -166,6 +167,8 @@ class Type extends Element {
|
|
|
166
167
|
isSubTypeOf(type) {
|
|
167
168
|
let subTypeOf;
|
|
168
169
|
|
|
170
|
+
const baseType = baseTypeFromNothing();
|
|
171
|
+
|
|
169
172
|
if (this === baseType) {
|
|
170
173
|
subTypeOf = false;
|
|
171
174
|
} else {
|
|
@@ -217,15 +220,16 @@ class Type extends Element {
|
|
|
217
220
|
return equalToOrSuperTypeOf;
|
|
218
221
|
}
|
|
219
222
|
|
|
220
|
-
|
|
223
|
+
compareTypeName(typeName) {
|
|
221
224
|
const name = this.getName(),
|
|
222
|
-
|
|
225
|
+
nameTypeName = (name === typeName),
|
|
226
|
+
comparesToTypeName = nameTypeName; ///
|
|
223
227
|
|
|
224
|
-
return
|
|
228
|
+
return comparesToTypeName;
|
|
225
229
|
}
|
|
226
230
|
|
|
227
|
-
|
|
228
|
-
let
|
|
231
|
+
compareProvisional(provisional) {
|
|
232
|
+
let comparesToProvisional;
|
|
229
233
|
|
|
230
234
|
const provisionalA = provisional; ///
|
|
231
235
|
|
|
@@ -233,45 +237,54 @@ class Type extends Element {
|
|
|
233
237
|
|
|
234
238
|
const provisionalB = provisional; ///
|
|
235
239
|
|
|
236
|
-
|
|
240
|
+
comparesToProvisional = (provisionalA === provisionalB);
|
|
237
241
|
|
|
238
|
-
return
|
|
242
|
+
return comparesToProvisional;
|
|
239
243
|
}
|
|
240
244
|
|
|
241
|
-
|
|
242
|
-
let
|
|
245
|
+
comparePrefixedTypeName(prefixedTypeName) {
|
|
246
|
+
let comparesToPrefixedTypeName = false;
|
|
243
247
|
|
|
244
248
|
const prefixed = this.isPrefixed();
|
|
245
249
|
|
|
246
250
|
if (prefixed) {
|
|
247
|
-
const prefixedName = this.getPrefixedName()
|
|
251
|
+
const prefixedName = this.getPrefixedName(),
|
|
252
|
+
prefixedTypeNamePrefixedName = (prefixedTypeName === prefixedName);
|
|
248
253
|
|
|
249
|
-
|
|
254
|
+
if (prefixedTypeNamePrefixedName) {
|
|
255
|
+
comparesToPrefixedTypeName = true;
|
|
256
|
+
}
|
|
250
257
|
}
|
|
251
258
|
|
|
252
|
-
return
|
|
259
|
+
return comparesToPrefixedTypeName;
|
|
253
260
|
}
|
|
254
261
|
|
|
255
|
-
|
|
256
|
-
let
|
|
262
|
+
compareNominalTypeName(nominalTypeName) {
|
|
263
|
+
let comparesToNominalTypeName = false;
|
|
257
264
|
|
|
258
|
-
if (!
|
|
259
|
-
const name = this.getName()
|
|
265
|
+
if (!comparesToNominalTypeName) {
|
|
266
|
+
const name = this.getName(),
|
|
267
|
+
nominalTypeNameName = (nominalTypeName === name);
|
|
260
268
|
|
|
261
|
-
|
|
269
|
+
if (nominalTypeNameName) {
|
|
270
|
+
comparesToNominalTypeName = true;
|
|
271
|
+
}
|
|
262
272
|
}
|
|
263
273
|
|
|
264
|
-
if (!
|
|
274
|
+
if (!comparesToNominalTypeName) {
|
|
265
275
|
const prefixed = this.isPrefixed();
|
|
266
276
|
|
|
267
277
|
if (prefixed) {
|
|
268
|
-
const prefixedName = this.getPrefixedName()
|
|
278
|
+
const prefixedName = this.getPrefixedName(),
|
|
279
|
+
nominalTypeNamePrefixedName = (nominalTypeName === prefixedName);
|
|
269
280
|
|
|
270
|
-
|
|
281
|
+
if (nominalTypeNamePrefixedName) {
|
|
282
|
+
comparesToNominalTypeName = true;
|
|
283
|
+
}
|
|
271
284
|
}
|
|
272
285
|
}
|
|
273
286
|
|
|
274
|
-
return
|
|
287
|
+
return comparesToNominalTypeName;
|
|
275
288
|
}
|
|
276
289
|
|
|
277
290
|
toJSON() {
|
|
@@ -307,24 +320,17 @@ class Type extends Element {
|
|
|
307
320
|
|
|
308
321
|
return type;
|
|
309
322
|
}
|
|
310
|
-
}
|
|
311
323
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
class BaseType extends Type {
|
|
315
|
-
static fromNothing() {
|
|
316
|
-
const name = BASE_TYPE_SYMBOL, ///
|
|
317
|
-
context = null,
|
|
324
|
+
static fromName(name) {
|
|
325
|
+
const context = null,
|
|
318
326
|
string = name, ///
|
|
319
327
|
node = null,
|
|
320
328
|
prefixName = null,
|
|
321
329
|
superTypes = [],
|
|
322
330
|
properties = [],
|
|
323
331
|
provisional = false,
|
|
324
|
-
|
|
332
|
+
type = new Type(context, string, node, name, prefixName, superTypes, properties, provisional);
|
|
325
333
|
|
|
326
|
-
return
|
|
334
|
+
return type;
|
|
327
335
|
}
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
export const baseType = BaseType.fromNothing();
|
|
336
|
+
});
|
|
@@ -15,10 +15,10 @@ export default define(class TypePrefix extends Element {
|
|
|
15
15
|
return this.name;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
const
|
|
18
|
+
compareTypePrefixName(typePrefixName) {
|
|
19
|
+
const comparesToTypePrefixName = (this.name === typePrefixName);
|
|
20
20
|
|
|
21
|
-
return
|
|
21
|
+
return comparesToTypePrefixName;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
toJSON() {
|
package/src/element/variable.js
CHANGED
|
@@ -34,18 +34,18 @@ export default define(class Variable extends Element {
|
|
|
34
34
|
|
|
35
35
|
getTypeString() { return this.type.getString(); }
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
compareParameter(parameter) {
|
|
38
38
|
const parameterName = parameter.getName(),
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
identifierParamterName = (this.identifier === parameterName),
|
|
40
|
+
comparesToParamter = identifierParamterName; ///
|
|
41
41
|
|
|
42
|
-
return
|
|
42
|
+
return comparesToParamter;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
const
|
|
45
|
+
compareVariableIdentifier(variableIdentifier) {
|
|
46
|
+
const comparesToVariablbeIdentifier = (this.identifier === variableIdentifier);
|
|
47
47
|
|
|
48
|
-
return
|
|
48
|
+
return comparesToVariablbeIdentifier;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
verify(context) {
|
package/src/element.js
CHANGED
|
@@ -31,7 +31,9 @@ export default class Element {
|
|
|
31
31
|
this.node = node;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
matchNode(node) { return this.node.match(node); }
|
|
35
|
+
|
|
36
|
+
isEqualTo(element) {
|
|
35
37
|
const elementNode = element.getNode(),
|
|
36
38
|
matches = this.node.match(elementNode),
|
|
37
39
|
equalTo = matches; ///
|
package/src/metaTypes.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import elements from "./elements";
|
|
4
|
+
|
|
5
|
+
import { FRAME_META_TYPE_NAME, REFERENCE_META_TYPE_NAME, STATEMENT_META_TYPE_NAME } from "./metaTypeNames";
|
|
6
|
+
|
|
7
|
+
let frameMetaType = null,
|
|
8
|
+
referenceMetaType = null,
|
|
9
|
+
statementMetaType = null;
|
|
10
|
+
|
|
11
|
+
export function frameMetaTypeFromNothing() {
|
|
12
|
+
if (frameMetaType === null) {
|
|
13
|
+
const { MetaType } = elements,
|
|
14
|
+
name = FRAME_META_TYPE_NAME; ///
|
|
15
|
+
|
|
16
|
+
frameMetaType = MetaType.fromName(name);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return frameMetaType;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function referenceMetaTypeFromNothing() {
|
|
23
|
+
if (referenceMetaType === null) {
|
|
24
|
+
const { MetaType } = elements,
|
|
25
|
+
name = REFERENCE_META_TYPE_NAME; ///
|
|
26
|
+
|
|
27
|
+
referenceMetaType = MetaType.fromName(name);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return referenceMetaType;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function statementMetaTypeFromNothing() {
|
|
34
|
+
if (statementMetaType === null) {
|
|
35
|
+
const { MetaType } = elements,
|
|
36
|
+
name = STATEMENT_META_TYPE_NAME; ///
|
|
37
|
+
|
|
38
|
+
statementMetaType = MetaType.fromName(name);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return statementMetaType;
|
|
42
|
+
}
|
|
@@ -33,11 +33,11 @@ export default class AxiomLemmaTheoremConjectureNode extends NonTerminalNode {
|
|
|
33
33
|
return labelNodes;
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
getProofNode() {
|
|
37
37
|
const bodyNode = this.getBodyNode(),
|
|
38
|
-
|
|
38
|
+
proofNode = bodyNode.getProofNode();
|
|
39
39
|
|
|
40
|
-
return
|
|
40
|
+
return proofNode;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
getDeductionNode() {
|
|
@@ -47,11 +47,11 @@ export default class AxiomLemmaTheoremConjectureNode extends NonTerminalNode {
|
|
|
47
47
|
return deductionNode;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
getSuppositionNodes() {
|
|
51
51
|
const bodyNode = this.getBodyNode(),
|
|
52
|
-
|
|
52
|
+
suppositionNodes = bodyNode.getSuppositionNodes();
|
|
53
53
|
|
|
54
|
-
return
|
|
54
|
+
return suppositionNodes;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
static fromRuleNameChildNodesOpacityAndPrecedence(Class, ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(Class, ruleName, childNodes, opacity, precedence); }
|
package/src/node/body/axiom.js
CHANGED
|
@@ -1,28 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import BodyNode from "../../node/body";
|
|
4
|
-
import { DEDUCTION_RULE_NAME, SUPPOSITION_RULE_NAME } from "../../ruleNames";
|
|
5
4
|
|
|
6
5
|
export default class AxiomBodyNode extends BodyNode {
|
|
7
|
-
getProofNode() {
|
|
8
|
-
const proofNode = null;
|
|
9
|
-
|
|
10
|
-
return proofNode;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
getDeductionNode() {
|
|
14
|
-
const ruleName = DEDUCTION_RULE_NAME,
|
|
15
|
-
deductionNode = this.getNodeByRuleName(ruleName);
|
|
16
|
-
|
|
17
|
-
return deductionNode;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
getSuppositionNodes() {
|
|
21
|
-
const ruleName = SUPPOSITION_RULE_NAME,
|
|
22
|
-
suppositionNodes = this.getNodesByRuleName(ruleName);
|
|
23
|
-
|
|
24
|
-
return suppositionNodes;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
6
|
static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return BodyNode.fromRuleNameChildNodesOpacityAndPrecedence(AxiomBodyNode, ruleName, childNodes, opacity, precedence); }
|
|
28
7
|
}
|