occam-verify-cli 0.0.869 → 0.0.871
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/axiomLemmaTheoremConjecture.js +13 -13
- package/lib/conclusion.js +3 -3
- package/lib/context/file.js +77 -73
- package/lib/equality.js +2 -4
- package/lib/equivalence.js +1 -1
- package/lib/label.js +5 -6
- package/lib/metaLemmaMetatheorem.js +13 -13
- package/lib/mixins/context.js +28 -28
- package/lib/premise.js +4 -4
- package/lib/rule.js +13 -13
- package/lib/ruleNames.js +1 -29
- package/lib/substitution/metastatementForMetavariable.js +3 -2
- package/lib/substitution/statementForMetavariable.js +27 -64
- package/lib/substitution/termForVariable.js +5 -5
- package/lib/utilities/name.js +8 -8
- package/lib/utilities/node.js +14 -14
- package/lib/utilities/query.js +4 -9
- package/lib/utilities/tokens.js +6 -6
- package/lib/utilities/verifier.js +86 -0
- package/lib/verifier/node/metastatement.js +41 -28
- package/lib/verifier/node/statementAsCombinator.js +41 -28
- package/lib/verifier/node/termAsConstructor.js +30 -22
- package/lib/verifier/nodes/equality.js +27 -32
- package/lib/verifier/nodes/intrinsicLevel.js +25 -34
- package/lib/verifier/nodes/intrinsicLevelAgainstMetaLevel.js +270 -0
- package/lib/verifier/nodes/metaLevel.js +25 -34
- package/lib/verifier/nodes/statementAgainstCombinator.js +45 -49
- package/lib/verifier/nodes/termAgainstConstructor.js +24 -51
- package/lib/verify/argumentAgainstArgument.js +24 -0
- package/lib/verify/axiom.js +4 -4
- package/lib/verify/conjecture.js +4 -4
- package/lib/verify/containment.js +5 -5
- package/lib/verify/equality.js +9 -9
- package/lib/verify/label.js +8 -9
- package/lib/verify/labels.js +15 -8
- package/lib/verify/lemma.js +4 -4
- package/lib/verify/metaDerivation.js +19 -19
- package/lib/verify/metaLemma.js +4 -4
- package/lib/verify/metaproof.js +4 -6
- package/lib/verify/metastatement/qualified.js +3 -3
- package/lib/verify/metatheorem.js +4 -4
- package/lib/verify/metavariable.js +7 -5
- package/lib/verify/metavariableAgainstMetastatement.js +44 -0
- package/lib/verify/metavariableAgainstStatement.js +65 -0
- package/lib/verify/rule.js +4 -4
- package/lib/verify/statement/qualified.js +29 -29
- package/lib/verify/statement.js +4 -4
- package/lib/verify/statementAgainstMetaType.js +24 -0
- package/lib/verify/statementAtainstStatement.js +52 -0
- package/lib/verify/term.js +7 -8
- package/lib/verify/termAgainstTerm.js +22 -0
- package/lib/verify/termAgainstType.js +26 -0
- package/lib/verify/terms.js +2 -3
- package/lib/verify/theorem.js +4 -4
- package/lib/verify/type.js +7 -5
- package/lib/verify/typeAssertion.js +45 -40
- package/lib/verify/variable.js +7 -5
- package/lib/verify/variableAgainstTerm.js +70 -0
- package/package.json +4 -4
- package/src/axiomLemmaTheoremConjecture.js +13 -13
- package/src/conclusion.js +2 -2
- package/src/context/file.js +79 -73
- package/src/equality.js +3 -9
- package/src/equivalence.js +1 -1
- package/src/label.js +6 -7
- package/src/metaLemmaMetatheorem.js +13 -13
- package/src/mixins/context.js +17 -17
- package/src/premise.js +3 -3
- package/src/rule.js +13 -13
- package/src/ruleNames.js +0 -7
- package/src/substitution/metastatementForMetavariable.js +3 -1
- package/src/substitution/statementForMetavariable.js +32 -74
- package/src/substitution/termForVariable.js +3 -3
- package/src/utilities/name.js +7 -7
- package/src/utilities/node.js +13 -13
- package/src/utilities/query.js +3 -9
- package/src/utilities/tokens.js +4 -4
- package/src/utilities/verifier.js +46 -0
- package/src/verifier/node/metastatement.js +41 -34
- package/src/verifier/node/statementAsCombinator.js +39 -32
- package/src/verifier/node/termAsConstructor.js +30 -25
- package/src/verifier/nodes/equality.js +31 -36
- package/src/verifier/nodes/intrinsicLevel.js +30 -38
- package/src/verifier/nodes/intrinsicLevelAgainstMetaLevel.js +222 -0
- package/src/verifier/nodes/metaLevel.js +30 -38
- package/src/verifier/nodes/statementAgainstCombinator.js +52 -55
- package/src/verifier/nodes/termAgainstConstructor.js +30 -71
- package/src/verify/argumentAgainstArgument.js +15 -0
- package/src/verify/axiom.js +4 -4
- package/src/verify/conjecture.js +4 -4
- package/src/verify/containment.js +4 -4
- package/src/verify/equality.js +8 -8
- package/src/verify/label.js +8 -9
- package/src/verify/labels.js +17 -7
- package/src/verify/lemma.js +4 -4
- package/src/verify/metaDerivation.js +18 -18
- package/src/verify/metaLemma.js +6 -6
- package/src/verify/metaproof.js +3 -6
- package/src/verify/metastatement/qualified.js +5 -4
- package/src/verify/metatheorem.js +4 -4
- package/src/verify/metavariable.js +7 -5
- package/src/verify/metavariableAgainstMetastatement.js +42 -0
- package/src/verify/metavariableAgainstStatement.js +77 -0
- package/src/verify/rule.js +4 -4
- package/src/verify/statement/qualified.js +35 -30
- package/src/verify/statement.js +5 -5
- package/src/verify/statementAgainstMetaType.js +21 -0
- package/src/verify/statementAtainstStatement.js +60 -0
- package/src/verify/term.js +13 -17
- package/src/verify/termAgainstTerm.js +20 -0
- package/src/verify/termAgainstType.js +28 -0
- package/src/verify/terms.js +1 -3
- package/src/verify/theorem.js +4 -4
- package/src/verify/type.js +7 -5
- package/src/verify/typeAssertion.js +56 -55
- package/src/verify/variable.js +7 -5
- package/src/verify/variableAgainstTerm.js +86 -0
- package/lib/verifier/nodes/metaLevelToIntrinsicLevel.js +0 -327
- package/lib/verifier/nodes/substitution.js +0 -223
- package/lib/verify/givenMetavariable.js +0 -31
- package/lib/verify/givenType.js +0 -31
- package/lib/verify/givenVariable.js +0 -31
- package/lib/verify/termAndGivenType.js +0 -39
- package/src/verifier/nodes/metaLevelToIntrinsicLevel.js +0 -219
- package/src/verifier/nodes/substitution.js +0 -125
- package/src/verify/givenMetavariable.js +0 -31
- package/src/verify/givenType.js +0 -31
- package/src/verify/givenVariable.js +0 -31
- package/src/verify/termAndGivenType.js +0 -37
|
@@ -1,102 +1,61 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import NodesVerifier from "../../verifier/nodes";
|
|
4
|
+
import verifyTermAgainstType from "../../verify/termAgainstType";
|
|
4
5
|
|
|
5
|
-
import { first } from "../../utilities/array";
|
|
6
6
|
import { nodeQuery } from "../../utilities/query";
|
|
7
|
-
import {
|
|
7
|
+
import { verifyNodes } from "../../utilities/verifier";
|
|
8
8
|
|
|
9
9
|
const termNodeQuery = nodeQuery("/argument/term!"),
|
|
10
10
|
typeNodeQuery = nodeQuery("/argument/type!");
|
|
11
11
|
|
|
12
12
|
class TermAgainstConstructorNodesVerifier extends NodesVerifier {
|
|
13
13
|
verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, localContext, verifyAhead) {
|
|
14
|
-
let nonTerminalNodeVerified
|
|
14
|
+
let nonTerminalNodeVerified;
|
|
15
15
|
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
const nodeQueryMaps = [
|
|
17
|
+
{
|
|
18
|
+
nodeQueryA: termNodeQuery,
|
|
19
|
+
nodeQueryB: typeNodeQuery,
|
|
20
|
+
verifyNodes: (nodeA, nodeB, localContext, verifyAhead) => {
|
|
21
|
+
let nonTerminalNodeVerified;
|
|
20
22
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const argumentNode = nonTerminalNode, ///
|
|
25
|
-
constructorArgumentNode = constructorNonTerminalNode, ///
|
|
26
|
-
argumentNodeVerified = this.verifyArgumentNode(argumentNode, constructorArgumentNode, localContext, verifyAhead);
|
|
23
|
+
const termNodeA = nodeA, ///
|
|
24
|
+
typeNodeB = nodeB, ///
|
|
25
|
+
termNodeVerifiedAgainstTypeNode =
|
|
27
26
|
|
|
28
|
-
|
|
27
|
+
this.verifyTermNodeAgainstTypeNode(termNodeA, typeNodeB, localContext, verifyAhead);
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
default: {
|
|
34
|
-
nonTerminalNodeVerified = super.verifyNonTerminalNode(nonTerminalNode, constructorNonTerminalNode, localContext, verifyAhead);
|
|
29
|
+
nonTerminalNodeVerified = termNodeVerifiedAgainstTypeNode; ///
|
|
35
30
|
|
|
36
|
-
|
|
31
|
+
return nonTerminalNodeVerified;
|
|
37
32
|
}
|
|
38
33
|
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return nonTerminalNodeVerified;
|
|
42
|
-
}
|
|
34
|
+
];
|
|
43
35
|
|
|
44
|
-
|
|
45
|
-
let argumentNodeVerified = false;
|
|
36
|
+
const nodesVerified = verifyNodes(nodeQueryMaps, nonTerminalNodeA, nonTerminalNodeB, localContext, verifyAhead);
|
|
46
37
|
|
|
47
|
-
|
|
38
|
+
nonTerminalNodeVerified = nodesVerified ?
|
|
39
|
+
true :
|
|
40
|
+
super.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, localContext, verifyAhead);
|
|
48
41
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (typeNode !== null) {
|
|
52
|
-
localContext.debug(`The '${argumentString}' argument should be a term, not a type.`, argumentNode);
|
|
53
|
-
} else {
|
|
54
|
-
const termNode = termNodeQuery(argumentNode);
|
|
55
|
-
|
|
56
|
-
if (!argumentNodeVerified) {
|
|
57
|
-
const constructorTermNode = termNodeQuery(constructorArgumentNode);
|
|
58
|
-
|
|
59
|
-
if (constructorTermNode !== null) {
|
|
60
|
-
const node = termNode, ///
|
|
61
|
-
constructorNode = constructorTermNode, ///
|
|
62
|
-
nodeVerified = this.verifyNode(node, constructorNode, localContext, verifyAhead);
|
|
63
|
-
|
|
64
|
-
argumentNodeVerified = nodeVerified; ///
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
if (!argumentNodeVerified) {
|
|
69
|
-
const constructorTypeNode = typeNodeQuery(constructorArgumentNode);
|
|
70
|
-
|
|
71
|
-
if (constructorTypeNode !== null) {
|
|
72
|
-
const { verifyTerm } = termAgainstConstructorNodesVerifier,
|
|
73
|
-
terms = [],
|
|
74
|
-
termVerified = verifyTerm(termNode, terms, localContext, () => {
|
|
75
|
-
let verifiedAhead = false;
|
|
76
|
-
|
|
77
|
-
const firstTerm = first(terms),
|
|
78
|
-
term = firstTerm, ///
|
|
79
|
-
termType = term.getType(),
|
|
80
|
-
constructorType = localContext.findTypeByTypeNode(constructorTypeNode),
|
|
81
|
-
termTypeEqualToOrSubTypeOfType = termType.isEqualToOrSubTypeOf(constructorType);
|
|
42
|
+
return nonTerminalNodeVerified;
|
|
43
|
+
}
|
|
82
44
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}
|
|
45
|
+
verifyTermNodeAgainstTypeNode(termNodeA, typeNodeB, localContext, verifyAhead) {
|
|
46
|
+
let termNodeVerifiedAgainstTypeNode;
|
|
86
47
|
|
|
87
|
-
|
|
88
|
-
|
|
48
|
+
const { verifyTerm } = termAgainstConstructorNodesVerifier,
|
|
49
|
+
termNode = termNodeA, ///
|
|
50
|
+
typeNode = typeNodeB, ///
|
|
51
|
+
typeVerifiedAgainstTerm = verifyTermAgainstType(termNode, typeNode, localContext, verifyAhead, verifyTerm);
|
|
89
52
|
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
}
|
|
53
|
+
termNodeVerifiedAgainstTypeNode = typeVerifiedAgainstTerm; ///
|
|
94
54
|
|
|
95
|
-
return
|
|
55
|
+
return termNodeVerifiedAgainstTypeNode;
|
|
96
56
|
}
|
|
97
57
|
}
|
|
98
58
|
|
|
99
59
|
const termAgainstConstructorNodesVerifier = new TermAgainstConstructorNodesVerifier();
|
|
100
60
|
|
|
101
61
|
export default termAgainstConstructorNodesVerifier;
|
|
102
|
-
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import termAgainstConstructorNodesVerifier from "../verifier/nodes/termAgainstConstructor";
|
|
4
|
+
|
|
5
|
+
export default function verifyArgumentAgainstArgument(argumentNodeA, argumentNodeB, localContext, verifyAhead) {
|
|
6
|
+
let argumentVerifiedAgainstArgument;
|
|
7
|
+
|
|
8
|
+
const nonTerminalNodeA = argumentNodeA, ///
|
|
9
|
+
nonTerminalNodeB = argumentNodeB, ///
|
|
10
|
+
nonTerminalNodeVerified = termAgainstConstructorNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, localContext, verifyAhead);
|
|
11
|
+
|
|
12
|
+
argumentVerifiedAgainstArgument = nonTerminalNodeVerified; ///
|
|
13
|
+
|
|
14
|
+
return argumentVerifiedAgainstArgument;
|
|
15
|
+
}
|
package/src/verify/axiom.js
CHANGED
|
@@ -9,21 +9,21 @@ import verifySuppositions from "../verify/suppositions";
|
|
|
9
9
|
import { first } from "../utilities/array";
|
|
10
10
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
11
11
|
|
|
12
|
-
const
|
|
12
|
+
const labelsNodeQuery = nodeQuery("/axiom/labels!"),
|
|
13
13
|
consequentNodeQuery = nodeQuery("/axiom/consequent!"),
|
|
14
14
|
suppositionsNodeQuery = nodesQuery("/axiom/supposition");
|
|
15
15
|
|
|
16
16
|
export default function verifyAxiom(axiomNode, fileContext) {
|
|
17
17
|
let axiomVerified = false;
|
|
18
18
|
|
|
19
|
-
const
|
|
20
|
-
labelsString = fileContext.
|
|
19
|
+
const labelsNode = labelsNodeQuery(axiomNode),
|
|
20
|
+
labelsString = fileContext.nodeAsString(labelsNode),
|
|
21
21
|
localContext = LocalContext.fromFileContext(fileContext);
|
|
22
22
|
|
|
23
23
|
fileContext.trace(`Verifying the '${labelsString}' axiom...`, axiomNode);
|
|
24
24
|
|
|
25
25
|
const labels = [],
|
|
26
|
-
labelsVerified = verifyLabels(
|
|
26
|
+
labelsVerified = verifyLabels(labelsNode, labels, fileContext);
|
|
27
27
|
|
|
28
28
|
if (labelsVerified) {
|
|
29
29
|
const suppositions = [],
|
package/src/verify/conjecture.js
CHANGED
|
@@ -11,21 +11,21 @@ import { first } from "../utilities/array";
|
|
|
11
11
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
12
12
|
|
|
13
13
|
const proofNodeQuery = nodeQuery("/conjecture/proof!"),
|
|
14
|
-
|
|
14
|
+
labelsNodeQuery = nodeQuery("/conjecture/labels!"),
|
|
15
15
|
consequentNodeQuery = nodeQuery("/conjecture/consequent!"),
|
|
16
16
|
suppositionsNodeQuery = nodesQuery("/conjecture/supposition");
|
|
17
17
|
|
|
18
18
|
export default function verifyConjecture(conjectureNode, fileContext) {
|
|
19
19
|
let conjectureVerified = false;
|
|
20
20
|
|
|
21
|
-
const
|
|
22
|
-
labelsString = fileContext.
|
|
21
|
+
const labelsNode = labelsNodeQuery(conjectureNode),
|
|
22
|
+
labelsString = fileContext.nodeAsString(labelsNode),
|
|
23
23
|
localContext = LocalContext.fromFileContext(fileContext);
|
|
24
24
|
|
|
25
25
|
fileContext.trace(`Verifying the '${labelsString}' conjecture...`, conjectureNode);
|
|
26
26
|
|
|
27
27
|
const labels = [],
|
|
28
|
-
labelsVerified = verifyLabels(
|
|
28
|
+
labelsVerified = verifyLabels(labelsNode, labels, fileContext);
|
|
29
29
|
|
|
30
30
|
if (labelsVerified) {
|
|
31
31
|
const suppositions = [],
|
|
@@ -6,9 +6,9 @@ import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
|
6
6
|
|
|
7
7
|
const variableNodeQuery = nodeQuery("/term/variable!"),
|
|
8
8
|
metaArgumentTermNodesQuery = nodesQuery("/metaArgument//term"),
|
|
9
|
-
|
|
9
|
+
metastatementVariableNodesQuery = nodesQuery("/metastatement//variable");
|
|
10
10
|
|
|
11
|
-
export default function verifyContainment(termNode, containmentNode,
|
|
11
|
+
export default function verifyContainment(termNode, containmentNode, metastatementNode, localContext) {
|
|
12
12
|
let containmentVerified = false;
|
|
13
13
|
|
|
14
14
|
const contained = containedFromContainmentNode(containmentNode),
|
|
@@ -17,7 +17,7 @@ export default function verifyContainment(termNode, containmentNode, metaArgumen
|
|
|
17
17
|
if (false) {
|
|
18
18
|
///
|
|
19
19
|
} else if (variableNode !== null) {
|
|
20
|
-
const metaArgumentVariableNodes =
|
|
20
|
+
const metaArgumentVariableNodes = metastatementVariableNodesQuery(metastatementNode),
|
|
21
21
|
variableNodeMatchesMetaArgumentVariableNode = metaArgumentVariableNodes.some((metaArgumentVariableNode) => {
|
|
22
22
|
const variableNodeMatchesMetaArgumentVariableNode = variableNode.match(metaArgumentVariableNode);
|
|
23
23
|
|
|
@@ -38,7 +38,7 @@ export default function verifyContainment(termNode, containmentNode, metaArgumen
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
} else if (termNode !== null) {
|
|
41
|
-
const metaArgumentTermNodes = metaArgumentTermNodesQuery(
|
|
41
|
+
const metaArgumentTermNodes = metaArgumentTermNodesQuery(metastatementNode),
|
|
42
42
|
termNodeMatchesMetaArgumentTermNode = metaArgumentTermNodes.some((metaArgumentTermNode) => {
|
|
43
43
|
const termNodeMatchesMetaArgumentTermNode = termNode.match(metaArgumentTermNode);
|
|
44
44
|
|
package/src/verify/equality.js
CHANGED
|
@@ -19,7 +19,7 @@ export default function verifyEquality(equalityNode, assignments, derived, local
|
|
|
19
19
|
|
|
20
20
|
const verifyEqualityFunctions = [
|
|
21
21
|
verifyDerivedEquality,
|
|
22
|
-
|
|
22
|
+
verifyStatedEquality
|
|
23
23
|
];
|
|
24
24
|
|
|
25
25
|
equalityVerified = verifyEqualityFunctions.some((verifyEqualityFunction) => {
|
|
@@ -91,13 +91,13 @@ function verifyDerivedEquality(equalityNode, assignments, derived, localContext,
|
|
|
91
91
|
return derivedEqualityVerified;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
function
|
|
95
|
-
let
|
|
94
|
+
function verifyStatedEquality(equalityNode, assignments, derived, localContext, verifyAhead) {
|
|
95
|
+
let statedEqualityVerified = false;
|
|
96
96
|
|
|
97
97
|
if (!derived) {
|
|
98
98
|
const equalityString = localContext.nodeAsString(equalityNode);
|
|
99
99
|
|
|
100
|
-
localContext.trace(`Verifying the '${equalityString}'
|
|
100
|
+
localContext.trace(`Verifying the '${equalityString}' stated equality...`, equalityNode);
|
|
101
101
|
|
|
102
102
|
const terms = [],
|
|
103
103
|
leftTermNode = leftTermNodeQuery(equalityNode),
|
|
@@ -131,12 +131,12 @@ function verifyGivenEquality(equalityNode, assignments, derived, localContext, v
|
|
|
131
131
|
return verifiedAhead;
|
|
132
132
|
});
|
|
133
133
|
|
|
134
|
-
|
|
134
|
+
statedEqualityVerified = termsVerified; ///
|
|
135
135
|
|
|
136
|
-
if (
|
|
137
|
-
localContext.trace(`...verified the '${equalityString}'
|
|
136
|
+
if (statedEqualityVerified) {
|
|
137
|
+
localContext.trace(`...verified the '${equalityString}' stated equality.`, equalityNode);
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
|
|
141
|
-
return
|
|
141
|
+
return statedEqualityVerified;
|
|
142
142
|
}
|
package/src/verify/label.js
CHANGED
|
@@ -2,21 +2,20 @@
|
|
|
2
2
|
|
|
3
3
|
import Label from "../label";
|
|
4
4
|
|
|
5
|
-
export default function verifyLabel(
|
|
5
|
+
export default function verifyLabel(labelsMetavariableNode, labels, fileContext) {
|
|
6
6
|
let labelVerified = false;
|
|
7
7
|
|
|
8
|
-
const
|
|
8
|
+
const labelMetavariableString = fileContext.nodeAsString(labelsMetavariableNode);
|
|
9
9
|
|
|
10
|
-
fileContext.trace(`Verifying the '${
|
|
10
|
+
fileContext.trace(`Verifying the '${labelMetavariableString}' label...`, labelsMetavariableNode);
|
|
11
11
|
|
|
12
|
-
const labelPresent = fileContext.
|
|
12
|
+
const labelPresent = fileContext.isLabelPresentByLabelMetavariableNode(labelsMetavariableNode);
|
|
13
13
|
|
|
14
14
|
if (labelPresent) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
fileContext.debug(`The '${labelString}' label is already present.`, labelNode);
|
|
15
|
+
fileContext.debug(`The '${labelMetavariableString}' label is already present.`, labelsMetavariableNode);
|
|
18
16
|
} else {
|
|
19
|
-
const
|
|
17
|
+
const metavariableNode = labelsMetavariableNode, ///
|
|
18
|
+
label = Label.fromMetavariableNode(metavariableNode);
|
|
20
19
|
|
|
21
20
|
labels.push(label);
|
|
22
21
|
|
|
@@ -24,7 +23,7 @@ export default function verifyLabel(labelNode, labels, fileContext) {
|
|
|
24
23
|
}
|
|
25
24
|
|
|
26
25
|
if (labelVerified) {
|
|
27
|
-
fileContext.debug(`...verified the '${
|
|
26
|
+
fileContext.debug(`...verified the '${labelMetavariableString}' label.`, labelsMetavariableNode);
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
return labelVerified;
|
package/src/verify/labels.js
CHANGED
|
@@ -2,16 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
import verifyLabel from "../verify/label";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
import { nodesQuery } from "../utilities/query";
|
|
6
|
+
|
|
7
|
+
const labelsMetavariableNodesQuery = nodesQuery("/labels/metavariable");
|
|
8
|
+
|
|
9
|
+
export default function verifyLabels(labelsNode, labels, fileContext) {
|
|
6
10
|
let labelsVerified;
|
|
7
11
|
|
|
8
|
-
|
|
9
|
-
|
|
12
|
+
if (labelsNode === null) {
|
|
13
|
+
labelsVerified = true;
|
|
14
|
+
} else {
|
|
15
|
+
const labelsMetavariableNodes = labelsMetavariableNodesQuery(labelsNode);
|
|
16
|
+
|
|
17
|
+
labelsVerified = labelsMetavariableNodes.every((labelsMetavariableNode) => {
|
|
18
|
+
const labelVerified = verifyLabel(labelsMetavariableNode, labels, fileContext);
|
|
10
19
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
20
|
+
if (labelVerified) {
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
}
|
|
15
25
|
|
|
16
26
|
return labelsVerified;
|
|
17
27
|
}
|
package/src/verify/lemma.js
CHANGED
|
@@ -12,15 +12,15 @@ import { EMPTY_STRING } from "../constants";
|
|
|
12
12
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
13
13
|
|
|
14
14
|
const proofNodeQuery = nodeQuery("/lemma/proof!"),
|
|
15
|
-
|
|
15
|
+
labelsNodeQuery = nodeQuery("/lemma/labels!"),
|
|
16
16
|
consequentNodeQuery = nodeQuery("/lemma/consequent!"),
|
|
17
17
|
suppositionsNodeQuery = nodesQuery("/lemma/supposition");
|
|
18
18
|
|
|
19
19
|
export default function verifyLemma(lemmaNode, fileContext) {
|
|
20
20
|
let lemmaVerified = false;
|
|
21
21
|
|
|
22
|
-
const
|
|
23
|
-
labelsString = fileContext.
|
|
22
|
+
const labelsNode = labelsNodeQuery(lemmaNode),
|
|
23
|
+
labelsString = fileContext.nodeAsString(labelsNode),
|
|
24
24
|
localContext = LocalContext.fromFileContext(fileContext);
|
|
25
25
|
|
|
26
26
|
(labelsString === EMPTY_STRING) ?
|
|
@@ -28,7 +28,7 @@ export default function verifyLemma(lemmaNode, fileContext) {
|
|
|
28
28
|
fileContext.trace(`Verifying the '${labelsString}' lemma...`, lemmaNode);
|
|
29
29
|
|
|
30
30
|
const labels = [],
|
|
31
|
-
labelsVerified = verifyLabels(
|
|
31
|
+
labelsVerified = verifyLabels(labelsNode, labels, fileContext);
|
|
32
32
|
|
|
33
33
|
if (labelsVerified) {
|
|
34
34
|
const suppositions = [],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import LocalContext from "../context/local";
|
|
4
3
|
import MetaproofStep from "../step/metaproof";
|
|
4
|
+
import LocalMetaContext from "../context/localMeta";
|
|
5
5
|
import verifyMetaSuppositions from "../verify/metaSuppositions";
|
|
6
6
|
import verifyQualifiedMetastatement from "../verify/metastatement/qualified";
|
|
7
7
|
import verifyUnqualifiedMetastatement from "../verify/metastatement/unqualified";
|
|
@@ -15,13 +15,13 @@ const childNodesQuery = nodesQuery("/metaDerivation|metaSubDerivation/*"),
|
|
|
15
15
|
metaSuppositionNodesQuery = nodesQuery("/metaSubproof/metaSupposition"),
|
|
16
16
|
metaSubDerivationNodeQuery = nodeQuery("/metaSubproof/metaSubDerivation");
|
|
17
17
|
|
|
18
|
-
export default function verifyMetaDerivation(metaDerivationNode,
|
|
18
|
+
export default function verifyMetaDerivation(metaDerivationNode, localMetaContext) {
|
|
19
19
|
let metaDerivationVerified;
|
|
20
20
|
|
|
21
21
|
const childNodes = childNodesQuery(metaDerivationNode);
|
|
22
22
|
|
|
23
23
|
metaDerivationVerified = childNodes.every((childNode) => {
|
|
24
|
-
const childVerified = verifyChild(childNode,
|
|
24
|
+
const childVerified = verifyChild(childNode, localMetaContext);
|
|
25
25
|
|
|
26
26
|
if (childVerified) {
|
|
27
27
|
return true;
|
|
@@ -31,13 +31,13 @@ export default function verifyMetaDerivation(metaDerivationNode, localContext) {
|
|
|
31
31
|
return metaDerivationVerified;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
function verifyMetaSubDerivation(metaSubDerivationNode,
|
|
34
|
+
function verifyMetaSubDerivation(metaSubDerivationNode, localMetaContext) {
|
|
35
35
|
let metaSubDerivationVerified;
|
|
36
36
|
|
|
37
37
|
const childNodes = childNodesQuery(metaSubDerivationNode);
|
|
38
38
|
|
|
39
39
|
metaSubDerivationVerified = childNodes.every((childNode) => {
|
|
40
|
-
const childVerified = verifyChild(childNode,
|
|
40
|
+
const childVerified = verifyChild(childNode, localMetaContext);
|
|
41
41
|
|
|
42
42
|
if (childVerified) {
|
|
43
43
|
return true;
|
|
@@ -47,18 +47,18 @@ function verifyMetaSubDerivation(metaSubDerivationNode, localContext) {
|
|
|
47
47
|
return metaSubDerivationVerified;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
function verifyMetaSubproof(metaSubproofNode,
|
|
50
|
+
function verifyMetaSubproof(metaSubproofNode, localMetaContext) {
|
|
51
51
|
let metaSubproofVerified = false;
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
localMetaContext = LocalMetaContext.fromLocalMetaContext(localMetaContext); ///
|
|
54
54
|
|
|
55
55
|
const metaSuppositions = [],
|
|
56
56
|
metaSuppositionNodes = metaSuppositionNodesQuery(metaSubproofNode),
|
|
57
|
-
metaSuppositionsVerified = verifyMetaSuppositions(metaSuppositionNodes, metaSuppositions,
|
|
57
|
+
metaSuppositionsVerified = verifyMetaSuppositions(metaSuppositionNodes, metaSuppositions, localMetaContext);
|
|
58
58
|
|
|
59
59
|
if (metaSuppositionsVerified) {
|
|
60
60
|
const metaSubDerivationNode = metaSubDerivationNodeQuery(metaSubproofNode),
|
|
61
|
-
metaSubDerivationVerified = verifyMetaSubDerivation(metaSubDerivationNode,
|
|
61
|
+
metaSubDerivationVerified = verifyMetaSubDerivation(metaSubDerivationNode, localMetaContext);
|
|
62
62
|
|
|
63
63
|
if (metaSubDerivationVerified) {
|
|
64
64
|
metaSubproofVerified = true;
|
|
@@ -68,7 +68,7 @@ function verifyMetaSubproof(metaSubproofNode, localContext) {
|
|
|
68
68
|
return metaSubproofVerified;
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
function verifyChild(childNode,
|
|
71
|
+
function verifyChild(childNode, localMetaContext) {
|
|
72
72
|
let childVerified = false;
|
|
73
73
|
|
|
74
74
|
const childNodeRuleName = childNode.getRuleName();
|
|
@@ -79,12 +79,12 @@ function verifyChild(childNode, localContext) {
|
|
|
79
79
|
|
|
80
80
|
const metaSubproofNode = childNode; ///
|
|
81
81
|
|
|
82
|
-
metaSubproofVerified = verifyMetaSubproof(metaSubproofNode,
|
|
82
|
+
metaSubproofVerified = verifyMetaSubproof(metaSubproofNode, localMetaContext);
|
|
83
83
|
|
|
84
84
|
if (metaSubproofVerified) {
|
|
85
85
|
const metaproofStep = MetaproofStep.fromMetaSubproofNode(metaSubproofNode);
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
localMetaContext.addMetaproofStep(metaproofStep);
|
|
88
88
|
|
|
89
89
|
childVerified = true;
|
|
90
90
|
}
|
|
@@ -99,10 +99,10 @@ function verifyChild(childNode, localContext) {
|
|
|
99
99
|
assignments = [],
|
|
100
100
|
qualifiedMetastatementNode = childNode; ///
|
|
101
101
|
|
|
102
|
-
qualifiedMetastatementVerified = verifyQualifiedMetastatement(qualifiedMetastatementNode, assignments, derived,
|
|
102
|
+
qualifiedMetastatementVerified = verifyQualifiedMetastatement(qualifiedMetastatementNode, assignments, derived, localMetaContext);
|
|
103
103
|
|
|
104
104
|
if (qualifiedMetastatementVerified) {
|
|
105
|
-
const assignmentAssigned = assignAssignment(assignments,
|
|
105
|
+
const assignmentAssigned = assignAssignment(assignments, localMetaContext);
|
|
106
106
|
|
|
107
107
|
qualifiedMetastatementVerified = assignmentAssigned; ///
|
|
108
108
|
}
|
|
@@ -111,7 +111,7 @@ function verifyChild(childNode, localContext) {
|
|
|
111
111
|
const metastatementNode = metastatementNodeQuery(qualifiedMetastatementNode),
|
|
112
112
|
metaproofStep = MetaproofStep.fromMetastatementNode(metastatementNode);
|
|
113
113
|
|
|
114
|
-
|
|
114
|
+
localMetaContext.addMetaproofStep(metaproofStep);
|
|
115
115
|
|
|
116
116
|
childVerified = true; ///
|
|
117
117
|
}
|
|
@@ -126,10 +126,10 @@ function verifyChild(childNode, localContext) {
|
|
|
126
126
|
assignments = [],
|
|
127
127
|
unqualifiedMetastatementNode = childNode; ///
|
|
128
128
|
|
|
129
|
-
unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, assignments, derived,
|
|
129
|
+
unqualifiedMetastatementVerified = verifyUnqualifiedMetastatement(unqualifiedMetastatementNode, assignments, derived, localMetaContext);
|
|
130
130
|
|
|
131
131
|
if (unqualifiedMetastatementVerified) {
|
|
132
|
-
const assignmentAssigned = assignAssignment(assignments,
|
|
132
|
+
const assignmentAssigned = assignAssignment(assignments, localMetaContext);
|
|
133
133
|
|
|
134
134
|
unqualifiedMetastatementVerified = assignmentAssigned; ///
|
|
135
135
|
}
|
|
@@ -138,7 +138,7 @@ function verifyChild(childNode, localContext) {
|
|
|
138
138
|
const metastatementNode = metastatementNodeQuery(unqualifiedMetastatementNode),
|
|
139
139
|
metaproofStep = MetaproofStep.fromMetastatementNode(metastatementNode);
|
|
140
140
|
|
|
141
|
-
|
|
141
|
+
localMetaContext.addMetaproofStep(metaproofStep);
|
|
142
142
|
|
|
143
143
|
childVerified = true;
|
|
144
144
|
}
|
package/src/verify/metaLemma.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import MetaLemma from "../metaLemma";
|
|
4
4
|
import verifyLabels from "../verify/labels";
|
|
5
|
-
import
|
|
5
|
+
import verifyMetaproof from "../verify/metaproof";
|
|
6
6
|
import LocalMetaContext from "../context/localMeta";
|
|
7
7
|
import verifyMetaConsequent from "../verify/metaConsequent";
|
|
8
8
|
import verifyMetaSuppositions from "../verify/metaSuppositions";
|
|
@@ -11,7 +11,7 @@ import { first } from "../utilities/array";
|
|
|
11
11
|
import { EMPTY_STRING } from "../constants";
|
|
12
12
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
13
13
|
|
|
14
|
-
const
|
|
14
|
+
const labelsNodeQuery = nodeQuery("/metaLemma/labels!"),
|
|
15
15
|
metaproofNodeQuery = nodeQuery("/metaLemma/metaproof!"),
|
|
16
16
|
metaConsequentNodeQuery = nodeQuery("/metaLemma/metaConsequent!"),
|
|
17
17
|
metaSuppositionsNodeQuery = nodesQuery("/metaLemma/metaSupposition");
|
|
@@ -19,8 +19,8 @@ const labelNodesQuery = nodesQuery("/metaLemma//reference/label"),
|
|
|
19
19
|
export default function verifyMetaLemma(metaLemmaNode, fileContext) {
|
|
20
20
|
let metaLemmaVerified = false;
|
|
21
21
|
|
|
22
|
-
const
|
|
23
|
-
labelsString = fileContext.
|
|
22
|
+
const labelsNode = labelsNodeQuery(metaLemmaNode),
|
|
23
|
+
labelsString = fileContext.nodeAsString(labelsNode),
|
|
24
24
|
localMetaContext = LocalMetaContext.fromFileContext(fileContext);
|
|
25
25
|
|
|
26
26
|
(labelsString === EMPTY_STRING) ?
|
|
@@ -28,7 +28,7 @@ export default function verifyMetaLemma(metaLemmaNode, fileContext) {
|
|
|
28
28
|
fileContext.trace(`Verifying the '${labelsString}' meta-lLemma...`, metaLemmaNode);
|
|
29
29
|
|
|
30
30
|
const labels = [],
|
|
31
|
-
labelsVerified = verifyLabels(
|
|
31
|
+
labelsVerified = verifyLabels(labelsNode, labels, fileContext);
|
|
32
32
|
|
|
33
33
|
if (labelsVerified) {
|
|
34
34
|
const metaSuppositions = [],
|
|
@@ -44,7 +44,7 @@ export default function verifyMetaLemma(metaLemmaNode, fileContext) {
|
|
|
44
44
|
const metaproofNode = metaproofNodeQuery(metaLemmaNode),
|
|
45
45
|
firstMetaConsequent = first(metaConsequents),
|
|
46
46
|
metaConsequent = firstMetaConsequent, ///
|
|
47
|
-
metaproofVerified =
|
|
47
|
+
metaproofVerified = verifyMetaproof(metaproofNode, metaConsequent, localMetaContext);
|
|
48
48
|
|
|
49
49
|
if (metaproofVerified) {
|
|
50
50
|
const metaLemma = MetaLemma.fromLabelsMetaSuppositionsMetaConsequentAndLocalMetaContext(labels, metaSuppositions, metaConsequent, localMetaContext);
|
package/src/verify/metaproof.js
CHANGED
|
@@ -1,22 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import LocalContext from "../context/local";
|
|
4
3
|
import verifyMetaDerivation from "../verify/metaDerivation";
|
|
5
4
|
|
|
6
5
|
import { nodeQuery } from "../utilities/query";
|
|
7
6
|
|
|
8
7
|
const metaDerivationNodeQuery = nodeQuery("/metaproof/metaDerivation!");
|
|
9
8
|
|
|
10
|
-
export default function verifyMetaproof(metaproofNode, conclusion,
|
|
9
|
+
export default function verifyMetaproof(metaproofNode, conclusion, localMetaproof) {
|
|
11
10
|
let metaproofVerified = false;
|
|
12
11
|
|
|
13
|
-
localContext = LocalContext.fromLocalContext(localContext); ///
|
|
14
|
-
|
|
15
12
|
const metaDerivationNode = metaDerivationNodeQuery(metaproofNode),
|
|
16
|
-
metaDerivationVerified = verifyMetaDerivation(metaDerivationNode,
|
|
13
|
+
metaDerivationVerified = verifyMetaDerivation(metaDerivationNode, localMetaproof);
|
|
17
14
|
|
|
18
15
|
if (metaDerivationVerified) {
|
|
19
|
-
const lastMetaproofStep =
|
|
16
|
+
const lastMetaproofStep = localMetaproof.getLastMetaproofStep();
|
|
20
17
|
|
|
21
18
|
if (lastMetaproofStep !== null) {
|
|
22
19
|
const metaproofStep = lastMetaproofStep, ///
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { nodeQuery } from "../../utilities/query";
|
|
4
4
|
|
|
5
|
-
const
|
|
6
|
-
|
|
5
|
+
const metastatementNodeQuery = nodeQuery("/qualifiedMetastatement/metastatement!"),
|
|
6
|
+
referenceMetavariableNodeQuery = nodeQuery("/qualifiedMetastatement/reference!/metavariable!");
|
|
7
7
|
|
|
8
8
|
export default function verifyQualifiedMetastatement(qualifiedMetastatementNode, assignments, derived, localMetaContext) {
|
|
9
9
|
let qualifiedMetastatementVerified = false;
|
|
@@ -16,8 +16,9 @@ export default function verifyQualifiedMetastatement(qualifiedMetastatementNode,
|
|
|
16
16
|
|
|
17
17
|
localMetaContext.trace(`Verifying the '${metastatementString}' qualified metastatement...`, qualifiedMetastatementNode);
|
|
18
18
|
|
|
19
|
-
const
|
|
20
|
-
|
|
19
|
+
const referenceMetavariableNode = referenceMetavariableNodeQuery(qualifiedMetastatementNode),
|
|
20
|
+
labelMetavariableNode = referenceMetavariableNode, ///
|
|
21
|
+
rule = localMetaContext.findRuleByLabelMetavariableNode(labelMetavariableNode);
|
|
21
22
|
|
|
22
23
|
if (rule !== null) {
|
|
23
24
|
const ruleMatchesMetastatement = rule.matchMetastatement(metastatementNode, metastatementLocalMetaContext);
|
|
@@ -10,7 +10,7 @@ import verifyMetaSuppositions from "../verify/metaSuppositions";
|
|
|
10
10
|
import { first } from "../utilities/array";
|
|
11
11
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
12
12
|
|
|
13
|
-
const
|
|
13
|
+
const labelsNodeQuery = nodeQuery("/metatheorem/labels!"),
|
|
14
14
|
metaproofNodeQuery = nodeQuery("/metatheorem/metaproof!"),
|
|
15
15
|
metaConsequentNodeQuery = nodeQuery("/metatheorem/metaConsequent!"),
|
|
16
16
|
metaSuppositionsNodeQuery = nodesQuery("/metatheorem/metaSupposition");
|
|
@@ -18,14 +18,14 @@ const labelNodesQuery = nodesQuery("/metatheorem//reference/label"),
|
|
|
18
18
|
export default function verifyMetatheorem(metatheoremNode, fileContext) {
|
|
19
19
|
let metatheoremVerified = false;
|
|
20
20
|
|
|
21
|
-
const
|
|
22
|
-
labelsString = fileContext.
|
|
21
|
+
const labelsNode = labelsNodeQuery(metatheoremNode),
|
|
22
|
+
labelsString = fileContext.nodeAsString(labelsNode),
|
|
23
23
|
localMetaContext = LocalMetaContext.fromFileContext(fileContext);
|
|
24
24
|
|
|
25
25
|
fileContext.trace(`Verifying the '${labelsString}' metatheorem...`, metatheoremNode);
|
|
26
26
|
|
|
27
27
|
const labels = [],
|
|
28
|
-
labelsVerified = verifyLabels(
|
|
28
|
+
labelsVerified = verifyLabels(labelsNode, labels, fileContext);
|
|
29
29
|
|
|
30
30
|
if (labelsVerified) {
|
|
31
31
|
const metaSuppositions = [],
|