occam-verify-cli 0.0.893 → 0.0.894
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 +3 -3
- package/lib/metaLemmaMetatheorem.js +4 -4
- package/lib/metaSupposition.js +15 -17
- package/lib/premise.js +57 -15
- package/lib/rule.js +31 -20
- package/lib/step/metaproof.js +19 -5
- package/lib/utilities/array.js +5 -2
- package/lib/verify/metaProofStep.js +2 -2
- package/lib/verify/metaSubDerivation.js +3 -3
- package/lib/verify/metaSubproof.js +3 -3
- package/lib/verify/metastatement/qualified.js +32 -15
- package/lib/verify/ruleProofStep.js +27 -15
- package/lib/verify/statement/qualified.js +39 -23
- package/lib/verify/statement.js +7 -1
- package/package.json +4 -4
- package/src/axiomLemmaTheoremConjecture.js +3 -4
- package/src/metaLemmaMetatheorem.js +4 -4
- package/src/metaSupposition.js +25 -29
- package/src/premise.js +95 -25
- package/src/rule.js +36 -20
- package/src/step/metaproof.js +24 -7
- package/src/utilities/array.js +1 -1
- package/src/verify/metaProofStep.js +1 -1
- package/src/verify/metaSubDerivation.js +2 -2
- package/src/verify/metaSubproof.js +2 -2
- package/src/verify/metastatement/qualified.js +51 -21
- package/src/verify/ruleProofStep.js +24 -2
- package/src/verify/statement/qualified.js +55 -25
- package/src/verify/statement.js +2 -2
package/src/premise.js
CHANGED
|
@@ -11,9 +11,13 @@ import { nodeQuery, nodesQuery } from "./utilities/query";
|
|
|
11
11
|
import { metastatementNodeFromMetastatementString } from "./utilities/node";
|
|
12
12
|
|
|
13
13
|
const subproofAssertionNodeQuery = nodeQuery("/metastatement/subproofAssertion!"),
|
|
14
|
+
subproofSuppositionStatementNodesQuery = nodesQuery("/subproof/supposition/unqualifiedStatement!/statement!"),
|
|
15
|
+
subproofLastProofStepStatementNodeQuery = nodeQuery("/subproof/subDerivation/lastProofStep/unqualifiedStatement|qualifiedStatement/statement!"),
|
|
14
16
|
subproofAssertionMetastatementNodesQuery = nodesQuery("/subproofAssertion/metastatement"),
|
|
15
17
|
ruleSubproofPremiseMetastatementNodesQuery = nodesQuery("/ruleSubproof/premise/unqualifiedMetastatement!/metastatement!"),
|
|
16
|
-
|
|
18
|
+
metaSubproofMetaSuppositionMetastatementNodesQuery = nodesQuery("/metaSubproof/metaSupposition/unqualifiedMetastatement!/metastatement!"),
|
|
19
|
+
ruleSubproofLastRuleProofStepMetastatementNodeQuery = nodeQuery("/ruleSubproof/ruleSubDerivation/lastRuleProofStep/unqualifiedMetastatement|qualifiedMetastatement/metastatement!"),
|
|
20
|
+
metaSubproofLastMetaProofStepMetastatementNodeQuery = nodeQuery("/metaSubproof/metaSubDerivation/lastMetaProofStep/unqualifiedMetastatement|qualifiedMetastatement/metastatement!");
|
|
17
21
|
|
|
18
22
|
export default class Premise {
|
|
19
23
|
constructor(metastatementNode) {
|
|
@@ -24,12 +28,12 @@ export default class Premise {
|
|
|
24
28
|
return this.metastatementNode;
|
|
25
29
|
}
|
|
26
30
|
|
|
27
|
-
matchStatementNode(statementNode, substitutions, fileContext,
|
|
31
|
+
matchStatementNode(statementNode, substitutions, fileContext, localContext) {
|
|
28
32
|
const nonTerminalNodeA = this.metastatementNode, ///
|
|
29
33
|
nonTerminalNodeB = statementNode, ///
|
|
30
34
|
fileContextA = fileContext, ///
|
|
31
35
|
localContextA = LocalContext.fromFileContext(fileContextA),
|
|
32
|
-
localContextB =
|
|
36
|
+
localContextB = localContext, ///
|
|
33
37
|
nonTerminalNodeVerified = intrinsicLevelAgainstMetaLevelNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localContextA, localContextB, () => {
|
|
34
38
|
const verifiedAhead = true;
|
|
35
39
|
|
|
@@ -40,6 +44,41 @@ export default class Premise {
|
|
|
40
44
|
return statementNodeMatches;
|
|
41
45
|
}
|
|
42
46
|
|
|
47
|
+
matchSubproofNode(subproofNode, substitutions, fileContext, localContext) {
|
|
48
|
+
let subproofNodeMatches = false;
|
|
49
|
+
|
|
50
|
+
const subproofAssertionNode = subproofAssertionNodeQuery(this.metastatementNode);
|
|
51
|
+
|
|
52
|
+
if (subproofAssertionNode !== null) {
|
|
53
|
+
const subproofSuppositionStatementNodes = subproofSuppositionStatementNodesQuery(subproofNode),
|
|
54
|
+
subproofLastProofStepStatementNode = subproofLastProofStepStatementNodeQuery(subproofNode),
|
|
55
|
+
subproofStatementNodes = [
|
|
56
|
+
...subproofSuppositionStatementNodes,
|
|
57
|
+
subproofLastProofStepStatementNode
|
|
58
|
+
],
|
|
59
|
+
subproofAssertionMetastatementNodes = subproofAssertionMetastatementNodesQuery(subproofAssertionNode);
|
|
60
|
+
|
|
61
|
+
subproofNodeMatches = match(subproofAssertionMetastatementNodes, subproofStatementNodes, (subproofAssertionMetastatementNode, subproofStatementNode) => {
|
|
62
|
+
const nonTerminalNodeA = subproofAssertionMetastatementNode, ///
|
|
63
|
+
nonTerminalNodeB = subproofStatementNode, ///
|
|
64
|
+
fileContextA = fileContext, ///
|
|
65
|
+
localContextA = LocalMetaContext.fromFileContext(fileContextA),
|
|
66
|
+
localContextB = localContext, ///
|
|
67
|
+
nonTerminalNodeVerified = intrinsicLevelAgainstMetaLevelNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localContextA, localContextB, () => {
|
|
68
|
+
const verifiedAhead = true;
|
|
69
|
+
|
|
70
|
+
return verifiedAhead;
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
if (nonTerminalNodeVerified) {
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return subproofNodeMatches;
|
|
80
|
+
}
|
|
81
|
+
|
|
43
82
|
matchRuleSubproofNode(ruleSubproofNode, substitutions, fileContext, localMetaContext) {
|
|
44
83
|
let ruleSubproofNodeMatches = false;
|
|
45
84
|
|
|
@@ -52,33 +91,64 @@ export default class Premise {
|
|
|
52
91
|
...ruleSubproofPremiseMetastatementNodes,
|
|
53
92
|
ruleSubproofLastRuleProofStepMetastatementNode
|
|
54
93
|
],
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
return true;
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
}
|
|
94
|
+
subproofAssertionMetastatementNodes = subproofAssertionMetastatementNodesQuery(subproofAssertionNode);
|
|
95
|
+
|
|
96
|
+
ruleSubproofNodeMatches = match(subproofAssertionMetastatementNodes, ruleSubproofMetastatementNodes, (subproofAssertionMetastatementNode, ruleSubproofMetastatementNode) => {
|
|
97
|
+
const nonTerminalNodeA = subproofAssertionMetastatementNode, ///
|
|
98
|
+
nonTerminalNodeB = ruleSubproofMetastatementNode, ///
|
|
99
|
+
fileContextA = fileContext, ///
|
|
100
|
+
localMetaContextA = LocalMetaContext.fromFileContext(fileContextA),
|
|
101
|
+
localMetaContextB = localMetaContext, ///
|
|
102
|
+
nonTerminalNodeVerified = metaLevelNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localMetaContextA, localMetaContextB, () => {
|
|
103
|
+
const verifiedAhead = true;
|
|
104
|
+
|
|
105
|
+
return verifiedAhead;
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
if (nonTerminalNodeVerified) {
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
});
|
|
77
112
|
}
|
|
78
113
|
|
|
79
114
|
return ruleSubproofNodeMatches;
|
|
80
115
|
}
|
|
81
116
|
|
|
117
|
+
matchMetaSubproofNode(metaSubproofNode, substitutions, fileContext, localMetaContext) {
|
|
118
|
+
let metaSubproofNodeMatches = false;
|
|
119
|
+
|
|
120
|
+
const subproofAssertionNode = subproofAssertionNodeQuery(this.metastatementNode);
|
|
121
|
+
|
|
122
|
+
if (subproofAssertionNode !== null) {
|
|
123
|
+
const metaSubproofMetaSuppositionMetastatementNodes = metaSubproofMetaSuppositionMetastatementNodesQuery(metaSubproofNode),
|
|
124
|
+
metaSubproofLastMetaProofStepMetastatementNode = metaSubproofLastMetaProofStepMetastatementNodeQuery(metaSubproofNode),
|
|
125
|
+
metaSubproofMetastatementNodes = [
|
|
126
|
+
...metaSubproofMetaSuppositionMetastatementNodes,
|
|
127
|
+
metaSubproofLastMetaProofStepMetastatementNode
|
|
128
|
+
],
|
|
129
|
+
subproofAssertionMetastatementNodes = subproofAssertionMetastatementNodesQuery(subproofAssertionNode);
|
|
130
|
+
|
|
131
|
+
metaSubproofNodeMatches = match(subproofAssertionMetastatementNodes, metaSubproofMetastatementNodes, (subproofAssertionMetastatementNode, ruleSubproofMetastatementNode) => {
|
|
132
|
+
const nonTerminalNodeA = subproofAssertionMetastatementNode, ///
|
|
133
|
+
nonTerminalNodeB = ruleSubproofMetastatementNode, ///
|
|
134
|
+
fileContextA = fileContext, ///
|
|
135
|
+
localMetaContextA = LocalMetaContext.fromFileContext(fileContextA),
|
|
136
|
+
localMetaContextB = localMetaContext, ///
|
|
137
|
+
nonTerminalNodeVerified = metaLevelNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localMetaContextA, localMetaContextB, () => {
|
|
138
|
+
const verifiedAhead = true;
|
|
139
|
+
|
|
140
|
+
return verifiedAhead;
|
|
141
|
+
});
|
|
142
|
+
|
|
143
|
+
if (nonTerminalNodeVerified) {
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return metaSubproofNodeMatches;
|
|
150
|
+
}
|
|
151
|
+
|
|
82
152
|
matchMetastatementNode(metastatementNode, substitutions, fileContext, localMetaContext) {
|
|
83
153
|
const nonTerminalNodeA = this.metastatementNode, ///
|
|
84
154
|
nonTerminalNodeB = metastatementNode, ///
|
package/src/rule.js
CHANGED
|
@@ -4,9 +4,8 @@ import Label from "./label";
|
|
|
4
4
|
import Premise from "./premise";
|
|
5
5
|
import Conclusion from "./conclusion";
|
|
6
6
|
|
|
7
|
-
import {
|
|
7
|
+
import { extract } from "./utilities/array";
|
|
8
8
|
import { someSubArray } from "./utilities/array";
|
|
9
|
-
import local from "./context/local";
|
|
10
9
|
|
|
11
10
|
export default class Rule {
|
|
12
11
|
constructor(labels, premises, conclusion, fileContext) {
|
|
@@ -35,25 +34,24 @@ export default class Rule {
|
|
|
35
34
|
matchStatement(statementNode, localContext) {
|
|
36
35
|
let statementNatches;
|
|
37
36
|
|
|
38
|
-
const premisesLength = this.premises.length
|
|
39
|
-
statementLocalContext = localContext; ///
|
|
37
|
+
const premisesLength = this.premises.length;
|
|
40
38
|
|
|
41
39
|
if (premisesLength === 0) {
|
|
42
40
|
const substitutions = [],
|
|
43
|
-
conclusionMatches = matchConclusion(this.conclusion, statementNode, substitutions, this.fileContext,
|
|
41
|
+
conclusionMatches = matchConclusion(this.conclusion, statementNode, substitutions, this.fileContext, localContext);
|
|
44
42
|
|
|
45
43
|
statementNatches = conclusionMatches; ///
|
|
46
44
|
} else {
|
|
47
|
-
const proofSteps =
|
|
45
|
+
const proofSteps = localContext.getProofSteps();
|
|
48
46
|
|
|
49
47
|
statementNatches = someSubArray(proofSteps, premisesLength, (proofSteps) => {
|
|
50
48
|
let premisesMatchConclusion = false;
|
|
51
49
|
|
|
52
50
|
const substitutions = [],
|
|
53
|
-
premisesMatch = matchPremises(this.premises, proofSteps, substitutions, this.fileContext,
|
|
51
|
+
premisesMatch = matchPremises(this.premises, proofSteps, substitutions, this.fileContext, localContext);
|
|
54
52
|
|
|
55
53
|
if (premisesMatch) {
|
|
56
|
-
const conclusionMatches = matchConclusion(this.conclusion, statementNode, substitutions, this.fileContext,
|
|
54
|
+
const conclusionMatches = matchConclusion(this.conclusion, statementNode, substitutions, this.fileContext, localContext);
|
|
57
55
|
|
|
58
56
|
premisesMatchConclusion = conclusionMatches; ///
|
|
59
57
|
}
|
|
@@ -182,14 +180,23 @@ export default class Rule {
|
|
|
182
180
|
}
|
|
183
181
|
}
|
|
184
182
|
|
|
185
|
-
function matchPremise(premise, proofSteps, substitutions, fileContext,
|
|
186
|
-
const proofStep =
|
|
187
|
-
const
|
|
183
|
+
function matchPremise(premise, proofSteps, substitutions, fileContext, localContext) {
|
|
184
|
+
const proofStep = extract(proofSteps, (proofStep) => {
|
|
185
|
+
const subproofNode = proofStep.getSubproofNode(),
|
|
186
|
+
statementNode = proofStep.getStatementNode();
|
|
187
|
+
|
|
188
|
+
if (subproofNode !== null) {
|
|
189
|
+
const subproofNodeMatches = premise.matchSubproofNode(subproofNode, substitutions, fileContext, localContext);
|
|
190
|
+
|
|
191
|
+
if (subproofNodeMatches) {
|
|
192
|
+
return true;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
188
195
|
|
|
189
196
|
if (statementNode !== null) {
|
|
190
|
-
const statementNodeMatches = premise.matchStatementNode(statementNode, substitutions, fileContext,
|
|
197
|
+
const statementNodeMatches = premise.matchStatementNode(statementNode, substitutions, fileContext, localContext);
|
|
191
198
|
|
|
192
|
-
if (
|
|
199
|
+
if (statementNodeMatches) {
|
|
193
200
|
return true;
|
|
194
201
|
}
|
|
195
202
|
}
|
|
@@ -200,9 +207,9 @@ function matchPremise(premise, proofSteps, substitutions, fileContext, statement
|
|
|
200
207
|
return premiseMatches;
|
|
201
208
|
}
|
|
202
209
|
|
|
203
|
-
function matchPremises(premise, proofSteps, substitutions, fileContext,
|
|
210
|
+
function matchPremises(premise, proofSteps, substitutions, fileContext, localContext) {
|
|
204
211
|
const premisesMatch = premise.every((premise) => {
|
|
205
|
-
const premiseMatches = matchPremise(premise, proofSteps, substitutions, fileContext,
|
|
212
|
+
const premiseMatches = matchPremise(premise, proofSteps, substitutions, fileContext, localContext);
|
|
206
213
|
|
|
207
214
|
if (premiseMatches) {
|
|
208
215
|
return true;
|
|
@@ -212,22 +219,31 @@ function matchPremises(premise, proofSteps, substitutions, fileContext, statemen
|
|
|
212
219
|
return premisesMatch;
|
|
213
220
|
}
|
|
214
221
|
|
|
215
|
-
function matchConclusion(conclusion, statementNode, substitutions, fileContext,
|
|
216
|
-
const statementNodeMatches = conclusion.matchStatementNode(statementNode, substitutions, fileContext,
|
|
222
|
+
function matchConclusion(conclusion, statementNode, substitutions, fileContext, localContext) {
|
|
223
|
+
const statementNodeMatches = conclusion.matchStatementNode(statementNode, substitutions, fileContext, localContext),
|
|
217
224
|
conclusionMatches = statementNodeMatches; ///
|
|
218
225
|
|
|
219
226
|
return conclusionMatches;
|
|
220
227
|
}
|
|
221
228
|
|
|
222
229
|
function metaMatchPremise(premise, metaproofSteps, substitutions, fileContext, localMetaContext) {
|
|
223
|
-
const metaproofStep =
|
|
230
|
+
const metaproofStep = extract(metaproofSteps, (metaproofStep) => {
|
|
224
231
|
const ruleSubproofNode = metaproofStep.getRuleSubproofNode(),
|
|
232
|
+
metaSubproofNode = metaproofStep.getMetaSubproofNode(),
|
|
225
233
|
metastatementNode = metaproofStep.getMetastatementNode()
|
|
226
234
|
|
|
227
235
|
if (ruleSubproofNode !== null) {
|
|
228
236
|
const ruleSubProofNodeMatches = premise.matchRuleSubproofNode(ruleSubproofNode, substitutions, fileContext, localMetaContext);
|
|
229
237
|
|
|
230
|
-
if (
|
|
238
|
+
if (ruleSubProofNodeMatches) {
|
|
239
|
+
return true;
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
if (metaSubproofNode !== null) {
|
|
244
|
+
const metaSubProofNodeMatches = premise.matchMetaSubproofNode(metaSubproofNode, substitutions, fileContext, localMetaContext);
|
|
245
|
+
|
|
246
|
+
if (metaSubProofNodeMatches) {
|
|
231
247
|
return true;
|
|
232
248
|
}
|
|
233
249
|
}
|
|
@@ -235,7 +251,7 @@ function metaMatchPremise(premise, metaproofSteps, substitutions, fileContext, l
|
|
|
235
251
|
if (metastatementNode !== null) {
|
|
236
252
|
const metastatementNodeMatches = premise.matchMetastatementNode(metastatementNode, substitutions, fileContext, localMetaContext);
|
|
237
253
|
|
|
238
|
-
if (
|
|
254
|
+
if (metastatementNodeMatches) {
|
|
239
255
|
return true;
|
|
240
256
|
}
|
|
241
257
|
}
|
package/src/step/metaproof.js
CHANGED
|
@@ -9,12 +9,17 @@ const metastatementNodesQuery = nodesQuery("/subproofAssertion/metastatement"),
|
|
|
9
9
|
qualifiedOrUnqualifiedMetastatementMetastatementNodesQuery = nodesQuery("/ruleSubproof/qualifiedMetastatement|unqualifiedMetastatement/metastatement!");
|
|
10
10
|
|
|
11
11
|
export default class MetaproofStep {
|
|
12
|
-
constructor(ruleSubproofNode, metaSubproofNode, metastatementNode) {
|
|
12
|
+
constructor(statementNode, ruleSubproofNode, metaSubproofNode, metastatementNode) {
|
|
13
|
+
this.statementNode = statementNode;
|
|
13
14
|
this.ruleSubproofNode = ruleSubproofNode;
|
|
14
15
|
this.metaSubproofNode = metaSubproofNode;
|
|
15
16
|
this.metastatementNode = metastatementNode;
|
|
16
17
|
}
|
|
17
18
|
|
|
19
|
+
getStatementNode() {
|
|
20
|
+
return this.statementNode;
|
|
21
|
+
}
|
|
22
|
+
|
|
18
23
|
getRuleSubproofNode() {
|
|
19
24
|
return this.ruleSubproofNode;
|
|
20
25
|
}
|
|
@@ -90,27 +95,39 @@ export default class MetaproofStep {
|
|
|
90
95
|
return ruleSubproofAssertionMatches;
|
|
91
96
|
}
|
|
92
97
|
|
|
98
|
+
static fromStatementNode(statementNode) {
|
|
99
|
+
const ruleSubproofNode = null,
|
|
100
|
+
metaSubproofNode = null,
|
|
101
|
+
metastatementNode = null,
|
|
102
|
+
metaProofStep = new MetaproofStep(statementNode, ruleSubproofNode, metaSubproofNode, metastatementNode);
|
|
103
|
+
|
|
104
|
+
return metaProofStep;
|
|
105
|
+
}
|
|
106
|
+
|
|
93
107
|
static fromRuleSubproofNode(ruleSubproofNode) {
|
|
94
|
-
const
|
|
108
|
+
const statementNode = null,
|
|
109
|
+
metaSubproofNode = null,
|
|
95
110
|
metastatementNode = null,
|
|
96
|
-
metaProofStep = new MetaproofStep(ruleSubproofNode, metaSubproofNode, metastatementNode);
|
|
111
|
+
metaProofStep = new MetaproofStep(statementNode, ruleSubproofNode, metaSubproofNode, metastatementNode);
|
|
97
112
|
|
|
98
113
|
return metaProofStep;
|
|
99
114
|
}
|
|
100
115
|
|
|
101
116
|
static fromMetaSubproofNode(metaSubproofNode) {
|
|
102
|
-
const
|
|
117
|
+
const statementNode = null,
|
|
118
|
+
ruleSubproofNode = null,
|
|
103
119
|
metastatementNode = null,
|
|
104
|
-
metaProofStep = new MetaproofStep(ruleSubproofNode, metaSubproofNode, metastatementNode);
|
|
120
|
+
metaProofStep = new MetaproofStep(statementNode, ruleSubproofNode, metaSubproofNode, metastatementNode);
|
|
105
121
|
|
|
106
122
|
return metaProofStep;
|
|
107
123
|
|
|
108
124
|
}
|
|
109
125
|
|
|
110
126
|
static fromMetastatementNode(metastatementNode) {
|
|
111
|
-
const
|
|
127
|
+
const statementNode = null,
|
|
128
|
+
ruleSubproofNode = null,
|
|
112
129
|
metaSubproofNode = null,
|
|
113
|
-
metaProofStep = new MetaproofStep(ruleSubproofNode, metaSubproofNode, metastatementNode);
|
|
130
|
+
metaProofStep = new MetaproofStep(statementNode, ruleSubproofNode, metaSubproofNode, metastatementNode);
|
|
114
131
|
|
|
115
132
|
return metaProofStep;
|
|
116
133
|
}
|
package/src/utilities/array.js
CHANGED
|
@@ -6,7 +6,7 @@ import permutationsMatrix from "../permutationsMatrix";
|
|
|
6
6
|
|
|
7
7
|
import { MAXIMUM_INDEXES_LENGTH, MAXIMUM_PERMUTATION_LENGTH } from "../constants";
|
|
8
8
|
|
|
9
|
-
export const { first, second, last, push, prune, match, filter, compress, separate } = arrayUtilities;
|
|
9
|
+
export const { first, second, last, push, prune, extract, match, filter, compress, separate } = arrayUtilities;
|
|
10
10
|
|
|
11
11
|
export function someSubArray(array, subArrayLength, callback) {
|
|
12
12
|
let found = false;
|
|
@@ -32,7 +32,7 @@ export default function verifyMetaProofStep(metaProofStepNode, substitutions, lo
|
|
|
32
32
|
} else if (metaSubproofNode !== null) {
|
|
33
33
|
let metaSubproofVerified;
|
|
34
34
|
|
|
35
|
-
metaSubproofVerified = verifyMetaSubproof(metaSubproofNode, localMetaContext);
|
|
35
|
+
metaSubproofVerified = verifyMetaSubproof(metaSubproofNode, substitutions, localMetaContext);
|
|
36
36
|
|
|
37
37
|
if (metaSubproofVerified) {
|
|
38
38
|
const metaproofStep = MetaproofStep.fromMetaSubproofNode(metaSubproofNode);
|
|
@@ -4,14 +4,14 @@ import { nodesQuery } from "../utilities/query";
|
|
|
4
4
|
|
|
5
5
|
const metaProofStepNodesQuery = nodesQuery("/metaSubDerivation/metaProofStep|lastMetaProofStep");
|
|
6
6
|
|
|
7
|
-
export default function verifyMetaSubDerivation(metaSubDerivationNode, localMetaContext) {
|
|
7
|
+
export default function verifyMetaSubDerivation(metaSubDerivationNode, substitutions, localMetaContext) {
|
|
8
8
|
let metaSubDerivationVerified;
|
|
9
9
|
|
|
10
10
|
const metaProofStepNodes = metaProofStepNodesQuery(metaSubDerivationNode);
|
|
11
11
|
|
|
12
12
|
metaSubDerivationVerified = metaProofStepNodes.every((metaProofStepNode) => {
|
|
13
13
|
const { verifyMetaProofStep } = verifyMetaSubDerivation,
|
|
14
|
-
metaProofStepVerified = verifyMetaProofStep(metaProofStepNode, localMetaContext);
|
|
14
|
+
metaProofStepVerified = verifyMetaProofStep(metaProofStepNode, substitutions, localMetaContext);
|
|
15
15
|
|
|
16
16
|
if (metaProofStepVerified) {
|
|
17
17
|
return true;
|
|
@@ -9,7 +9,7 @@ import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
|
9
9
|
const suppositionNodesQuery = nodesQuery("/metaSubproof/supposition"),
|
|
10
10
|
metaSubDerivationNodeQuery = nodeQuery("/metaSubproof/metaSubDerivation");
|
|
11
11
|
|
|
12
|
-
export default function verifyMetaSubproof(metaSubproofNode, localMetaContext) {
|
|
12
|
+
export default function verifyMetaSubproof(metaSubproofNode, substitutions, localMetaContext) {
|
|
13
13
|
let metaSubproofVerified = false;
|
|
14
14
|
|
|
15
15
|
localMetaContext = LocalMetaContext.fromLocalMetaContext(localMetaContext); ///
|
|
@@ -20,7 +20,7 @@ export default function verifyMetaSubproof(metaSubproofNode, localMetaContext) {
|
|
|
20
20
|
|
|
21
21
|
if (metaSuppositionsVerified) {
|
|
22
22
|
const metaSubDerivationNode = metaSubDerivationNodeQuery(metaSubproofNode),
|
|
23
|
-
metaSubDerivationVerified = verifyMetaSubDerivation(metaSubDerivationNode, localMetaContext);
|
|
23
|
+
metaSubDerivationVerified = verifyMetaSubDerivation(metaSubDerivationNode, substitutions, localMetaContext);
|
|
24
24
|
|
|
25
25
|
if (metaSubDerivationVerified) {
|
|
26
26
|
metaSubproofVerified = true;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import verifyMetastatement from "../../verify/metastatement";
|
|
4
3
|
import verifyMetavariableAgainstMetastatement from "../../verify/metavariableAgainstMetastatement";
|
|
5
4
|
|
|
6
5
|
import { nodeQuery } from "../../utilities/query";
|
|
@@ -15,28 +14,30 @@ export default function verifyQualifiedMetastatement(qualifiedMetastatementNode,
|
|
|
15
14
|
|
|
16
15
|
localMetaContext.trace(`Verifying the '${qualifiedMetastatementString}' qualified metastatement...`, qualifiedMetastatementNode);
|
|
17
16
|
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
17
|
+
const metavariableNode = metavariableNodeQuery(qualifiedMetastatementNode),
|
|
18
|
+
verifyQualifiedMetastatementFunctions = [
|
|
19
|
+
verifyQualifiedMetastatementAAgainstRule,
|
|
20
|
+
verifyQualifiedMetastatementAAgainstReference
|
|
21
|
+
];
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
qualifiedMetastatementVerified = verifyQualifiedMetastatementFunctions.some((verifyQualifiedMetastatementFunction) => { ///
|
|
24
|
+
const qualifiedMetastatementVerified = verifyQualifiedMetastatementFunction(qualifiedMetastatementNode, metavariableNode, substitutions, localMetaContext);
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
26
|
+
if (qualifiedMetastatementVerified) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
if (qualifiedMetastatementVerified) {
|
|
32
|
+
const derived = false,
|
|
33
|
+
metastatementNode = metastatementNodeQuery(qualifiedMetastatementNode),
|
|
34
|
+
metastatementVerified = verifyMetastatement(metastatementNode, assignments, derived, localMetaContext, () => {
|
|
35
|
+
const verifiedAhead = true;
|
|
36
|
+
|
|
37
|
+
return verifiedAhead;
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
qualifiedMetastatementVerified = metastatementVerified; ///
|
|
40
41
|
}
|
|
41
42
|
|
|
42
43
|
if (qualifiedMetastatementVerified) {
|
|
@@ -98,3 +99,32 @@ function verifyQualifiedMetastatementAAgainstReference(qualifiedMetastatementNod
|
|
|
98
99
|
|
|
99
100
|
return qualifiedMetastatementVerifiedAgainstReference;
|
|
100
101
|
}
|
|
102
|
+
|
|
103
|
+
function verifyMetastatement(metastatementNode, assignments, derived, localMetaContext) {
|
|
104
|
+
let metastatementVerified;
|
|
105
|
+
|
|
106
|
+
const metastatementString = localMetaContext.nodeAsString(metastatementNode);
|
|
107
|
+
|
|
108
|
+
localMetaContext.trace(`Verifying the '${metastatementString}' metastatement...`, metastatementNode);
|
|
109
|
+
|
|
110
|
+
const verifyMetaStatementFunctions = [
|
|
111
|
+
///
|
|
112
|
+
];
|
|
113
|
+
|
|
114
|
+
verifyMetaStatementFunctions.some((verifyStatementFunction) => {
|
|
115
|
+
const metastatementVerified = verifyStatementFunction(metastatementNode, assignments, derived, localMetaContext);
|
|
116
|
+
|
|
117
|
+
if (metastatementVerified) {
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
metastatementVerified = true; ///
|
|
123
|
+
|
|
124
|
+
if (metastatementVerified) {
|
|
125
|
+
localMetaContext.debug(`...verified the '${metastatementString}' metastatement.`, metastatementNode);
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return metastatementVerified;
|
|
129
|
+
}
|
|
130
|
+
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import LocalContext from "../context/local";
|
|
3
4
|
import MetaproofStep from "../step/metaproof";
|
|
4
5
|
import verifyRuleSubproof from "../verify/ruleSubproof";
|
|
5
6
|
import verifyRuleSubDerivation from "../verify/ruleSubDerivation";
|
|
@@ -11,7 +12,8 @@ import verifyUnqualifiedMetastatement from "../verify/metastatement/unqualified"
|
|
|
11
12
|
import { nodeQuery } from "../utilities/query";
|
|
12
13
|
import { assignAssignment } from "../utilities/assignments";
|
|
13
14
|
|
|
14
|
-
const
|
|
15
|
+
const statementNodeQuery = nodeQuery("/qualifiedStatement|unqualifiedStatement/statement!"),
|
|
16
|
+
ruleSubproofNodeQuery = nodeQuery("/ruleProofStep|lastRuleProofStep/ruleSubproof!"),
|
|
15
17
|
metastatementNodeQuery = nodeQuery("/qualifiedMetastatement|unqualifiedMetastatement/metastatement!"),
|
|
16
18
|
qualifiedStatementNodeQuery = nodeQuery("/ruleProofStep|lastRuleProofStep/qualifiedStatement!"),
|
|
17
19
|
unqualifiedStatementNodeQuery = nodeQuery("/ruleProofStep|lastRuleProofStep/unqualifiedStatement!"),
|
|
@@ -42,7 +44,27 @@ export default function verifyRuleProofStep(ruleProofStepNode, localMetaContext)
|
|
|
42
44
|
ruleProofStepVerified = true;
|
|
43
45
|
}
|
|
44
46
|
} else if (qualifiedStatementNode !== null) {
|
|
45
|
-
|
|
47
|
+
let qualifiedStatementVerified;
|
|
48
|
+
|
|
49
|
+
const assignments = [],
|
|
50
|
+
localContext = LocalContext.fromLocalMetaContext(localMetaContext);
|
|
51
|
+
|
|
52
|
+
qualifiedStatementVerified = verifyQualifiedStatement(qualifiedStatementNode, assignments, localContext);
|
|
53
|
+
|
|
54
|
+
if (qualifiedStatementVerified) {
|
|
55
|
+
const assignmentAssigned = assignAssignment(assignments, localContext);
|
|
56
|
+
|
|
57
|
+
qualifiedStatementVerified = assignmentAssigned; ///
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if (qualifiedStatementVerified) {
|
|
61
|
+
const statementNode = statementNodeQuery(qualifiedStatementNode),
|
|
62
|
+
metaproofStep = MetaproofStep.fromStatementNode(statementNode);
|
|
63
|
+
|
|
64
|
+
localMetaContext.addMetaproofStep(metaproofStep);
|
|
65
|
+
|
|
66
|
+
ruleProofStepVerified = true;
|
|
67
|
+
}
|
|
46
68
|
} else if (unqualifiedStatementNode !== null) {
|
|
47
69
|
debugger
|
|
48
70
|
} else if (qualifiedMetastatementNode !== null) {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import verifyStatement from "../../verify/statement";
|
|
4
|
-
|
|
5
3
|
import { nodeQuery } from "../../utilities/query";
|
|
4
|
+
import { verifyStatementAsEquality, verifyStatementAsTypeAssertion } from "../../verify/statement";
|
|
6
5
|
|
|
7
6
|
const statementNodeQuery = nodeQuery("/qualifiedStatement/statement!"),
|
|
8
7
|
metavariableNodeQuery = nodeQuery("/qualifiedStatement/reference!/metavariable!");
|
|
@@ -14,31 +13,33 @@ export default function verifyQualifiedStatement(qualifiedStatementNode, assignm
|
|
|
14
13
|
|
|
15
14
|
localContext.trace(`Verifying the '${qualifiedStatementString}' qualified statement...`, qualifiedStatementNode);
|
|
16
15
|
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
const metavariableNode = metavariableNodeQuery(qualifiedStatementNode),
|
|
17
|
+
verifyQualifiedStatementFunctions = [
|
|
18
|
+
verifyQualifiedStatementAAgainstRule,
|
|
19
|
+
verifyQualifiedStatementAAgainstAxiom,
|
|
20
|
+
verifyQualifiedStatementAAgainstLemma,
|
|
21
|
+
verifyQualifiedStatementAAgainstTheorem,
|
|
22
|
+
verifyQualifiedStatementAAgainstConjecture
|
|
23
|
+
];
|
|
21
24
|
|
|
22
|
-
|
|
23
|
-
|
|
25
|
+
qualifiedStatementVerified = verifyQualifiedStatementFunctions.some((verifyQualifiedStatementFunction) => { ///
|
|
26
|
+
const qualifiedStatementVerified = verifyQualifiedStatementFunction(qualifiedStatementNode, metavariableNode, localContext);
|
|
24
27
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
}
|
|
41
|
-
});
|
|
28
|
+
if (qualifiedStatementVerified) {
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
if (qualifiedStatementVerified) {
|
|
34
|
+
const derived = false,
|
|
35
|
+
statementNode = statementNodeQuery(qualifiedStatementNode),
|
|
36
|
+
statementVerified = verifyStatement(statementNode, assignments, derived, localContext, () => {
|
|
37
|
+
const verifiedAhead = true;
|
|
38
|
+
|
|
39
|
+
return verifiedAhead;
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
qualifiedStatementVerified = statementVerified; ///
|
|
42
43
|
}
|
|
43
44
|
|
|
44
45
|
if (qualifiedStatementVerified) {
|
|
@@ -167,3 +168,32 @@ function verifyQualifiedStatementAAgainstConjecture(qualifiedStatementNode, meta
|
|
|
167
168
|
|
|
168
169
|
return qualifiedStatementVerifiedAgainstConjecture;
|
|
169
170
|
}
|
|
171
|
+
|
|
172
|
+
function verifyStatement(statementNode, assignments, derived, localContext, verifyAhead) {
|
|
173
|
+
let statementVerified;
|
|
174
|
+
|
|
175
|
+
const statementString = localContext.nodeAsString(statementNode);
|
|
176
|
+
|
|
177
|
+
localContext.trace(`Verifying the '${statementString}' statement...`, statementNode);
|
|
178
|
+
|
|
179
|
+
const verifyStatementFunctions = [
|
|
180
|
+
verifyStatementAsEquality,
|
|
181
|
+
verifyStatementAsTypeAssertion
|
|
182
|
+
];
|
|
183
|
+
|
|
184
|
+
verifyStatementFunctions.some((verifyStatementFunction) => {
|
|
185
|
+
const statementVerified = verifyStatementFunction(statementNode, assignments, derived, localContext, verifyAhead);
|
|
186
|
+
|
|
187
|
+
if (statementVerified) {
|
|
188
|
+
return true;
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
statementVerified = true; ///
|
|
193
|
+
|
|
194
|
+
if (statementVerified) {
|
|
195
|
+
localContext.debug(`...verified the '${statementString}' statement.`, statementNode);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return statementVerified;
|
|
199
|
+
}
|