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/context/temporary.js
CHANGED
|
@@ -159,9 +159,9 @@ export default class TemporaryContext {
|
|
|
159
159
|
|
|
160
160
|
findTermByTermNode(termNode) {
|
|
161
161
|
const term = this.terms.find((term) => {
|
|
162
|
-
const
|
|
162
|
+
const termNodeMatches = term.matchNode(termNode);
|
|
163
163
|
|
|
164
|
-
if (
|
|
164
|
+
if (termNodeMatches) {
|
|
165
165
|
return true;
|
|
166
166
|
}
|
|
167
167
|
}) || null;
|
|
@@ -171,9 +171,9 @@ export default class TemporaryContext {
|
|
|
171
171
|
|
|
172
172
|
findFrameByFrameNode(frameNode) {
|
|
173
173
|
const frame = this.frames.find((frame) => {
|
|
174
|
-
const
|
|
174
|
+
const frameNodeMatches = frame.matchNode(frameNode);
|
|
175
175
|
|
|
176
|
-
if (
|
|
176
|
+
if (frameNodeMatches) {
|
|
177
177
|
return true;
|
|
178
178
|
}
|
|
179
179
|
}) || null;
|
|
@@ -183,9 +183,9 @@ export default class TemporaryContext {
|
|
|
183
183
|
|
|
184
184
|
findStatementByStatementNode(statementNode) {
|
|
185
185
|
const statement = this.statements.find((statement) => {
|
|
186
|
-
const
|
|
186
|
+
const statementNodeMatches = statement.matchNode(statementNode);
|
|
187
187
|
|
|
188
|
-
if (
|
|
188
|
+
if (statementNodeMatches) {
|
|
189
189
|
return true;
|
|
190
190
|
}
|
|
191
191
|
}) || null;
|
|
@@ -195,9 +195,9 @@ export default class TemporaryContext {
|
|
|
195
195
|
|
|
196
196
|
findAssertionByAssertionNode(assertionNode) {
|
|
197
197
|
const assertion = this.assertions.find((assertion) => {
|
|
198
|
-
const
|
|
198
|
+
const assertionNodeMatches = assertion.matchNode(assertionNode);
|
|
199
199
|
|
|
200
|
-
if (
|
|
200
|
+
if (assertionNodeMatches) {
|
|
201
201
|
return true;
|
|
202
202
|
}
|
|
203
203
|
}) || null;
|
|
@@ -219,9 +219,9 @@ export default class TemporaryContext {
|
|
|
219
219
|
|
|
220
220
|
findSubstitutionBySubstitutionNode(substitutionNode) {
|
|
221
221
|
const substitution = this.substitutions.find((substitution) => {
|
|
222
|
-
const
|
|
222
|
+
const substitutionNodeMatches = substitution.matchNode(substitutionNode);
|
|
223
223
|
|
|
224
|
-
if (
|
|
224
|
+
if (substitutionNodeMatches) {
|
|
225
225
|
return true;
|
|
226
226
|
}
|
|
227
227
|
}) || null;
|
|
@@ -349,7 +349,7 @@ export default class TemporaryContext {
|
|
|
349
349
|
|
|
350
350
|
isMetavariableDefined(metavariable) { return this.context.isMetavariableDefined(metavariable); }
|
|
351
351
|
|
|
352
|
-
|
|
352
|
+
compareTermAndPropertyRelation(term, propertyRelation) { return this.context.compareTermAndPropertyRelation(term, propertyRelation); }
|
|
353
353
|
|
|
354
354
|
nodeAsString(node) { return this.context.nodeAsString(node); }
|
|
355
355
|
|
|
@@ -3,12 +3,11 @@
|
|
|
3
3
|
import Assertion from "../assertion";
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
|
-
import { containedAssertionFromStatementNode } from "../../utilities/element";
|
|
7
6
|
import { termFromTermAndSubstitutions, frameFromFrameAndSubstitutions, statementFromStatementAndSubstitutions } from "../../utilities/substitutions";
|
|
8
7
|
|
|
9
8
|
export default define(class ContainedAssertion extends Assertion {
|
|
10
|
-
constructor(string, node, term, frame, negated, statement) {
|
|
11
|
-
super(string, node);
|
|
9
|
+
constructor(cpontext, string, node, term, frame, negated, statement) {
|
|
10
|
+
super(context, string, node);
|
|
12
11
|
|
|
13
12
|
this.term = term;
|
|
14
13
|
this.frame = frame;
|
|
@@ -39,11 +38,11 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
39
38
|
|
|
40
39
|
context.trace(`Verifying the '${containedAssertionString}' contained assertion...`);
|
|
41
40
|
|
|
42
|
-
const
|
|
41
|
+
const termValidates = this.validateTerm(assignments, stated, context),
|
|
43
42
|
frameVerifies = this.verifyFrame(assignments, stated, context),
|
|
44
|
-
|
|
43
|
+
statementValidates = this.validateStatement(assignments, stated, context)
|
|
45
44
|
|
|
46
|
-
if (
|
|
45
|
+
if (termValidates || frameVerifies || statementValidates) {
|
|
47
46
|
let verifiesWhenStated = false,
|
|
48
47
|
verifiesWhenDerived = false;
|
|
49
48
|
|
|
@@ -65,32 +64,32 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
65
64
|
return verifies;
|
|
66
65
|
}
|
|
67
66
|
|
|
68
|
-
|
|
69
|
-
let
|
|
67
|
+
validateTerm(assignments, stated, context) {
|
|
68
|
+
let termValidates = false;
|
|
70
69
|
|
|
71
70
|
if (this.term !== null) {
|
|
72
71
|
const termString = this.term.getString();
|
|
73
72
|
|
|
74
|
-
context.trace(`
|
|
73
|
+
context.trace(`Validating the '${termString}' term...`);
|
|
75
74
|
|
|
76
75
|
const termSingular = this.term.isSingular();
|
|
77
76
|
|
|
78
77
|
if (!termSingular) {
|
|
79
78
|
context.debug(`The '${termString}' term is not singular.`);
|
|
80
79
|
} else {
|
|
81
|
-
|
|
80
|
+
termValidates = this.term.validate(context, () => {
|
|
82
81
|
const verifiesAhead = true;
|
|
83
82
|
|
|
84
83
|
return verifiesAhead;
|
|
85
84
|
});
|
|
86
85
|
|
|
87
|
-
if (
|
|
88
|
-
context.debug(`...
|
|
86
|
+
if (termValidates) {
|
|
87
|
+
context.debug(`...validated the '${termString}' term.`);
|
|
89
88
|
}
|
|
90
89
|
}
|
|
91
90
|
}
|
|
92
91
|
|
|
93
|
-
return
|
|
92
|
+
return termValidates;
|
|
94
93
|
}
|
|
95
94
|
|
|
96
95
|
verifyFrame(assignments, stated, context) {
|
|
@@ -121,26 +120,26 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
121
120
|
return frameVerifies;
|
|
122
121
|
}
|
|
123
122
|
|
|
124
|
-
|
|
125
|
-
let
|
|
123
|
+
validateStatement(assignments, stated, context) {
|
|
124
|
+
let statementValidates = false;
|
|
126
125
|
|
|
127
126
|
if (this.statement !== null) {
|
|
128
127
|
const statementString = this.statement.getString();
|
|
129
128
|
|
|
130
|
-
context.trace(`
|
|
129
|
+
context.trace(`Validating the '${statementString}' statement...`);
|
|
131
130
|
|
|
132
131
|
stated = true; ///
|
|
133
132
|
|
|
134
133
|
assignments = null; ///
|
|
135
134
|
|
|
136
|
-
|
|
135
|
+
statementValidates = this.statement.validate(assignments, stated, context);
|
|
137
136
|
|
|
138
|
-
if (
|
|
139
|
-
context.debug(`...
|
|
137
|
+
if (statementValidates) {
|
|
138
|
+
context.debug(`...validated the '${statementString}' statement.`);
|
|
140
139
|
}
|
|
141
140
|
}
|
|
142
141
|
|
|
143
|
-
return
|
|
142
|
+
return statementValidates;
|
|
144
143
|
}
|
|
145
144
|
|
|
146
145
|
verifyWhenStated(assignments, context) {
|
|
@@ -4,12 +4,11 @@ import elements from "../../elements";
|
|
|
4
4
|
import Assertion from "../assertion";
|
|
5
5
|
|
|
6
6
|
import { define } from "../../elements";
|
|
7
|
-
import { definedAssertionFromStatementNode } from "../../utilities/element";
|
|
8
7
|
import { termFromTermAndSubstitutions, frameFromFrameAndSubstitutions } from "../../utilities/substitutions";
|
|
9
8
|
|
|
10
9
|
export default define(class DefinedAssertion extends Assertion {
|
|
11
|
-
constructor(string, node, term, frame, negated) {
|
|
12
|
-
super(string, node);
|
|
10
|
+
constructor(context, string, node, term, frame, negated) {
|
|
11
|
+
super(context, string, node);
|
|
13
12
|
|
|
14
13
|
this.term = term;
|
|
15
14
|
this.frame= frame;
|
|
@@ -35,10 +34,10 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
35
34
|
|
|
36
35
|
context.trace(`Verifying the '${definedAssertionString}' defined assertion...`);
|
|
37
36
|
|
|
38
|
-
const
|
|
37
|
+
const termValidates = this.validateTerm(assignments, stated, context),
|
|
39
38
|
frameVerifies = this.verifyFrame(assignments, stated, context);
|
|
40
39
|
|
|
41
|
-
if (
|
|
40
|
+
if (termValidates || frameVerifies) {
|
|
42
41
|
let verifiesWhenStated = false,
|
|
43
42
|
verifiesWhenDerived = false;
|
|
44
43
|
|
|
@@ -60,32 +59,32 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
60
59
|
return verifies;
|
|
61
60
|
}
|
|
62
61
|
|
|
63
|
-
|
|
64
|
-
let
|
|
62
|
+
validateTerm(assignments, stated, context) {
|
|
63
|
+
let termValidates = false;
|
|
65
64
|
|
|
66
65
|
if (this.term !== null) {
|
|
67
66
|
const termString = this.term.getString(); ///
|
|
68
67
|
|
|
69
|
-
context.trace(`
|
|
68
|
+
context.trace(`Validating the '${termString}' term...`);
|
|
70
69
|
|
|
71
70
|
const termSingular = this.term.isSingular();
|
|
72
71
|
|
|
73
72
|
if (!termSingular) {
|
|
74
73
|
context.debug(`The '${termString}' term is not singular.`);
|
|
75
74
|
} else {
|
|
76
|
-
|
|
75
|
+
termValidates = this.term.validate(context, () => {
|
|
77
76
|
const verifiesAhead = true;
|
|
78
77
|
|
|
79
78
|
return verifiesAhead;
|
|
80
79
|
});
|
|
81
80
|
|
|
82
|
-
if (
|
|
83
|
-
context.debug(`...
|
|
81
|
+
if (termValidates) {
|
|
82
|
+
context.debug(`...validated the '${termString}' term.`);
|
|
84
83
|
}
|
|
85
84
|
}
|
|
86
85
|
}
|
|
87
86
|
|
|
88
|
-
return
|
|
87
|
+
return termValidates;
|
|
89
88
|
}
|
|
90
89
|
|
|
91
90
|
verifyFrame(assignments, stated, context) {
|
|
@@ -7,8 +7,8 @@ import { define } from "../../elements";
|
|
|
7
7
|
import { variableAssignmentFromVariable } from "../../process/assign";
|
|
8
8
|
|
|
9
9
|
export default define(class PropertyAssertion extends Assertion {
|
|
10
|
-
constructor(string, node, term, propertyRelation) {
|
|
11
|
-
super(string, node);
|
|
10
|
+
constructor(context, string, node, term, propertyRelation) {
|
|
11
|
+
super(context, string, node);
|
|
12
12
|
|
|
13
13
|
this.term = term;
|
|
14
14
|
this.propertyRelation = propertyRelation;
|
|
@@ -22,14 +22,14 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
22
22
|
return this.propertyRelation;
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
let
|
|
25
|
+
compareTermAndPropertyRelation(term, propertyRelation, context) {
|
|
26
|
+
let comparesToTermAndPropertyRelation = false;
|
|
27
27
|
|
|
28
28
|
const termString = term.getString(),
|
|
29
29
|
propertyRelationString = propertyRelation.getString(),
|
|
30
|
-
propertyAssertionString = this.getString();
|
|
30
|
+
propertyAssertionString = this.getString(); ///
|
|
31
31
|
|
|
32
|
-
context.trace(`
|
|
32
|
+
context.trace(`Comparing the '${propertyAssertionString}' property assertion to the '${termString}' term and '${propertyRelationString}' property relation...`);
|
|
33
33
|
|
|
34
34
|
const termA = term,
|
|
35
35
|
termB = this.term, ///
|
|
@@ -38,14 +38,14 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
38
38
|
if (termAEqualToTermB) {
|
|
39
39
|
const propertyRelationEqualToPropertyRelation = this.propertyRelation.isEqualTo(propertyRelation);
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
comparesToTermAndPropertyRelation = propertyRelationEqualToPropertyRelation; ///
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
if (
|
|
45
|
-
context.debug(`...
|
|
44
|
+
if (comparesToTermAndPropertyRelation) {
|
|
45
|
+
context.debug(`...compared the '${propertyAssertionString}' property assertion to the '${termString}' term and '${propertyRelationString}' property relation.`);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
return
|
|
48
|
+
return comparesToTermAndPropertyRelation;
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
verify(assignments, stated, context) {
|
|
@@ -55,9 +55,9 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
55
55
|
|
|
56
56
|
context.trace(`Verifying the '${propertyAssertionString}' property assertion...`);
|
|
57
57
|
|
|
58
|
-
const
|
|
58
|
+
const termValidates = this.validateTerm(assignments, stated, context);
|
|
59
59
|
|
|
60
|
-
if (
|
|
60
|
+
if (termValidates) {
|
|
61
61
|
const propertyRelationVerifies = this.verifyPropertyRelation(assignments, stated, context);
|
|
62
62
|
|
|
63
63
|
if (propertyRelationVerifies) {
|
|
@@ -89,24 +89,24 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
89
89
|
return verifies;
|
|
90
90
|
}
|
|
91
91
|
|
|
92
|
-
|
|
93
|
-
let
|
|
92
|
+
validateTerm(assignments, stated, context) {
|
|
93
|
+
let termValidates;
|
|
94
94
|
|
|
95
95
|
const termString = this.term.getString();
|
|
96
96
|
|
|
97
|
-
context.trace(`
|
|
97
|
+
context.trace(`Validating the '${termString}' term...`);
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
termValidates = this.term.verify(context, () => {
|
|
100
100
|
const verifiesAhead = true;
|
|
101
101
|
|
|
102
102
|
return verifiesAhead;
|
|
103
103
|
});
|
|
104
104
|
|
|
105
|
-
if (
|
|
106
|
-
context.debug(`...
|
|
105
|
+
if (termValidates) {
|
|
106
|
+
context.debug(`...validated the '${termString}' term.`);
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
return
|
|
109
|
+
return termValidates;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
verifyPropertyRelation(assignments, stated, context) {
|
|
@@ -126,7 +126,7 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
verifyWhenStated(assignments, context) {
|
|
129
|
-
let verifiesWhenStated
|
|
129
|
+
let verifiesWhenStated;
|
|
130
130
|
|
|
131
131
|
const propertyAssertionString = this.getString(); ///
|
|
132
132
|
|
|
@@ -6,8 +6,8 @@ import Assertion from "../assertion";
|
|
|
6
6
|
import { define } from "../../elements";
|
|
7
7
|
|
|
8
8
|
export default define(class SatisfiesAssertion extends Assertion {
|
|
9
|
-
constructor(string, node, signature, reference) {
|
|
10
|
-
super(string, node);
|
|
9
|
+
constructor(context, string, node, signature, reference) {
|
|
10
|
+
super(context, string, node);
|
|
11
11
|
|
|
12
12
|
this.signature = signature;
|
|
13
13
|
this.reference = reference;
|
|
@@ -97,9 +97,9 @@ export default define(class SatisfiesAssertion extends Assertion {
|
|
|
97
97
|
|
|
98
98
|
substitutions = Substitutions.fromNothing();
|
|
99
99
|
|
|
100
|
-
const
|
|
100
|
+
const axiomComparesToSignature = axiom.compareSignature(this.signature, substitutions, context);
|
|
101
101
|
|
|
102
|
-
if (
|
|
102
|
+
if (axiomComparesToSignature) {
|
|
103
103
|
const substitutionsB = substitutions; ///
|
|
104
104
|
|
|
105
105
|
substitutions = Substitutions.fromNothing();
|
|
@@ -108,9 +108,9 @@ export default define(class SatisfiesAssertion extends Assertion {
|
|
|
108
108
|
|
|
109
109
|
if (statementUnifies) {
|
|
110
110
|
const substitutionsA = substitutions, ///
|
|
111
|
-
|
|
111
|
+
substitutionsCorrelate = substitutionsA.correlateSubstitutions(substitutionsB);
|
|
112
112
|
|
|
113
|
-
if (!
|
|
113
|
+
if (!substitutionsCorrelate) {
|
|
114
114
|
const substitutionsAString = substitutionsA.asString(),
|
|
115
115
|
substitutionsBString = substitutionsB.asString();
|
|
116
116
|
|
|
@@ -10,8 +10,8 @@ import { unifyStatement } from "../../process/unify";
|
|
|
10
10
|
const { match } = arrayUtilities;
|
|
11
11
|
|
|
12
12
|
export default define(class SubproofAssertion extends Assertion {
|
|
13
|
-
constructor(string, node, statements) {
|
|
14
|
-
super(string, node);
|
|
13
|
+
constructor(context, string, node, statements) {
|
|
14
|
+
super(context, string, node);
|
|
15
15
|
|
|
16
16
|
this.statements = statements;
|
|
17
17
|
}
|
|
@@ -20,38 +20,40 @@ export default define(class SubproofAssertion extends Assertion {
|
|
|
20
20
|
return this.statements;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
let
|
|
23
|
+
validate(assignments, stated, context) {
|
|
24
|
+
let validates = false;
|
|
25
25
|
|
|
26
26
|
const subproofAssertionString = this.getString(); ///
|
|
27
27
|
|
|
28
|
-
context.trace(`
|
|
28
|
+
context.trace(`Validating the '${subproofAssertionString}' subproof assertion...`);
|
|
29
29
|
|
|
30
|
-
const
|
|
30
|
+
const statementsValidate = this.validateStatements(assignments, stated, context);
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
if (statementsValidate) {
|
|
33
|
+
validates = true;
|
|
34
|
+
}
|
|
33
35
|
|
|
34
|
-
if (
|
|
35
|
-
context.debug(`...
|
|
36
|
+
if (validates) {
|
|
37
|
+
context.debug(`...validated the '${subproofAssertionString}' subproof assertion.`);
|
|
36
38
|
}
|
|
37
39
|
|
|
38
|
-
return
|
|
40
|
+
return validates;
|
|
39
41
|
}
|
|
40
42
|
|
|
41
|
-
|
|
43
|
+
validateStatements(assignments, stated, context) {
|
|
42
44
|
stated = true; ///
|
|
43
45
|
|
|
44
46
|
assignments = null; ///
|
|
45
47
|
|
|
46
|
-
const
|
|
47
|
-
const
|
|
48
|
+
const statementsValidate = this.statements.map((statement) => {
|
|
49
|
+
const statementValidates = statement.validate(assignments, stated, context);
|
|
48
50
|
|
|
49
|
-
if (
|
|
51
|
+
if (statementValidates) {
|
|
50
52
|
return true;
|
|
51
53
|
}
|
|
52
54
|
});
|
|
53
55
|
|
|
54
|
-
return
|
|
56
|
+
return statementsValidate;
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
unifySubproof(subproof, substitutions, generalContext, specificContext) {
|
|
@@ -7,8 +7,8 @@ import { define } from "../../elements";
|
|
|
7
7
|
import { variableAssignmentFromVariable } from "../../process/assign";
|
|
8
8
|
|
|
9
9
|
export default define(class TypeAssertion extends Assertion {
|
|
10
|
-
constructor(string, node, term, type) {
|
|
11
|
-
super(string, node);
|
|
10
|
+
constructor(context, string, node, term, type) {
|
|
11
|
+
super(context, string, node);
|
|
12
12
|
|
|
13
13
|
this.term = term;
|
|
14
14
|
this.type = type;
|
package/src/element/assertion.js
CHANGED
|
@@ -31,13 +31,13 @@ export default define(class Assumption extends Element {
|
|
|
31
31
|
return simple;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
|
|
35
|
-
let
|
|
34
|
+
compareSubstitution(substitution, context) {
|
|
35
|
+
let comparesToSubstituion = false;
|
|
36
36
|
|
|
37
37
|
const assumptionString = this.string, ///
|
|
38
38
|
substitutionString = substitution.getString();
|
|
39
39
|
|
|
40
|
-
context.trace(`
|
|
40
|
+
context.trace(`Comparing the '${assumptionString}' assumption to the '${substitutionString}' substitution...`);
|
|
41
41
|
|
|
42
42
|
const simple = this.isSimple();
|
|
43
43
|
|
|
@@ -46,9 +46,12 @@ export default define(class Assumption extends Element {
|
|
|
46
46
|
judgement = context.findJudgementByMetavariable(metavariable);
|
|
47
47
|
|
|
48
48
|
if (judgement !== null) {
|
|
49
|
-
const assumption = judgement.getDeclaration()
|
|
49
|
+
const assumption = judgement.getDeclaration(),
|
|
50
|
+
assumptionComaresToSubstitution = assumption.compareSubstitution(substitution, context);
|
|
50
51
|
|
|
51
|
-
|
|
52
|
+
if (assumptionComaresToSubstitution) {
|
|
53
|
+
comparesToSubstituion = true;
|
|
54
|
+
}
|
|
52
55
|
}
|
|
53
56
|
} else {
|
|
54
57
|
const statement = substitution.getStatement(),
|
|
@@ -57,15 +60,15 @@ export default define(class Assumption extends Element {
|
|
|
57
60
|
referenceMetavariableEqualToMetavariable = this.reference.isMetavariableEqualToMetavariable(metavariable);
|
|
58
61
|
|
|
59
62
|
if (statementEqualToStatement && referenceMetavariableEqualToMetavariable) {
|
|
60
|
-
|
|
63
|
+
comparesToSubstituion = true;
|
|
61
64
|
}
|
|
62
65
|
}
|
|
63
66
|
|
|
64
|
-
if (
|
|
65
|
-
context.debug(`...
|
|
67
|
+
if (comparesToSubstituion) {
|
|
68
|
+
context.debug(`...compared the '${substitutionString}' assumption to the '${assumptionString}' substitution.`);
|
|
66
69
|
}
|
|
67
70
|
|
|
68
|
-
return
|
|
71
|
+
return comparesToSubstituion;
|
|
69
72
|
}
|
|
70
73
|
|
|
71
74
|
verify(assignments, stated, context) {
|
|
@@ -85,9 +88,9 @@ export default define(class Assumption extends Element {
|
|
|
85
88
|
const referenceVerified = this.verifyReference(assignments, stated, context);
|
|
86
89
|
|
|
87
90
|
if (referenceVerified) {
|
|
88
|
-
const
|
|
91
|
+
const statementValidates = this.validateStatement(assignments, stated, context);
|
|
89
92
|
|
|
90
|
-
if (
|
|
93
|
+
if (statementValidates) {
|
|
91
94
|
let verifiesWhenStated = false,
|
|
92
95
|
verifiesWhenDerived = false;
|
|
93
96
|
|
|
@@ -128,28 +131,28 @@ export default define(class Assumption extends Element {
|
|
|
128
131
|
return referenceVerified;
|
|
129
132
|
}
|
|
130
133
|
|
|
131
|
-
|
|
132
|
-
let
|
|
134
|
+
validateStatement(assignments, stated, context) {
|
|
135
|
+
let statementValidates;
|
|
133
136
|
|
|
134
137
|
if (this.statement === null) {
|
|
135
|
-
|
|
138
|
+
statementValidates = true;
|
|
136
139
|
} else {
|
|
137
140
|
const statementString = this.statement.getString();
|
|
138
141
|
|
|
139
|
-
context.trace(`
|
|
142
|
+
context.trace(`Validating the '${statementString}' statement...`);
|
|
140
143
|
|
|
141
144
|
stated = true; ///
|
|
142
145
|
|
|
143
146
|
assignments = null; ///
|
|
144
147
|
|
|
145
|
-
|
|
148
|
+
statementValidates = this.statement.validate(assignments, stated, context);
|
|
146
149
|
|
|
147
|
-
if (
|
|
148
|
-
context.debug(`...
|
|
150
|
+
if (statementValidates) {
|
|
151
|
+
context.debug(`...validated the '${statementString}' statement.`);
|
|
149
152
|
}
|
|
150
153
|
}
|
|
151
154
|
|
|
152
|
-
return
|
|
155
|
+
return statementValidates;
|
|
153
156
|
}
|
|
154
157
|
|
|
155
158
|
verifyReferenceAsMetavariable(assignments, stated, context) {
|
package/src/element/axiom.js
CHANGED
|
@@ -56,8 +56,8 @@ export default define(class Axiom extends AxiomLemmaTheoremConjecture {
|
|
|
56
56
|
return signatureVerifies;
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
|
|
60
|
-
let
|
|
59
|
+
compareSignature(signature, substitutions, context) {
|
|
60
|
+
let comparesToSignature = false;
|
|
61
61
|
|
|
62
62
|
const satisfiable = this.isSatisfiable();
|
|
63
63
|
|
|
@@ -73,10 +73,10 @@ export default define(class Axiom extends AxiomLemmaTheoremConjecture {
|
|
|
73
73
|
|
|
74
74
|
const generalContext = context; ///
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
comparesToSignature = signatureA.compare(signatureB, substitutions, generalContext, specificContext);
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
return
|
|
79
|
+
return comparesToSignature;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
unifyStep(step, substitutions, context) {
|
|
@@ -93,7 +93,7 @@ export default define(class Axiom extends AxiomLemmaTheoremConjecture {
|
|
|
93
93
|
const unconditional = this.isUnconditional();
|
|
94
94
|
|
|
95
95
|
if (!unconditional) {
|
|
96
|
-
context.trace(`
|
|
96
|
+
context.trace(`Unable to unify the '${stepString}' step with the '${axiomString}' axiom because the axiom is not unconditional.`, node);
|
|
97
97
|
} else {
|
|
98
98
|
const statement = step.getStatement(),
|
|
99
99
|
statementUnifiesWithDeduction = this.unifyStatementWithDeduction(statement, substitutions, context);
|
|
@@ -145,7 +145,7 @@ export default define(class Axiom extends AxiomLemmaTheoremConjecture {
|
|
|
145
145
|
const unconditional = this.isUnconditional();
|
|
146
146
|
|
|
147
147
|
if (unconditional) {
|
|
148
|
-
context.trace(`
|
|
148
|
+
context.trace(`Unable to unify the '${subproofString}' subproof with the '${axiomString}' axiom because the axiom is unconditional.`, node);
|
|
149
149
|
} else {
|
|
150
150
|
const lastStep = subproof.getLastStep(),
|
|
151
151
|
lastStepUnifies = this.unifyLastStep(lastStep, substitutions, context);
|
|
@@ -213,17 +213,13 @@ export default define(class Axiom extends AxiomLemmaTheoremConjecture {
|
|
|
213
213
|
if (generalSuppositionsLength === specificSuppositionsLength) {
|
|
214
214
|
suppositions = specificSuppositions; ///
|
|
215
215
|
|
|
216
|
-
|
|
216
|
+
suppositionsUnify = suppositions.every((supposition, index) => {
|
|
217
217
|
const suppositionUnifies = this.unifySupposition(supposition, index, substitutions, generalContext, specificContext);
|
|
218
218
|
|
|
219
219
|
if (suppositionUnifies) {
|
|
220
220
|
return true;
|
|
221
221
|
}
|
|
222
222
|
});
|
|
223
|
-
|
|
224
|
-
if (suppositionsMatch) {
|
|
225
|
-
suppositionsUnify = true;
|
|
226
|
-
}
|
|
227
223
|
}
|
|
228
224
|
|
|
229
225
|
return suppositionsUnify;
|