occam-verify-cli 0.0.923 → 0.0.925
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/axiom.js +9 -9
- package/lib/conjecture.js +9 -9
- package/lib/constants.js +1 -9
- package/lib/context/file.js +3 -3
- package/lib/context/local.js +5 -5
- package/lib/lemma.js +9 -9
- package/lib/metaLemma.js +7 -7
- package/lib/metatheorem.js +7 -7
- package/lib/metavariable.js +8 -1
- package/lib/mixins/nodesVerifier/metaLevel.js +2 -2
- package/lib/premise.js +6 -6
- package/lib/theorem.js +9 -9
- package/lib/topLevelAssertion.js +186 -0
- package/lib/verifier/nodes/intrinsicLevel.js +3 -3
- package/lib/verifier/nodes/intrinsicLevelAgainstMetaLevel.js +3 -3
- package/lib/verifier/nodes/metaLevel.js +16 -16
- package/lib/verify/assertion/contained.js +91 -0
- package/lib/verify/assertion/defined.js +114 -0
- package/lib/verify/assertion/subproof.js +65 -0
- package/lib/verify/assertion/type.js +112 -0
- package/lib/verify/axiom.js +4 -4
- package/lib/verify/conjecture.js +4 -4
- package/lib/verify/declaration.js +3 -6
- package/lib/verify/derivation.js +7 -7
- package/lib/verify/equality.js +3 -3
- package/lib/verify/frame.js +2 -2
- package/lib/verify/judgement.js +2 -2
- package/lib/verify/lemma.js +5 -5
- package/lib/verify/metaLemma.js +4 -4
- package/lib/verify/metastatement.js +4 -24
- package/lib/verify/metatheorem.js +4 -4
- package/lib/verify/metavariable.js +2 -2
- package/lib/verify/proof.js +3 -3
- package/lib/verify/proofStep.js +4 -4
- package/lib/verify/rule.js +3 -3
- package/lib/verify/statement/qualified.js +19 -25
- package/lib/verify/statement/unqualified.js +38 -10
- package/lib/verify/statement.js +106 -97
- package/lib/verify/subDerivation.js +3 -3
- package/lib/verify/subproof.js +3 -3
- package/lib/verify/termAsConstructor.js +2 -2
- package/lib/verify/theorem.js +4 -4
- package/package.json +2 -2
- package/src/axiom.js +4 -4
- package/src/conjecture.js +4 -4
- package/src/constants.js +0 -2
- package/src/context/file.js +2 -2
- package/src/context/local.js +4 -3
- package/src/lemma.js +4 -4
- package/src/metaLemma.js +4 -4
- package/src/metatheorem.js +4 -4
- package/src/metavariable.js +6 -0
- package/src/mixins/nodesVerifier/metaLevel.js +1 -1
- package/src/premise.js +6 -6
- package/src/theorem.js +4 -4
- package/src/{metaLemmaMetatheorem.js → topLevelAssertion.js} +16 -26
- package/src/verifier/nodes/intrinsicLevel.js +2 -2
- package/src/verifier/nodes/intrinsicLevelAgainstMetaLevel.js +3 -3
- package/src/verifier/nodes/metaLevel.js +18 -19
- package/src/verify/assertion/contained.js +111 -0
- package/src/verify/{statementAsDefinedAssertion.js → assertion/defined.js} +25 -41
- package/src/verify/assertion/subproof.js +77 -0
- package/src/verify/{typeAssertion.js → assertion/type.js} +15 -15
- package/src/verify/axiom.js +5 -4
- package/src/verify/conjecture.js +5 -4
- package/src/verify/declaration.js +2 -6
- package/src/verify/derivation.js +6 -6
- package/src/verify/equality.js +2 -2
- package/src/verify/frame.js +1 -1
- package/src/verify/judgement.js +1 -1
- package/src/verify/lemma.js +8 -5
- package/src/verify/metaLemma.js +4 -4
- package/src/verify/metastatement.js +3 -32
- package/src/verify/metatheorem.js +4 -4
- package/src/verify/metavariable.js +1 -1
- package/src/verify/proof.js +2 -2
- package/src/verify/proofStep.js +3 -3
- package/src/verify/rule.js +4 -4
- package/src/verify/statement/qualified.js +30 -33
- package/src/verify/statement/unqualified.js +52 -10
- package/src/verify/statement.js +168 -47
- package/src/verify/subDerivation.js +2 -2
- package/src/verify/subproof.js +2 -2
- package/src/verify/termAsConstructor.js +2 -2
- package/src/verify/theorem.js +7 -4
- package/lib/axiomLemmaTheoremConjecture.js +0 -174
- package/lib/metaLemmaMetatheorem.js +0 -191
- package/lib/verify/statementAsContainedAssertion.js +0 -109
- package/lib/verify/statementAsDefinedAssertion.js +0 -132
- package/lib/verify/typeAssertion.js +0 -112
- package/src/axiomLemmaTheoremConjecture.js +0 -165
- package/src/verify/statementAsContainedAssertion.js +0 -127
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { nodesQuery } from "../../utilities/query";
|
|
4
|
+
import { STATEMENT_META_TYPE_NAME } from "../../metaTypeNames";
|
|
5
|
+
|
|
6
|
+
const metavariableNodesQuery = nodesQuery("/subproofAssertion/statement/metavariable!");
|
|
7
|
+
|
|
8
|
+
export default function verifySubproofAssertion(subproofAssertionNode, assignments, derived, localContext) {
|
|
9
|
+
let subproofAssertionVerified;
|
|
10
|
+
|
|
11
|
+
const subproofAssertionString = localContext.nodeAsString(subproofAssertionNode);
|
|
12
|
+
|
|
13
|
+
localContext.trace(`Verifying the '${subproofAssertionString}' subproof assertion...`, subproofAssertionNode);
|
|
14
|
+
|
|
15
|
+
const verifySubproofAssertionFunctions = [
|
|
16
|
+
verifyDerivedSubproofAssertion,
|
|
17
|
+
verifyStatedSubproofAssertion
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
subproofAssertionVerified = verifySubproofAssertionFunctions.some((verifySubproofAssertionFunction) => {
|
|
21
|
+
const subproofAssertionVerified = verifySubproofAssertionFunction(subproofAssertionNode, assignments, derived, localContext);
|
|
22
|
+
|
|
23
|
+
if (subproofAssertionVerified) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
if (subproofAssertionVerified) {
|
|
29
|
+
localContext.debug(`...verified the '${subproofAssertionString}' subproof assertion.`, subproofAssertionNode);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return subproofAssertionVerified;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function verifyDerivedSubproofAssertion(subproofAssertionNode, assignments, derived, localContext) {
|
|
36
|
+
let derivedSubproofAssertionVerified = false;
|
|
37
|
+
|
|
38
|
+
if (derived) {
|
|
39
|
+
const subproofAssertionString = localContext.nodeAsString(subproofAssertionNode);
|
|
40
|
+
|
|
41
|
+
if (derivedSubproofAssertionVerified) {
|
|
42
|
+
localContext.debug(`The '${subproofAssertionString}' derived subproof assertion cannot be verified.`, subproofAssertionNode);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
return derivedSubproofAssertionVerified;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
function verifyStatedSubproofAssertion(subproofAssertionNode, assignments, derived, localContext) {
|
|
50
|
+
let statedSubproofAssertionVerified = false;
|
|
51
|
+
|
|
52
|
+
if (!derived) {
|
|
53
|
+
const subproofAssertionString = localContext.nodeAsString(subproofAssertionNode);
|
|
54
|
+
|
|
55
|
+
localContext.trace(`Verifying the '${subproofAssertionString}' stated subproof assertion...`, subproofAssertionNode);
|
|
56
|
+
|
|
57
|
+
const metavariableNodes = metavariableNodesQuery(subproofAssertionNode);
|
|
58
|
+
|
|
59
|
+
statedSubproofAssertionVerified = metavariableNodes.every((metavariableNode) => {
|
|
60
|
+
const metavariable = localContext.findMetavariableByMetavariableNode(metavariableNode);
|
|
61
|
+
|
|
62
|
+
if (metavariable !== null) {
|
|
63
|
+
const metaTypeName = metavariable.getMetaTypeName();
|
|
64
|
+
|
|
65
|
+
if (metaTypeName === STATEMENT_META_TYPE_NAME) {
|
|
66
|
+
return true;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
if (statedSubproofAssertionVerified) {
|
|
72
|
+
localContext.debug(`...verified the '${subproofAssertionString}' stated subproof assertion.`, subproofAssertionNode);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return statedSubproofAssertionVerified;
|
|
77
|
+
}
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import Variable from "
|
|
4
|
-
import verifyTerm from "
|
|
5
|
-
import VariableAssignment from "
|
|
3
|
+
import Variable from "../../variable";
|
|
4
|
+
import verifyTerm from "../../verify/term";
|
|
5
|
+
import VariableAssignment from "../../assignment/variable";
|
|
6
6
|
|
|
7
|
-
import { first } from "
|
|
8
|
-
import { nodeQuery } from "
|
|
7
|
+
import { first } from "../../utilities/array";
|
|
8
|
+
import { nodeQuery } from "../../utilities/query";
|
|
9
9
|
|
|
10
10
|
const termNodeQuery = nodeQuery("/typeAssertion/term!"),
|
|
11
11
|
typeNodeQuery = nodeQuery("/typeAssertion/type!"),
|
|
12
12
|
variableNodeQuery = nodeQuery("/term/variable!");
|
|
13
13
|
|
|
14
|
-
export default function verifyTypeAssertion(typeAssertionNode, assignments, derived, localContext
|
|
14
|
+
export default function verifyTypeAssertion(typeAssertionNode, assignments, derived, localContext) {
|
|
15
15
|
let typeAssertionVerified;
|
|
16
16
|
|
|
17
17
|
const typeAssertionString = localContext.nodeAsString(typeAssertionNode);
|
|
@@ -24,7 +24,7 @@ export default function verifyTypeAssertion(typeAssertionNode, assignments, deri
|
|
|
24
24
|
];
|
|
25
25
|
|
|
26
26
|
typeAssertionVerified = verifyTypeAssertionFunctions.some((verifyTypeAssertionFunction) => {
|
|
27
|
-
const typeAssertionVerified = verifyTypeAssertionFunction(typeAssertionNode, assignments, derived, localContext
|
|
27
|
+
const typeAssertionVerified = verifyTypeAssertionFunction(typeAssertionNode, assignments, derived, localContext);
|
|
28
28
|
|
|
29
29
|
if (typeAssertionVerified) {
|
|
30
30
|
return true;
|
|
@@ -38,7 +38,7 @@ export default function verifyTypeAssertion(typeAssertionNode, assignments, deri
|
|
|
38
38
|
return typeAssertionVerified;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
function verifyDerivedTypeAssertion(typeAssertionNode, assignments, derived, localContext
|
|
41
|
+
function verifyDerivedTypeAssertion(typeAssertionNode, assignments, derived, localContext) {
|
|
42
42
|
let derivedTypeAssertionVerified = false;
|
|
43
43
|
|
|
44
44
|
if (derived) {
|
|
@@ -64,7 +64,7 @@ function verifyDerivedTypeAssertion(typeAssertionNode, assignments, derived, loc
|
|
|
64
64
|
const variableNode = variableNodeQuery(termNode);
|
|
65
65
|
|
|
66
66
|
if (variableNode === null) {
|
|
67
|
-
verifiedAhead =
|
|
67
|
+
verifiedAhead = true;
|
|
68
68
|
} else {
|
|
69
69
|
let variable = localContext.findVariableByVariableNode(variableNode);
|
|
70
70
|
|
|
@@ -75,7 +75,7 @@ function verifyDerivedTypeAssertion(typeAssertionNode, assignments, derived, loc
|
|
|
75
75
|
|
|
76
76
|
assignments.push(assignment);
|
|
77
77
|
|
|
78
|
-
verifiedAhead =
|
|
78
|
+
verifiedAhead = true;
|
|
79
79
|
|
|
80
80
|
if (!verifiedAhead) {
|
|
81
81
|
assignments.pop();
|
|
@@ -90,14 +90,14 @@ function verifyDerivedTypeAssertion(typeAssertionNode, assignments, derived, loc
|
|
|
90
90
|
derivedTypeAssertionVerified = termVerified; ///
|
|
91
91
|
|
|
92
92
|
if (derivedTypeAssertionVerified) {
|
|
93
|
-
localContext.
|
|
93
|
+
localContext.debug(`...verified the '${typeAssertionString}' derived type assertion.`, typeAssertionNode);
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
return derivedTypeAssertionVerified;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
function verifyStatedTypeAssertion(typeAssertionNode, assignments, derived, localContext
|
|
100
|
+
function verifyStatedTypeAssertion(typeAssertionNode, assignments, derived, localContext) {
|
|
101
101
|
let statedTypeAssertionVerified = false;
|
|
102
102
|
|
|
103
103
|
if (!derived) {
|
|
@@ -123,7 +123,7 @@ function verifyStatedTypeAssertion(typeAssertionNode, assignments, derived, loca
|
|
|
123
123
|
const variableNode = variableNodeQuery(termNode);
|
|
124
124
|
|
|
125
125
|
if (variableNode === null) {
|
|
126
|
-
verifiedAhead =
|
|
126
|
+
verifiedAhead = true;
|
|
127
127
|
} else {
|
|
128
128
|
let variable = localContext.findVariableByVariableNode(variableNode);
|
|
129
129
|
|
|
@@ -134,7 +134,7 @@ function verifyStatedTypeAssertion(typeAssertionNode, assignments, derived, loca
|
|
|
134
134
|
|
|
135
135
|
assignments.push(assignment);
|
|
136
136
|
|
|
137
|
-
verifiedAhead =
|
|
137
|
+
verifiedAhead = true;
|
|
138
138
|
|
|
139
139
|
if (!verifiedAhead) {
|
|
140
140
|
assignments.pop();
|
|
@@ -149,7 +149,7 @@ function verifyStatedTypeAssertion(typeAssertionNode, assignments, derived, loca
|
|
|
149
149
|
statedTypeAssertionVerified = termVerified; ///
|
|
150
150
|
|
|
151
151
|
if (statedTypeAssertionVerified) {
|
|
152
|
-
localContext.
|
|
152
|
+
localContext.debug(`...verified the '${typeAssertionString}' stated type assertion.`, typeAssertionNode);
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
155
|
|
package/src/verify/axiom.js
CHANGED
|
@@ -17,8 +17,7 @@ export default function verifyAxiom(axiomNode, fileContext) {
|
|
|
17
17
|
let axiomVerified = false;
|
|
18
18
|
|
|
19
19
|
const labelNodes = labelNodesQuery(axiomNode),
|
|
20
|
-
labelsString = fileContext.nodesAsString(labelNodes)
|
|
21
|
-
localContext = LocalContext.fromFileContext(fileContext);
|
|
20
|
+
labelsString = fileContext.nodesAsString(labelNodes);
|
|
22
21
|
|
|
23
22
|
fileContext.trace(`Verifying the '${labelsString}' axiom...`, axiomNode);
|
|
24
23
|
|
|
@@ -26,7 +25,8 @@ export default function verifyAxiom(axiomNode, fileContext) {
|
|
|
26
25
|
labelsVerified = verifyLabels(labelNodes, labels, fileContext);
|
|
27
26
|
|
|
28
27
|
if (labelsVerified) {
|
|
29
|
-
const
|
|
28
|
+
const localContext = LocalContext.fromFileContext(fileContext),
|
|
29
|
+
suppositions = [],
|
|
30
30
|
suppositionNodes = suppositionsNodeQuery(axiomNode),
|
|
31
31
|
suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
|
|
32
32
|
|
|
@@ -38,7 +38,8 @@ export default function verifyAxiom(axiomNode, fileContext) {
|
|
|
38
38
|
if (consequentVerified) {
|
|
39
39
|
const firstConsequent = first(consequents),
|
|
40
40
|
consequent = firstConsequent, ///
|
|
41
|
-
|
|
41
|
+
substitutions = [],
|
|
42
|
+
axiom = Axiom.fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, substitutions, fileContext);
|
|
42
43
|
|
|
43
44
|
fileContext.addAxiom(axiom);
|
|
44
45
|
|
package/src/verify/conjecture.js
CHANGED
|
@@ -19,8 +19,7 @@ export default function verifyConjecture(conjectureNode, fileContext) {
|
|
|
19
19
|
let conjectureVerified = false;
|
|
20
20
|
|
|
21
21
|
const labelNodes = labelNodesQuery(conjectureNode),
|
|
22
|
-
labelsString = fileContext.nodesAsString(labelNodes)
|
|
23
|
-
localContext = LocalContext.fromFileContext(fileContext); ///
|
|
22
|
+
labelsString = fileContext.nodesAsString(labelNodes);
|
|
24
23
|
|
|
25
24
|
fileContext.trace(`Verifying the '${labelsString}' conjecture...`, conjectureNode);
|
|
26
25
|
|
|
@@ -28,7 +27,8 @@ export default function verifyConjecture(conjectureNode, fileContext) {
|
|
|
28
27
|
labelsVerified = verifyLabels(labelNodes, labels, fileContext);
|
|
29
28
|
|
|
30
29
|
if (labelsVerified) {
|
|
31
|
-
const
|
|
30
|
+
const localContext = LocalContext.fromFileContext(fileContext),
|
|
31
|
+
suppositions = [],
|
|
32
32
|
suppositionNodes = suppositionsNodeQuery(conjectureNode),
|
|
33
33
|
suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
|
|
34
34
|
|
|
@@ -46,7 +46,8 @@ export default function verifyConjecture(conjectureNode, fileContext) {
|
|
|
46
46
|
verifyProof(proofNode, consequent, localContext);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
const
|
|
49
|
+
const substitutions = [],
|
|
50
|
+
conjecture = Conjecture.fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, substitutions, fileContext);
|
|
50
51
|
|
|
51
52
|
fileContext.addConjecture(conjecture);
|
|
52
53
|
|
|
@@ -26,11 +26,7 @@ export default function verifyDeclaration(declarationNode, declarations, localCo
|
|
|
26
26
|
const { verifyStatement } = metaLevelNodeVerifier,
|
|
27
27
|
derived = false,
|
|
28
28
|
assignments = [],
|
|
29
|
-
statementVerified = verifyStatement(statementNode, assignments, derived, localContext
|
|
30
|
-
const verifiedAhead = true;
|
|
31
|
-
|
|
32
|
-
return verifiedAhead;
|
|
33
|
-
});
|
|
29
|
+
statementVerified = verifyStatement(statementNode, assignments, derived, localContext);
|
|
34
30
|
|
|
35
31
|
if (statementVerified) {
|
|
36
32
|
const metavariableNode = metavariableNodeQuery(referenceNode),
|
|
@@ -57,7 +53,7 @@ function verifyReference(referenceNode, localContext) {
|
|
|
57
53
|
localContext.trace(`Verifying the '${referenceString}' reference...`, referenceNode);
|
|
58
54
|
|
|
59
55
|
const metavariableNode = metavariableNodeQuery(referenceNode),
|
|
60
|
-
metavariable = localContext.findMetavariableByMetavariableNode(metavariableNode
|
|
56
|
+
metavariable = localContext.findMetavariableByMetavariableNode(metavariableNode);
|
|
61
57
|
|
|
62
58
|
if (metavariable !== null) {
|
|
63
59
|
const metaType = metavariable.getMetaType();
|
package/src/verify/derivation.js
CHANGED
|
@@ -6,18 +6,18 @@ import { nodesQuery } from "../utilities/query";
|
|
|
6
6
|
|
|
7
7
|
const proofStepNodesQuery = nodesQuery("/derivation/proofStep|lastProofStep");
|
|
8
8
|
|
|
9
|
-
export default function verifyDerivation(
|
|
10
|
-
let
|
|
9
|
+
export default function verifyDerivation(derivationNode, substitutions, localContext) {
|
|
10
|
+
let derivationVerified;
|
|
11
11
|
|
|
12
|
-
const proofStepNodes = proofStepNodesQuery(
|
|
12
|
+
const proofStepNodes = proofStepNodesQuery(derivationNode);
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
const proofStepVerified = verifyProofStep(proofStepNode, localContext);
|
|
14
|
+
derivationVerified = proofStepNodes.every((proofStepNode) => {
|
|
15
|
+
const proofStepVerified = verifyProofStep(proofStepNode, substitutions, localContext);
|
|
16
16
|
|
|
17
17
|
if (proofStepVerified) {
|
|
18
18
|
return true;
|
|
19
19
|
}
|
|
20
20
|
});
|
|
21
21
|
|
|
22
|
-
return
|
|
22
|
+
return derivationVerified;
|
|
23
23
|
}
|
package/src/verify/equality.js
CHANGED
|
@@ -84,7 +84,7 @@ function verifyDerivedEquality(equalityNode, assignments, derived, localContext,
|
|
|
84
84
|
derivedEqualityVerified = termsVerified; ///
|
|
85
85
|
|
|
86
86
|
if (derivedEqualityVerified) {
|
|
87
|
-
localContext.
|
|
87
|
+
localContext.debug(`...verified the '${equalityString}' derived equality.`, equalityNode);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
90
|
|
|
@@ -134,7 +134,7 @@ function verifyStatedEquality(equalityNode, assignments, derived, localContext,
|
|
|
134
134
|
statedEqualityVerified = termsVerified; ///
|
|
135
135
|
|
|
136
136
|
if (statedEqualityVerified) {
|
|
137
|
-
localContext.
|
|
137
|
+
localContext.debug(`...verified the '${equalityString}' stated equality.`, equalityNode);
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
|
package/src/verify/frame.js
CHANGED
|
@@ -56,7 +56,7 @@ function verifyMetavariable(metavariableNode, declarations, localContext) {
|
|
|
56
56
|
|
|
57
57
|
localContext.trace(`Verifying the '${metavariableString}' metavariable...`, metavariableNode);
|
|
58
58
|
|
|
59
|
-
const metavariable = localContext.findMetavariableByMetavariableNode(metavariableNode
|
|
59
|
+
const metavariable = localContext.findMetavariableByMetavariableNode(metavariableNode);
|
|
60
60
|
|
|
61
61
|
if (metavariable !== null) {
|
|
62
62
|
const metaType = metavariable.getMetaType();
|
package/src/verify/judgement.js
CHANGED
|
@@ -144,7 +144,7 @@ function verifyMetavariable(metavariableNode, localContext) {
|
|
|
144
144
|
|
|
145
145
|
localContext.trace(`Verifying the '${metavariableString}' metavariable...`, metavariableNode);
|
|
146
146
|
|
|
147
|
-
const metavariable = localContext.findMetavariableByMetavariableNode(metavariableNode
|
|
147
|
+
const metavariable = localContext.findMetavariableByMetavariableNode(metavariableNode);
|
|
148
148
|
|
|
149
149
|
if (metavariable !== null) {
|
|
150
150
|
const metaType = metavariable.getMetaType();
|
package/src/verify/lemma.js
CHANGED
|
@@ -20,8 +20,7 @@ export default function verifyLemma(lemmaNode, fileContext) {
|
|
|
20
20
|
let lemmaVerified = false;
|
|
21
21
|
|
|
22
22
|
const labelNodes = labelNodesQuery(lemmaNode),
|
|
23
|
-
labelsString = fileContext.nodesAsString(labelNodes)
|
|
24
|
-
localContext = LocalContext.fromFileContext(fileContext);
|
|
23
|
+
labelsString = fileContext.nodesAsString(labelNodes);
|
|
25
24
|
|
|
26
25
|
(labelsString === EMPTY_STRING) ?
|
|
27
26
|
fileContext.trace(`Verifying a lemma...`, lemmaNode) :
|
|
@@ -31,7 +30,8 @@ export default function verifyLemma(lemmaNode, fileContext) {
|
|
|
31
30
|
labelsVerified = verifyLabels(labelNodes, labels, fileContext);
|
|
32
31
|
|
|
33
32
|
if (labelsVerified) {
|
|
34
|
-
const
|
|
33
|
+
const localContext = LocalContext.fromFileContext(fileContext),
|
|
34
|
+
suppositions = [],
|
|
35
35
|
suppositionNodes = suppositionsNodeQuery(lemmaNode),
|
|
36
36
|
suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
|
|
37
37
|
|
|
@@ -44,10 +44,13 @@ export default function verifyLemma(lemmaNode, fileContext) {
|
|
|
44
44
|
const proofNode = proofNodeQuery(lemmaNode),
|
|
45
45
|
firstConsequent = first(consequents),
|
|
46
46
|
consequent = firstConsequent, ///
|
|
47
|
-
|
|
47
|
+
statementNode = consequent.getStatementNode(),
|
|
48
|
+
substitutions = [],
|
|
49
|
+
proofVerified = verifyProof(proofNode, statementNode, substitutions, localContext);
|
|
48
50
|
|
|
49
51
|
if (proofVerified) {
|
|
50
|
-
const
|
|
52
|
+
const substitutions = [],
|
|
53
|
+
lemma = Lemma.fromLabelsSuppositionsConsequentSubstitutionsAndFileContext(labels, suppositions, consequent, substitutions, fileContext);
|
|
51
54
|
|
|
52
55
|
fileContext.addLemma(lemma);
|
|
53
56
|
|
package/src/verify/metaLemma.js
CHANGED
|
@@ -30,22 +30,22 @@ export default function verifyMetaLemma(metaLemmaNode, fileContext) {
|
|
|
30
30
|
labelsVerified = verifyLabels(labelNodes, labels, fileContext);
|
|
31
31
|
|
|
32
32
|
if (labelsVerified) {
|
|
33
|
-
const localContext = LocalContext.fromFileContext(fileContext),
|
|
34
|
-
substitutions = [],
|
|
33
|
+
const localContext = LocalContext.fromFileContext(fileContext),
|
|
35
34
|
suppositions = [],
|
|
36
35
|
suppositionNodes = suppositionsNodeQuery(metaLemmaNode),
|
|
37
|
-
suppositionsVerified = verifySuppositions(suppositionNodes, suppositions,
|
|
36
|
+
suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
|
|
38
37
|
|
|
39
38
|
if (suppositionsVerified) {
|
|
40
39
|
const consequents = [],
|
|
41
40
|
consequentNode = consequentNodeQuery(metaLemmaNode),
|
|
42
|
-
consequentVerified = verifyConsequent(consequentNode, consequents,
|
|
41
|
+
consequentVerified = verifyConsequent(consequentNode, consequents, localContext);
|
|
43
42
|
|
|
44
43
|
if (consequentVerified) {
|
|
45
44
|
const proofNode = proofNodeQuery(metaLemmaNode),
|
|
46
45
|
firstConsequent = first(consequents),
|
|
47
46
|
consequent = firstConsequent, ///
|
|
48
47
|
statementNode = consequent.getStatementNode(),
|
|
48
|
+
substitutions = [],
|
|
49
49
|
proofVerified = verifyProof(proofNode, statementNode, substitutions, localContext);
|
|
50
50
|
|
|
51
51
|
if (proofVerified) {
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import verifyJudgement from "../verify/judgement";
|
|
4
3
|
import metaLevelNodeVerifier from "../verifier/node/metaLevel";
|
|
5
|
-
import verifyStatementAsDefinedAssertion from "./statementAsDefinedAssertion";
|
|
6
|
-
import verifyStatementAsContainedAssertion from "./statementAsContainedAssertion";
|
|
7
4
|
|
|
8
5
|
import { nodeQuery } from "../utilities/query";
|
|
9
6
|
|
|
@@ -17,9 +14,6 @@ function verifyStatement(statementNode, assignments, derived, localContext) {
|
|
|
17
14
|
localContext.trace(`Verifying the '${statementString}' statement...`, statementNode);
|
|
18
15
|
|
|
19
16
|
const verifyStatementFunctions = [
|
|
20
|
-
verifyStatementAsJudgement,
|
|
21
|
-
verifyStatementAsDefinedAssertion,
|
|
22
|
-
verifyStatementAsContainedAssertion,
|
|
23
17
|
verifyStatementAsIs
|
|
24
18
|
];
|
|
25
19
|
|
|
@@ -44,29 +38,6 @@ Object.assign(metaLevelNodeVerifier, {
|
|
|
44
38
|
|
|
45
39
|
export default verifyStatement;
|
|
46
40
|
|
|
47
|
-
function verifyStatementAsJudgement(statementNode, assignments, derived, localContext) {
|
|
48
|
-
let statementVerifiedAsJudgement = false;
|
|
49
|
-
|
|
50
|
-
const statementJudgement = isStatementJudgement(statementNode);
|
|
51
|
-
|
|
52
|
-
if (statementJudgement) {
|
|
53
|
-
const statementString = localContext.nodeAsString(statementNode);
|
|
54
|
-
|
|
55
|
-
localContext.trace(`Verifying the '${statementString}' statement as a judgement...`, statementNode);
|
|
56
|
-
|
|
57
|
-
const judgementNode = judgementNodeQuery(statementNode),
|
|
58
|
-
judgementVerified = verifyJudgement(judgementNode, assignments, derived, localContext);
|
|
59
|
-
|
|
60
|
-
statementVerifiedAsJudgement = judgementVerified; ///
|
|
61
|
-
|
|
62
|
-
if (statementVerifiedAsJudgement) {
|
|
63
|
-
localContext.debug(`...verified the '${statementString}' statement as a judgement.`, statementNode);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
return statementVerifiedAsJudgement;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
41
|
function verifyStatementAsIs(statementNode, assignments, derived, localContext) {
|
|
71
42
|
let statementVerifiedAsIs;
|
|
72
43
|
|
|
@@ -104,7 +75,7 @@ function verifyDerivedStatementAsIs(statementNode, assignments, derived, localCo
|
|
|
104
75
|
if (derived) {
|
|
105
76
|
const statementString = localContext.nodeAsString(statementNode);
|
|
106
77
|
|
|
107
|
-
localContext.debug(`Cannot verify the
|
|
78
|
+
localContext.debug(`Cannot verify the '${statementString}' derived statement as is.`, statementNode);
|
|
108
79
|
}
|
|
109
80
|
|
|
110
81
|
return derivedStatementVerifiedAsIs;
|
|
@@ -116,7 +87,7 @@ function verifyStatedStatementAsIs(statementNode, assignments, derived, localCon
|
|
|
116
87
|
if (!derived) {
|
|
117
88
|
const statementString = localContext.nodeAsString(statementNode);
|
|
118
89
|
|
|
119
|
-
localContext.trace(`Verifying the
|
|
90
|
+
localContext.trace(`Verifying the '${statementString}' stated statement as is...`, statementNode);
|
|
120
91
|
|
|
121
92
|
const nonTerminalNode = statementNode, ///
|
|
122
93
|
nonTerminalNodeVerified = metaLevelNodeVerifier.verifyNonTerminalNode(nonTerminalNode, localContext, () => {
|
|
@@ -128,7 +99,7 @@ function verifyStatedStatementAsIs(statementNode, assignments, derived, localCon
|
|
|
128
99
|
statedStatementVerifiedAsIs = nonTerminalNodeVerified; ///
|
|
129
100
|
|
|
130
101
|
if (statedStatementVerifiedAsIs) {
|
|
131
|
-
localContext.debug(`...verified the
|
|
102
|
+
localContext.debug(`...verified the '${statementString}' stated statement as is.`, statementNode);
|
|
132
103
|
}
|
|
133
104
|
}
|
|
134
105
|
|
|
@@ -27,21 +27,21 @@ export default function verifyMetatheorem(metatheoremNode, fileContext) {
|
|
|
27
27
|
labelsVerified = verifyLabels(labelNodes, labels, fileContext);
|
|
28
28
|
|
|
29
29
|
if (labelsVerified) {
|
|
30
|
-
const localContext = LocalContext.fromFileContext(fileContext),
|
|
31
|
-
substitutions = [],
|
|
30
|
+
const localContext = LocalContext.fromFileContext(fileContext),
|
|
32
31
|
suppositions = [],
|
|
33
32
|
suppositionNodes = suppositionsNodeQuery(metatheoremNode),
|
|
34
|
-
suppositionsVerified = verifySuppositions(suppositionNodes, suppositions,
|
|
33
|
+
suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
|
|
35
34
|
|
|
36
35
|
if (suppositionsVerified) {
|
|
37
36
|
const consequents = [],
|
|
38
37
|
consequentNode = consequentNodeQuery(metatheoremNode),
|
|
39
|
-
consequentVerified = verifyConsequent(consequentNode, consequents,
|
|
38
|
+
consequentVerified = verifyConsequent(consequentNode, consequents, localContext);
|
|
40
39
|
|
|
41
40
|
if (consequentVerified) {
|
|
42
41
|
const proofNode = proofNodeQuery(metatheoremNode),
|
|
43
42
|
firstConsequent = first(consequents),
|
|
44
43
|
consequent = firstConsequent, ///
|
|
44
|
+
substitutions = [],
|
|
45
45
|
statementNode = consequent.getStatementNode(),
|
|
46
46
|
proofVerified = verifyProof(proofNode, statementNode, substitutions, localContext);
|
|
47
47
|
|
|
@@ -73,7 +73,7 @@ export function verifyStandaloneMetavariable(metavariableNode, localContext, ver
|
|
|
73
73
|
|
|
74
74
|
localContext.trace(`Verifying the '${metavariableString}' standalone metavariable...`, metavariableNode);
|
|
75
75
|
|
|
76
|
-
const metavariablePresent = localContext.isMetavariablePresentByMetavariableNode(metavariableNode
|
|
76
|
+
const metavariablePresent = localContext.isMetavariablePresentByMetavariableNode(metavariableNode);
|
|
77
77
|
|
|
78
78
|
if (metavariablePresent) {
|
|
79
79
|
const verifiedAhead = verifyAhead();
|
package/src/verify/proof.js
CHANGED
|
@@ -7,13 +7,13 @@ import { nodeQuery } from "../utilities/query";
|
|
|
7
7
|
|
|
8
8
|
const derivationNodeQuery = nodeQuery("/proof/derivation!");
|
|
9
9
|
|
|
10
|
-
export default function verifyProof(proofNode, conclusion, localContext) {
|
|
10
|
+
export default function verifyProof(proofNode, conclusion, substitutions, localContext) {
|
|
11
11
|
let proofVerified = false;
|
|
12
12
|
|
|
13
13
|
localContext = LocalContext.fromLocalContext(localContext); ///
|
|
14
14
|
|
|
15
15
|
const derivationNode = derivationNodeQuery(proofNode),
|
|
16
|
-
derivationVerified = verifyDerivation(derivationNode, localContext);
|
|
16
|
+
derivationVerified = verifyDerivation(derivationNode, substitutions, localContext);
|
|
17
17
|
|
|
18
18
|
if (derivationVerified) {
|
|
19
19
|
const lastProofStep = localContext.getLastProofStep();
|
package/src/verify/proofStep.js
CHANGED
|
@@ -14,7 +14,7 @@ const subproofNodeQuery = nodeQuery("/proofStep|lastProofStep/subproof!"),
|
|
|
14
14
|
qualifiedStatementNodeQuery = nodeQuery("/proofStep|lastProofStep/qualifiedStatement!"),
|
|
15
15
|
unqualifiedStatementNodeQuery = nodeQuery("/proofStep|lastProofStep/unqualifiedStatement!");
|
|
16
16
|
|
|
17
|
-
export default function verifyProofStep(proofStepNode, localContext) {
|
|
17
|
+
export default function verifyProofStep(proofStepNode, substitutions, localContext) {
|
|
18
18
|
let proofStepVerified = false;
|
|
19
19
|
|
|
20
20
|
const subproofNode = subproofNodeQuery(proofStepNode),
|
|
@@ -26,7 +26,7 @@ export default function verifyProofStep(proofStepNode, localContext) {
|
|
|
26
26
|
} else if (subproofNode !== null) {
|
|
27
27
|
let subproofVerified;
|
|
28
28
|
|
|
29
|
-
subproofVerified = verifySubproof(subproofNode, localContext);
|
|
29
|
+
subproofVerified = verifySubproof(subproofNode, substitutions, localContext);
|
|
30
30
|
|
|
31
31
|
if (subproofVerified) {
|
|
32
32
|
const proofStep = ProofStep.fromSubproofNode(subproofNode);
|
|
@@ -40,7 +40,7 @@ export default function verifyProofStep(proofStepNode, localContext) {
|
|
|
40
40
|
|
|
41
41
|
const assignments = [];
|
|
42
42
|
|
|
43
|
-
qualifiedStatementVerified = verifyQualifiedStatement(qualifiedStatementNode, assignments, localContext);
|
|
43
|
+
qualifiedStatementVerified = verifyQualifiedStatement(qualifiedStatementNode, substitutions, assignments, localContext);
|
|
44
44
|
|
|
45
45
|
if (qualifiedStatementVerified) {
|
|
46
46
|
const assignmentAssigned = assignAssignment(assignments, localContext);
|
package/src/verify/rule.js
CHANGED
|
@@ -10,9 +10,9 @@ import verifyConclusion from "../verify/conclusion";
|
|
|
10
10
|
import { first } from "../utilities/array";
|
|
11
11
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
12
12
|
|
|
13
|
-
const
|
|
13
|
+
const proofNodeQuery = nodeQuery("/rule/proof!"),
|
|
14
|
+
labelNodesQuery = nodesQuery("/rule/label"),
|
|
14
15
|
premisesNodeQuery = nodesQuery("/rule/premise"),
|
|
15
|
-
proofNodeQuery = nodeQuery("/rule/proof!"),
|
|
16
16
|
conclusionNodeQuery = nodeQuery("/rule/conclusion!");
|
|
17
17
|
|
|
18
18
|
export default function verifyRule(ruleNode, fileContext) {
|
|
@@ -27,8 +27,8 @@ export default function verifyRule(ruleNode, fileContext) {
|
|
|
27
27
|
labelsVerified = verifyLabels(labelNodes, labels, fileContext);
|
|
28
28
|
|
|
29
29
|
if (labelsVerified) {
|
|
30
|
-
const
|
|
31
|
-
|
|
30
|
+
const localContext = LocalContext.fromFileContext(fileContext),
|
|
31
|
+
premises = [],
|
|
32
32
|
premiseNodes = premisesNodeQuery(ruleNode),
|
|
33
33
|
premisesVerified = verifyPremises(premiseNodes, premises, localContext);
|
|
34
34
|
|