occam-verify-cli 1.0.438 → 1.0.448
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/context/file.js +42 -39
- package/lib/context/local.js +34 -34
- package/lib/context/release.js +3 -7
- package/lib/context/temporary.js +26 -26
- package/lib/element/assertion/contained.js +45 -45
- package/lib/element/assertion/defined.js +13 -13
- package/lib/element/assertion/property.js +23 -22
- package/lib/element/assertion/satisfies.js +7 -6
- package/lib/element/assertion/subproof.js +20 -17
- package/lib/element/assertion/type.js +3 -2
- package/lib/element/assertion.js +1 -23
- package/lib/element/assumption.js +24 -22
- package/lib/element/axiom.js +27 -30
- package/lib/element/axiomLemmaTheoremConjecture.js +50 -57
- package/lib/element/{statement/combinator → combinator}/bracketed.js +16 -16
- package/lib/element/combinator.js +229 -0
- package/lib/element/conclusion.js +11 -9
- package/lib/element/{term/constructor → constructor}/bracketed.js +5 -5
- package/lib/element/constructor.js +232 -0
- package/lib/element/declaration/combinator.js +2 -16
- package/lib/element/declaration/complexType.js +12 -12
- package/lib/element/declaration/constructor.js +13 -11
- package/lib/element/declaration/simpleType.js +4 -4
- package/lib/element/declaration/typePrefix.js +2 -2
- package/lib/element/declaration/variable.js +3 -3
- package/lib/element/deduction.js +11 -9
- package/lib/element/derivation.js +17 -20
- package/lib/element/equivalence.js +10 -10
- package/lib/element/equivalences.js +5 -5
- package/lib/element/frame.js +32 -38
- package/lib/element/hypothesis.js +16 -57
- package/lib/element/judgement.js +6 -4
- package/lib/element/label.js +8 -8
- package/lib/element/metaLemmaMetatheorem.js +6 -39
- package/lib/element/metaType.js +17 -80
- package/lib/element/metavariable.js +38 -34
- package/lib/element/parameter.js +3 -3
- package/lib/element/premise.js +92 -174
- package/lib/element/proof.js +7 -7
- package/lib/element/proofAssertion.js +203 -0
- package/lib/element/property.js +9 -9
- package/lib/element/propertyRelation.js +13 -13
- package/lib/element/reference.js +16 -17
- package/lib/element/rule.js +46 -46
- package/lib/element/signature.js +11 -11
- package/lib/element/statement.js +18 -18
- package/lib/element/step.js +73 -124
- package/lib/element/subDerivation.js +17 -20
- package/lib/element/subproof.js +16 -24
- package/lib/element/substitution/frame.js +1 -7
- package/lib/element/substitution/reference.js +2 -3
- package/lib/element/substitution/statement.js +44 -15
- package/lib/element/substitution/term.js +10 -57
- package/lib/element/substitution.js +5 -11
- package/lib/element/substitutions.js +29 -29
- package/lib/element/supposition.js +95 -177
- package/lib/element/term.js +21 -34
- package/lib/element/type.js +47 -60
- package/lib/element/typePrefix.js +5 -5
- package/lib/element/variable.js +9 -9
- package/lib/element.js +9 -3
- package/lib/metaTypes.js +63 -0
- package/lib/node/axiomLemmaTheoremConjecture.js +9 -9
- package/lib/node/body/axiom.js +2 -25
- package/lib/node/body/conjecture.js +2 -25
- package/lib/node/body/lemma.js +2 -25
- package/lib/node/body/metaLemma.js +2 -25
- package/lib/node/body/metatheorem.js +2 -25
- package/lib/node/body/rule.js +15 -1
- package/lib/node/body/theorem.js +2 -25
- package/lib/node/body.js +25 -2
- package/lib/node/combinator.js +11 -2
- package/lib/node/constructor.js +11 -2
- package/lib/node/declaration/combinator.js +5 -5
- package/lib/node/declaration/constructor.js +8 -8
- package/lib/node/declaration/property.js +15 -15
- package/lib/node/declaration/simpleType.js +31 -31
- package/lib/node/declaration/variable.js +8 -8
- package/lib/node/equality.js +8 -8
- package/lib/node/frame.js +20 -20
- package/lib/node/header.js +22 -22
- package/lib/node/metaLemmaMetaTheorem.js +16 -16
- package/lib/node/metavariable.js +15 -15
- package/lib/node/property.js +8 -8
- package/lib/node/propertyRelation.js +8 -8
- package/lib/node/rule.js +16 -16
- package/lib/node/statement.js +12 -12
- package/lib/node/step.js +22 -22
- package/lib/node/subDerivation.js +1 -8
- package/lib/node/subproof.js +5 -12
- package/lib/node/substitution/frame.js +19 -19
- package/lib/node/substitution/statement.js +19 -19
- package/lib/node/substitution/term.js +19 -19
- package/lib/node/term.js +35 -35
- package/lib/preamble.js +5 -5
- package/lib/process/instantiate.js +20 -2
- package/lib/process/unify.js +39 -42
- package/lib/process/validate.js +431 -0
- package/lib/process/verify.js +44 -135
- package/lib/types.js +27 -0
- package/lib/utilities/brackets.js +9 -14
- package/lib/utilities/element.js +91 -55
- package/lib/utilities/instance.js +41 -28
- package/lib/utilities/statement.js +2 -2
- package/lib/utilities/string.js +25 -14
- package/lib/utilities/unification.js +237 -0
- package/lib/utilities/validation.js +251 -0
- package/package.json +6 -6
- package/src/context/file.js +40 -34
- package/src/context/local.js +34 -34
- package/src/context/release.js +2 -6
- package/src/context/temporary.js +15 -15
- package/src/element/assertion/contained.js +19 -20
- package/src/element/assertion/defined.js +11 -12
- package/src/element/assertion/property.js +20 -20
- package/src/element/assertion/satisfies.js +6 -6
- package/src/element/assertion/subproof.js +17 -15
- package/src/element/assertion/type.js +2 -2
- package/src/element/assertion.js +0 -2
- package/src/element/assumption.js +22 -19
- package/src/element/axiom.js +33 -37
- package/src/element/axiomLemmaTheoremConjecture.js +54 -73
- package/src/element/{statement/combinator → combinator}/bracketed.js +7 -7
- package/src/element/combinator.js +90 -0
- package/src/element/conclusion.js +12 -10
- package/src/element/{term/constructor → constructor}/bracketed.js +5 -5
- package/src/element/{term/constructor.js → constructor.js} +17 -25
- package/src/element/declaration/combinator.js +1 -22
- package/src/element/declaration/complexType.js +11 -11
- package/src/element/declaration/constructor.js +13 -10
- package/src/element/declaration/simpleType.js +3 -3
- package/src/element/declaration/typePrefix.js +1 -1
- package/src/element/declaration/variable.js +2 -2
- package/src/element/deduction.js +12 -9
- package/src/element/derivation.js +15 -19
- package/src/element/equivalence.js +8 -8
- package/src/element/equivalences.js +4 -4
- package/src/element/frame.js +28 -30
- package/src/element/hypothesis.js +16 -18
- package/src/element/judgement.js +6 -3
- package/src/element/label.js +4 -4
- package/src/element/metaLemmaMetatheorem.js +5 -69
- package/src/element/metaType.js +9 -45
- package/src/element/metavariable.js +34 -31
- package/src/element/parameter.js +2 -2
- package/src/element/premise.js +124 -99
- package/src/element/proof.js +6 -6
- package/src/element/proofAssertion.js +76 -0
- package/src/element/property.js +6 -6
- package/src/element/propertyRelation.js +11 -11
- package/src/element/reference.js +14 -21
- package/src/element/rule.js +39 -38
- package/src/element/signature.js +10 -9
- package/src/element/statement.js +16 -18
- package/src/element/step.js +78 -78
- package/src/element/subDerivation.js +15 -19
- package/src/element/subproof.js +11 -19
- package/src/element/substitution/frame.js +0 -2
- package/src/element/substitution/reference.js +1 -5
- package/src/element/substitution/statement.js +44 -14
- package/src/element/substitution/term.js +10 -13
- package/src/element/substitution.js +3 -5
- package/src/element/substitutions.js +48 -30
- package/src/element/supposition.js +127 -108
- package/src/element/term.js +18 -28
- package/src/element/type.js +42 -36
- package/src/element/typePrefix.js +3 -3
- package/src/element/variable.js +7 -7
- package/src/element.js +3 -1
- package/src/metaTypes.js +55 -0
- package/src/node/axiomLemmaTheoremConjecture.js +6 -6
- package/src/node/body/axiom.js +0 -21
- package/src/node/body/conjecture.js +0 -23
- package/src/node/body/lemma.js +0 -23
- package/src/node/body/metaLemma.js +0 -23
- package/src/node/body/metatheorem.js +0 -23
- package/src/node/body/rule.js +12 -0
- package/src/node/body/theorem.js +0 -23
- package/src/node/body.js +23 -0
- package/src/node/combinator.js +9 -0
- package/src/node/constructor.js +9 -0
- package/src/node/declaration/combinator.js +5 -5
- package/src/node/declaration/constructor.js +8 -8
- package/src/node/declaration/property.js +14 -14
- package/src/node/declaration/simpleType.js +31 -31
- package/src/node/declaration/variable.js +7 -7
- package/src/node/equality.js +7 -7
- package/src/node/frame.js +21 -21
- package/src/node/header.js +22 -22
- package/src/node/metaLemmaMetaTheorem.js +14 -14
- package/src/node/metavariable.js +14 -14
- package/src/node/property.js +7 -7
- package/src/node/propertyRelation.js +7 -7
- package/src/node/rule.js +15 -15
- package/src/node/statement.js +12 -12
- package/src/node/step.js +21 -21
- package/src/node/subDerivation.js +0 -7
- package/src/node/subproof.js +4 -11
- package/src/node/substitution/frame.js +18 -18
- package/src/node/substitution/statement.js +18 -18
- package/src/node/substitution/term.js +18 -18
- package/src/node/term.js +34 -34
- package/src/preamble.js +4 -4
- package/src/process/instantiate.js +12 -0
- package/src/process/unify.js +53 -57
- package/src/process/validate.js +316 -0
- package/src/process/verify.js +50 -138
- package/src/types.js +18 -0
- package/src/utilities/brackets.js +15 -14
- package/src/utilities/element.js +125 -82
- package/src/utilities/instance.js +42 -24
- package/src/utilities/statement.js +2 -2
- package/src/utilities/string.js +38 -24
- package/src/{mixins/step/unify.js → utilities/unification.js} +99 -85
- package/src/{mixins/statement/validate.js → utilities/validation.js} +143 -69
- package/lib/element/statement/combinator.js +0 -105
- package/lib/element/term/constructor.js +0 -172
- package/lib/mixins/statement/validate.js +0 -198
- package/lib/mixins/step/unify.js +0 -228
- package/lib/mixins/term/verify.js +0 -65
- package/src/element/statement/combinator.js +0 -59
- package/src/mixins/term/verify.js +0 -81
|
@@ -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);
|
|
@@ -110,29 +110,6 @@ export default define(class Axiom extends AxiomLemmaTheoremConjecture {
|
|
|
110
110
|
return stepUnifies;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
unifyLastStep(lastStep, substitutions, context) {
|
|
114
|
-
let lastStepUnifies = false;
|
|
115
|
-
|
|
116
|
-
const node = this.getNode(),
|
|
117
|
-
axiomString = this.getString(),
|
|
118
|
-
lastStepString = lastStep.getString();
|
|
119
|
-
|
|
120
|
-
context.trace(`Unifying the '${lastStepString}' last step with the '${axiomString}' axiom...`, node)
|
|
121
|
-
|
|
122
|
-
const statement = lastStep.getStatement(),
|
|
123
|
-
statementUnifiesWithDeduction = this.unifyStatementWithDeduction(statement, substitutions, context);
|
|
124
|
-
|
|
125
|
-
if (statementUnifiesWithDeduction) {
|
|
126
|
-
lastStepUnifies = true;
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
if (lastStepUnifies) {
|
|
130
|
-
context.debug(`...unified the '${lastStepString}' last step with the '${axiomString}' axiom.`, node)
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
return lastStepUnifies;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
113
|
unifySubproof(subproof, substitutions, context) {
|
|
137
114
|
let subproofUnifies = false;
|
|
138
115
|
|
|
@@ -145,12 +122,12 @@ export default define(class Axiom extends AxiomLemmaTheoremConjecture {
|
|
|
145
122
|
const unconditional = this.isUnconditional();
|
|
146
123
|
|
|
147
124
|
if (unconditional) {
|
|
148
|
-
context.trace(`
|
|
125
|
+
context.trace(`Unable to unify the '${subproofString}' subproof with the '${axiomString}' axiom because the axiom is unconditional.`, node);
|
|
149
126
|
} else {
|
|
150
|
-
const
|
|
151
|
-
|
|
127
|
+
const lastProofAssertion = subproof.getLastProofAssertion(),
|
|
128
|
+
lastProofAssertionUnifies = this.unifyLastProofAssertion(lastProofAssertion, substitutions, context);
|
|
152
129
|
|
|
153
|
-
if (
|
|
130
|
+
if (lastProofAssertionUnifies) {
|
|
154
131
|
const suppositions = subproof.getSuppositions(),
|
|
155
132
|
suppositionsUnify = this.unifySuppositions(suppositions, substitutions, context);
|
|
156
133
|
|
|
@@ -213,22 +190,41 @@ export default define(class Axiom extends AxiomLemmaTheoremConjecture {
|
|
|
213
190
|
if (generalSuppositionsLength === specificSuppositionsLength) {
|
|
214
191
|
suppositions = specificSuppositions; ///
|
|
215
192
|
|
|
216
|
-
|
|
193
|
+
suppositionsUnify = suppositions.every((supposition, index) => {
|
|
217
194
|
const suppositionUnifies = this.unifySupposition(supposition, index, substitutions, generalContext, specificContext);
|
|
218
195
|
|
|
219
196
|
if (suppositionUnifies) {
|
|
220
197
|
return true;
|
|
221
198
|
}
|
|
222
199
|
});
|
|
223
|
-
|
|
224
|
-
if (suppositionsMatch) {
|
|
225
|
-
suppositionsUnify = true;
|
|
226
|
-
}
|
|
227
200
|
}
|
|
228
201
|
|
|
229
202
|
return suppositionsUnify;
|
|
230
203
|
}
|
|
231
204
|
|
|
205
|
+
unifyLastProofAssertion(lastProofAssertion, substitutions, context) {
|
|
206
|
+
let lastProofAssertionUnifies = false;
|
|
207
|
+
|
|
208
|
+
const node = this.getNode(),
|
|
209
|
+
axiomString = this.getString(),
|
|
210
|
+
lastProofAssertionString = lastProofAssertion.getString();
|
|
211
|
+
|
|
212
|
+
context.trace(`Unifying the '${lastProofAssertionString}' last proof assertion with the '${axiomString}' axiom...`, node)
|
|
213
|
+
|
|
214
|
+
const statement = lastProofAssertion.getStatement(),
|
|
215
|
+
statementUnifiesWithDeduction = this.unifyStatementWithDeduction(statement, substitutions, context);
|
|
216
|
+
|
|
217
|
+
if (statementUnifiesWithDeduction) {
|
|
218
|
+
lastProofAssertionUnifies = true;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if (lastProofAssertionUnifies) {
|
|
222
|
+
context.debug(`...unified the '${lastProofAssertionString}' last proof assertion with the '${axiomString}' axiom.`, node)
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
return lastProofAssertionUnifies;
|
|
226
|
+
}
|
|
227
|
+
|
|
232
228
|
unifyAxiomLemmaTheoremOrConjecture(axiomLemmaTheoremOrConjecture, substitutions, context) {
|
|
233
229
|
let axiomLemmaTheoremOrConjectureUnifies = false;
|
|
234
230
|
|
|
@@ -81,16 +81,45 @@ export default class AxiomLemmaTheoremConjecture extends Element {
|
|
|
81
81
|
return supposition;
|
|
82
82
|
}
|
|
83
83
|
|
|
84
|
-
|
|
85
|
-
const
|
|
86
|
-
const
|
|
84
|
+
compareMetavariableName(metavariableName) {
|
|
85
|
+
const comparesToMetavariableName = this.labels.some((label) => {
|
|
86
|
+
const labelComparesToMetavariableName = label.compareMetavariableName(metavariableName);
|
|
87
87
|
|
|
88
|
-
if (
|
|
88
|
+
if (labelComparesToMetavariableName) {
|
|
89
89
|
return true;
|
|
90
90
|
}
|
|
91
91
|
});
|
|
92
92
|
|
|
93
|
-
return
|
|
93
|
+
return comparesToMetavariableName;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
correlateHypotheses(context) {
|
|
97
|
+
let correlatesToHypotheses;
|
|
98
|
+
|
|
99
|
+
const hypothetical = this.isHypothetical();
|
|
100
|
+
|
|
101
|
+
if (hypothetical) {
|
|
102
|
+
const proofAssertions = context.getProofAssertions(),
|
|
103
|
+
axiomLemmaTheoremConjectureString = this.getString(); ///
|
|
104
|
+
|
|
105
|
+
context.trace(`Correlating the hypotheses of the '${axiomLemmaTheoremConjectureString}' axiom, lemma, theorem or conjecture...`, this.node);
|
|
106
|
+
|
|
107
|
+
correlatesToHypotheses = correlate(this.hypotheses, proofAssertions, (hypothesis, proofAssertion) => {
|
|
108
|
+
const hypothesesComparesToStep = hypothesis.compareProofAssertion(proofAssertion, context);
|
|
109
|
+
|
|
110
|
+
if (hypothesesComparesToStep) {
|
|
111
|
+
return true;
|
|
112
|
+
}
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
if (correlatesToHypotheses) {
|
|
116
|
+
context.debug(`...correlated the hypotheses of the '${axiomLemmaTheoremConjectureString}' axiom, lemma, theorem or conjecture.`, this.node);
|
|
117
|
+
}
|
|
118
|
+
} else {
|
|
119
|
+
correlatesToHypotheses = true
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
return correlatesToHypotheses;
|
|
94
123
|
}
|
|
95
124
|
|
|
96
125
|
verify() {
|
|
@@ -171,35 +200,6 @@ export default class AxiomLemmaTheoremConjecture extends Element {
|
|
|
171
200
|
return proofVerifies;
|
|
172
201
|
}
|
|
173
202
|
|
|
174
|
-
correlateHypotheses(context) {
|
|
175
|
-
let hypothesesCorrelate;
|
|
176
|
-
|
|
177
|
-
const hypothetical = this.isHypothetical();
|
|
178
|
-
|
|
179
|
-
if (hypothetical) {
|
|
180
|
-
const steps = context.getSteps(),
|
|
181
|
-
topLevelAssertionString = this.string; ///
|
|
182
|
-
|
|
183
|
-
context.trace(`Correlating the hypotheses of the '${topLevelAssertionString}' axiom, lemma, theorem or conjecture...`, this.node);
|
|
184
|
-
|
|
185
|
-
hypothesesCorrelate = correlate(this.hypotheses, steps, (hypothesis, step) => {
|
|
186
|
-
const hypothesesEqualToStep = hypothesis.isEqualToStep(step, context);
|
|
187
|
-
|
|
188
|
-
if (hypothesesEqualToStep) {
|
|
189
|
-
return true;
|
|
190
|
-
}
|
|
191
|
-
});
|
|
192
|
-
|
|
193
|
-
if (hypothesesCorrelate) {
|
|
194
|
-
context.debug(`...correlated the hypotheses of the '${topLevelAssertionString}' axiom, lemma, theorem or conjecture.`, this.node);
|
|
195
|
-
}
|
|
196
|
-
} else {
|
|
197
|
-
hypothesesCorrelate = true
|
|
198
|
-
}
|
|
199
|
-
|
|
200
|
-
return hypothesesCorrelate;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
203
|
unifyStatementWithDeduction(statement, substitutions, context) {
|
|
204
204
|
let statementUnifiesWithDeduction = false;
|
|
205
205
|
|
|
@@ -212,18 +212,18 @@ export default class AxiomLemmaTheoremConjecture extends Element {
|
|
|
212
212
|
return statementUnifiesWithDeduction;
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
-
unifyStatementAndStepsOrSubproofs(statement,
|
|
215
|
+
unifyStatementAndStepsOrSubproofs(statement, subproofOrProofAssertions, substitutions, context) {
|
|
216
216
|
let statementAndStepsOrSubproofsUnifies = false;
|
|
217
217
|
|
|
218
|
-
const
|
|
218
|
+
const correlatesToHypotheses = this.correlateHypotheses(context);
|
|
219
219
|
|
|
220
|
-
if (
|
|
220
|
+
if (correlatesToHypotheses) {
|
|
221
221
|
const statementUnifiesWithDeduction = this.unifyStatementWithDeduction(statement, substitutions, context);
|
|
222
222
|
|
|
223
223
|
if (statementUnifiesWithDeduction) {
|
|
224
|
-
const
|
|
224
|
+
const subproofOrProofAssertionsUnifyWithSuppositions = this.unifyStepsOrSubproofsWithSuppositions(subproofOrProofAssertions, substitutions, context);
|
|
225
225
|
|
|
226
|
-
if (
|
|
226
|
+
if (subproofOrProofAssertionsUnifyWithSuppositions) {
|
|
227
227
|
const substitutionsResolved = substitutions.areResolved();
|
|
228
228
|
|
|
229
229
|
if (substitutionsResolved) {
|
|
@@ -236,43 +236,43 @@ export default class AxiomLemmaTheoremConjecture extends Element {
|
|
|
236
236
|
return statementAndStepsOrSubproofsUnifies;
|
|
237
237
|
}
|
|
238
238
|
|
|
239
|
-
unifyStepsOrSubproofsWithSupposition(
|
|
240
|
-
let
|
|
239
|
+
unifyStepsOrSubproofsWithSupposition(subproofOrProofAssertions, supposition, substitutions, generalContext, specificContext) {
|
|
240
|
+
let subproofOrProofAssertionsUnifiesWithSupposition = false;
|
|
241
241
|
|
|
242
242
|
const context = specificContext, ///
|
|
243
243
|
suppositionUnifiesIndependently = supposition.unifyIndependently(substitutions, context);
|
|
244
244
|
|
|
245
245
|
if (suppositionUnifiesIndependently) {
|
|
246
|
-
|
|
246
|
+
subproofOrProofAssertionsUnifiesWithSupposition = true;
|
|
247
247
|
} else {
|
|
248
|
-
const
|
|
249
|
-
const
|
|
248
|
+
const subproofOrProofAssertion = extract(subproofOrProofAssertions, (subproofOrProofAssertion) => {
|
|
249
|
+
const subproofOrProofAssertionUnifies = supposition.unifySubproofOrProofAssertion(subproofOrProofAssertion, substitutions, generalContext, specificContext);
|
|
250
250
|
|
|
251
|
-
if (
|
|
251
|
+
if (subproofOrProofAssertionUnifies) {
|
|
252
252
|
return true;
|
|
253
253
|
}
|
|
254
254
|
}) || null;
|
|
255
255
|
|
|
256
|
-
if (
|
|
257
|
-
|
|
256
|
+
if (subproofOrProofAssertion !== null) {
|
|
257
|
+
subproofOrProofAssertionsUnifiesWithSupposition = true;
|
|
258
258
|
}
|
|
259
259
|
}
|
|
260
260
|
|
|
261
|
-
return
|
|
261
|
+
return subproofOrProofAssertionsUnifiesWithSupposition;
|
|
262
262
|
}
|
|
263
263
|
|
|
264
|
-
unifyStepsOrSubproofsWithSuppositions(
|
|
265
|
-
|
|
264
|
+
unifyStepsOrSubproofsWithSuppositions(subproofOrProofAssertions, substitutions, generalContext, specificContext) {
|
|
265
|
+
subproofOrProofAssertions = reverse(subproofOrProofAssertions); ///
|
|
266
266
|
|
|
267
|
-
const
|
|
268
|
-
const
|
|
267
|
+
const subproofOrProofAssertionsUnifyWithSuppositions = backwardsEvery(this.suppositions, (supposition) => {
|
|
268
|
+
const subproofOrProofAssertionsUnifiesWithSupposition = this.unifyStepsOrSubproofsWithSupposition(subproofOrProofAssertions, supposition, substitutions, generalContext, specificContext);
|
|
269
269
|
|
|
270
|
-
if (
|
|
270
|
+
if (subproofOrProofAssertionsUnifiesWithSupposition) {
|
|
271
271
|
return true;
|
|
272
272
|
}
|
|
273
273
|
});
|
|
274
274
|
|
|
275
|
-
return
|
|
275
|
+
return subproofOrProofAssertionsUnifyWithSuppositions;
|
|
276
276
|
}
|
|
277
277
|
|
|
278
278
|
toJSON() {
|
|
@@ -310,23 +310,4 @@ export default class AxiomLemmaTheoremConjecture extends Element {
|
|
|
310
310
|
|
|
311
311
|
return axiomLemmaTheoremConjecture;
|
|
312
312
|
}
|
|
313
|
-
|
|
314
|
-
static fromNode(Class, node, context) {
|
|
315
|
-
const topLevelAssertionNode = node, ///
|
|
316
|
-
proofNode = topLevelAssertionNode.getProofNode(),
|
|
317
|
-
labelNodes = topLevelAssertionNode.getLabelNodes(),
|
|
318
|
-
deductionNode = topLevelAssertionNode.getDeductionNode(),
|
|
319
|
-
suppositionNodes = topLevelAssertionNode.getSuppositionNodes(),
|
|
320
|
-
signatureNode = topLevelAssertionNode.getSignatureNode(),
|
|
321
|
-
proof = proofFromProofNode(proofNode, context),
|
|
322
|
-
labels = labelsFromLabelNodes(labelNodes, context),
|
|
323
|
-
deduction = deductionFromDeductionNode(deductionNode, context),
|
|
324
|
-
suppositions = suppositionsFromSuppositionNodes(suppositionNodes, context),
|
|
325
|
-
signature = signatureFromSignatureNode(signatureNode, context),
|
|
326
|
-
hypotheses = [],
|
|
327
|
-
string = stringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction),
|
|
328
|
-
axiomLemmaTheoremConjecture = new Class(context, string, node, labels, suppositions, deduction, proof, signature, hypotheses);
|
|
329
|
-
|
|
330
|
-
return axiomLemmaTheoremConjecture;
|
|
331
|
-
}
|
|
332
313
|
}
|