occam-verify-cli 0.0.678 → 0.0.679
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/conclusion.js +10 -5
- package/lib/consequent.js +8 -3
- package/lib/context/file.js +74 -4
- package/lib/context/release.js +7 -2
- package/lib/equality.js +16 -16
- package/lib/premise.js +12 -7
- package/lib/supposition.js +9 -4
- package/lib/type.js +3 -8
- package/lib/utilities/string.js +26 -13
- package/lib/verifier/node/metastatement.js +173 -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/{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 +199 -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 +212 -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 +209 -0
- package/lib/verifier/nodes.js +175 -0
- package/lib/verify/assertion/type.js +20 -10
- 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 +34 -157
- 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 +112 -317
- package/lib/verify/statementAsCombinator.js +8 -82
- package/lib/verify/supposition.js +3 -3
- package/lib/verify/term.js +69 -213
- package/lib/verify/termAsConstructor.js +15 -89
- package/lib/verify/theorem.js +3 -3
- package/lib/verify/type.js +7 -5
- package/lib/verify/typeInference.js +5 -5
- package/lib/verify/variable.js +7 -5
- package/package.json +5 -5
- package/src/conclusion.js +5 -4
- package/src/consequent.js +3 -2
- package/src/context/file.js +11 -4
- package/src/context/release.js +9 -2
- package/src/equality.js +10 -10
- package/src/premise.js +7 -6
- package/src/supposition.js +4 -3
- package/src/type.js +3 -8
- package/src/utilities/string.js +34 -23
- package/src/verifier/node/metastatement.js +57 -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/metastatementForMetavariable/conclusion.js +11 -0
- package/src/verifier/nodes/metastatementForMetavariable/premise.js +11 -0
- package/src/verifier/{metastatementForMetavariable.js → nodes/metastatementForMetavariable.js} +6 -6
- package/src/verifier/nodes/statement.js +98 -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 +111 -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} +9 -9
- package/src/verifier/nodes.js +111 -0
- package/src/verify/assertion/type.js +25 -9
- 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 +32 -57
- 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 +159 -283
- package/src/verify/statementAsCombinator.js +9 -129
- package/src/verify/supposition.js +2 -2
- package/src/verify/term.js +94 -159
- package/src/verify/termAsConstructor.js +20 -135
- package/src/verify/theorem.js +2 -2
- package/src/verify/type.js +7 -4
- package/src/verify/typeInference.js +4 -4
- package/src/verify/variable.js +7 -4
- 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/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
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import StatementForMetavariableNodesVerifier from "../../../verifier/nodes/statementForMetavariable";
|
|
4
|
+
|
|
5
|
+
class ConclusionStatementForMetavariableNodesVerifier extends StatementForMetavariableNodesVerifier {
|
|
6
|
+
static createSubstitutions = false;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const conclusionStatementForMetavariableNodesVerifier = new ConclusionStatementForMetavariableNodesVerifier();
|
|
10
|
+
|
|
11
|
+
export default conclusionStatementForMetavariableNodesVerifier;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import StatementForMetavariableNodesVerifier from "../../../verifier/nodes/statementForMetavariable";
|
|
4
|
+
|
|
5
|
+
class PremiseStatementForMetavariableNodesVerifier extends StatementForMetavariableNodesVerifier {
|
|
6
|
+
static createSubstitutions = true;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const premiseStatementForMetavariableNodesVerifier = new PremiseStatementForMetavariableNodesVerifier();
|
|
10
|
+
|
|
11
|
+
export default premiseStatementForMetavariableNodesVerifier;
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import StatementForMetavariableSubstitution from "
|
|
3
|
+
import NodesVerifier from "../../verifier/nodes";
|
|
4
|
+
import StatementForMetavariableSubstitution from "../../substitution/statementForMetavariable";
|
|
5
5
|
|
|
6
|
-
import { nodeQuery } from "
|
|
7
|
-
import { metavariableNameFromMetavariableNode } from "
|
|
8
|
-
import { STATEMENT_RULE_NAME, METASTATEMENT_RULE_NAME, META_ARGUMENT_RULE_NAME } from "
|
|
6
|
+
import { nodeQuery } from "../../utilities/query";
|
|
7
|
+
import { metavariableNameFromMetavariableNode } from "../../utilities/query";
|
|
8
|
+
import { STATEMENT_RULE_NAME, METASTATEMENT_RULE_NAME, META_ARGUMENT_RULE_NAME } from "../../ruleNames";
|
|
9
9
|
|
|
10
10
|
const metavariableNodeQuery = nodeQuery('/metastatement/metavariable!'),
|
|
11
11
|
metaArgumentChildNodeNodeQuery = nodeQuery('/metaArgument/*!');
|
|
12
12
|
|
|
13
|
-
export default class
|
|
13
|
+
export default class StatementForMetavariableNodesVerifier extends NodesVerifier {
|
|
14
14
|
verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, fileContextA, proofContextB) {
|
|
15
15
|
let nonTerminalNodeVerified = false;
|
|
16
16
|
|
|
@@ -40,11 +40,11 @@ export default class StatementForMetavariableVerifier extends Verifier {
|
|
|
40
40
|
} else {
|
|
41
41
|
const nonTerminalNodeAChildNodes = nonTerminalNodeA.getChildNodes(),
|
|
42
42
|
nonTerminalNodeBChildNodes = nonTerminalNodeB.getChildNodes(),
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
childNodesA = nonTerminalNodeAChildNodes, ///
|
|
44
|
+
childNodesB = nonTerminalNodeBChildNodes, ///
|
|
45
|
+
childNodesVerified = this.verifyChildNodes(childNodesA, childNodesB, substitutions, fileContextA, proofContextB);
|
|
46
46
|
|
|
47
|
-
nonTerminalNodeVerified =
|
|
47
|
+
nonTerminalNodeVerified = childNodesVerified; ///
|
|
48
48
|
}
|
|
49
49
|
} else if (nonTerminalNodeBRuleName === nonTerminalNodeARuleName) {
|
|
50
50
|
nonTerminalNodeVerified = super.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, fileContextA, proofContextB);
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import NodesVerifier from "../../verifier/nodes";
|
|
4
|
+
|
|
5
|
+
import { first } from "../../utilities/array";
|
|
6
|
+
import { ARGUMENT_RULE_NAME } from "../../ruleNames";
|
|
7
|
+
import { nodeQuery, typeNameFromTypeNode } from "../../utilities/query";
|
|
8
|
+
|
|
9
|
+
const termNodeQuery = nodeQuery("/argument/term!"),
|
|
10
|
+
typeNodeQuery = nodeQuery("/argument/type!");
|
|
11
|
+
|
|
12
|
+
class TermNodesVerifier extends NodesVerifier {
|
|
13
|
+
verifyNonTerminalNode(nonTerminalNode, constructorNonTerminalNode, context, verifyAhead) {
|
|
14
|
+
let nonTerminalNodeVerified = false;
|
|
15
|
+
|
|
16
|
+
const ruleName = nonTerminalNode.getRuleName(), ///
|
|
17
|
+
constructorRuleName = constructorNonTerminalNode.getRuleName(); ///
|
|
18
|
+
|
|
19
|
+
if (ruleName === constructorRuleName) {
|
|
20
|
+
switch (ruleName) {
|
|
21
|
+
case ARGUMENT_RULE_NAME: {
|
|
22
|
+
const argumentNode = nonTerminalNode, ///
|
|
23
|
+
constructorArgumentNode = constructorNonTerminalNode, ///
|
|
24
|
+
argumentVerified = verifyArgument(argumentNode, constructorArgumentNode, context, verifyAhead),
|
|
25
|
+
argumentNodeVerified = argumentVerified; ///
|
|
26
|
+
|
|
27
|
+
nonTerminalNodeVerified = argumentNodeVerified; ///
|
|
28
|
+
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
default: {
|
|
33
|
+
nonTerminalNodeVerified = super.verifyNonTerminalNode(nonTerminalNode, constructorNonTerminalNode, context, verifyAhead);
|
|
34
|
+
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return nonTerminalNodeVerified;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const termNodesVerifier = new TermNodesVerifier();
|
|
45
|
+
|
|
46
|
+
export default termNodesVerifier;
|
|
47
|
+
|
|
48
|
+
export function verifyArgument(argumentNode, constructorArgumentNode, context, verifyAhead) {
|
|
49
|
+
let argumentVerified = false;
|
|
50
|
+
|
|
51
|
+
const argumentString = context.nodeAsString(argumentNode);
|
|
52
|
+
|
|
53
|
+
context.trace(`Verifying the '${argumentString}' argument...`, argumentNode);
|
|
54
|
+
|
|
55
|
+
const typeNode = typeNodeQuery(argumentNode);
|
|
56
|
+
|
|
57
|
+
if (typeNode !== null) {
|
|
58
|
+
context.info(`The '${argumentString}' argument should be a term, not a type`, argumentNode);
|
|
59
|
+
} else {
|
|
60
|
+
const termNode = termNodeQuery(argumentNode);
|
|
61
|
+
|
|
62
|
+
if (!argumentVerified) {
|
|
63
|
+
const constructorTermNode = termNodeQuery(constructorArgumentNode);
|
|
64
|
+
|
|
65
|
+
if (constructorTermNode !== null) {
|
|
66
|
+
const node = termNode, ///
|
|
67
|
+
constructorNode = constructorTermNode, ///
|
|
68
|
+
nodeVerified = this.verifyNode(node, constructorNode, context, verifyAhead);
|
|
69
|
+
|
|
70
|
+
argumentVerified = nodeVerified; ///
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (!argumentVerified) {
|
|
75
|
+
const constructorTypeNode = typeNodeQuery(constructorArgumentNode);
|
|
76
|
+
|
|
77
|
+
if (constructorTypeNode !== null) {
|
|
78
|
+
const { verifyTerm } = termNodesVerifier,
|
|
79
|
+
types = [],
|
|
80
|
+
termVerified = verifyTerm(termNode, types, context, () => {
|
|
81
|
+
let verifiedAhead = false;
|
|
82
|
+
|
|
83
|
+
const constructorTypeName = typeNameFromTypeNode(constructorTypeNode),
|
|
84
|
+
firstType = first(types),
|
|
85
|
+
termType = firstType, ///
|
|
86
|
+
termTypeName = termType.getName(),
|
|
87
|
+
constructorType = context.findTypeByTypeName(constructorTypeName),
|
|
88
|
+
termTypeEqualToOrSubTypeOfType = termType.isEqualToOrSubTypeOf(constructorType);
|
|
89
|
+
|
|
90
|
+
if (termTypeEqualToOrSubTypeOfType) {
|
|
91
|
+
const termString = context.nodeAsString(termNode);
|
|
92
|
+
|
|
93
|
+
context.trace(`The '${termTypeName}' type of the '${termString}' term is equal to or a sub-type of the '${constructorTypeName}' type in the constructor.`, argumentNode);
|
|
94
|
+
|
|
95
|
+
verifiedAhead = verifyAhead();
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
return verifiedAhead;
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
argumentVerified = termVerified; ///
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
if (argumentVerified) {
|
|
107
|
+
context.debug(`...verified the '${argumentString}' argument.`, argumentNode);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
return argumentVerified;
|
|
111
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import TermForVariableNodesVerifier from "../../../verifier/nodes/termForVariable";
|
|
4
|
+
|
|
5
|
+
class ConsequentTermForVariableNodesVerifier extends TermForVariableNodesVerifier {
|
|
6
|
+
static createSubstitutions = false;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const consequentTermForVariableNodesVerifier = new ConsequentTermForVariableNodesVerifier();
|
|
10
|
+
|
|
11
|
+
export default consequentTermForVariableNodesVerifier;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import TermForVariableNodesVerifier from "../../../verifier/nodes/termForVariable";
|
|
4
|
+
|
|
5
|
+
class SuppositionTermForVariableNodesVerifier extends TermForVariableNodesVerifier {
|
|
6
|
+
static createSubstitutions = true;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
const suppositionTermForVariableNodesVerifier = new SuppositionTermForVariableNodesVerifier();
|
|
10
|
+
|
|
11
|
+
export default suppositionTermForVariableNodesVerifier;
|
|
@@ -1,17 +1,17 @@
|
|
|
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
|
|
14
|
+
export default class TermForVariableNodesVerifier extends NodesVerifier {
|
|
15
15
|
verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, proofContextA, proofContextB) {
|
|
16
16
|
let nonTerminalNodeVerified = false;
|
|
17
17
|
|
|
@@ -83,7 +83,7 @@ export default class TermForVariableVerifier extends Verifier {
|
|
|
83
83
|
const types = [],
|
|
84
84
|
context = proofContextB, ///
|
|
85
85
|
termNode = termNodeB, ///
|
|
86
|
-
termVerified = verifyTerm(termNode, types, context);
|
|
86
|
+
termVerified = verifyTerm(termNode, types, context, verifyAhead);
|
|
87
87
|
|
|
88
88
|
if (termVerified) {
|
|
89
89
|
const firstType = first(types),
|
|
@@ -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
|
+
}
|
|
@@ -15,14 +15,14 @@ export default function verifyTypeAssertion(typeAssertionNode, assignments, deri
|
|
|
15
15
|
|
|
16
16
|
const typeAssertionString = context.nodeAsString(typeAssertionNode);
|
|
17
17
|
|
|
18
|
-
context.
|
|
18
|
+
context.trace(`Verifying the '${typeAssertionString}' type assertion...`, typeAssertionNode);
|
|
19
19
|
|
|
20
20
|
const typeNode = typeNodeQuery(typeAssertionNode),
|
|
21
21
|
typeName = typeNameFromTypeNode(typeNode),
|
|
22
22
|
typePresent = context.isTypePresentByTypeName(typeName);
|
|
23
23
|
|
|
24
24
|
if (!typePresent) {
|
|
25
|
-
context.
|
|
25
|
+
context.info(`The '${typeName}' type is not present.`, typeAssertionNode);
|
|
26
26
|
} else {
|
|
27
27
|
if (!typeAssertionVerified) {
|
|
28
28
|
const variableTypeAssertionVerified = verifyVariableTypeAssertion(typeAssertionNode, assignments, derived, context);
|
|
@@ -38,7 +38,7 @@ export default function verifyTypeAssertion(typeAssertionNode, assignments, deri
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
if (typeAssertionVerified) {
|
|
41
|
-
context.
|
|
41
|
+
context.debug(`...verified the '${typeAssertionString}' statement type assertion.`, typeAssertionNode);
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
return typeAssertionVerified;
|
|
@@ -52,13 +52,17 @@ export function verifyVariableTypeAssertion(typeAssertionNode, assignments, deri
|
|
|
52
52
|
termVerifiedAsVariable = verifyTermAsVariable(termNode, variables, context);
|
|
53
53
|
|
|
54
54
|
if (termVerifiedAsVariable) {
|
|
55
|
+
const typeAssertionString = context.nodeAsString(typeAssertionNode);
|
|
56
|
+
|
|
57
|
+
context.trace(`Verifying the '${typeAssertionString}' variable type assertion...`, typeAssertionNode);
|
|
58
|
+
|
|
55
59
|
const typeNode = typeNodeQuery(typeAssertionNode),
|
|
56
60
|
typeName = typeNameFromTypeNode(typeNode),
|
|
57
61
|
assertedTypeName = typeName, ///
|
|
58
62
|
assertedType = context.findTypeByTypeName(assertedTypeName);
|
|
59
63
|
|
|
60
64
|
if (assertedType === null) {
|
|
61
|
-
context.
|
|
65
|
+
context.info(`The '${assertedTypeName}' asserted type is not present.`, typeAssertionNode);
|
|
62
66
|
} else {
|
|
63
67
|
const firstVariable = first(variables),
|
|
64
68
|
variable = firstVariable, ///
|
|
@@ -72,7 +76,7 @@ export function verifyVariableTypeAssertion(typeAssertionNode, assignments, deri
|
|
|
72
76
|
const assertedTypeName = assertedType.getName(),
|
|
73
77
|
variableTypeName = variableType.getName();
|
|
74
78
|
|
|
75
|
-
context.
|
|
79
|
+
context.info(`The '${assertedTypeName}' asserted type is not equal to or a super-type of the '${variableName}' variable's '${variableTypeName}' type.`, typeAssertionNode);
|
|
76
80
|
} else {
|
|
77
81
|
variableTypeAssertionVerified = true;
|
|
78
82
|
}
|
|
@@ -83,7 +87,7 @@ export function verifyVariableTypeAssertion(typeAssertionNode, assignments, deri
|
|
|
83
87
|
const assertedTypeName = assertedType.getName(),
|
|
84
88
|
variableTypeName = variableType.getName();
|
|
85
89
|
|
|
86
|
-
context.
|
|
90
|
+
context.info(`The '${assertedTypeName}' asserted type is not equal to or a sub-type of the '${variableName}' variable's '${variableTypeName}' type.`, typeAssertionNode);
|
|
87
91
|
} else {
|
|
88
92
|
const name = variableName, ///
|
|
89
93
|
type = assertedType, ///
|
|
@@ -96,6 +100,10 @@ export function verifyVariableTypeAssertion(typeAssertionNode, assignments, deri
|
|
|
96
100
|
}
|
|
97
101
|
}
|
|
98
102
|
}
|
|
103
|
+
|
|
104
|
+
if (variableTypeAssertionVerified) {
|
|
105
|
+
context.debug(`...verified the '${typeAssertionString}' variable type assertion.`, typeAssertionNode);
|
|
106
|
+
}
|
|
99
107
|
}
|
|
100
108
|
|
|
101
109
|
return variableTypeAssertionVerified;
|
|
@@ -109,13 +117,17 @@ function verifyTermTypeAssertion(typeAssertionNode, derived, context) {
|
|
|
109
117
|
termVerifiedAgainstConstructors = verifyTermAgainstConstructors(termNode, types, context);
|
|
110
118
|
|
|
111
119
|
if (termVerifiedAgainstConstructors) {
|
|
120
|
+
const typeAssertionString = context.nodeAsString(typeAssertionNode);
|
|
121
|
+
|
|
122
|
+
context.trace(`Verifying the '${typeAssertionString}' term type assertion...`, typeAssertionNode);
|
|
123
|
+
|
|
112
124
|
const typeNode = typeNodeQuery(typeAssertionNode),
|
|
113
125
|
typeName = typeNameFromTypeNode(typeNode),
|
|
114
126
|
assertedTypeName = typeName, ///
|
|
115
127
|
assertedType = context.findTypeByTypeName(assertedTypeName);
|
|
116
128
|
|
|
117
129
|
if (assertedType === null) {
|
|
118
|
-
context.
|
|
130
|
+
context.info(`The '${assertedTypeName}' asserted type is not present.`, typeAssertionNode);
|
|
119
131
|
} else {
|
|
120
132
|
const firstType = first(types),
|
|
121
133
|
termType = firstType; ///
|
|
@@ -128,7 +140,7 @@ function verifyTermTypeAssertion(typeAssertionNode, derived, context) {
|
|
|
128
140
|
termTypeName = termType.getName(),
|
|
129
141
|
assertedTypeName = assertedType.getName();
|
|
130
142
|
|
|
131
|
-
context.
|
|
143
|
+
context.info(`The '${assertedTypeName}' asserted type is not equal to or a super-type of the '${termString}' term's '${termTypeName}' type.`, typeAssertionNode);
|
|
132
144
|
} else {
|
|
133
145
|
termTypeAssertionVerified = true;
|
|
134
146
|
}
|
|
@@ -140,12 +152,16 @@ function verifyTermTypeAssertion(typeAssertionNode, derived, context) {
|
|
|
140
152
|
termTypeName = termType.getName(),
|
|
141
153
|
assertedTypeName = assertedType.getName();
|
|
142
154
|
|
|
143
|
-
context.
|
|
155
|
+
context.info(`The '${assertedTypeName}' asserted type is not equal to or a sub-type of the '${termString}' term's '${termTypeName}' type.`, typeAssertionNode);
|
|
144
156
|
} else {
|
|
145
157
|
termTypeAssertionVerified = true;
|
|
146
158
|
}
|
|
147
159
|
}
|
|
148
160
|
}
|
|
161
|
+
|
|
162
|
+
if (termTypeAssertionVerified) {
|
|
163
|
+
context.debug(`...verified the '${typeAssertionString}' term type assertion.`, typeAssertionNode);
|
|
164
|
+
}
|
|
149
165
|
}
|
|
150
166
|
|
|
151
167
|
return termTypeAssertionVerified;
|
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
|
}
|