occam-verify-cli 0.0.1002 → 0.0.1005
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/README.md +0 -2
- package/bin/abbreviations.js +1 -3
- package/bin/action/help.js +0 -2
- package/bin/action/verify.js +4 -24
- package/bin/defaults.js +0 -2
- package/bin/main.js +3 -4
- package/bin/options.js +0 -2
- package/lib/assertion/subproof.js +106 -0
- package/lib/assignment/metavariable.js +2 -2
- package/lib/combinator.js +50 -16
- package/lib/conclusion.js +73 -14
- package/lib/context/file.js +191 -31
- package/lib/context/local.js +37 -49
- package/lib/context/release.js +42 -35
- package/lib/context/release.other.js +605 -0
- package/lib/declaration/combinator.js +83 -0
- package/lib/derivation.js +86 -0
- package/lib/equality.js +3 -11
- package/lib/index.js +1 -1
- package/lib/judgement.js +3 -10
- package/lib/label.js +58 -16
- package/lib/log.js +3 -11
- package/lib/metaType.js +31 -19
- package/lib/metavariable.js +39 -12
- package/lib/mixins/statement/qualified/unify.js +118 -0
- package/lib/mixins/statement/unify.js +57 -0
- package/lib/mixins/statement/verify.js +184 -0
- package/lib/node/statement/combinator/bracketed.js +15 -11
- package/lib/ocmbinator/bracketed.js +52 -8
- package/lib/premise.js +109 -56
- package/lib/proof.js +91 -0
- package/lib/proofStep.js +78 -25
- package/lib/reference.js +62 -16
- package/lib/rule.js +146 -26
- package/lib/ruleNames.js +5 -5
- package/lib/statement/qualified.js +127 -0
- package/lib/statement/unqualified.js +89 -0
- package/lib/statement.js +176 -0
- package/lib/subDerivation.js +86 -0
- package/lib/subproof.js +155 -0
- package/lib/substitution/frameForMetavariable.js +14 -15
- package/lib/substitution/statementForMetavariable.js +23 -24
- package/lib/substitution/termForVariable.js +11 -12
- package/lib/substitution.js +9 -2
- package/lib/substitutions.js +14 -14
- package/lib/supposition.js +92 -60
- package/lib/unifier/statementWithCombinator.js +3 -3
- package/lib/unify/metavariableWithFrame.js +2 -2
- package/lib/unify/metavariableWithStatement.js +2 -2
- package/lib/unify/metavariableWithStatementGivenSubstitution.js +2 -2
- package/lib/unify/variableWithTerm.js +2 -2
- package/lib/utilities/node.js +13 -11
- package/lib/utilities/releaseContext.js +3 -3
- package/lib/utilities/string.js +8 -2
- package/lib/utilities/subproof.js +5 -5
- package/lib/utilities/tokens.js +10 -10
- package/lib/variable.js +1 -10
- package/lib/verifier/metaLevel.js +2 -2
- package/lib/verifier/topLevel.js +5 -5
- package/lib/verify/axiom.js +3 -5
- package/lib/verify/conjecture.js +4 -7
- package/lib/verify/consequent.js +2 -3
- package/lib/verify/declaration/combinator.js +2 -14
- package/lib/verify/declaration/metavariable.js +9 -10
- package/lib/verify/files.js +4 -4
- package/lib/verify/frame.js +12 -12
- package/lib/verify/lemma.js +4 -7
- package/lib/verify/metaLemma.js +4 -7
- package/lib/verify/metatheorem.js +4 -7
- package/lib/verify/proofStep.js +2 -31
- package/lib/verify/theorem.js +4 -7
- package/package.json +4 -4
- package/src/assertion/subproof.js +84 -0
- package/src/assignment/metavariable.js +2 -2
- package/src/combinator.js +45 -15
- package/src/conclusion.js +83 -13
- package/src/context/file.js +223 -11
- package/src/context/local.js +12 -16
- package/src/context/release.js +57 -39
- package/src/context/release.other.js +547 -0
- package/src/declaration/combinator.js +44 -0
- package/src/derivation.js +50 -0
- package/src/equality.js +2 -9
- package/src/index.js +0 -1
- package/src/judgement.js +2 -8
- package/src/label.js +56 -13
- package/src/log.js +2 -9
- package/src/metaType.js +26 -14
- package/src/metavariable.js +57 -9
- package/src/mixins/statement/qualified/unify.js +186 -0
- package/src/mixins/statement/unify.js +70 -0
- package/src/mixins/statement/verify.js +274 -0
- package/src/node/statement/combinator/bracketed.js +4 -3
- package/src/ocmbinator/bracketed.js +15 -12
- package/src/premise.js +136 -44
- package/src/proof.js +58 -0
- package/src/proofStep.js +92 -22
- package/src/reference.js +58 -12
- package/src/rule.js +199 -30
- package/src/ruleNames.js +1 -1
- package/src/statement/qualified.js +104 -0
- package/src/statement/unqualified.js +60 -0
- package/src/statement.js +179 -0
- package/src/subDerivation.js +52 -0
- package/src/subproof.js +99 -0
- package/src/substitution/frameForMetavariable.js +20 -17
- package/src/substitution/statementForMetavariable.js +31 -29
- package/src/substitution/termForVariable.js +15 -14
- package/src/substitution.js +8 -0
- package/src/substitutions.js +12 -13
- package/src/supposition.js +94 -44
- package/src/unifier/statementWithCombinator.js +6 -3
- package/src/unify/metavariableWithFrame.js +1 -1
- package/src/unify/metavariableWithStatement.js +1 -1
- package/src/unify/metavariableWithStatementGivenSubstitution.js +1 -1
- package/src/unify/variableWithTerm.js +1 -1
- package/src/utilities/node.js +18 -12
- package/src/utilities/releaseContext.js +2 -2
- package/src/utilities/string.js +6 -2
- package/src/utilities/subproof.js +2 -2
- package/src/utilities/tokens.js +7 -7
- package/src/variable.js +0 -10
- package/src/verifier/metaLevel.js +3 -2
- package/src/verifier/topLevel.js +6 -4
- package/src/verify/axiom.js +1 -2
- package/src/verify/conjecture.js +2 -3
- package/src/verify/consequent.js +1 -1
- package/src/verify/declaration/combinator.js +0 -20
- package/src/verify/declaration/metavariable.js +8 -12
- package/src/verify/files.js +3 -3
- package/src/verify/frame.js +11 -11
- package/src/verify/lemma.js +2 -3
- package/src/verify/metaLemma.js +2 -3
- package/src/verify/metatheorem.js +2 -3
- package/src/verify/proofStep.js +0 -41
- package/src/verify/theorem.js +2 -3
- package/lib/tokens/combinatorStatement/bracketed.js +0 -17
- package/lib/unify/premiseWithProofStep.js +0 -41
- package/lib/unify/premisesWithProofSteps.js +0 -31
- package/lib/unify/qualifiedStatement.js +0 -136
- package/lib/unify/statementWithBracketedCombinator.js +0 -30
- package/lib/unify/statementWithCombinator.js +0 -29
- package/lib/unify/statementWithCombinators.js +0 -31
- package/lib/unify/statementWithMetaType.js +0 -24
- package/lib/verify/conclusion.js +0 -39
- package/lib/verify/derivation.js +0 -31
- package/lib/verify/label.js +0 -37
- package/lib/verify/labels.js +0 -28
- package/lib/verify/premise.js +0 -45
- package/lib/verify/premises.js +0 -28
- package/lib/verify/proof.js +0 -34
- package/lib/verify/rule.js +0 -56
- package/lib/verify/statement/qualified.js +0 -41
- package/lib/verify/statement/unqualified.js +0 -45
- package/lib/verify/statement.js +0 -219
- package/lib/verify/statementAsCombinator.js +0 -33
- package/lib/verify/statementGivenMetaType.js +0 -52
- package/lib/verify/subproof.js +0 -34
- package/lib/verify/supposition.js +0 -45
- package/lib/verify/suppositions.js +0 -28
- package/src/tokens/combinatorStatement/bracketed.js +0 -10
- package/src/unify/premiseWithProofStep.js +0 -54
- package/src/unify/premisesWithProofSteps.js +0 -23
- package/src/unify/qualifiedStatement.js +0 -208
- package/src/unify/statementWithBracketedCombinator.js +0 -22
- package/src/unify/statementWithCombinator.js +0 -22
- package/src/unify/statementWithCombinators.js +0 -23
- package/src/unify/statementWithMetaType.js +0 -14
- package/src/verify/conclusion.js +0 -40
- package/src/verify/derivation.js +0 -23
- package/src/verify/label.js +0 -34
- package/src/verify/labels.js +0 -17
- package/src/verify/premise.js +0 -49
- package/src/verify/premises.js +0 -17
- package/src/verify/proof.js +0 -31
- package/src/verify/rule.js +0 -71
- package/src/verify/statement/qualified.js +0 -40
- package/src/verify/statement/unqualified.js +0 -49
- package/src/verify/statement.js +0 -312
- package/src/verify/statementAsCombinator.js +0 -27
- package/src/verify/statementGivenMetaType.js +0 -52
- package/src/verify/subproof.js +0 -32
- package/src/verify/supposition.js +0 -49
- package/src/verify/suppositions.js +0 -17
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import metavariableUnifier from "../unifier/metavariable";
|
|
4
|
-
import StatementForMetavariableSubstitution from "../substitution/statementForMetavariable";
|
|
5
|
-
|
|
6
|
-
import { nodeQuery } from "../utilities/query";
|
|
7
|
-
import { metavariableNameFromMetavariableNode } from "../utilities/name";
|
|
8
|
-
|
|
9
|
-
const statementNodeQuery = nodeQuery("/qualifiedStatement/statement!"),
|
|
10
|
-
metavariableNodeQuery = nodeQuery("/qualifiedStatement/reference/metavariable!");
|
|
11
|
-
|
|
12
|
-
const unifyQualifiedStatementFunctions = [
|
|
13
|
-
unifyQualifiedStatementAWithRule,
|
|
14
|
-
unifyQualifiedStatementAWithAxiom,
|
|
15
|
-
unifyQualifiedStatementAWithLemma,
|
|
16
|
-
unifyQualifiedStatementAWithTheorem,
|
|
17
|
-
unifyQualifiedStatementAWithConjecture,
|
|
18
|
-
unifyQualifiedStatementAWithReference
|
|
19
|
-
];
|
|
20
|
-
|
|
21
|
-
export default function unifyQualifiedStatement(qualifiedStatementNode, substitutions, localContext) {
|
|
22
|
-
let qualifiedStatementUnified;
|
|
23
|
-
|
|
24
|
-
const qualifiedStatementString = localContext.nodeAsString(qualifiedStatementNode);
|
|
25
|
-
|
|
26
|
-
localContext.trace(`Unifying the '${qualifiedStatementString}' qualified statement...`, qualifiedStatementNode);
|
|
27
|
-
|
|
28
|
-
qualifiedStatementUnified = unifyQualifiedStatementFunctions.some((unifyQualifiedStatementFunction) => {
|
|
29
|
-
const qualifiedStatementUnified = unifyQualifiedStatementFunction(qualifiedStatementNode, substitutions, localContext);
|
|
30
|
-
|
|
31
|
-
return qualifiedStatementUnified;
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
if (qualifiedStatementUnified) {
|
|
35
|
-
localContext.debug(`...unified the '${qualifiedStatementString}' qualified statement.`, qualifiedStatementNode);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return qualifiedStatementUnified;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
function unifyQualifiedStatementAWithRule(qualifiedStatementNode, substitutions, localContext) {
|
|
42
|
-
let qualifiedStatementUnifiedWithRule = false;
|
|
43
|
-
|
|
44
|
-
const metavariableNode = metavariableNodeQuery(qualifiedStatementNode),
|
|
45
|
-
rule = localContext.findRuleByMetavariableNode(metavariableNode);
|
|
46
|
-
|
|
47
|
-
if (rule !== null) {
|
|
48
|
-
const statementNode = statementNodeQuery(qualifiedStatementNode),
|
|
49
|
-
metavariableString = localContext.nodeAsString(metavariableNode),
|
|
50
|
-
qualifiedStatementString = localContext.nodeAsString(qualifiedStatementNode);
|
|
51
|
-
|
|
52
|
-
localContext.trace(`Unifying the '${qualifiedStatementString}' qualified statement with the '${metavariableString}' rule...`, qualifiedStatementNode);
|
|
53
|
-
|
|
54
|
-
const statementUnified = rule.unifyStatement(statementNode, localContext);
|
|
55
|
-
|
|
56
|
-
qualifiedStatementUnifiedWithRule = statementUnified; ///
|
|
57
|
-
|
|
58
|
-
if (qualifiedStatementUnifiedWithRule) {
|
|
59
|
-
localContext.debug(`...unified the '${qualifiedStatementString}' qualified statement with the '${metavariableString}' rule.`, qualifiedStatementNode);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return qualifiedStatementUnifiedWithRule;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function unifyQualifiedStatementAWithAxiom(qualifiedStatementNode, substitutions, localContext) {
|
|
67
|
-
let qualifiedStatementUnifiedWithAxiom = false;
|
|
68
|
-
|
|
69
|
-
const metavariableNode = metavariableNodeQuery(qualifiedStatementNode),
|
|
70
|
-
axiom = localContext.findAxiomByMetavariableNode(metavariableNode);
|
|
71
|
-
|
|
72
|
-
if (axiom !== null) {
|
|
73
|
-
const statementNode = statementNodeQuery(qualifiedStatementNode),
|
|
74
|
-
metavariableString = localContext.nodeAsString(metavariableNode),
|
|
75
|
-
qualifiedStatementString = localContext.nodeAsString(qualifiedStatementNode);
|
|
76
|
-
|
|
77
|
-
localContext.trace(`Unifying the '${qualifiedStatementString}' qualified statement with the '${metavariableString}' axiom...`, qualifiedStatementNode);
|
|
78
|
-
|
|
79
|
-
const statementUnified = axiom.unifyStatement(statementNode, localContext);
|
|
80
|
-
|
|
81
|
-
qualifiedStatementUnifiedWithAxiom = statementUnified; ///
|
|
82
|
-
|
|
83
|
-
if (qualifiedStatementUnifiedWithAxiom) {
|
|
84
|
-
localContext.debug(`...unified the '${qualifiedStatementString}' qualified statement with the '${metavariableString}' axiom.`, qualifiedStatementNode);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return qualifiedStatementUnifiedWithAxiom;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function unifyQualifiedStatementAWithLemma(qualifiedStatementNode, substitutions, localContext) {
|
|
92
|
-
let qualifiedStatementUnifiedWithLemma = false;
|
|
93
|
-
|
|
94
|
-
const metavariableNode = metavariableNodeQuery(qualifiedStatementNode),
|
|
95
|
-
lemma = localContext.findLemmaByMetavariableNode(metavariableNode);
|
|
96
|
-
|
|
97
|
-
if (lemma !== null) {
|
|
98
|
-
const statementNode = statementNodeQuery(qualifiedStatementNode),
|
|
99
|
-
metavariableString = localContext.nodeAsString(metavariableNode),
|
|
100
|
-
qualifiedStatementString = localContext.nodeAsString(qualifiedStatementNode);
|
|
101
|
-
|
|
102
|
-
localContext.trace(`Unifying the '${qualifiedStatementString}' qualified statement with the '${metavariableString}' lemma...`, qualifiedStatementNode);
|
|
103
|
-
|
|
104
|
-
const statementUnified = lemma.unifyStatement(statementNode, localContext);
|
|
105
|
-
|
|
106
|
-
qualifiedStatementUnifiedWithLemma = statementUnified; ///
|
|
107
|
-
|
|
108
|
-
if (qualifiedStatementUnifiedWithLemma) {
|
|
109
|
-
localContext.debug(`...unified the '${qualifiedStatementString}' qualified statement with the '${metavariableString}' lemma.`, qualifiedStatementNode);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
return qualifiedStatementUnifiedWithLemma;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
function unifyQualifiedStatementAWithTheorem(qualifiedStatementNode, substitutions, localContext) {
|
|
117
|
-
let qualifiedStatementUnifiedWithTheorem = false;
|
|
118
|
-
|
|
119
|
-
const metavariableNode = metavariableNodeQuery(qualifiedStatementNode),
|
|
120
|
-
theorem = localContext.findTheoremByMetavariableNode(metavariableNode);
|
|
121
|
-
|
|
122
|
-
if (theorem !== null) {
|
|
123
|
-
const statementNode = statementNodeQuery(qualifiedStatementNode),
|
|
124
|
-
metavariableString = localContext.nodeAsString(metavariableNode),
|
|
125
|
-
qualifiedStatementString = localContext.nodeAsString(qualifiedStatementNode);
|
|
126
|
-
|
|
127
|
-
localContext.trace(`Unifying the '${qualifiedStatementString}' qualified statement with the '${metavariableString}' theorem...`, qualifiedStatementNode);
|
|
128
|
-
|
|
129
|
-
const statementUnified = theorem.unifyStatement(statementNode, localContext);
|
|
130
|
-
|
|
131
|
-
qualifiedStatementUnifiedWithTheorem = statementUnified; ///
|
|
132
|
-
|
|
133
|
-
if (qualifiedStatementUnifiedWithTheorem) {
|
|
134
|
-
localContext.debug(`...unified the '${qualifiedStatementString}' qualified statement with the '${metavariableString}' theorem.`, qualifiedStatementNode);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
return qualifiedStatementUnifiedWithTheorem;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
function unifyQualifiedStatementAWithConjecture(qualifiedStatementNode, substitutions, localContext) {
|
|
142
|
-
let qualifiedStatementUnifiedWithConjecture = false;
|
|
143
|
-
|
|
144
|
-
const metavariableNode = metavariableNodeQuery(qualifiedStatementNode),
|
|
145
|
-
conjecture = localContext.findConjectureByMetavariableNode(metavariableNode);
|
|
146
|
-
|
|
147
|
-
if (conjecture !== null) {
|
|
148
|
-
const statementNode = statementNodeQuery(qualifiedStatementNode),
|
|
149
|
-
metavariableString = localContext.nodeAsString(metavariableNode),
|
|
150
|
-
qualifiedStatementString = localContext.nodeAsString(qualifiedStatementNode);
|
|
151
|
-
|
|
152
|
-
localContext.trace(`Unifying the '${qualifiedStatementString}' qualified statement with the '${metavariableString}' conjecture...`, qualifiedStatementNode);
|
|
153
|
-
|
|
154
|
-
const statementUnified = conjecture.unifyStatement(statementNode, localContext);
|
|
155
|
-
|
|
156
|
-
qualifiedStatementUnifiedWithConjecture = statementUnified; ///
|
|
157
|
-
|
|
158
|
-
if (qualifiedStatementUnifiedWithConjecture) {
|
|
159
|
-
localContext.debug(`...unified the '${qualifiedStatementString}' qualified statement with the '${metavariableString}' conjecture.`, qualifiedStatementNode);
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
return qualifiedStatementUnifiedWithConjecture;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
function unifyQualifiedStatementAWithReference(qualifiedStatementNode, substitutions, localContext) {
|
|
167
|
-
let qualifiedStatementUnifiedWithReference = false;
|
|
168
|
-
|
|
169
|
-
let metavariableNode = metavariableNodeQuery(qualifiedStatementNode);
|
|
170
|
-
|
|
171
|
-
const metavariableName = metavariableNameFromMetavariableNode(metavariableNode),
|
|
172
|
-
metavariable = localContext.findMetavariableByMetavariableName(metavariableName);
|
|
173
|
-
|
|
174
|
-
if (metavariable !== null) {
|
|
175
|
-
const statementNode = statementNodeQuery(qualifiedStatementNode),
|
|
176
|
-
statementString = localContext.nodeAsString(statementNode),
|
|
177
|
-
metavariableString = localContext.nodeAsString(metavariableNode);
|
|
178
|
-
|
|
179
|
-
localContext.trace(`Unifying the '${statementString}' qualified statement with the '${metavariableString}' reference...`, qualifiedStatementNode);
|
|
180
|
-
|
|
181
|
-
const metavariableNodeA = metavariableNode; ///
|
|
182
|
-
|
|
183
|
-
metavariableNode = metavariable.getNode();
|
|
184
|
-
|
|
185
|
-
const metavariableNodeB = metavariableNode; ///
|
|
186
|
-
|
|
187
|
-
const unified = metavariableUnifier.unify(metavariableNodeA, metavariableNodeB, localContext);
|
|
188
|
-
|
|
189
|
-
if (unified) {
|
|
190
|
-
metavariableNode = metavariableNodeA; ///
|
|
191
|
-
|
|
192
|
-
const statementForMetavariableSubstitution = StatementForMetavariableSubstitution.fromStatementNodeAndMetavariableNode(statementNode, metavariableNode),
|
|
193
|
-
substitution = statementForMetavariableSubstitution, ///
|
|
194
|
-
localContextA = localContext, ///
|
|
195
|
-
localContextB = localContext; ///
|
|
196
|
-
|
|
197
|
-
substitutions.addSubstitution(substitution, localContextA, localContextB);
|
|
198
|
-
|
|
199
|
-
qualifiedStatementUnifiedWithReference = true;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
if (qualifiedStatementUnifiedWithReference) {
|
|
203
|
-
localContext.debug(`...unified the '${statementString}' qualified statement with the '${metavariableString}' reference.`, qualifiedStatementNode);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
return qualifiedStatementUnifiedWithReference;
|
|
208
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import bracketedCombinator from "../ocmbinator/bracketed";
|
|
4
|
-
import statementWithCombinatorUnifier from "../unifier/statementWithCombinator";
|
|
5
|
-
|
|
6
|
-
export default function unifyStatementWithBracketedCombinator(statementNode, assignments, stated, localContext) {
|
|
7
|
-
let statementUnifiedWithBracketedCombinator;
|
|
8
|
-
|
|
9
|
-
const statementString = localContext.nodeAsString(statementNode);
|
|
10
|
-
|
|
11
|
-
localContext.trace(`Unifying the '${statementString}' statement with the bracketed combinator...`, statementNode);
|
|
12
|
-
|
|
13
|
-
const bracketedCombinatorStatementNode = bracketedCombinator.getStatementNode();
|
|
14
|
-
|
|
15
|
-
statementUnifiedWithBracketedCombinator = statementWithCombinatorUnifier.unify(statementNode, bracketedCombinatorStatementNode, assignments, stated, localContext);
|
|
16
|
-
|
|
17
|
-
if (statementUnifiedWithBracketedCombinator) {
|
|
18
|
-
localContext.debug(`...unified the '${statementString}' statement with the bracketed combinator.`, statementNode);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return statementUnifiedWithBracketedCombinator;
|
|
22
|
-
}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import statementWithCombinatorUnifier from "../unifier/statementWithCombinator";
|
|
4
|
-
|
|
5
|
-
export default function unifyStatementWithCombinator(statementNode, combinator, assignments, stated, localContext) {
|
|
6
|
-
let statementUnifiedWithCombinator;
|
|
7
|
-
|
|
8
|
-
const statementString = localContext.nodeAsString(statementNode),
|
|
9
|
-
combinatorString = combinator.getString();
|
|
10
|
-
|
|
11
|
-
localContext.trace(`Unifying the '${statementString}' statement with the '${combinatorString}' combinator...`, statementNode);
|
|
12
|
-
|
|
13
|
-
const combinatorStatementNode = combinator.getStatementNode();
|
|
14
|
-
|
|
15
|
-
statementUnifiedWithCombinator = statementWithCombinatorUnifier.unify(statementNode, combinatorStatementNode, assignments, stated, localContext);
|
|
16
|
-
|
|
17
|
-
if (statementUnifiedWithCombinator) {
|
|
18
|
-
localContext.debug(`...unified the '${statementString}' statement with the '${combinatorString}' combinator.`, statementNode);
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return statementUnifiedWithCombinator;
|
|
22
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import unifyStatementWithCombinator from "../unify/statementWithCombinator";
|
|
4
|
-
|
|
5
|
-
export default function unifyStatementWithCombinators(statementNode, assignments, stated, localContext) {
|
|
6
|
-
let statementUnifiedWithCombinators;
|
|
7
|
-
|
|
8
|
-
const combinators = localContext.getCombinators();
|
|
9
|
-
|
|
10
|
-
assignments = null; ///
|
|
11
|
-
|
|
12
|
-
stated = true; ///
|
|
13
|
-
|
|
14
|
-
statementUnifiedWithCombinators = combinators.some((combinator) => {
|
|
15
|
-
const statementUnifiedWithCombinator = unifyStatementWithCombinator(statementNode, combinator, assignments, stated, localContext);
|
|
16
|
-
|
|
17
|
-
if (statementUnifiedWithCombinator) {
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
return statementUnifiedWithCombinators;
|
|
23
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import verifyStatementGivenMetaType from "../verify/statementGivenMetaType";
|
|
4
|
-
|
|
5
|
-
export default function unifyStatementWithMetaType(statementNode, metaTypeNode, assignments, stated, localContext) {
|
|
6
|
-
let statementUnifiedWithMetaType;
|
|
7
|
-
|
|
8
|
-
const metaType = localContext.findMetaTypeByMetaTypeNode(metaTypeNode),
|
|
9
|
-
statementVerifiedGivenMetaType = verifyStatementGivenMetaType(statementNode, metaType, assignments, stated, localContext);
|
|
10
|
-
|
|
11
|
-
statementUnifiedWithMetaType = statementVerifiedGivenMetaType; ///
|
|
12
|
-
|
|
13
|
-
return statementUnifiedWithMetaType;
|
|
14
|
-
}
|
package/src/verify/conclusion.js
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import Conclusion from "../conclusion";
|
|
4
|
-
import verifyStatement from "../verify/statement";
|
|
5
|
-
|
|
6
|
-
import { nodeQuery } from "../utilities/query";
|
|
7
|
-
|
|
8
|
-
const statementNodeQuery = nodeQuery("/unqualifiedStatement/statement!"),
|
|
9
|
-
unqualifiedStatementNodeQuery = nodeQuery("/conclusion/unqualifiedStatement!");
|
|
10
|
-
|
|
11
|
-
export default function verifyConclusion(conclusionNode, conclusions, localContext) {
|
|
12
|
-
let conclusionVerified = false;
|
|
13
|
-
|
|
14
|
-
const conclusionString = localContext.nodeAsString(conclusionNode);
|
|
15
|
-
|
|
16
|
-
localContext.trace(`Verifying the '${conclusionString}' conclusion...`, conclusionNode);
|
|
17
|
-
|
|
18
|
-
const unqualifiedStatementNode = unqualifiedStatementNodeQuery(conclusionNode);
|
|
19
|
-
|
|
20
|
-
if (unqualifiedStatementNode !== null) {
|
|
21
|
-
const stated = true,
|
|
22
|
-
assignments = null,
|
|
23
|
-
statementNode = statementNodeQuery(unqualifiedStatementNode),
|
|
24
|
-
statementVerified = verifyStatement(statementNode, assignments, stated, localContext);
|
|
25
|
-
|
|
26
|
-
if (statementVerified) {
|
|
27
|
-
const conclusion = Conclusion.fromStatementNode(statementNode);
|
|
28
|
-
|
|
29
|
-
conclusions.push(conclusion);
|
|
30
|
-
|
|
31
|
-
conclusionVerified = true;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (conclusionVerified) {
|
|
36
|
-
localContext.debug(`...verified the '${conclusionString}' conclusion.`, conclusionNode);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return conclusionVerified;
|
|
40
|
-
}
|
package/src/verify/derivation.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import verifyProofStep from "../verify/proofStep";
|
|
4
|
-
|
|
5
|
-
import { nodesQuery } from "../utilities/query";
|
|
6
|
-
|
|
7
|
-
const proofStepNodesQuery = nodesQuery("/derivation/proofStep|lastProofStep");
|
|
8
|
-
|
|
9
|
-
export default function verifyDerivation(derivationNode, substitutions, localContext) {
|
|
10
|
-
let derivationVerified;
|
|
11
|
-
|
|
12
|
-
const proofStepNodes = proofStepNodesQuery(derivationNode);
|
|
13
|
-
|
|
14
|
-
derivationVerified = proofStepNodes.every((proofStepNode) => {
|
|
15
|
-
const proofStepVerified = verifyProofStep(proofStepNode, substitutions, localContext);
|
|
16
|
-
|
|
17
|
-
if (proofStepVerified) {
|
|
18
|
-
return true;
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
return derivationVerified;
|
|
23
|
-
}
|
package/src/verify/label.js
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import Label from "../label";
|
|
4
|
-
|
|
5
|
-
import { nodeQuery } from "../utilities/query";
|
|
6
|
-
|
|
7
|
-
const metavariableNodeQuery = nodeQuery("/label/metavariable!");
|
|
8
|
-
|
|
9
|
-
export default function verifyLabel(labelNode, labels, fileContext) {
|
|
10
|
-
let labelVerified = false;
|
|
11
|
-
|
|
12
|
-
const labelString = fileContext.nodeAsString(labelNode);
|
|
13
|
-
|
|
14
|
-
fileContext.trace(`Verifying the '${labelString}' label...`, labelNode);
|
|
15
|
-
|
|
16
|
-
const metavariableNode = metavariableNodeQuery(labelNode),
|
|
17
|
-
labelPresent = fileContext.isLabelPresentByMetavariableNode(metavariableNode);
|
|
18
|
-
|
|
19
|
-
if (labelPresent) {
|
|
20
|
-
fileContext.debug(`The '${labelString}' label is already present.`, labelNode);
|
|
21
|
-
} else {
|
|
22
|
-
const label = Label.fromMetavariableNode(metavariableNode);
|
|
23
|
-
|
|
24
|
-
labels.push(label);
|
|
25
|
-
|
|
26
|
-
labelVerified = true;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (labelVerified) {
|
|
30
|
-
fileContext.debug(`...verified the '${labelString}' label.`, labelNode);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return labelVerified;
|
|
34
|
-
}
|
package/src/verify/labels.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import verifyLabel from "../verify/label";
|
|
4
|
-
|
|
5
|
-
export default function verifyLabels(labelNodes, labels, fileContext) {
|
|
6
|
-
let labelsVerified;
|
|
7
|
-
|
|
8
|
-
labelsVerified = labelNodes.every((labelNode) => {
|
|
9
|
-
const labelVerified = verifyLabel(labelNode, labels, fileContext);
|
|
10
|
-
|
|
11
|
-
if (labelVerified) {
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
return labelsVerified;
|
|
17
|
-
}
|
package/src/verify/premise.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import Premise from "../premise";
|
|
4
|
-
import ProofStep from "../proofStep";
|
|
5
|
-
import verifyStatement from "../verify/statement";
|
|
6
|
-
|
|
7
|
-
import { nodeQuery } from "../utilities/query";
|
|
8
|
-
import { assignAssignments } from "../utilities/assignments";
|
|
9
|
-
|
|
10
|
-
const statementNodeQuery = nodeQuery("/unqualifiedStatement/statement!"),
|
|
11
|
-
unqualifiedStatementNodeQuery = nodeQuery("/premise/unqualifiedStatement!");
|
|
12
|
-
|
|
13
|
-
export default function verifyPremise(premiseNode, premises, localContext) {
|
|
14
|
-
let premiseVerified;
|
|
15
|
-
|
|
16
|
-
const premiseString = localContext.nodeAsString(premiseNode);
|
|
17
|
-
|
|
18
|
-
localContext.trace(`Verifying the '${premiseString}' premise...`, premiseNode);
|
|
19
|
-
|
|
20
|
-
const unqualifiedStatementNode = unqualifiedStatementNodeQuery(premiseNode);
|
|
21
|
-
|
|
22
|
-
if (unqualifiedStatementNode !== null) {
|
|
23
|
-
const stated = true,
|
|
24
|
-
assignments = [],
|
|
25
|
-
statementNode = statementNodeQuery(unqualifiedStatementNode),
|
|
26
|
-
statementVerified = verifyStatement(statementNode, assignments, stated, localContext);
|
|
27
|
-
|
|
28
|
-
if (statementVerified) {
|
|
29
|
-
const assignmentsAssigned = assignAssignments(assignments, localContext);
|
|
30
|
-
|
|
31
|
-
if (assignmentsAssigned) {
|
|
32
|
-
const premise = Premise.fromStatementNode(statementNode),
|
|
33
|
-
proofStep = ProofStep.fromStatementNode(statementNode);
|
|
34
|
-
|
|
35
|
-
premises.push(premise);
|
|
36
|
-
|
|
37
|
-
localContext.addProofStep(proofStep);
|
|
38
|
-
|
|
39
|
-
premiseVerified = true;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (premiseVerified) {
|
|
45
|
-
localContext.debug(`...verified the '${premiseString}' premise.`, premiseNode);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return premiseVerified;
|
|
49
|
-
}
|
package/src/verify/premises.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import verifyPremise from "../verify/premise";
|
|
4
|
-
|
|
5
|
-
export default function verifyPremises(premiseNodes, premises, localContext) {
|
|
6
|
-
let premisesVerified;
|
|
7
|
-
|
|
8
|
-
premisesVerified = premiseNodes.every((premiseNode) => {
|
|
9
|
-
const premiseVerified = verifyPremise(premiseNode, premises, localContext);
|
|
10
|
-
|
|
11
|
-
if (premiseVerified) {
|
|
12
|
-
return true;
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
return premisesVerified;
|
|
17
|
-
}
|
package/src/verify/proof.js
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import LocalContext from "../context/local";
|
|
4
|
-
import verifyDerivation from "../verify/derivation";
|
|
5
|
-
|
|
6
|
-
import { nodeQuery } from "../utilities/query";
|
|
7
|
-
|
|
8
|
-
const derivationNodeQuery = nodeQuery("/proof/derivation!");
|
|
9
|
-
|
|
10
|
-
export default function verifyProof(proofNode, statementNode, substitutions, localContext) {
|
|
11
|
-
let proofVerified = false;
|
|
12
|
-
|
|
13
|
-
localContext = LocalContext.fromLocalContext(localContext); ///
|
|
14
|
-
|
|
15
|
-
const derivationNode = derivationNodeQuery(proofNode),
|
|
16
|
-
derivationVerified = verifyDerivation(derivationNode, substitutions, localContext);
|
|
17
|
-
|
|
18
|
-
if (derivationVerified) {
|
|
19
|
-
const lastProofStep = localContext.getLastProofStep();
|
|
20
|
-
|
|
21
|
-
if (lastProofStep !== null) {
|
|
22
|
-
const lastProofStepStatementNode = lastProofStep.getStatementNode(),
|
|
23
|
-
lastStatementNode = lastProofStepStatementNode, ///
|
|
24
|
-
statementNodeMatchesLastStatementNode = statementNode.match(lastStatementNode);
|
|
25
|
-
|
|
26
|
-
proofVerified = statementNodeMatchesLastStatementNode; ///
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
return proofVerified;
|
|
31
|
-
}
|
package/src/verify/rule.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import Rule from "../rule";
|
|
4
|
-
import verifyProof from "../verify/proof";
|
|
5
|
-
import LocalContext from "../context/local";
|
|
6
|
-
import verifyLabels from "../verify/labels";
|
|
7
|
-
import verifyPremises from "../verify/premises";
|
|
8
|
-
import verifyConclusion from "../verify/conclusion";
|
|
9
|
-
|
|
10
|
-
import { first } from "../utilities/array";
|
|
11
|
-
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
12
|
-
import Substitutions from "../substitutions";
|
|
13
|
-
|
|
14
|
-
const proofNodeQuery = nodeQuery("/rule/proof!"),
|
|
15
|
-
labelNodesQuery = nodesQuery("/rule/label"),
|
|
16
|
-
premisesNodeQuery = nodesQuery("/rule/premise"),
|
|
17
|
-
conclusionNodeQuery = nodeQuery("/rule/conclusion!");
|
|
18
|
-
|
|
19
|
-
export default function verifyRule(ruleNode, fileContext) {
|
|
20
|
-
let ruleVerified = false;
|
|
21
|
-
|
|
22
|
-
const labelNodes = labelNodesQuery(ruleNode),
|
|
23
|
-
labelsString = fileContext.nodesAsString(labelNodes);
|
|
24
|
-
|
|
25
|
-
fileContext.trace(`Verifying the '${labelsString}' rule...`, ruleNode);
|
|
26
|
-
|
|
27
|
-
const labels = [],
|
|
28
|
-
labelsVerified = verifyLabels(labelNodes, labels, fileContext);
|
|
29
|
-
|
|
30
|
-
if (labelsVerified) {
|
|
31
|
-
const localContext = LocalContext.fromFileContext(fileContext),
|
|
32
|
-
premises = [],
|
|
33
|
-
premiseNodes = premisesNodeQuery(ruleNode),
|
|
34
|
-
premisesVerified = verifyPremises(premiseNodes, premises, localContext);
|
|
35
|
-
|
|
36
|
-
if (premisesVerified) {
|
|
37
|
-
const conclusions = [],
|
|
38
|
-
conclusionNode = conclusionNodeQuery(ruleNode),
|
|
39
|
-
conclusionVerified = verifyConclusion(conclusionNode, conclusions, localContext);
|
|
40
|
-
|
|
41
|
-
if (conclusionVerified) {
|
|
42
|
-
let proofVerified = true; ///
|
|
43
|
-
|
|
44
|
-
const firstConclusion = first(conclusions),
|
|
45
|
-
proofNode = proofNodeQuery(ruleNode),
|
|
46
|
-
conclusion = firstConclusion; ///
|
|
47
|
-
|
|
48
|
-
if (proofNode !== null) {
|
|
49
|
-
const substitutions = Substitutions.fromNothing(),
|
|
50
|
-
statementNode = conclusion.getStatementNode();
|
|
51
|
-
|
|
52
|
-
proofVerified = verifyProof(proofNode, statementNode, substitutions, localContext);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
if (proofVerified) {
|
|
56
|
-
const rule = Rule.fromLabelsPremisesConclusionAndFileContext(labels, premises, conclusion, fileContext);
|
|
57
|
-
|
|
58
|
-
fileContext.addRule(rule);
|
|
59
|
-
|
|
60
|
-
ruleVerified = true;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
if (ruleVerified) {
|
|
67
|
-
fileContext.debug(`...verified the '${labelsString}' rule.`, ruleNode);
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
return ruleVerified;
|
|
71
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import verifyStatement from "../../verify/statement";
|
|
4
|
-
import unifyQualifiedStatement from "../../unify/qualifiedStatement";
|
|
5
|
-
|
|
6
|
-
import { nodeQuery } from "../../utilities/query";
|
|
7
|
-
import { assignAssignments } from "../../utilities/assignments";
|
|
8
|
-
|
|
9
|
-
const statementNodeQuery = nodeQuery("/qualifiedStatement/statement!");
|
|
10
|
-
|
|
11
|
-
export default function verifyQualifiedStatement(qualifiedStatementNode, substitutions, localContext) {
|
|
12
|
-
let qualifiedStatementVerified = false;
|
|
13
|
-
|
|
14
|
-
const qualifiedStatementString = localContext.nodeAsString(qualifiedStatementNode);
|
|
15
|
-
|
|
16
|
-
localContext.trace(`Verifying the '${qualifiedStatementString}' qualified statement...`, qualifiedStatementNode);
|
|
17
|
-
|
|
18
|
-
if (!qualifiedStatementVerified) {
|
|
19
|
-
const stated = true,
|
|
20
|
-
assignments = [],
|
|
21
|
-
statementNode = statementNodeQuery(qualifiedStatementNode),
|
|
22
|
-
statementVerified = verifyStatement(statementNode, assignments, stated, localContext);
|
|
23
|
-
|
|
24
|
-
if (statementVerified) {
|
|
25
|
-
const qualifiedStatementUnified = unifyQualifiedStatement(qualifiedStatementNode, substitutions, localContext);
|
|
26
|
-
|
|
27
|
-
if (qualifiedStatementUnified) {
|
|
28
|
-
const assignmentsAssigned = assignAssignments(assignments, localContext);
|
|
29
|
-
|
|
30
|
-
qualifiedStatementVerified = assignmentsAssigned; ///
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
if (qualifiedStatementVerified) {
|
|
36
|
-
localContext.debug(`...verified the '${qualifiedStatementString}' qualified statement.`, qualifiedStatementNode);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return qualifiedStatementVerified;
|
|
40
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import verifyStatement from "../../verify/statement";
|
|
4
|
-
import unifyUnqualifiedStatement from "../../unify/unqualifiedStatement";
|
|
5
|
-
|
|
6
|
-
import { nodeQuery } from "../../utilities/query";
|
|
7
|
-
import { assignAssignments } from "../../utilities/assignments";
|
|
8
|
-
|
|
9
|
-
const statementNodeQuery = nodeQuery("/unqualifiedStatement/statement!");
|
|
10
|
-
|
|
11
|
-
export default function verifyUnqualifiedStatement(unqualifiedStatementNode, localContext) {
|
|
12
|
-
let unqualifiedStatementVerified = false;
|
|
13
|
-
|
|
14
|
-
const unqualifiedStatementString = localContext.nodeAsString(unqualifiedStatementNode);
|
|
15
|
-
|
|
16
|
-
localContext.trace(`Verifying the '${unqualifiedStatementString}' unqualified statement...`, unqualifiedStatementNode);
|
|
17
|
-
|
|
18
|
-
if (!unqualifiedStatementVerified) {
|
|
19
|
-
const stated = false,
|
|
20
|
-
assignments = [],
|
|
21
|
-
statementNode = statementNodeQuery(unqualifiedStatementNode),
|
|
22
|
-
statementVerified = verifyStatement(statementNode, assignments, stated, localContext);
|
|
23
|
-
|
|
24
|
-
if (statementVerified) {
|
|
25
|
-
const assignmentsAssigned = assignAssignments(assignments, localContext);
|
|
26
|
-
|
|
27
|
-
unqualifiedStatementVerified = assignmentsAssigned; ///
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
if (!unqualifiedStatementVerified) {
|
|
32
|
-
const stated = true,
|
|
33
|
-
assignments = null,
|
|
34
|
-
statementNode = statementNodeQuery(unqualifiedStatementNode),
|
|
35
|
-
statementVerified = verifyStatement(statementNode, assignments, stated, localContext);
|
|
36
|
-
|
|
37
|
-
if (statementVerified) {
|
|
38
|
-
const unqualifiedStatementUnified = unifyUnqualifiedStatement(unqualifiedStatementNode, localContext);
|
|
39
|
-
|
|
40
|
-
unqualifiedStatementVerified = unqualifiedStatementUnified; ///
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
if (unqualifiedStatementVerified) {
|
|
45
|
-
localContext.debug(`...verified the '${unqualifiedStatementString}' unqualified statement.`, unqualifiedStatementNode);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
return unqualifiedStatementVerified;
|
|
49
|
-
}
|