occam-verify-cli 0.0.698 → 0.0.702
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/assignment/equality.js +4 -4
- package/lib/assignment/metavariable.js +4 -4
- package/lib/assignment/variable.js +4 -4
- package/lib/collection.js +44 -6
- package/lib/conclusion.js +6 -6
- package/lib/consequent.js +4 -4
- package/lib/constructor.js +3 -10
- package/lib/context/file.js +12 -73
- package/lib/context/local.js +31 -70
- package/lib/context/localMeta.js +12 -9
- package/lib/context/release.js +2 -4
- package/lib/equality.js +22 -6
- package/lib/metaType.js +10 -10
- package/lib/metavariable.js +3 -10
- package/lib/mixins/context.js +107 -0
- package/lib/premise.js +9 -9
- package/lib/ruleNames.js +9 -1
- package/lib/supposition.js +4 -4
- package/lib/type.js +23 -27
- package/lib/utilities/collection.js +27 -13
- package/lib/utilities/node.js +3 -73
- package/lib/utilities/tokens.js +1 -8
- package/lib/variable.js +11 -10
- package/lib/verifier/node/statementAsCombinator.js +4 -1
- package/lib/verifier/node/termAsConstructor.js +4 -20
- package/lib/verifier/nodes/equality.js +169 -0
- package/lib/verifier/nodes/metastatementForMetavariable.js +6 -7
- package/lib/verifier/nodes/statement.js +12 -4
- package/lib/verifier/nodes/statementForMetavariable.js +6 -7
- package/lib/verifier/nodes/termForVariable.js +19 -20
- package/lib/verify/axiom.js +3 -8
- package/lib/verify/conclusion.js +2 -2
- package/lib/verify/conjecture.js +4 -9
- package/lib/verify/consequent.js +3 -3
- package/lib/verify/derivation.js +30 -13
- package/lib/verify/equality.js +17 -12
- package/lib/verify/givenType.js +32 -0
- package/lib/verify/lemma.js +4 -9
- package/lib/verify/metastatement.js +3 -3
- package/lib/verify/premises.js +28 -0
- package/lib/verify/rule.js +3 -8
- package/lib/verify/ruleDerivation.js +6 -8
- package/lib/verify/statement/qualified.js +135 -37
- package/lib/verify/statement.js +34 -42
- package/lib/verify/supposition.js +6 -7
- package/lib/verify/suppositions.js +28 -0
- package/lib/verify/term.js +25 -60
- package/lib/verify/termAndGivenType.js +39 -0
- package/lib/verify/termAsGivenVariable.js +36 -0
- package/lib/verify/theorem.js +3 -8
- package/lib/verify/typeAssertion.js +44 -27
- package/package.json +1 -1
- package/src/assignment/equality.js +5 -5
- package/src/assignment/metavariable.js +5 -5
- package/src/assignment/variable.js +7 -5
- package/src/collection.js +55 -5
- package/src/conclusion.js +6 -6
- package/src/consequent.js +4 -4
- package/src/constructor.js +2 -7
- package/src/context/file.js +16 -13
- package/src/context/local.js +39 -86
- package/src/context/localMeta.js +11 -7
- package/src/context/release.js +6 -9
- package/src/equality.js +25 -4
- package/src/metaType.js +10 -10
- package/src/metavariable.js +2 -7
- package/src/mixins/{file.js → context.js} +20 -2
- package/src/premise.js +10 -10
- package/src/ruleNames.js +2 -0
- package/src/supposition.js +3 -3
- package/src/type.js +27 -39
- package/src/utilities/collection.js +31 -11
- package/src/utilities/node.js +3 -81
- package/src/utilities/tokens.js +0 -8
- package/src/variable.js +9 -6
- package/src/verifier/node/statementAsCombinator.js +7 -1
- package/src/verifier/node/termAsConstructor.js +5 -26
- package/src/verifier/nodes/equality.js +47 -0
- package/src/verifier/nodes/metastatementForMetavariable.js +10 -10
- package/src/verifier/nodes/statement.js +1 -1
- package/src/verifier/nodes/statementForMetavariable.js +10 -10
- package/src/verifier/nodes/termForVariable.js +30 -30
- package/src/verify/axiom.js +2 -8
- package/src/verify/conclusion.js +1 -1
- package/src/verify/conjecture.js +3 -9
- package/src/verify/consequent.js +4 -4
- package/src/verify/derivation.js +39 -16
- package/src/verify/equality.js +20 -11
- package/src/verify/{standaloneType.js → givenType.js} +7 -7
- package/src/verify/lemma.js +3 -9
- package/src/verify/metastatement.js +2 -2
- package/src/verify/premises.js +17 -0
- package/src/verify/rule.js +2 -8
- package/src/verify/ruleDerivation.js +5 -7
- package/src/verify/statement/qualified.js +194 -39
- package/src/verify/statement.js +47 -47
- package/src/verify/supposition.js +10 -12
- package/src/verify/suppositions.js +17 -0
- package/src/verify/term.js +26 -64
- package/src/verify/termAndGivenType.js +37 -0
- package/src/verify/termAsGivenVariable.js +39 -0
- package/src/verify/theorem.js +2 -8
- package/src/verify/typeAssertion.js +59 -32
- package/lib/mixins/file.js +0 -83
- package/lib/mixins/logging.js +0 -39
- package/lib/verifier/nodes/metastatementForMetavariable/conclusion.js +0 -114
- package/lib/verifier/nodes/metastatementForMetavariable/premise.js +0 -114
- package/lib/verifier/nodes/statementForMetavariable/conclusion.js +0 -114
- package/lib/verifier/nodes/statementForMetavariable/premise.js +0 -114
- package/lib/verifier/nodes/termForVariable/consequent.js +0 -114
- package/lib/verifier/nodes/termForVariable/supposition.js +0 -114
- package/lib/verify/standaloneType.js +0 -32
- package/lib/verify/termAndStandaloneType.js +0 -39
- package/lib/verify/termAsVariableAndStandaloneType.js +0 -39
- package/src/mixins/logging.js +0 -24
- package/src/verifier/nodes/metastatementForMetavariable/conclusion.js +0 -11
- package/src/verifier/nodes/metastatementForMetavariable/premise.js +0 -11
- package/src/verifier/nodes/statementForMetavariable/conclusion.js +0 -11
- package/src/verifier/nodes/statementForMetavariable/premise.js +0 -11
- package/src/verifier/nodes/termForVariable/consequent.js +0 -11
- package/src/verifier/nodes/termForVariable/supposition.js +0 -11
- package/src/verify/termAndStandaloneType.js +0 -37
- package/src/verify/termAsVariableAndStandaloneType.js +0 -38
|
@@ -60,7 +60,7 @@ const statementNodesVerifier = new StatementNodesVerifier();
|
|
|
60
60
|
|
|
61
61
|
export default statementNodesVerifier;
|
|
62
62
|
|
|
63
|
-
function verifyMetaargument(metaArgumentNode, combinatorMetaargumentNode, context, verifyAhead) {
|
|
63
|
+
export function verifyMetaargument(metaArgumentNode, combinatorMetaargumentNode, context, verifyAhead) {
|
|
64
64
|
let metaArgumentVerified = false;
|
|
65
65
|
|
|
66
66
|
const metaArgumentString = context.nodeAsString(metaArgumentNode);
|
|
@@ -9,7 +9,7 @@ import { STATEMENT_RULE_NAME, METASTATEMENT_RULE_NAME, META_ARGUMENT_RULE_NAME }
|
|
|
9
9
|
const metavariableNodeQuery = nodeQuery('/metastatement/metavariable!'),
|
|
10
10
|
metaArgumentChildNodeNodeQuery = nodeQuery('/metaArgument/*!');
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
class StatementForMetavariableNodesVerifier extends NodesVerifier {
|
|
13
13
|
verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, fileContextA, localContext) {
|
|
14
14
|
let nonTerminalNodeVerified = false;
|
|
15
15
|
|
|
@@ -84,16 +84,12 @@ export default class StatementForMetavariableNodesVerifier extends NodesVerifier
|
|
|
84
84
|
|
|
85
85
|
metavariableNodeVerified = statementNodeMatches; ///
|
|
86
86
|
} else {
|
|
87
|
-
const
|
|
87
|
+
const metavariableNode = metavariableNodeA, ///
|
|
88
|
+
statementNode = statementNodeB, ///
|
|
89
|
+
statementForMetavariableSubstitution = StatementForMetavariableSubstitution.fromMetavariableNodeAndStatementNode(metavariableNode, statementNode),
|
|
90
|
+
substitution = statementForMetavariableSubstitution; ///
|
|
88
91
|
|
|
89
|
-
|
|
90
|
-
const metavariableNode = metavariableNodeA, ///
|
|
91
|
-
statementNode = statementNodeB, ///
|
|
92
|
-
statementForMetavariableSubstitution = StatementForMetavariableSubstitution.fromMetavariableNodeAndStatementNode(metavariableNode, statementNode),
|
|
93
|
-
substitution = statementForMetavariableSubstitution; ///
|
|
94
|
-
|
|
95
|
-
substitutions.push(substitution);
|
|
96
|
-
}
|
|
92
|
+
substitutions.push(substitution);
|
|
97
93
|
|
|
98
94
|
metavariableNodeVerified = true;
|
|
99
95
|
}
|
|
@@ -101,3 +97,7 @@ export default class StatementForMetavariableNodesVerifier extends NodesVerifier
|
|
|
101
97
|
return metavariableNodeVerified;
|
|
102
98
|
}
|
|
103
99
|
}
|
|
100
|
+
|
|
101
|
+
const statementForMetavariableNodesVerifier = new StatementForMetavariableNodesVerifier();
|
|
102
|
+
|
|
103
|
+
export default statementForMetavariableNodesVerifier;
|
|
@@ -10,7 +10,7 @@ import { TERM_RULE_NAME } from "../../ruleNames";
|
|
|
10
10
|
|
|
11
11
|
const variableNodeQuery = nodeQuery('/term/variable!');
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
class TermForVariableNodesVerifier extends NodesVerifier {
|
|
14
14
|
verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localContextA, localContextB, verifyAhead) {
|
|
15
15
|
let nonTerminalNodeVerified = false;
|
|
16
16
|
|
|
@@ -74,47 +74,47 @@ export default class TermForVariableNodesVerifier extends NodesVerifier {
|
|
|
74
74
|
variableVerified = verifiedAhead; ///
|
|
75
75
|
}
|
|
76
76
|
} else {
|
|
77
|
-
const
|
|
77
|
+
const variableNode = variableNodeA, ///
|
|
78
|
+
localContext = localContextA, ///
|
|
79
|
+
variable = localContext.findVariableByVariableNode(variableNode);
|
|
78
80
|
|
|
79
|
-
if (
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
81
|
+
if (variable !== null) {
|
|
82
|
+
const terms = [],
|
|
83
|
+
context = localContextB, ///
|
|
84
|
+
termNode = termNodeB, ///
|
|
85
|
+
termVerified = verifyTerm(termNode, terms, context, () => {
|
|
86
|
+
let verifiedAhead = false;
|
|
83
87
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
let verifiedAhead = false;
|
|
88
|
+
const firstTerm = first(terms),
|
|
89
|
+
term = firstTerm, ///
|
|
90
|
+
termType = term.getType(),
|
|
91
|
+
variableType = variable.getType(),
|
|
92
|
+
variableTypeEqualToOrSuperTypeOfTermType = variableType.isEqualToOrSuperTypeOf(termType);
|
|
90
93
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
variableType = variable.getType(),
|
|
95
|
-
variableTypeEqualToOrSuperTypeOfTermType = variableType.isEqualToOrSuperTypeOf(termType);
|
|
94
|
+
if (variableTypeEqualToOrSuperTypeOfTermType) {
|
|
95
|
+
const termForVariableSubstitution = TermForVariableSubstitution.fromVariableNodeAndTermNode(variableNode, termNode),
|
|
96
|
+
substitution = termForVariableSubstitution; ///
|
|
96
97
|
|
|
97
|
-
|
|
98
|
-
const termForVariableSubstitution = TermForVariableSubstitution.fromVariableNodeAndTermNode(variableNode, termNode),
|
|
99
|
-
substitution = termForVariableSubstitution; ///
|
|
98
|
+
substitutions.push(substitution);
|
|
100
99
|
|
|
101
|
-
|
|
100
|
+
verifiedAhead = verifyAhead();
|
|
102
101
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
if (!verifiedAhead) {
|
|
106
|
-
substitutions.pop();
|
|
107
|
-
}
|
|
102
|
+
if (!verifiedAhead) {
|
|
103
|
+
substitutions.pop();
|
|
108
104
|
}
|
|
105
|
+
}
|
|
109
106
|
|
|
110
|
-
|
|
111
|
-
|
|
107
|
+
return verifiedAhead;
|
|
108
|
+
});
|
|
112
109
|
|
|
113
|
-
|
|
114
|
-
}
|
|
110
|
+
variableVerified = termVerified; ///
|
|
115
111
|
}
|
|
116
112
|
}
|
|
117
113
|
|
|
118
114
|
return variableVerified;
|
|
119
115
|
}
|
|
120
116
|
}
|
|
117
|
+
|
|
118
|
+
const termForVariableNodesVerifier = new TermForVariableNodesVerifier();
|
|
119
|
+
|
|
120
|
+
export default termForVariableNodesVerifier;
|
package/src/verify/axiom.js
CHANGED
|
@@ -4,7 +4,7 @@ import Axiom from "../axiom";
|
|
|
4
4
|
import LocalContext from "../context/local";
|
|
5
5
|
import verifyLabels from "../verify/labels";
|
|
6
6
|
import verifyConsequent from "../verify/consequent";
|
|
7
|
-
import
|
|
7
|
+
import verifySuppositions from "../verify/suppositions";
|
|
8
8
|
|
|
9
9
|
import { first } from "../utilities/array";
|
|
10
10
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
@@ -28,13 +28,7 @@ export default function verifyAxiom(axiomNode, fileContext) {
|
|
|
28
28
|
if (labelsVerified) {
|
|
29
29
|
const suppositions = [],
|
|
30
30
|
suppositionNodes = suppositionsNodeQuery(axiomNode),
|
|
31
|
-
suppositionsVerified = suppositionNodes
|
|
32
|
-
const suppositionVerified = verifySupposition(suppositionNode, suppositions, localContext);
|
|
33
|
-
|
|
34
|
-
if (suppositionVerified) {
|
|
35
|
-
return true;
|
|
36
|
-
}
|
|
37
|
-
});
|
|
31
|
+
suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
|
|
38
32
|
|
|
39
33
|
if (suppositionsVerified) {
|
|
40
34
|
const consequents = [],
|
package/src/verify/conclusion.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import Conclusion from "../conclusion";
|
|
4
|
-
import verifyUnqualifiedMetastatement from "
|
|
4
|
+
import verifyUnqualifiedMetastatement from "../verify/metastatement/unqualified";
|
|
5
5
|
|
|
6
6
|
import { nodeQuery } from "../utilities/query";
|
|
7
7
|
|
package/src/verify/conjecture.js
CHANGED
|
@@ -4,8 +4,8 @@ import Conjecture from "../conjecture";
|
|
|
4
4
|
import verifyProof from "../verify/proof";
|
|
5
5
|
import LocalContext from "../context/local";
|
|
6
6
|
import verifyLabels from "../verify/labels";
|
|
7
|
-
import verifyConsequent from "
|
|
8
|
-
import
|
|
7
|
+
import verifyConsequent from "../verify/consequent";
|
|
8
|
+
import verifySuppositions from "../verify/suppositions";
|
|
9
9
|
|
|
10
10
|
import { first } from "../utilities/array";
|
|
11
11
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
@@ -30,13 +30,7 @@ export default function verifyConjecture(conjectureNode, fileContext) {
|
|
|
30
30
|
if (labelsVerified) {
|
|
31
31
|
const suppositions = [],
|
|
32
32
|
suppositionNodes = suppositionsNodeQuery(conjectureNode),
|
|
33
|
-
suppositionsVerified = suppositionNodes
|
|
34
|
-
const suppositionVerified = verifySupposition(suppositionNode, suppositions, localContext);
|
|
35
|
-
|
|
36
|
-
if (suppositionVerified) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
});
|
|
33
|
+
suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
|
|
40
34
|
|
|
41
35
|
if (suppositionsVerified) {
|
|
42
36
|
const consequents = [],
|
package/src/verify/consequent.js
CHANGED
|
@@ -21,15 +21,15 @@ export default function verifyConsequent(consequentNode, consequents, localConte
|
|
|
21
21
|
unqualifiedStatementVerified = verifyUnqualifiedStatement(unqualifiedStatementNode, assignments, derived, localContext);
|
|
22
22
|
|
|
23
23
|
if (unqualifiedStatementVerified) {
|
|
24
|
+
consequentVerified = true;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
if (consequentVerified) {
|
|
24
28
|
const statementNode = statementNodeQuery(unqualifiedStatementNode),
|
|
25
29
|
consequent = Consequent.fromStatementNode(statementNode);
|
|
26
30
|
|
|
27
31
|
consequents.push(consequent);
|
|
28
32
|
|
|
29
|
-
consequentVerified = true;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (consequentVerified) {
|
|
33
33
|
localContext.debug(`...verified the '${consequentString}' consequent.`, consequentNode);
|
|
34
34
|
}
|
|
35
35
|
|
package/src/verify/derivation.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import ProofStep from "../step/proof";
|
|
4
4
|
import LocalContext from "../context/local";
|
|
5
|
-
import
|
|
5
|
+
import verifySuppositions from "../verify/suppositions";
|
|
6
6
|
import verifyQualifiedStatement from "../verify/statement/qualified";
|
|
7
7
|
import verifyUnqualifiedStatement from "../verify/statement/unqualified";
|
|
8
8
|
|
|
@@ -53,13 +53,7 @@ function verifySubproof(subproofNode, localContext) {
|
|
|
53
53
|
|
|
54
54
|
const suppositions = [],
|
|
55
55
|
suppositionNodes = suppositionNodesQuery(subproofNode),
|
|
56
|
-
suppositionsVerified = suppositionNodes
|
|
57
|
-
const suppositionVerified = verifySupposition(suppositionNode, suppositions, localContext);
|
|
58
|
-
|
|
59
|
-
if (suppositionVerified) {
|
|
60
|
-
return true;
|
|
61
|
-
}
|
|
62
|
-
});
|
|
56
|
+
suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
|
|
63
57
|
|
|
64
58
|
if (suppositionsVerified) {
|
|
65
59
|
const subDerivationNode = subDerivationNodeQuery(subproofNode),
|
|
@@ -74,14 +68,17 @@ function verifySubproof(subproofNode, localContext) {
|
|
|
74
68
|
}
|
|
75
69
|
|
|
76
70
|
function verifyChild(childNode, localContext) {
|
|
77
|
-
let childVerified;
|
|
71
|
+
let childVerified = false;
|
|
78
72
|
|
|
79
73
|
const childNodeRuleName = childNode.getRuleName();
|
|
80
74
|
|
|
81
75
|
switch (childNodeRuleName) {
|
|
82
76
|
case SUBPROOF_RULE_NAME: {
|
|
83
|
-
|
|
84
|
-
|
|
77
|
+
let subproofVerified;
|
|
78
|
+
|
|
79
|
+
const subproofNode = childNode; ///
|
|
80
|
+
|
|
81
|
+
subproofVerified = verifySubproof(subproofNode, localContext);
|
|
85
82
|
|
|
86
83
|
if (subproofVerified) {
|
|
87
84
|
const proofStep = ProofStep.fromSubproofNode(subproofNode);
|
|
@@ -95,10 +92,23 @@ function verifyChild(childNode, localContext) {
|
|
|
95
92
|
}
|
|
96
93
|
|
|
97
94
|
case QUALIFIED_STATEMENT_RULE_NAME: {
|
|
95
|
+
let qualifiedStatementVerified;
|
|
96
|
+
|
|
98
97
|
const derived = true,
|
|
99
98
|
assignments = [],
|
|
100
|
-
qualifiedStatementNode = childNode
|
|
101
|
-
|
|
99
|
+
qualifiedStatementNode = childNode; ///
|
|
100
|
+
|
|
101
|
+
qualifiedStatementVerified = verifyQualifiedStatement(qualifiedStatementNode, assignments, derived, localContext);
|
|
102
|
+
|
|
103
|
+
if (qualifiedStatementVerified) {
|
|
104
|
+
qualifiedStatementVerified = assignments.every((assignment) => { ///
|
|
105
|
+
const assigned = assignment.assign(localContext);
|
|
106
|
+
|
|
107
|
+
if (assigned) {
|
|
108
|
+
return true;
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
}
|
|
102
112
|
|
|
103
113
|
if (qualifiedStatementVerified) {
|
|
104
114
|
const statementNode = statementNodeQuery(qualifiedStatementNode),
|
|
@@ -106,17 +116,30 @@ function verifyChild(childNode, localContext) {
|
|
|
106
116
|
|
|
107
117
|
localContext.addProofStep(proofStep);
|
|
108
118
|
|
|
109
|
-
childVerified =
|
|
119
|
+
childVerified = true; ///
|
|
110
120
|
}
|
|
111
121
|
|
|
112
122
|
break;
|
|
113
123
|
}
|
|
114
124
|
|
|
115
125
|
case UNQUALIFIED_STATEMENT_RULE_NAME: {
|
|
126
|
+
let unqualifiedStatementVerified;
|
|
127
|
+
|
|
116
128
|
const derived = true,
|
|
117
129
|
assignments = [],
|
|
118
|
-
unqualifiedStatementNode = childNode
|
|
119
|
-
|
|
130
|
+
unqualifiedStatementNode = childNode; ///
|
|
131
|
+
|
|
132
|
+
unqualifiedStatementVerified = verifyUnqualifiedStatement(unqualifiedStatementNode, assignments, derived, localContext);
|
|
133
|
+
|
|
134
|
+
if (unqualifiedStatementVerified) {
|
|
135
|
+
unqualifiedStatementVerified = assignments.every((assignment) => { ///
|
|
136
|
+
const assigned = assignment.assign(localContext);
|
|
137
|
+
|
|
138
|
+
if (assigned) {
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
}
|
|
120
143
|
|
|
121
144
|
if (unqualifiedStatementVerified) {
|
|
122
145
|
const statementNode = statementNodeQuery(unqualifiedStatementNode),
|
package/src/verify/equality.js
CHANGED
|
@@ -19,7 +19,7 @@ export default function verifyEquality(equalityNode, assignments, derived, conte
|
|
|
19
19
|
|
|
20
20
|
const verifyEqualityFunctions = [
|
|
21
21
|
verifyDerivedEquality,
|
|
22
|
-
|
|
22
|
+
verifyGivenEquality
|
|
23
23
|
];
|
|
24
24
|
|
|
25
25
|
equalityVerified = verifyEqualityFunctions.some((verifyEqualityFunction) => {
|
|
@@ -59,13 +59,22 @@ function verifyDerivedEquality(equalityNode, assignments, derived, context, veri
|
|
|
59
59
|
secondTerm = second(terms),
|
|
60
60
|
leftTerm = firstTerm, ///
|
|
61
61
|
rightTerm = secondTerm, ///
|
|
62
|
-
equality = Equality.
|
|
62
|
+
equality = Equality.fromLeftTermRightTermAndEqualityNode(leftTerm, rightTerm, equalityNode);
|
|
63
63
|
|
|
64
64
|
if (equality !== null) {
|
|
65
|
-
const equalityEqual =
|
|
65
|
+
const equalityEqual = equality.isEqual(context);
|
|
66
66
|
|
|
67
67
|
if (equalityEqual) {
|
|
68
|
+
const equalityAssignment = EqualityAssignment.fromEquality(equality),
|
|
69
|
+
assignment = equalityAssignment; ///
|
|
70
|
+
|
|
71
|
+
assignments.push(assignment);
|
|
72
|
+
|
|
68
73
|
verifiedAhead = verifyAhead();
|
|
74
|
+
|
|
75
|
+
if (!verifiedAhead) {
|
|
76
|
+
assignments.pop();
|
|
77
|
+
}
|
|
69
78
|
}
|
|
70
79
|
}
|
|
71
80
|
|
|
@@ -82,13 +91,13 @@ function verifyDerivedEquality(equalityNode, assignments, derived, context, veri
|
|
|
82
91
|
return derivedEqualityVerified;
|
|
83
92
|
}
|
|
84
93
|
|
|
85
|
-
function
|
|
86
|
-
let
|
|
94
|
+
function verifyGivenEquality(equalityNode, assignments, derived, context, verifyAhead) {
|
|
95
|
+
let givenEqualityVerified = false;
|
|
87
96
|
|
|
88
97
|
if (!derived) {
|
|
89
98
|
const equalityString = context.nodeAsString(equalityNode);
|
|
90
99
|
|
|
91
|
-
context.trace(`Verifying the '${equalityString}'
|
|
100
|
+
context.trace(`Verifying the '${equalityString}' given equality...`, equalityNode);
|
|
92
101
|
|
|
93
102
|
const terms = [],
|
|
94
103
|
leftTermNode = leftTermNodeQuery(equalityNode),
|
|
@@ -104,7 +113,7 @@ function verifyStandaloneEquality(equalityNode, assignments, derived, context, v
|
|
|
104
113
|
secondTerm = second(terms),
|
|
105
114
|
leftTerm = firstTerm, ///
|
|
106
115
|
rightTerm = secondTerm, ///
|
|
107
|
-
equality = Equality.
|
|
116
|
+
equality = Equality.fromLeftTermRightTermAndEqualityNode(leftTerm, rightTerm, equalityNode);
|
|
108
117
|
|
|
109
118
|
if (equality !== null) {
|
|
110
119
|
const equalityAssignment = EqualityAssignment.fromEquality(equality),
|
|
@@ -122,12 +131,12 @@ function verifyStandaloneEquality(equalityNode, assignments, derived, context, v
|
|
|
122
131
|
return verifiedAhead;
|
|
123
132
|
});
|
|
124
133
|
|
|
125
|
-
|
|
134
|
+
givenEqualityVerified = termsVerified; ///
|
|
126
135
|
|
|
127
|
-
if (
|
|
128
|
-
context.trace(`...verified the '${equalityString}'
|
|
136
|
+
if (givenEqualityVerified) {
|
|
137
|
+
context.trace(`...verified the '${equalityString}' given equality.`, equalityNode);
|
|
129
138
|
}
|
|
130
139
|
}
|
|
131
140
|
|
|
132
|
-
return
|
|
141
|
+
return givenEqualityVerified;
|
|
133
142
|
}
|
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import { typeNameFromTypeNode } from "../utilities/query";
|
|
4
4
|
|
|
5
|
-
export default function
|
|
6
|
-
let
|
|
5
|
+
export default function verifyGivenType(typeNode, types, context, verifyAhead) {
|
|
6
|
+
let givenTypeVerified = false;
|
|
7
7
|
|
|
8
8
|
const typeString = context.nodeAsString(typeNode);
|
|
9
9
|
|
|
10
|
-
context.trace(`Verifying the
|
|
10
|
+
context.trace(`Verifying the given '${typeString}' type...`, typeNode);
|
|
11
11
|
|
|
12
12
|
const typeName = typeNameFromTypeNode(typeNode),
|
|
13
13
|
type = context.findTypeByTypeName(typeName);
|
|
@@ -23,12 +23,12 @@ export default function verifyStandaloneType(typeNode, types, context, verifyAhe
|
|
|
23
23
|
types.pop();
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
givenTypeVerified = verifiedAhead; ///
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
if (
|
|
30
|
-
context.debug(`...verified the
|
|
29
|
+
if (givenTypeVerified) {
|
|
30
|
+
context.debug(`...verified the given '${typeString}' type.`, typeNode);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
-
return
|
|
33
|
+
return givenTypeVerified;
|
|
34
34
|
}
|
package/src/verify/lemma.js
CHANGED
|
@@ -4,8 +4,8 @@ import Lemma from "../lemma";
|
|
|
4
4
|
import verifyProof from "../verify/proof";
|
|
5
5
|
import LocalContext from "../context/local";
|
|
6
6
|
import verifyLabels from "../verify/labels";
|
|
7
|
-
import verifyConsequent from "
|
|
8
|
-
import
|
|
7
|
+
import verifyConsequent from "../verify/consequent";
|
|
8
|
+
import verifySuppositions from "../verify/suppositions";
|
|
9
9
|
|
|
10
10
|
import { first } from "../utilities/array";
|
|
11
11
|
import { EMPTY_STRING } from "../constants";
|
|
@@ -33,13 +33,7 @@ export default function verifyLemma(lemmaNode, fileContext) {
|
|
|
33
33
|
if (labelsVerified) {
|
|
34
34
|
const suppositions = [],
|
|
35
35
|
suppositionNodes = suppositionsNodeQuery(lemmaNode),
|
|
36
|
-
suppositionsVerified = suppositionNodes
|
|
37
|
-
const suppositionVerified = verifySupposition(suppositionNode, suppositions, localContext);
|
|
38
|
-
|
|
39
|
-
if (suppositionVerified) {
|
|
40
|
-
return true;
|
|
41
|
-
}
|
|
42
|
-
});
|
|
36
|
+
suppositionsVerified = verifySuppositions(suppositionNodes, suppositions, localContext);
|
|
43
37
|
|
|
44
38
|
if (suppositionsVerified) {
|
|
45
39
|
const consequents = [],
|
|
@@ -28,8 +28,8 @@ function verifyMetastatement(metastatementNode, derived, localMetaContext) {
|
|
|
28
28
|
return metastatementVerified;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
Object.assign(
|
|
32
|
-
|
|
31
|
+
Object.assign(metastatementNodeVerifier, {
|
|
32
|
+
verifyMetastatement
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
export default verifyMetastatement;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import verifyPremise from "../verify/premise";
|
|
4
|
+
|
|
5
|
+
export default function verifyPremises(premiseNodes, premises, localMetaContext) {
|
|
6
|
+
let premisesVerified;
|
|
7
|
+
|
|
8
|
+
premisesVerified = premiseNodes.every((premiseNode) => {
|
|
9
|
+
const premiseVerified = verifyPremise(premiseNode, premises, localMetaContext);
|
|
10
|
+
|
|
11
|
+
if (premiseVerified) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
return premisesVerified;
|
|
17
|
+
}
|
package/src/verify/rule.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import Rule from "../rule";
|
|
4
4
|
import verifyLabels from "../verify/labels";
|
|
5
|
-
import
|
|
5
|
+
import verifyPremises from "../verify/premises";
|
|
6
6
|
import verifyRuleProof from "../verify/ruleProof";
|
|
7
7
|
import LocalMetaContext from "../context/localMeta";
|
|
8
8
|
import verifyConclusion from "../verify/conclusion";
|
|
@@ -30,13 +30,7 @@ export default function verifyRule(ruleNode, fileContext) {
|
|
|
30
30
|
if (labelsVerified) {
|
|
31
31
|
const premises = [],
|
|
32
32
|
premiseNodes = premisesNodeQuery(ruleNode),
|
|
33
|
-
premisesVerified = premiseNodes
|
|
34
|
-
const premiseVerified = verifyPremise(premiseNode, premises, localMetaContext);
|
|
35
|
-
|
|
36
|
-
if (premiseVerified) {
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
});
|
|
33
|
+
premisesVerified = verifyPremises(premiseNodes, premises, localMetaContext);
|
|
40
34
|
|
|
41
35
|
if (premisesVerified) {
|
|
42
36
|
const conclusions = [],
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import MetaproofStep from "../step/metaproof";
|
|
4
|
-
import
|
|
4
|
+
import verifyPremises from "../verify/premises";
|
|
5
5
|
import LocalMetaContext from "../context/localMeta";
|
|
6
6
|
import verifyQualifiedMetastatement from "../verify/metastatement/qualified";
|
|
7
7
|
import verifyUnqualifiedMetastatement from "../verify/metastatement/unqualified";
|
|
@@ -53,13 +53,11 @@ function verifyRuleSubproof(ruleSubproofNode, localMetaContext) {
|
|
|
53
53
|
|
|
54
54
|
const premises = [],
|
|
55
55
|
premiseNodes = premiseNodesQuery(ruleSubproofNode),
|
|
56
|
-
premisesVerified = premiseNodes
|
|
57
|
-
const premiseVerified = verifyPremise(premiseNode, premises, localMetaContext);
|
|
56
|
+
premisesVerified = verifyPremises(premiseNodes, premises, localMetaContext);
|
|
58
57
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
});
|
|
58
|
+
if (premiseVerified) {
|
|
59
|
+
return true;
|
|
60
|
+
}
|
|
63
61
|
|
|
64
62
|
if (premisesVerified) {
|
|
65
63
|
const ruleSubDerivationNode = ruleSubDerivationNodeQuery(ruleSubproofNode),
|