occam-verify-cli 0.0.678 → 0.0.680
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/bin/action/verify.js +13 -3
- package/lib/axiomLemmaTheoremConjecture.js +3 -3
- package/lib/conclusion.js +16 -5
- package/lib/consequent.js +11 -3
- package/lib/context/file.js +73 -3
- package/lib/context/release.js +7 -2
- package/lib/equality.js +13 -199
- package/lib/premise.js +24 -7
- package/lib/supposition.js +15 -4
- package/lib/type.js +3 -8
- package/lib/utilities/array.js +5 -2
- package/lib/utilities/string.js +26 -13
- package/lib/verifier/node/metastatement.js +176 -0
- package/lib/verifier/node/statementAsCombinator.js +186 -0
- package/lib/verifier/node/termAsConstructor.js +224 -0
- package/lib/verifier/node.js +158 -0
- package/lib/verifier/nodes/equality.js +155 -0
- package/lib/verifier/{metastatementForMetavariable → nodes/metastatementForMetavariable}/conclusion.js +13 -12
- package/lib/verifier/{metastatementForMetavariable → nodes/metastatementForMetavariable}/premise.js +13 -12
- package/lib/verifier/nodes/metastatementForMetavariable.js +198 -0
- package/lib/verifier/nodes/statement.js +200 -0
- package/lib/verifier/{statementForMetavariable → nodes/statementForMetavariable}/conclusion.js +13 -12
- package/lib/verifier/{statementForMetavariable → nodes/statementForMetavariable}/premise.js +13 -12
- package/lib/verifier/nodes/statementForMetavariable.js +203 -0
- package/lib/verifier/nodes/term.js +210 -0
- package/lib/verifier/{termForVariable/supposition.js → nodes/termForVariable/consequent.js} +13 -12
- package/lib/verifier/{termForVariable/consequent.js → nodes/termForVariable/supposition.js} +13 -12
- package/lib/verifier/nodes/termForVariable.js +217 -0
- package/lib/verifier/nodes.js +175 -0
- package/lib/verify/axiom.js +3 -3
- package/lib/verify/conclusion.js +3 -3
- package/lib/verify/conjecture.js +3 -3
- package/lib/verify/consequent.js +3 -3
- package/lib/verify/declaration/combinator.js +7 -2
- package/lib/verify/declaration/constructor.js +8 -2
- package/lib/verify/declaration/metavariable.js +7 -2
- package/lib/verify/declaration/type.js +7 -2
- package/lib/verify/declaration/variable.js +8 -2
- package/lib/verify/file.js +3 -3
- package/lib/verify/label.js +9 -4
- package/lib/verify/lemma.js +3 -3
- package/lib/verify/metastatement/qualified.js +5 -6
- package/lib/verify/metastatement/unqualified.js +9 -7
- package/lib/verify/metastatement.js +36 -156
- package/lib/verify/metavariable.js +6 -4
- package/lib/verify/premise.js +3 -3
- package/lib/verify/release.js +3 -3
- package/lib/verify/rule.js +3 -3
- package/lib/verify/statement/qualified.js +5 -6
- package/lib/verify/statement/unqualified.js +9 -7
- package/lib/verify/statement.js +86 -332
- package/lib/verify/statementAsCombinator.js +8 -82
- package/lib/verify/supposition.js +3 -3
- package/lib/verify/term.js +79 -215
- package/lib/verify/termAsConstructor.js +15 -89
- package/lib/verify/terms.js +45 -0
- package/lib/verify/theorem.js +3 -3
- package/lib/verify/type.js +7 -5
- package/lib/verify/typeAssertion.js +124 -0
- package/lib/verify/variable.js +7 -5
- package/package.json +5 -5
- package/src/axiomLemmaTheoremConjecture.js +2 -2
- package/src/conclusion.js +13 -4
- package/src/consequent.js +9 -2
- package/src/context/file.js +9 -2
- package/src/context/release.js +9 -2
- package/src/equality.js +17 -143
- package/src/premise.js +23 -6
- package/src/supposition.js +12 -3
- package/src/type.js +3 -8
- package/src/utilities/array.js +1 -1
- package/src/utilities/string.js +34 -23
- package/src/verifier/node/metastatement.js +61 -0
- package/src/verifier/node/statementAsCombinator.js +80 -0
- package/src/verifier/node/termAsConstructor.js +124 -0
- package/src/verifier/node.js +85 -0
- package/src/verifier/nodes/equality.js +68 -0
- package/src/verifier/nodes/metastatementForMetavariable/conclusion.js +11 -0
- package/src/verifier/nodes/metastatementForMetavariable/premise.js +11 -0
- package/src/verifier/{metastatementForMetavariable.js → nodes/metastatementForMetavariable.js} +13 -13
- package/src/verifier/nodes/statement.js +100 -0
- package/src/verifier/nodes/statementForMetavariable/conclusion.js +11 -0
- package/src/verifier/nodes/statementForMetavariable/premise.js +11 -0
- package/src/verifier/{statementForMetavariable.js → nodes/statementForMetavariable.js} +10 -10
- package/src/verifier/nodes/term.js +106 -0
- package/src/verifier/nodes/termForVariable/consequent.js +11 -0
- package/src/verifier/nodes/termForVariable/supposition.js +11 -0
- package/src/verifier/{termForVariable.js → nodes/termForVariable.js} +42 -30
- package/src/verifier/nodes.js +111 -0
- package/src/verify/axiom.js +2 -2
- package/src/verify/conclusion.js +2 -2
- package/src/verify/conjecture.js +2 -2
- package/src/verify/consequent.js +2 -2
- package/src/verify/declaration/combinator.js +9 -1
- package/src/verify/declaration/constructor.js +15 -1
- package/src/verify/declaration/metavariable.js +9 -1
- package/src/verify/declaration/type.js +14 -1
- package/src/verify/declaration/variable.js +15 -1
- package/src/verify/file.js +2 -2
- package/src/verify/label.js +10 -2
- package/src/verify/lemma.js +4 -4
- package/src/verify/metastatement/qualified.js +4 -6
- package/src/verify/metastatement/unqualified.js +9 -7
- package/src/verify/metastatement.js +35 -56
- package/src/verify/metavariable.js +6 -3
- package/src/verify/premise.js +2 -2
- package/src/verify/release.js +2 -2
- package/src/verify/rule.js +2 -2
- package/src/verify/statement/qualified.js +4 -6
- package/src/verify/statement/unqualified.js +9 -7
- package/src/verify/statement.js +109 -302
- package/src/verify/statementAsCombinator.js +9 -129
- package/src/verify/supposition.js +2 -2
- package/src/verify/term.js +99 -156
- package/src/verify/termAsConstructor.js +20 -135
- package/src/verify/terms.js +54 -0
- package/src/verify/theorem.js +2 -2
- package/src/verify/type.js +7 -4
- package/src/verify/typeAssertion.js +164 -0
- package/src/verify/variable.js +7 -4
- package/lib/node/statement/combinator/equality.js +0 -21
- package/lib/ocmbinator/equality.js +0 -126
- package/lib/tokens/statement/combinator/equality.js +0 -17
- package/lib/verifier/metastatementForMetavariable.js +0 -198
- package/lib/verifier/statementForMetavariable.js +0 -203
- package/lib/verifier/termForVariable.js +0 -209
- package/lib/verifier.js +0 -138
- package/lib/verify/assertion/type.js +0 -115
- package/lib/verify/typeInference.js +0 -132
- package/src/node/statement/combinator/equality.js +0 -9
- package/src/ocmbinator/equality.js +0 -23
- package/src/tokens/statement/combinator/equality.js +0 -10
- package/src/verifier/metastatementForMetavariable/conclusion.js +0 -9
- package/src/verifier/metastatementForMetavariable/premise.js +0 -9
- package/src/verifier/statementForMetavariable/conclusion.js +0 -9
- package/src/verifier/statementForMetavariable/premise.js +0 -9
- package/src/verifier/termForVariable/consequent.js +0 -9
- package/src/verifier/termForVariable/supposition.js +0 -9
- package/src/verifier.js +0 -74
- package/src/verify/assertion/type.js +0 -153
- package/src/verify/typeInference.js +0 -146
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import TermForVariableSubstitution from "
|
|
3
|
+
import verifyTerm from "../../verify/term";
|
|
4
|
+
import NodesVerifier from "../../verifier/nodes";
|
|
5
|
+
import TermForVariableSubstitution from "../../substitution/termForVariable";
|
|
6
6
|
|
|
7
|
-
import { first } from "
|
|
8
|
-
import { nodeQuery } from "
|
|
9
|
-
import { TERM_RULE_NAME } from "
|
|
10
|
-
import { variableNameFromVariableNode } from "
|
|
7
|
+
import { first } from "../../utilities/array";
|
|
8
|
+
import { nodeQuery } from "../../utilities/query";
|
|
9
|
+
import { TERM_RULE_NAME } from "../../ruleNames";
|
|
10
|
+
import { variableNameFromVariableNode } from "../../utilities/query";
|
|
11
11
|
|
|
12
12
|
const variableNodeQuery = nodeQuery('/term/variable!');
|
|
13
13
|
|
|
14
|
-
export default class
|
|
15
|
-
verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, proofContextA, proofContextB) {
|
|
14
|
+
export default class TermForVariableNodesVerifier extends NodesVerifier {
|
|
15
|
+
verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, proofContextA, proofContextB, verifyAhead) {
|
|
16
16
|
let nonTerminalNodeVerified = false;
|
|
17
17
|
|
|
18
18
|
const nonTerminalNodeARuleName = nonTerminalNodeA.getRuleName(),
|
|
@@ -25,28 +25,28 @@ export default class TermForVariableVerifier extends Verifier {
|
|
|
25
25
|
if (nonTerminalNodeARuleNameTermRuleName && nonTerminalNodeBRuleNameTermRuleName) {
|
|
26
26
|
const termNodeA = nonTerminalNodeA, ///
|
|
27
27
|
termNodeB = nonTerminalNodeB, ///
|
|
28
|
-
termNodeVerified = this.verifyTermNode(termNodeA, termNodeB, substitutions, proofContextA, proofContextB);
|
|
28
|
+
termNodeVerified = this.verifyTermNode(termNodeA, termNodeB, substitutions, proofContextA, proofContextB, verifyAhead);
|
|
29
29
|
|
|
30
30
|
if (termNodeVerified) {
|
|
31
31
|
nonTerminalNodeVerified = true; ///
|
|
32
32
|
} else {
|
|
33
|
-
nonTerminalNodeVerified = super.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, proofContextA, proofContextB);
|
|
33
|
+
nonTerminalNodeVerified = super.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, proofContextA, proofContextB, verifyAhead);
|
|
34
34
|
}
|
|
35
35
|
} else {
|
|
36
|
-
nonTerminalNodeVerified = super.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, proofContextA, proofContextB);
|
|
36
|
+
nonTerminalNodeVerified = super.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, proofContextA, proofContextB, verifyAhead);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
return nonTerminalNodeVerified;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
verifyTermNode(termNodeA, termNodeB, substitutions, proofContextA, proofContextB) {
|
|
43
|
+
verifyTermNode(termNodeA, termNodeB, substitutions, proofContextA, proofContextB, verifyAhead) {
|
|
44
44
|
let termNodeVerified = false;
|
|
45
45
|
|
|
46
46
|
const variableNodeA = variableNodeQuery(termNodeA);
|
|
47
47
|
|
|
48
48
|
if (variableNodeA !== null) {
|
|
49
|
-
const variableVerified = this.verifyVariableNode(variableNodeA, termNodeB, substitutions, proofContextA, proofContextB);
|
|
49
|
+
const variableVerified = this.verifyVariableNode(variableNodeA, termNodeB, substitutions, proofContextA, proofContextB, verifyAhead);
|
|
50
50
|
|
|
51
51
|
termNodeVerified = variableVerified; ///
|
|
52
52
|
}
|
|
@@ -54,8 +54,8 @@ export default class TermForVariableVerifier extends Verifier {
|
|
|
54
54
|
return termNodeVerified;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
verifyVariableNode(variableNodeA, termNodeB, substitutions, proofContextA, proofContextB) {
|
|
58
|
-
let variableVerified;
|
|
57
|
+
verifyVariableNode(variableNodeA, termNodeB, substitutions, proofContextA, proofContextB, verifyAhead) {
|
|
58
|
+
let variableVerified = false;
|
|
59
59
|
|
|
60
60
|
const variableNameA = variableNameFromVariableNode(variableNodeA),
|
|
61
61
|
substitution = substitutions.find((substitution) => {
|
|
@@ -70,7 +70,11 @@ export default class TermForVariableVerifier extends Verifier {
|
|
|
70
70
|
const termNode = termNodeB, ///
|
|
71
71
|
substitutionNodesVerified = substitution.matchTermNode(termNode);
|
|
72
72
|
|
|
73
|
-
|
|
73
|
+
if (substitutionNodesVerified) {
|
|
74
|
+
const verifiedAhead = verifyAhead();
|
|
75
|
+
|
|
76
|
+
variableVerified = verifiedAhead; ///
|
|
77
|
+
}
|
|
74
78
|
} else {
|
|
75
79
|
const { createSubstitutions } = this.constructor;
|
|
76
80
|
|
|
@@ -83,23 +87,31 @@ export default class TermForVariableVerifier extends Verifier {
|
|
|
83
87
|
const types = [],
|
|
84
88
|
context = proofContextB, ///
|
|
85
89
|
termNode = termNodeB, ///
|
|
86
|
-
termVerified = verifyTerm(termNode, types, context)
|
|
90
|
+
termVerified = verifyTerm(termNode, types, context, () => {
|
|
91
|
+
let verifiedAhead = false;
|
|
87
92
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
variableTypeEqualToOrSuperTypeOfTermType = variableType.isEqualToOrSuperTypeOf(termType);
|
|
93
|
+
const firstType = first(types),
|
|
94
|
+
termType = firstType,
|
|
95
|
+
variableType = variable.getType(),
|
|
96
|
+
variableTypeEqualToOrSuperTypeOfTermType = variableType.isEqualToOrSuperTypeOf(termType);
|
|
93
97
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
98
|
+
if (variableTypeEqualToOrSuperTypeOfTermType) {
|
|
99
|
+
const termForVariableSubstitution = TermForVariableSubstitution.fromVariableNameAndTermNode(variableName, termNode),
|
|
100
|
+
substitution = termForVariableSubstitution; ///
|
|
97
101
|
|
|
98
|
-
|
|
102
|
+
substitutions.push(substitution);
|
|
99
103
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
104
|
+
verifiedAhead = verifyAhead();
|
|
105
|
+
|
|
106
|
+
if (!verifiedAhead) {
|
|
107
|
+
substitutions.pop();
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return verifiedAhead;
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
variableVerified = termVerified; ///
|
|
103
115
|
}
|
|
104
116
|
}
|
|
105
117
|
}
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
export default class NodesVerifier {
|
|
4
|
+
verifyNode(nodeA, nodeB, ...remainingArguments) {
|
|
5
|
+
let nodeVerified = false;
|
|
6
|
+
|
|
7
|
+
const nodeATerminalNode = nodeA.isTerminalNode(),
|
|
8
|
+
nodeBTerminalNode = nodeB.isTerminalNode(),
|
|
9
|
+
nodeANonTerminalNode = nodeA.isNonTerminalNode(),
|
|
10
|
+
nodeBNonTerminalNode = nodeB.isNonTerminalNode();
|
|
11
|
+
|
|
12
|
+
if (false) {
|
|
13
|
+
///
|
|
14
|
+
} else if (nodeATerminalNode && nodeBTerminalNode) {
|
|
15
|
+
const terminalNodeA = nodeA, ///
|
|
16
|
+
terminalNodeB = nodeB, ///
|
|
17
|
+
terminalNodeVerified = this.verifyTerminalNode(terminalNodeA, terminalNodeB, ...remainingArguments);
|
|
18
|
+
|
|
19
|
+
nodeVerified = terminalNodeVerified; ///
|
|
20
|
+
} else if (nodeANonTerminalNode && nodeBNonTerminalNode) {
|
|
21
|
+
const nonTerminalNodeA = nodeA, ///
|
|
22
|
+
nonTerminalNodeB = nodeB, ///
|
|
23
|
+
nonTerminalNodeVerified = this.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, ...remainingArguments);
|
|
24
|
+
|
|
25
|
+
nodeVerified = nonTerminalNodeVerified; ///
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return nodeVerified;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
verifyChildNodes(childNodesA, childNodesB, ...remainingArguments) {
|
|
32
|
+
let childNodesVerify = false;
|
|
33
|
+
|
|
34
|
+
const childNodesALength = childNodesA.length,
|
|
35
|
+
childNodesBLength = childNodesB.length;
|
|
36
|
+
|
|
37
|
+
if (childNodesALength === childNodesBLength) {
|
|
38
|
+
const index = 0,
|
|
39
|
+
childNodesVerifyAhead = this.verifyChildNodesAhead(index, childNodesA, childNodesB, ...remainingArguments);
|
|
40
|
+
|
|
41
|
+
childNodesVerify = childNodesVerifyAhead; ///
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
return childNodesVerify;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
verifyChildNodesAhead(index, childNodesA, childNodesB, ...remainingArguments) {
|
|
48
|
+
let childNodesVerify;
|
|
49
|
+
|
|
50
|
+
const verifyAhead = remainingArguments.pop(), ///
|
|
51
|
+
childNodesALength = childNodesA.length;
|
|
52
|
+
|
|
53
|
+
if (index === childNodesALength) {
|
|
54
|
+
const verifiedAhead = verifyAhead();
|
|
55
|
+
|
|
56
|
+
childNodesVerify = verifiedAhead; ///
|
|
57
|
+
} else {
|
|
58
|
+
const childNodeA = childNodesA[index],
|
|
59
|
+
childNodeB = childNodesB[index],
|
|
60
|
+
nodeA = childNodeA, ///
|
|
61
|
+
nodeB = childNodeB, ///
|
|
62
|
+
nodeVerified = this.verifyNode(nodeA, nodeB, ...remainingArguments, () => {
|
|
63
|
+
index++;
|
|
64
|
+
|
|
65
|
+
remainingArguments.push(verifyAhead); ///
|
|
66
|
+
|
|
67
|
+
const childNodesVerifyAhead = this.verifyChildNodesAhead(index, childNodesA, childNodesB, ...remainingArguments);
|
|
68
|
+
|
|
69
|
+
return childNodesVerifyAhead;
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
childNodesVerify = nodeVerified; ///
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return childNodesVerify;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
verifyTerminalNode(terminalNodeA, terminalNodeB, ...remainingArguments) {
|
|
79
|
+
let terminalNodeVerified = false;
|
|
80
|
+
|
|
81
|
+
const matches = terminalNodeA.match(terminalNodeB);
|
|
82
|
+
|
|
83
|
+
if (matches) {
|
|
84
|
+
const verifyAhead = remainingArguments.pop(),
|
|
85
|
+
verifiedAhead = verifyAhead();
|
|
86
|
+
|
|
87
|
+
terminalNodeVerified = verifiedAhead; ///
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return terminalNodeVerified;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, ...remainingArguments) {
|
|
94
|
+
let nonTerminalNodeVerified = false;
|
|
95
|
+
|
|
96
|
+
const nonTerminalNodeARuleName = nonTerminalNodeA.getRuleName(), ///
|
|
97
|
+
nonTerminalNodeBRuleName = nonTerminalNodeB.getRuleName(); ///
|
|
98
|
+
|
|
99
|
+
if (nonTerminalNodeARuleName === nonTerminalNodeBRuleName) {
|
|
100
|
+
const nonTerminalNodeAChildNodes = nonTerminalNodeA.getChildNodes(),
|
|
101
|
+
nonTerminalNodeBChildNodes = nonTerminalNodeB.getChildNodes(),
|
|
102
|
+
childNodesA = nonTerminalNodeAChildNodes, ///
|
|
103
|
+
childNodesB = nonTerminalNodeBChildNodes, ///
|
|
104
|
+
childNodesVerify = this.verifyChildNodes(childNodesA, childNodesB, ...remainingArguments);
|
|
105
|
+
|
|
106
|
+
nonTerminalNodeVerified = childNodesVerify; ///
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
return nonTerminalNodeVerified;
|
|
110
|
+
}
|
|
111
|
+
}
|
package/src/verify/axiom.js
CHANGED
|
@@ -20,7 +20,7 @@ export default function verifyAxiom(axiomNode, fileContext) {
|
|
|
20
20
|
labelsString = fileContext.nodesAsString(labelNodes),
|
|
21
21
|
proofContext = ProofContext.fromFileContext(fileContext);
|
|
22
22
|
|
|
23
|
-
fileContext.
|
|
23
|
+
fileContext.trace(`Verifying the '${labelsString}' axiom...`, axiomNode);
|
|
24
24
|
|
|
25
25
|
const labels = [],
|
|
26
26
|
labelsVerified = verifyLabels(labelNodes, labels, fileContext);
|
|
@@ -54,7 +54,7 @@ export default function verifyAxiom(axiomNode, fileContext) {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
if (axiomVerified) {
|
|
57
|
-
fileContext.
|
|
57
|
+
fileContext.debug(`...verified the '${labelsString}' axiom.`, axiomNode);
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
return axiomVerified;
|
package/src/verify/conclusion.js
CHANGED
|
@@ -13,7 +13,7 @@ export default function verifyConclusion(conclusionNode, conclusions, metaproofC
|
|
|
13
13
|
|
|
14
14
|
const conclusionString = metaproofContext.nodeAsString(conclusionNode);
|
|
15
15
|
|
|
16
|
-
metaproofContext.
|
|
16
|
+
metaproofContext.trace(`Verifying the '${conclusionString}' conclusion...`, conclusionNode);
|
|
17
17
|
|
|
18
18
|
const derived = false,
|
|
19
19
|
unqualifiedMetastatementNode = unqualifiedMetastatementNodeQuery(conclusionNode),
|
|
@@ -29,7 +29,7 @@ export default function verifyConclusion(conclusionNode, conclusions, metaproofC
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
if (conclusionVerified) {
|
|
32
|
-
metaproofContext.
|
|
32
|
+
metaproofContext.debug(`...verified the '${conclusionString}' conclusion.`, conclusionNode);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
return conclusionVerified;
|
package/src/verify/conjecture.js
CHANGED
|
@@ -22,7 +22,7 @@ export default function verifyConjecture(conjectureNode, fileContext) {
|
|
|
22
22
|
labelsString = fileContext.nodesAsString(labelNodes),
|
|
23
23
|
proofContext = ProofContext.fromFileContext(fileContext);
|
|
24
24
|
|
|
25
|
-
fileContext.
|
|
25
|
+
fileContext.trace(`Verifying the '${labelsString}' conjecture...`, conjectureNode);
|
|
26
26
|
|
|
27
27
|
const labels = [],
|
|
28
28
|
labelsVerified = verifyLabels(labelNodes, labels, fileContext);
|
|
@@ -60,7 +60,7 @@ export default function verifyConjecture(conjectureNode, fileContext) {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
if (conjectureVerified) {
|
|
63
|
-
fileContext.
|
|
63
|
+
fileContext.debug(`...verified the '${labelsString}' conjecture.`, conjectureNode);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
return conjectureVerified;
|
package/src/verify/consequent.js
CHANGED
|
@@ -13,7 +13,7 @@ export default function verifyConsequent(consequentNode, consequents, proofConte
|
|
|
13
13
|
|
|
14
14
|
const consequentString = proofContext.nodeAsString(consequentNode);
|
|
15
15
|
|
|
16
|
-
proofContext.
|
|
16
|
+
proofContext.trace(`Verifying the '${consequentString}' consequent...`, consequentNode);
|
|
17
17
|
|
|
18
18
|
const derived = false,
|
|
19
19
|
assignments = [],
|
|
@@ -30,7 +30,7 @@ export default function verifyConsequent(consequentNode, consequents, proofConte
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
if (consequentVerified) {
|
|
33
|
-
proofContext.
|
|
33
|
+
proofContext.debug(`...verified the '${consequentString}' consequent.`, consequentNode);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
return consequentVerified;
|
|
@@ -10,9 +10,17 @@ export default function verifyCombinatorDeclaration(combinatorDeclarationNode, f
|
|
|
10
10
|
let combinatorDeclarationVerified;
|
|
11
11
|
|
|
12
12
|
const statementNode = statementNodeQuery(combinatorDeclarationNode),
|
|
13
|
-
|
|
13
|
+
statementString = fileContext.nodeAsString(statementNode);
|
|
14
|
+
|
|
15
|
+
fileContext.trace(`Verifying the '${statementString}' combinator declaration...`, combinatorDeclarationNode);
|
|
16
|
+
|
|
17
|
+
const statementVerifiedAsCombinator = verifyStatementAsCombinator(statementNode, fileContext);
|
|
14
18
|
|
|
15
19
|
combinatorDeclarationVerified = statementVerifiedAsCombinator; ///
|
|
16
20
|
|
|
21
|
+
if (combinatorDeclarationVerified) {
|
|
22
|
+
fileContext.debug(`...verified the '${statementString}' combinator declaration.`, combinatorDeclarationNode);
|
|
23
|
+
}
|
|
24
|
+
|
|
17
25
|
return combinatorDeclarationVerified;
|
|
18
26
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import verifyTermAsConstructor from "../../verify/termAsConstructor";
|
|
4
4
|
|
|
5
5
|
import { nodeQuery } from "../../utilities/query";
|
|
6
|
+
import { EMPTY_STRING } from "../../constants";
|
|
6
7
|
|
|
7
8
|
const termNodeQuery = nodeQuery("/constructorDeclaration/term"),
|
|
8
9
|
typeNodeQuery = nodeQuery("/constructorDeclaration/type");
|
|
@@ -12,9 +13,22 @@ export default function verifyConstructorDeclaration(constructorDeclarationNode,
|
|
|
12
13
|
|
|
13
14
|
const termNode = termNodeQuery(constructorDeclarationNode),
|
|
14
15
|
typeNode = typeNodeQuery(constructorDeclarationNode),
|
|
15
|
-
|
|
16
|
+
termString = fileContext.nodeAsString(termNode),
|
|
17
|
+
typeString = fileContext.nodeAsString(typeNode);
|
|
18
|
+
|
|
19
|
+
(typeString === EMPTY_STRING) ?
|
|
20
|
+
fileContext.trace(`Verifying the '${termString}' constructor declaration...`, constructorDeclarationNode) :
|
|
21
|
+
fileContext.trace(`Verifying the '${termString}:${typeString}' constructor declaration...`, constructorDeclarationNode);
|
|
22
|
+
|
|
23
|
+
const termVerifiedAsConstructor = verifyTermAsConstructor(termNode, typeNode, fileContext);
|
|
16
24
|
|
|
17
25
|
constructorDeclarationVerified = termVerifiedAsConstructor; ///
|
|
18
26
|
|
|
27
|
+
if (constructorDeclarationVerified) {
|
|
28
|
+
(typeString === EMPTY_STRING) ?
|
|
29
|
+
fileContext.debug(`...verified the '${termString}' constructor declaration.`, constructorDeclarationNode) :
|
|
30
|
+
fileContext.debug(`...verified the '${termString}:${typeString}' constructor declaration.`, constructorDeclarationNode);
|
|
31
|
+
}
|
|
32
|
+
|
|
19
33
|
return constructorDeclarationVerified;
|
|
20
34
|
}
|
|
@@ -12,9 +12,17 @@ export default function verifyMetavariableDeclaration(metavariableDeclarationNod
|
|
|
12
12
|
|
|
13
13
|
const metaTypeNode = metaTypeNodeQuery(metavariableDeclarationNode),
|
|
14
14
|
metavariableNode = metavariableNodeQuery(metavariableDeclarationNode),
|
|
15
|
-
|
|
15
|
+
metavariableString = fileContext.nodeAsString(metaTypeNode);
|
|
16
|
+
|
|
17
|
+
fileContext.trace(`Verifying the '${metavariableString}' metavariable declaration...`, metavariableDeclarationNode);
|
|
18
|
+
|
|
19
|
+
const metavariableVVerified = verifyMetavariable(metavariableNode, metaTypeNode, fileContext);
|
|
16
20
|
|
|
17
21
|
metavariableDeclarationVerified = metavariableVVerified; ///
|
|
18
22
|
|
|
23
|
+
if (metavariableDeclarationVerified) {
|
|
24
|
+
fileContext.debug(`...verified the '${metavariableString}' metavariable declaration.`, metavariableDeclarationNode);
|
|
25
|
+
}
|
|
26
|
+
|
|
19
27
|
return metavariableDeclarationVerified;
|
|
20
28
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import verifyType from "../../verify/type";
|
|
4
4
|
|
|
5
5
|
import { nodeQuery } from "../../utilities/query";
|
|
6
|
+
import { EMPTY_STRING } from "../../constants";
|
|
6
7
|
|
|
7
8
|
const firstTypeNodeQuery = nodeQuery("/typeDeclaration/type[0]"),
|
|
8
9
|
secondTypeNodeQuery = nodeQuery("/typeDeclaration/type[1]");
|
|
@@ -13,11 +14,23 @@ export default function verifyTypeDeclaration(typeDeclarationNode, fileContext)
|
|
|
13
14
|
const firstTypeNode = firstTypeNodeQuery(typeDeclarationNode),
|
|
14
15
|
secondTypeNode = secondTypeNodeQuery(typeDeclarationNode),
|
|
15
16
|
typeNode = firstTypeNode, ///
|
|
16
|
-
superTypeNode = secondTypeNode
|
|
17
|
+
superTypeNode = secondTypeNode, ///
|
|
18
|
+
typeString = fileContext.nodeAsString(typeNode),
|
|
19
|
+
superTypeString = fileContext.nodeAsString(superTypeNode);
|
|
20
|
+
|
|
21
|
+
(superTypeString === EMPTY_STRING) ?
|
|
22
|
+
fileContext.trace(`Verifying the '${typeString}' type declaration...`, typeDeclarationNode) :
|
|
23
|
+
fileContext.trace(`Verifying the '${typeString}:${superTypeString}' type declaration...`, typeDeclarationNode);
|
|
17
24
|
|
|
18
25
|
const typeVerified = verifyType(typeNode, superTypeNode, fileContext);
|
|
19
26
|
|
|
20
27
|
typeDeclarationVerified = typeVerified; ///
|
|
21
28
|
|
|
29
|
+
if (typeDeclarationVerified) {
|
|
30
|
+
(superTypeString === EMPTY_STRING) ?
|
|
31
|
+
fileContext.trace(`...verified the '${typeString}' type declaration.`, typeDeclarationNode) :
|
|
32
|
+
fileContext.trace(`...verified the '${typeString}:${superTypeString}' type declaration.`, typeDeclarationNode);
|
|
33
|
+
}
|
|
34
|
+
|
|
22
35
|
return typeDeclarationVerified;
|
|
23
36
|
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import verifyVariable from "../../verify/variable";
|
|
4
4
|
|
|
5
5
|
import { nodeQuery } from "../../utilities/query";
|
|
6
|
+
import { EMPTY_STRING } from "../../constants";
|
|
6
7
|
|
|
7
8
|
const typeNodeQuery = nodeQuery("/variableDeclaration/type"),
|
|
8
9
|
variableNodeQuery = nodeQuery("/variableDeclaration/variable");
|
|
@@ -12,9 +13,22 @@ export default function verifyVariableDeclaration(variableDeclarationNode, fileC
|
|
|
12
13
|
|
|
13
14
|
const typeNode = typeNodeQuery(variableDeclarationNode),
|
|
14
15
|
variableNode = variableNodeQuery(variableDeclarationNode),
|
|
15
|
-
|
|
16
|
+
typeString = fileContext.nodeAsString(typeNode),
|
|
17
|
+
variableString = fileContext.nodeAsString(variableNode);
|
|
18
|
+
|
|
19
|
+
(typeString === EMPTY_STRING) ?
|
|
20
|
+
fileContext.trace(`Verifying the '${variableString}' variable declaration...`, variableDeclarationNode) :
|
|
21
|
+
fileContext.trace(`Verifying the '${variableString}:${typeString}' variable declaration...`, variableDeclarationNode);
|
|
22
|
+
|
|
23
|
+
const variableVVerified = verifyVariable(variableNode, typeNode, fileContext);
|
|
16
24
|
|
|
17
25
|
variableDeclarationVerified = variableVVerified; ///
|
|
18
26
|
|
|
27
|
+
if (variableDeclarationVerified) {
|
|
28
|
+
(typeString === EMPTY_STRING) ?
|
|
29
|
+
fileContext.debug(`...verified the '${variableString}' variable declaration.`, variableDeclarationNode) :
|
|
30
|
+
fileContext.debug(`...verified the '${variableString}:${typeString}' variable declaration.`, variableDeclarationNode);
|
|
31
|
+
}
|
|
32
|
+
|
|
19
33
|
return variableDeclarationVerified;
|
|
20
34
|
}
|
package/src/verify/file.js
CHANGED
|
@@ -23,7 +23,7 @@ export default function verifyFile(filePath, releaseContext) {
|
|
|
23
23
|
errorNodesLength = errorNodes.length;
|
|
24
24
|
|
|
25
25
|
if (errorNodesLength > 0) {
|
|
26
|
-
releaseContext.
|
|
26
|
+
releaseContext.warning(`The '${filePath}' file cannot be verified because it contains errors.`);
|
|
27
27
|
} else {
|
|
28
28
|
const topLevelDeclarationNodes = topLevelDeclarationNodesQuery(node),
|
|
29
29
|
topLevelDeclarationsVerified = topLevelDeclarationNodes.every((topLevelDeclarationNode) => {
|
|
@@ -43,7 +43,7 @@ export default function verifyFile(filePath, releaseContext) {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
if (fileVerified) {
|
|
46
|
-
releaseContext.info(
|
|
46
|
+
releaseContext.info(`...verified the '${filePath}' file.`);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
return fileVerified;
|
package/src/verify/label.js
CHANGED
|
@@ -8,12 +8,16 @@ export default function verifyLabel(labelNode, labels, fileContext) {
|
|
|
8
8
|
let labelVerified = false;
|
|
9
9
|
|
|
10
10
|
const labelName = labelNameFromLabelNode(labelNode),
|
|
11
|
-
|
|
11
|
+
labelString = fileContext.nodeAsString(labelNode);
|
|
12
|
+
|
|
13
|
+
fileContext.trace(`Verifying the '${labelString}' label...`, labelNode);
|
|
14
|
+
|
|
15
|
+
const labelPresent = fileContext.isLabelPresentByLabelName(labelName);
|
|
12
16
|
|
|
13
17
|
if (labelPresent) {
|
|
14
18
|
const labelString = fileContext.nodeAsString(labelNode);
|
|
15
19
|
|
|
16
|
-
fileContext.
|
|
20
|
+
fileContext.debug(`The '${labelString}' label is already present.`, labelNode);
|
|
17
21
|
} else {
|
|
18
22
|
const label = Label.fromLabelNode(labelNode);
|
|
19
23
|
|
|
@@ -22,5 +26,9 @@ export default function verifyLabel(labelNode, labels, fileContext) {
|
|
|
22
26
|
labelVerified = true;
|
|
23
27
|
}
|
|
24
28
|
|
|
29
|
+
if (labelVerified) {
|
|
30
|
+
fileContext.debug(`...verified the '${labelString}' label.`, labelNode);
|
|
31
|
+
}
|
|
32
|
+
|
|
25
33
|
return labelVerified;
|
|
26
34
|
}
|
package/src/verify/lemma.js
CHANGED
|
@@ -24,8 +24,8 @@ export default function verifyLemma(lemmaNode, fileContext) {
|
|
|
24
24
|
proofContext = ProofContext.fromFileContext(fileContext);
|
|
25
25
|
|
|
26
26
|
(labelsString === EMPTY_STRING) ?
|
|
27
|
-
fileContext.
|
|
28
|
-
fileContext.
|
|
27
|
+
fileContext.trace(`Verifying a lemma...`, lemmaNode) :
|
|
28
|
+
fileContext.trace(`Verifying the '${labelsString}' lemma...`, lemmaNode);
|
|
29
29
|
|
|
30
30
|
const labels = [],
|
|
31
31
|
labelsVerified = verifyLabels(labelNodes, labels, fileContext);
|
|
@@ -65,8 +65,8 @@ export default function verifyLemma(lemmaNode, fileContext) {
|
|
|
65
65
|
|
|
66
66
|
if (lemmaVerified) {
|
|
67
67
|
(labelsString === EMPTY_STRING) ?
|
|
68
|
-
fileContext.
|
|
69
|
-
fileContext.
|
|
68
|
+
fileContext.debug(`...verified the lemma.`, lemmaNode) :
|
|
69
|
+
fileContext.debug(`...verified the '${labelsString}' lemma.`, lemmaNode);
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
return lemmaVerified;
|
|
@@ -14,7 +14,7 @@ export default function verifyQualifiedMetastatement(qualifiedMetastatementNode,
|
|
|
14
14
|
const metastatementString = metaproofContext.nodeAsString(metastatementNode),
|
|
15
15
|
metastatementMetaproofContext = metaproofContext; ///
|
|
16
16
|
|
|
17
|
-
metaproofContext.
|
|
17
|
+
metaproofContext.trace(`Verifying the '${metastatementString}' qualified metastatement...`, qualifiedMetastatementNode);
|
|
18
18
|
|
|
19
19
|
const referenceNode = referenceNodeQuery(qualifiedMetastatementNode),
|
|
20
20
|
referenceName = referenceNameFromReferenceNode(referenceNode),
|
|
@@ -25,12 +25,10 @@ export default function verifyQualifiedMetastatement(qualifiedMetastatementNode,
|
|
|
25
25
|
|
|
26
26
|
qualifiedMetastatementVerified = ruleMatchesMetastatement; ///
|
|
27
27
|
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
if (qualifiedMetastatementVerified) {
|
|
31
|
-
const metastatementString = metaproofContext.nodeAsString(metastatementNode);
|
|
32
28
|
|
|
33
|
-
|
|
29
|
+
if (qualifiedMetastatementVerified) {
|
|
30
|
+
metaproofContext.debug(`...verified the '${metastatementString}' qualified metastatement.`, qualifiedMetastatementNode);
|
|
31
|
+
}
|
|
34
32
|
}
|
|
35
33
|
|
|
36
34
|
return qualifiedMetastatementVerified;
|
|
@@ -14,7 +14,7 @@ export default function verifyUnqualifiedMetastatement(unqualifiedMetastatementN
|
|
|
14
14
|
if (metastatementNode !== null) {
|
|
15
15
|
const metastatementString = metaproofContext.nodeAsString(metastatementNode);
|
|
16
16
|
|
|
17
|
-
metaproofContext.
|
|
17
|
+
metaproofContext.trace(`Verifying the '${metastatementString}' unqualified metastatement...`, unqualifiedMetastatementNode);
|
|
18
18
|
|
|
19
19
|
if (derived) {
|
|
20
20
|
const metastatementMatches = metaproofContext.matchMetastatement(metastatementNode);
|
|
@@ -23,16 +23,18 @@ export default function verifyUnqualifiedMetastatement(unqualifiedMetastatementN
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
if (!unqualifiedMetastatementVerified) {
|
|
26
|
-
const metastatementVerified = verifyMetastatement(metastatementNode, derived, metaproofContext)
|
|
26
|
+
const metastatementVerified = verifyMetastatement(metastatementNode, derived, metaproofContext, () => {
|
|
27
|
+
const verifiedAhead = true;
|
|
28
|
+
|
|
29
|
+
return verifiedAhead;
|
|
30
|
+
});
|
|
27
31
|
|
|
28
32
|
unqualifiedMetastatementVerified = metastatementVerified; ///
|
|
29
33
|
}
|
|
30
|
-
}
|
|
31
34
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
metaproofContext.info(`Verified the '${metastatementString}' unqualified metastatement.`, unqualifiedMetastatementNode);
|
|
35
|
+
if (unqualifiedMetastatementVerified) {
|
|
36
|
+
metaproofContext.debug(`...verified the '${metastatementString}' unqualified metastatement.`, unqualifiedMetastatementNode);
|
|
37
|
+
}
|
|
36
38
|
}
|
|
37
39
|
|
|
38
40
|
return unqualifiedMetastatementVerified;
|