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
package/src/element/premise.js
CHANGED
|
@@ -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 Premise extends Element {
|
|
@@ -25,8 +24,8 @@ export default define(class Premise extends Element {
|
|
|
25
24
|
return this.procedureCall;
|
|
26
25
|
}
|
|
27
26
|
|
|
28
|
-
|
|
29
|
-
let
|
|
27
|
+
verify(context) {
|
|
28
|
+
let verifies = false;
|
|
30
29
|
|
|
31
30
|
const temporaryContext = TemporaryContext.fromNothing(context);
|
|
32
31
|
|
|
@@ -35,53 +34,56 @@ export default define(class Premise extends Element {
|
|
|
35
34
|
const node = this.getNode(),
|
|
36
35
|
premiseString = this.getString(); ///
|
|
37
36
|
|
|
38
|
-
context.trace(`
|
|
37
|
+
context.trace(`Verifying the '${premiseString}' premise...`, node);
|
|
39
38
|
|
|
40
|
-
if (
|
|
41
|
-
|
|
42
|
-
} else
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
39
|
+
if ((this.statement === null) && (this.procedureCall === null)) {
|
|
40
|
+
context.debug(`Unable to verify the '${premiseString}' premise 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);
|
|
46
46
|
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
if (statementValidates) {
|
|
48
|
+
const assignmentsAssigned = assignAssignments(assignments, context);
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
if (assignmentsAssigned) {
|
|
51
|
+
const { Step } = elements,
|
|
52
|
+
step = Step.fromStatement(this.statement, context),
|
|
53
|
+
stepOrSubproof = step; ///
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
context.addStepOrSubproof(stepOrSubproof);
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
verifies = true;
|
|
58
|
+
}
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
|
-
} else if (this.procedureCall !== null) {
|
|
61
|
-
const stated = true,
|
|
62
|
-
assignments = null,
|
|
63
|
-
procedureCallVerifies = this.procedureCall.verify(assignments, stated, context);
|
|
64
61
|
|
|
65
|
-
if (
|
|
66
|
-
|
|
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
|
+
}
|
|
67
70
|
}
|
|
68
|
-
} else {
|
|
69
|
-
context.debug(`Unable to validate the '${premiseString}' premise because it is nonsense.`, node);
|
|
70
71
|
}
|
|
71
72
|
|
|
72
|
-
if (
|
|
73
|
+
if (verifies) {
|
|
73
74
|
this.setContext(context);
|
|
74
75
|
|
|
75
|
-
context.debug(`...
|
|
76
|
+
context.debug(`...verified the '${premiseString}' premise.`, node);
|
|
76
77
|
}
|
|
77
78
|
|
|
78
|
-
return
|
|
79
|
+
return verifies;
|
|
79
80
|
}
|
|
80
81
|
|
|
81
82
|
unifyIndependently(substitutions, context) {
|
|
82
83
|
let unifiesIndependently = false;
|
|
83
84
|
|
|
84
|
-
const
|
|
85
|
+
const node = this.getNode(),
|
|
86
|
+
premiseString = this.getString(), ///
|
|
85
87
|
generalContext = this.context, ///
|
|
86
88
|
specificContext = context; ///
|
|
87
89
|
|
|
@@ -146,22 +148,7 @@ export default define(class Premise extends Element {
|
|
|
146
148
|
return stepOrSubproofUnifies;
|
|
147
149
|
}
|
|
148
150
|
|
|
149
|
-
|
|
150
|
-
let stepUnifies = false;
|
|
151
|
-
|
|
152
|
-
context = step.getContext();
|
|
153
|
-
|
|
154
|
-
const statement = step.getStatement(),
|
|
155
|
-
statementUnifies = this.unifyStatement(statement, substitutions, context);
|
|
156
|
-
|
|
157
|
-
if (statementUnifies) {
|
|
158
|
-
stepUnifies = true;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
return stepUnifies;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
unifySubproof(subproof, substitutions, generalContext, specificContext) {
|
|
151
|
+
unifySubproof(subproof, substitutions, context) {
|
|
165
152
|
let subproofUnifies = false;
|
|
166
153
|
|
|
167
154
|
const premise = this, ///
|
|
@@ -169,10 +156,18 @@ export default define(class Premise extends Element {
|
|
|
169
156
|
premiseStatement = premise.getStatement(),
|
|
170
157
|
premiseStatementString = premiseStatement.getString();
|
|
171
158
|
|
|
172
|
-
|
|
159
|
+
context.trace(`Unifying the '${subproofString}' subproof with the premise's '${premiseStatementString}' statement...`);
|
|
160
|
+
|
|
161
|
+
const specificContext = context; ///
|
|
162
|
+
|
|
163
|
+
context = this.getContext();
|
|
164
|
+
|
|
165
|
+
const generalContext = context; ///
|
|
166
|
+
|
|
167
|
+
context = specificContext; ///
|
|
173
168
|
|
|
174
169
|
if (this.statement !== null) {
|
|
175
|
-
const context = generalContext,
|
|
170
|
+
const context = generalContext, ///
|
|
176
171
|
subproofAssertion = subproofAssertionFromStatement(this.statement, context);
|
|
177
172
|
|
|
178
173
|
if (subproofAssertion !== null) {
|
|
@@ -181,33 +176,31 @@ export default define(class Premise extends Element {
|
|
|
181
176
|
}
|
|
182
177
|
|
|
183
178
|
if (subproofUnifies) {
|
|
184
|
-
|
|
179
|
+
context.debug(`...unified the '${subproofString}' subproof with the premise's '${premiseStatementString}' statement.`);
|
|
185
180
|
}
|
|
186
181
|
|
|
187
182
|
return subproofUnifies;
|
|
188
183
|
}
|
|
189
184
|
|
|
190
|
-
|
|
191
|
-
let
|
|
185
|
+
unifyStep(step, substitutions, context) {
|
|
186
|
+
let stepUnifies = false;
|
|
192
187
|
|
|
193
|
-
const
|
|
194
|
-
premiseString = premise.getString(),
|
|
195
|
-
statementString = statement.getString();
|
|
188
|
+
const specificContext = context; ///
|
|
196
189
|
|
|
197
|
-
context.
|
|
190
|
+
context = this.getContext();
|
|
198
191
|
|
|
199
|
-
|
|
200
|
-
const generalContext = this.context, ///
|
|
201
|
-
specificContext = context; ///
|
|
192
|
+
const generalContext = context; ///
|
|
202
193
|
|
|
203
|
-
|
|
204
|
-
|
|
194
|
+
context = specificContext; ///
|
|
195
|
+
|
|
196
|
+
const statement = step.getStatement(),
|
|
197
|
+
statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
|
|
205
198
|
|
|
206
199
|
if (statementUnifies) {
|
|
207
|
-
|
|
200
|
+
stepUnifies = true;
|
|
208
201
|
}
|
|
209
202
|
|
|
210
|
-
return
|
|
203
|
+
return stepUnifies;
|
|
211
204
|
}
|
|
212
205
|
|
|
213
206
|
toJSON() {
|
package/src/element/property.js
CHANGED
|
@@ -20,16 +20,16 @@ export default define(class Property extends Element {
|
|
|
20
20
|
return this.nominalTypeName;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
const
|
|
23
|
+
comparePropertyName(propertyName) {
|
|
24
|
+
const comparesToPropertyName = (this.name === propertyName);
|
|
25
25
|
|
|
26
|
-
return
|
|
26
|
+
return comparesToPropertyName;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
const
|
|
29
|
+
compareNominalTypeName(nominalTypeName) {
|
|
30
|
+
const comparesToNominalTypeName = (this.nominalTypeName === nominalTypeName);
|
|
31
31
|
|
|
32
|
-
return
|
|
32
|
+
return comparesToNominalTypeName;
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
toJSON() {
|
|
@@ -27,9 +27,9 @@ export default define(class PropertyRelation extends Element {
|
|
|
27
27
|
|
|
28
28
|
context.trace(`Verifying the '${propertyRelationString}' property relation...`);
|
|
29
29
|
|
|
30
|
-
const
|
|
30
|
+
const termValidates = this.validateTerm(context);
|
|
31
31
|
|
|
32
|
-
if (
|
|
32
|
+
if (termValidates) {
|
|
33
33
|
const propertyVerifies = this.verifyProperty(context);
|
|
34
34
|
|
|
35
35
|
verifies = propertyVerifies;
|
|
@@ -42,24 +42,24 @@ export default define(class PropertyRelation extends Element {
|
|
|
42
42
|
return verifies;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
let
|
|
45
|
+
validateTerm(context) {
|
|
46
|
+
let termValidates;
|
|
47
47
|
|
|
48
48
|
const termString = this.term.getString();
|
|
49
49
|
|
|
50
|
-
context.trace(`
|
|
50
|
+
context.trace(`Validating the '${termString}' term...`);
|
|
51
51
|
|
|
52
|
-
|
|
52
|
+
termValidates = this.term.validate(context, () => {
|
|
53
53
|
const verifiesAhead = true;
|
|
54
54
|
|
|
55
55
|
return verifiesAhead;
|
|
56
56
|
});
|
|
57
57
|
|
|
58
|
-
if (
|
|
59
|
-
context.debug(`...
|
|
58
|
+
if (termValidates) {
|
|
59
|
+
context.debug(`...validated the '${termString}' term.`);
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
return
|
|
62
|
+
return termValidates;
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
verifyProperty(context) {
|
|
@@ -73,9 +73,9 @@ export default define(class PropertyRelation extends Element {
|
|
|
73
73
|
propertyName = this.property.getName(),
|
|
74
74
|
termTypeProperties = termType.getProperties(),
|
|
75
75
|
variableTypeProperty = termTypeProperties.find((termTypeProperty) => {
|
|
76
|
-
const
|
|
76
|
+
const termTypePropertyComparesToPropertyName = termTypeProperty.comparePropertyName(propertyName);
|
|
77
77
|
|
|
78
|
-
if (
|
|
78
|
+
if (termTypePropertyComparesToPropertyName) {
|
|
79
79
|
return true;
|
|
80
80
|
}
|
|
81
81
|
}) || null;
|
package/src/element/reference.js
CHANGED
|
@@ -4,7 +4,7 @@ import Element from "../element";
|
|
|
4
4
|
import elements from "../elements";
|
|
5
5
|
|
|
6
6
|
import { define } from "../elements";
|
|
7
|
-
import {
|
|
7
|
+
import { referenceMetaTypeFromNothing } from "../metaTypes";
|
|
8
8
|
import { unifyMetavariableIntrinsically } from "../process/unify";
|
|
9
9
|
import { metavariableFromJSON, metavariableToMetavariableJSON } from "../utilities/json";
|
|
10
10
|
|
|
@@ -35,19 +35,9 @@ export default define(class Reference extends Element {
|
|
|
35
35
|
|
|
36
36
|
isMetavariableEqualToMetavariable(metavariable) { return this.metavariable.isEqualTo(metavariable); }
|
|
37
37
|
|
|
38
|
-
|
|
38
|
+
compareMetavariableName(metavariableName) { return this.metavariable.compareMetavariableName(metavariableName); }
|
|
39
39
|
|
|
40
|
-
matchMetavariableNode(metavariableNode) {
|
|
41
|
-
const metavariableNodeA = metavariableNode; ///
|
|
42
|
-
|
|
43
|
-
metavariableNode = this.metavariable.getNode();
|
|
44
|
-
|
|
45
|
-
const metavariableNodeB = metavariableNode, ///
|
|
46
|
-
matches = metavariableNodeA.match(metavariableNodeB),
|
|
47
|
-
metavariableNodeMatches = matches; ///
|
|
48
|
-
|
|
49
|
-
return metavariableNodeMatches; ///
|
|
50
|
-
}
|
|
40
|
+
matchMetavariableNode(metavariableNode) { return this.metavariable.matchNode(metavariableNode); }
|
|
51
41
|
|
|
52
42
|
verify(context) {
|
|
53
43
|
let verifies = false;
|
|
@@ -57,9 +47,9 @@ export default define(class Reference extends Element {
|
|
|
57
47
|
context.trace(`Verifying the '${referenceString}' reference...`);
|
|
58
48
|
|
|
59
49
|
if (!verifies) {
|
|
60
|
-
const
|
|
50
|
+
const metavariableValidates = this.validateMetavariable(context);
|
|
61
51
|
|
|
62
|
-
verifies =
|
|
52
|
+
verifies = metavariableValidates; ///
|
|
63
53
|
}
|
|
64
54
|
|
|
65
55
|
if (!verifies) {
|
|
@@ -80,15 +70,16 @@ export default define(class Reference extends Element {
|
|
|
80
70
|
return verifies;
|
|
81
71
|
}
|
|
82
72
|
|
|
83
|
-
|
|
84
|
-
let
|
|
73
|
+
validateMetavariable(context) {
|
|
74
|
+
let metavariableValidates;
|
|
85
75
|
|
|
86
|
-
const
|
|
87
|
-
|
|
76
|
+
const referenceMetaType = referenceMetaTypeFromNothing(),
|
|
77
|
+
metaType = referenceMetaType, ///
|
|
78
|
+
metavariableValidatesGivenMetaType = this.metavariable.validateGivenMetaType(metaType, context);
|
|
88
79
|
|
|
89
|
-
|
|
80
|
+
metavariableValidates = metavariableValidatesGivenMetaType; ///
|
|
90
81
|
|
|
91
|
-
return
|
|
82
|
+
return metavariableValidates;
|
|
92
83
|
}
|
|
93
84
|
|
|
94
85
|
unifyLabel(label, substitutions, context) {
|
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) {
|
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
|
+
compareStepsOrSubproofs(stepsOrSubproofs, context) {
|
|
258
|
+
let comparesToStepsOrSubproofs;
|
|
261
259
|
|
|
262
|
-
|
|
260
|
+
comparesToStepsOrSubproofs = backwardsSome(stepsOrSubproofs, (stepOrSubproof) => {
|
|
263
261
|
const statement = this, ///
|
|
264
|
-
|
|
262
|
+
stepOrSubproofComparesToStatement = stepOrSubproof.compareStatement(statement, context);
|
|
265
263
|
|
|
266
|
-
if (
|
|
264
|
+
if (stepOrSubproofComparesToStatement) {
|
|
267
265
|
return true;
|
|
268
266
|
}
|
|
269
267
|
});
|
|
270
268
|
|
|
271
|
-
return
|
|
269
|
+
return comparesToStepsOrSubproofs;
|
|
272
270
|
}
|
|
273
271
|
|
|
274
272
|
toJSON() {
|