occam-verify-cli 0.0.902 → 0.0.903
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 +18 -34
- package/lib/constants.js +1 -9
- package/lib/metaLemmaMetatheorem.js +22 -40
- package/lib/rule.js +45 -83
- package/lib/ruleNames.js +1 -21
- package/lib/utilities/array.js +49 -42
- package/lib/utilities/verifier.js +4 -10
- package/lib/verifier/node/statementAsCombinator.js +7 -2
- package/lib/verifier/nodes/metaLevel.js +13 -3
- package/lib/verify/containedAssertion.js +2 -2
- package/lib/verify/premise.js +1 -3
- package/lib/verify/statement/qualified.js +4 -7
- package/lib/verify/statement/unqualified.js +2 -5
- package/lib/verify/statement.js +30 -18
- package/package.json +1 -1
- package/src/axiomLemmaTheoremConjecture.js +27 -47
- package/src/constants.js +0 -2
- package/src/metaLemmaMetatheorem.js +33 -54
- package/src/rule.js +58 -101
- package/src/ruleNames.js +0 -5
- package/src/utilities/array.js +22 -42
- package/src/utilities/verifier.js +3 -11
- package/src/verifier/node/statementAsCombinator.js +11 -4
- package/src/verifier/nodes/metaLevel.js +19 -4
- package/src/verify/containedAssertion.js +1 -1
- package/src/verify/premise.js +0 -2
- package/src/verify/statement/qualified.js +3 -7
- package/src/verify/statement/unqualified.js +1 -5
- package/src/verify/statement.js +33 -17
- package/lib/permutationsMatrix.js +0 -466136
- package/lib/utilities/permutations.js +0 -114
- package/src/permutationsMatrix.js +0 -6
- package/src/utilities/permutations.js +0 -148
package/src/rule.js
CHANGED
|
@@ -4,8 +4,7 @@ import Label from "./label";
|
|
|
4
4
|
import Premise from "./premise";
|
|
5
5
|
import Conclusion from "./conclusion";
|
|
6
6
|
|
|
7
|
-
import {
|
|
8
|
-
import { someSubArray } from "./utilities/array";
|
|
7
|
+
import { reverse, correlate } from "./utilities/array";
|
|
9
8
|
|
|
10
9
|
export default class Rule {
|
|
11
10
|
constructor(labels, premises, conclusion, fileContext) {
|
|
@@ -32,68 +31,32 @@ export default class Rule {
|
|
|
32
31
|
}
|
|
33
32
|
|
|
34
33
|
matchStatement(statementNode, localContext) {
|
|
35
|
-
let statementNatches;
|
|
34
|
+
let statementNatches = false;
|
|
36
35
|
|
|
37
|
-
const
|
|
36
|
+
const proofSteps = localContext.getProofSteps(),
|
|
37
|
+
substitutions = [],
|
|
38
|
+
premisesMatch = matchPremises(this.premises, proofSteps, substitutions, this.fileContext, localContext);
|
|
38
39
|
|
|
39
|
-
if (
|
|
40
|
-
const
|
|
41
|
-
conclusionMatches = matchConclusion(this.conclusion, statementNode, substitutions, this.fileContext, localContext);
|
|
40
|
+
if (premisesMatch) {
|
|
41
|
+
const conclusionMatches = matchConclusion(this.conclusion, statementNode, substitutions, this.fileContext, localContext);
|
|
42
42
|
|
|
43
|
-
statementNatches = conclusionMatches;
|
|
44
|
-
} else {
|
|
45
|
-
const proofSteps = localContext.getProofSteps();
|
|
46
|
-
|
|
47
|
-
statementNatches = someSubArray(proofSteps, premisesLength, (proofSteps) => {
|
|
48
|
-
let premisesMatchConclusion = false;
|
|
49
|
-
|
|
50
|
-
const substitutions = [],
|
|
51
|
-
premisesMatch = matchPremises(this.premises, proofSteps, substitutions, this.fileContext, localContext);
|
|
52
|
-
|
|
53
|
-
if (premisesMatch) {
|
|
54
|
-
const conclusionMatches = matchConclusion(this.conclusion, statementNode, substitutions, this.fileContext, localContext);
|
|
55
|
-
|
|
56
|
-
premisesMatchConclusion = conclusionMatches; ///
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
if (premisesMatchConclusion) {
|
|
60
|
-
return true;
|
|
61
|
-
}
|
|
62
|
-
});
|
|
43
|
+
statementNatches = conclusionMatches; ///
|
|
63
44
|
}
|
|
64
45
|
|
|
65
46
|
return statementNatches;
|
|
66
47
|
}
|
|
67
48
|
|
|
68
49
|
matchMetastatement(metastatementNode, localMetaContext) {
|
|
69
|
-
let metastatementNatches;
|
|
70
|
-
|
|
71
|
-
const premisesLength = this.premises.length;
|
|
72
|
-
|
|
73
|
-
if (premisesLength === 0) {
|
|
74
|
-
const substitutions = [],
|
|
75
|
-
conclusionMatches = metaMatchConclusion(this.conclusion, metastatementNode, substitutions, this.fileContext, localMetaContext);
|
|
76
|
-
|
|
77
|
-
metastatementNatches = conclusionMatches; ///
|
|
78
|
-
} else {
|
|
79
|
-
const metaproofSteps = localMetaContext.getMetaproofSteps();
|
|
80
|
-
|
|
81
|
-
metastatementNatches = someSubArray(metaproofSteps, premisesLength, (metaproofSteps) => {
|
|
82
|
-
let premisesMatchConclusion = false;
|
|
50
|
+
let metastatementNatches = false;
|
|
83
51
|
|
|
84
|
-
|
|
85
|
-
|
|
52
|
+
const metaproofSteps = localMetaContext.getMetaproofSteps(),
|
|
53
|
+
substitutions = [],
|
|
54
|
+
premisesMatch = metaMatchPremises(this.premises, metaproofSteps, substitutions, this.fileContext, localMetaContext);
|
|
86
55
|
|
|
87
|
-
|
|
88
|
-
|
|
56
|
+
if (premisesMatch) {
|
|
57
|
+
const conclusionMatches = metaMatchConclusion(this.conclusion, metastatementNode, substitutions, this.fileContext, localMetaContext);
|
|
89
58
|
|
|
90
|
-
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (premisesMatchConclusion) {
|
|
94
|
-
return true;
|
|
95
|
-
}
|
|
96
|
-
});
|
|
59
|
+
metastatementNatches = conclusionMatches; ///
|
|
97
60
|
}
|
|
98
61
|
|
|
99
62
|
return metastatementNatches;
|
|
@@ -180,36 +143,34 @@ export default class Rule {
|
|
|
180
143
|
}
|
|
181
144
|
}
|
|
182
145
|
|
|
183
|
-
function matchPremise(premise,
|
|
184
|
-
|
|
185
|
-
const subproofNode = proofStep.getSubproofNode(),
|
|
186
|
-
statementNode = proofStep.getStatementNode();
|
|
146
|
+
function matchPremise(premise, proofStep, substitutions, fileContext, localContext) {
|
|
147
|
+
let premiseMatches = false;
|
|
187
148
|
|
|
188
|
-
|
|
189
|
-
|
|
149
|
+
const subproofNode = proofStep.getSubproofNode(),
|
|
150
|
+
statementNode = proofStep.getStatementNode();
|
|
190
151
|
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
}
|
|
194
|
-
}
|
|
152
|
+
if (subproofNode !== null) {
|
|
153
|
+
const subproofNodeMatches = premise.matchSubproofNode(subproofNode, substitutions, fileContext, localContext);
|
|
195
154
|
|
|
196
|
-
|
|
197
|
-
|
|
155
|
+
premiseMatches = subproofNodeMatches; ///
|
|
156
|
+
}
|
|
198
157
|
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
}) || null;
|
|
158
|
+
if (statementNode !== null) {
|
|
159
|
+
const statementNodeMatches = premise.matchStatementNode(statementNode, substitutions, fileContext, localContext);
|
|
204
160
|
|
|
205
|
-
|
|
161
|
+
premiseMatches = statementNodeMatches; ///
|
|
162
|
+
}
|
|
206
163
|
|
|
207
164
|
return premiseMatches;
|
|
208
165
|
}
|
|
209
166
|
|
|
210
|
-
function matchPremises(
|
|
211
|
-
|
|
212
|
-
|
|
167
|
+
function matchPremises(premises, proofSteps, substitutions, fileContext, localContext) {
|
|
168
|
+
premises = reverse(premises); ///
|
|
169
|
+
|
|
170
|
+
proofSteps = reverse(proofSteps); ///
|
|
171
|
+
|
|
172
|
+
const premisesMatch = correlate(premises, proofSteps, (premise, proofStep) => {
|
|
173
|
+
const premiseMatches = matchPremise(premise, proofStep, substitutions, fileContext, localContext);
|
|
213
174
|
|
|
214
175
|
if (premiseMatches) {
|
|
215
176
|
return true;
|
|
@@ -226,45 +187,41 @@ function matchConclusion(conclusion, statementNode, substitutions, fileContext,
|
|
|
226
187
|
return conclusionMatches;
|
|
227
188
|
}
|
|
228
189
|
|
|
229
|
-
function metaMatchPremise(premise,
|
|
230
|
-
|
|
231
|
-
const ruleSubproofNode = metaproofStep.getRuleSubproofNode(),
|
|
232
|
-
metaSubproofNode = metaproofStep.getMetaSubproofNode(),
|
|
233
|
-
metastatementNode = metaproofStep.getMetastatementNode()
|
|
190
|
+
function metaMatchPremise(premise, metaproofStep, substitutions, fileContext, localMetaContext) {
|
|
191
|
+
let premiseMatches = false;
|
|
234
192
|
|
|
235
|
-
|
|
236
|
-
|
|
193
|
+
const ruleSubproofNode = metaproofStep.getRuleSubproofNode(),
|
|
194
|
+
metaSubproofNode = metaproofStep.getMetaSubproofNode(),
|
|
195
|
+
metastatementNode = metaproofStep.getMetastatementNode()
|
|
237
196
|
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
}
|
|
241
|
-
}
|
|
197
|
+
if (ruleSubproofNode !== null) {
|
|
198
|
+
const ruleSubProofNodeMatches = premise.matchRuleSubproofNode(ruleSubproofNode, substitutions, fileContext, localMetaContext);
|
|
242
199
|
|
|
243
|
-
|
|
244
|
-
|
|
200
|
+
premiseMatches = ruleSubProofNodeMatches; ///
|
|
201
|
+
}
|
|
245
202
|
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}
|
|
249
|
-
}
|
|
203
|
+
if (metaSubproofNode !== null) {
|
|
204
|
+
const metaSubProofNodeMatches = premise.matchMetaSubproofNode(metaSubproofNode, substitutions, fileContext, localMetaContext);
|
|
250
205
|
|
|
251
|
-
|
|
252
|
-
|
|
206
|
+
premiseMatches = metaSubProofNodeMatches; ///
|
|
207
|
+
}
|
|
253
208
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
}) || null;
|
|
209
|
+
if (metastatementNode !== null) {
|
|
210
|
+
const metastatementNodeMatches = premise.matchMetastatementNode(metastatementNode, substitutions, fileContext, localMetaContext);
|
|
259
211
|
|
|
260
|
-
|
|
212
|
+
premiseMatches = metastatementNodeMatches; ///
|
|
213
|
+
}
|
|
261
214
|
|
|
262
215
|
return premiseMatches;
|
|
263
216
|
}
|
|
264
217
|
|
|
265
|
-
function metaMatchPremises(
|
|
266
|
-
|
|
267
|
-
|
|
218
|
+
function metaMatchPremises(premises, metaproofSteps, substitutions, fileContext, localMetaContext) {
|
|
219
|
+
premises = reverse(premises); ///
|
|
220
|
+
|
|
221
|
+
metaproofSteps = reverse(metaproofSteps); ///
|
|
222
|
+
|
|
223
|
+
const premisesMatch = correlate(premises, metaproofSteps, (premise, metaproofStep) => {
|
|
224
|
+
const premiseMatches = metaMatchPremise(premise, metaproofStep, substitutions, fileContext, localMetaContext);
|
|
268
225
|
|
|
269
226
|
if (premiseMatches) {
|
|
270
227
|
return true;
|
package/src/ruleNames.js
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
export const SUBPROOF_RULE_NAME = "subproof";
|
|
4
3
|
export const METAVARIABLE_RULE_NAME = "metavariable";
|
|
5
|
-
export const RULE_SUBPROOF_RULE_NAME = "ruleSubproof";
|
|
6
|
-
export const META_SUBPROOF_RULE_NAME = "metaSubproof";
|
|
7
4
|
export const META_ARGUMENT_RULE_NAME = "metaArgument";
|
|
8
|
-
export const QUALIFIED_STATEMENT_RULE_NAME = "qualifiedStatement";
|
|
9
5
|
export const VARIABLE_DECLARATION_RULE_NAME = "variableDeclaration";
|
|
10
6
|
export const UNQUALIFIED_STATEMENT_RULE_NAME = "unqualifiedStatement";
|
|
11
7
|
export const CONSTRUCTOR_DECLARATION_RULE_NAME = "constructorDeclaration";
|
|
12
|
-
export const QUALIFIED_METASTATEMENT_RULE_NAME = "qualifiedMetastatement";
|
|
13
8
|
export const UNQUALIFIED_METASTATEMENT_RULE_NAME = "unqualifiedMetastatement";
|
package/src/utilities/array.js
CHANGED
|
@@ -2,56 +2,36 @@
|
|
|
2
2
|
|
|
3
3
|
import { arrayUtilities } from "necessary";
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
export const { first, second, last, extract, push, match, filter, compress, separate } = arrayUtilities;
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
export function reverse(array) {
|
|
8
|
+
array = [ ///
|
|
9
|
+
...array
|
|
10
|
+
].reverse();
|
|
8
11
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
export function someSubArray(array, subArrayLength, callback) {
|
|
12
|
-
let found = false;
|
|
13
|
-
|
|
14
|
-
const arrayLength = array.length,
|
|
15
|
-
indexesLength = arrayLength, ///
|
|
16
|
-
permutationLength = subArrayLength; ///
|
|
17
|
-
|
|
18
|
-
if (permutationLength <= MAXIMUM_PERMUTATION_LENGTH) {
|
|
19
|
-
let offset,
|
|
20
|
-
permutations;
|
|
21
|
-
|
|
22
|
-
if (indexesLength > MAXIMUM_INDEXES_LENGTH) {
|
|
23
|
-
offset = indexesLength - MAXIMUM_INDEXES_LENGTH;
|
|
24
|
-
|
|
25
|
-
permutations = permutationsMatrix[MAXIMUM_INDEXES_LENGTH][permutationLength];
|
|
26
|
-
} else {
|
|
27
|
-
offset = 0;
|
|
28
|
-
|
|
29
|
-
permutations = permutationsMatrix[indexesLength][permutationLength];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
if (permutations !== null) {
|
|
33
|
-
found = permutations.some((permutation) => {
|
|
34
|
-
if (permutation !== null) {
|
|
35
|
-
const subArray = [];
|
|
12
|
+
return array;
|
|
13
|
+
}
|
|
36
14
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
15
|
+
export function correlate(arrayA, arrayB, callback) {
|
|
16
|
+
arrayB = [ ///
|
|
17
|
+
...arrayB
|
|
18
|
+
];
|
|
40
19
|
|
|
41
|
-
|
|
42
|
-
|
|
20
|
+
const correlates = arrayA.every((elementA) => {
|
|
21
|
+
const elementB = extract(arrayB, (elementB) => {
|
|
22
|
+
const result = callback(elementA, elementB);
|
|
43
23
|
|
|
44
|
-
|
|
24
|
+
if (result) {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
}) || null;
|
|
45
28
|
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
});
|
|
29
|
+
if (elementB !== null) {
|
|
30
|
+
return true;
|
|
51
31
|
}
|
|
52
|
-
}
|
|
32
|
+
});
|
|
53
33
|
|
|
54
|
-
return
|
|
34
|
+
return correlates;
|
|
55
35
|
}
|
|
56
36
|
|
|
57
37
|
export function leftDifference(arrayA, arrayB) {
|
|
@@ -1,20 +1,16 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
export function verifyNode(nodeQueryMaps, nonTerminalNode, ...remainingArguments) {
|
|
4
|
-
let nodeVerified;
|
|
4
|
+
let nodeVerified = false;
|
|
5
5
|
|
|
6
6
|
nodeVerified = nodeQueryMaps.some((nodeQueryMap) => {
|
|
7
|
-
let nodeVerified = false;
|
|
8
|
-
|
|
9
7
|
const { nodeQuery, verifyNode } = nodeQueryMap;
|
|
10
8
|
|
|
11
9
|
const node = nodeQuery(nonTerminalNode);
|
|
12
10
|
|
|
13
11
|
if (node !== null) {
|
|
14
12
|
nodeVerified = verifyNode(node, ...remainingArguments);
|
|
15
|
-
}
|
|
16
13
|
|
|
17
|
-
if (nodeVerified) {
|
|
18
14
|
return true;
|
|
19
15
|
}
|
|
20
16
|
});
|
|
@@ -23,11 +19,9 @@ export function verifyNode(nodeQueryMaps, nonTerminalNode, ...remainingArguments
|
|
|
23
19
|
}
|
|
24
20
|
|
|
25
21
|
export function verifyNodes(nodeQueryMaps, nonTerminalNodeA, nonTerminalNodeB, ...remainingArguments) {
|
|
26
|
-
let nodesVerified;
|
|
27
|
-
|
|
28
|
-
nodesVerified = nodeQueryMaps.some((nodeQueryMap) => {
|
|
29
|
-
let nodesVerified = false;
|
|
22
|
+
let nodesVerified = false;
|
|
30
23
|
|
|
24
|
+
nodeQueryMaps.some((nodeQueryMap) => {
|
|
31
25
|
const { nodeQueryA, nodeQueryB, verifyNodes } = nodeQueryMap;
|
|
32
26
|
|
|
33
27
|
const nodeA = nodeQueryA(nonTerminalNodeA), ///
|
|
@@ -35,9 +29,7 @@ export function verifyNodes(nodeQueryMaps, nonTerminalNodeA, nonTerminalNodeB, .
|
|
|
35
29
|
|
|
36
30
|
if ((nodeA !== null) && (nodeB !== null)) {
|
|
37
31
|
nodesVerified = verifyNodes(nodeA, nodeB, ...remainingArguments);
|
|
38
|
-
}
|
|
39
32
|
|
|
40
|
-
if (nodesVerified) {
|
|
41
33
|
return true;
|
|
42
34
|
}
|
|
43
35
|
});
|
|
@@ -41,22 +41,29 @@ class StatementAsCombinatorNodeVerifier extends NodeVerifier {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
verifyStatementNode(statementNode, localContext, verifyAhead) {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
let statementNodeVerified = false;
|
|
45
|
+
|
|
46
|
+
const standaloneStatementVerified = verifyStandaloneStatement(statementNode, localContext);
|
|
47
|
+
|
|
48
|
+
if (standaloneStatementVerified) {
|
|
49
|
+
const verifiedAhead = verifyAhead; ///
|
|
50
|
+
|
|
51
|
+
statementNodeVerified = verifiedAhead; ///
|
|
52
|
+
}
|
|
46
53
|
|
|
47
54
|
return statementNodeVerified;
|
|
48
55
|
}
|
|
49
56
|
|
|
50
57
|
verifyTermNode(termNode, localContext, verifyAhead) {
|
|
51
58
|
const standaloneTermVerified = verifyStandaloneTerm(termNode, localContext, verifyAhead),
|
|
52
|
-
|
|
59
|
+
termNodeVerified = standaloneTermVerified; ///
|
|
53
60
|
|
|
54
61
|
return termNodeVerified;
|
|
55
62
|
}
|
|
56
63
|
|
|
57
64
|
verifyTypeNode(typeNode, localContext, verifyAhead) {
|
|
58
65
|
const standaloneTypeVerified = verifyStandaloneType(typeNode, localContext, verifyAhead),
|
|
59
|
-
|
|
66
|
+
typeNodeVerified = standaloneTypeVerified; ///
|
|
60
67
|
|
|
61
68
|
return typeNodeVerified;
|
|
62
69
|
}
|
|
@@ -6,7 +6,8 @@ import verifyMetavariableAgainstMetastatement from "../../verify/metavariableAga
|
|
|
6
6
|
import { nodeQuery } from "../../utilities/query";
|
|
7
7
|
import { verifyNodes } from "../../utilities/verifier";
|
|
8
8
|
|
|
9
|
-
const
|
|
9
|
+
const nonTerminalNodeQuery = nodeQuery("/*"),
|
|
10
|
+
metastatementNodeQuery = nodeQuery("/metastatement!"),
|
|
10
11
|
metastatementMetavariableNodeQuery = nodeQuery("/metastatement/metavariable!");
|
|
11
12
|
|
|
12
13
|
class MetaLevelNodesVerifier extends NodesVerifier {
|
|
@@ -28,6 +29,22 @@ class MetaLevelNodesVerifier extends NodesVerifier {
|
|
|
28
29
|
|
|
29
30
|
nonTerminalNodeVerified = metastatementMetavariableNodeVerifiedAgainstMetastatementNode; ///
|
|
30
31
|
|
|
32
|
+
return nonTerminalNodeVerified;
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
nodeQueryA: nonTerminalNodeQuery,
|
|
37
|
+
nodeQueryB: nonTerminalNodeQuery,
|
|
38
|
+
verifyNodes: (nodeA, nodeB, substitutions, localMetaContextA, localMetaContextB, verifyAhead) => {
|
|
39
|
+
let nonTerminalNodeVerified;
|
|
40
|
+
|
|
41
|
+
const nonTerminalNodeA = nodeA, ///
|
|
42
|
+
nonTerminalNodeB = nodeB; ///
|
|
43
|
+
|
|
44
|
+
nonTerminalNodeVerified =
|
|
45
|
+
|
|
46
|
+
super.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localMetaContextA, localMetaContextB, verifyAhead);
|
|
47
|
+
|
|
31
48
|
return nonTerminalNodeVerified;
|
|
32
49
|
}
|
|
33
50
|
}
|
|
@@ -35,9 +52,7 @@ class MetaLevelNodesVerifier extends NodesVerifier {
|
|
|
35
52
|
|
|
36
53
|
const nodesVerified = verifyNodes(nodeQueryMaps, nonTerminalNodeA, nonTerminalNodeB, substitutions, localMetaContextA, localMetaContextB, verifyAhead);
|
|
37
54
|
|
|
38
|
-
nonTerminalNodeVerified = nodesVerified
|
|
39
|
-
true :
|
|
40
|
-
super.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, substitutions, localMetaContextA, localMetaContextB, verifyAhead);
|
|
55
|
+
nonTerminalNodeVerified = nodesVerified; ///
|
|
41
56
|
|
|
42
57
|
return nonTerminalNodeVerified;
|
|
43
58
|
}
|
|
@@ -4,7 +4,7 @@ import { isAssertionNegated } from "../utilities/verify";
|
|
|
4
4
|
import { nodeQuery, nodesQuery } from "../utilities/query";
|
|
5
5
|
|
|
6
6
|
const variableNodeQuery = nodeQuery("/containedAssertion/term/variable!"),
|
|
7
|
-
metastatementVariableNodesQuery = nodesQuery("/containedAssertion/
|
|
7
|
+
metastatementVariableNodesQuery = nodesQuery("/containedAssertion/statement//variable");
|
|
8
8
|
|
|
9
9
|
export default function verifyContainedAssertion(containedAssertionNode) {
|
|
10
10
|
let containedAssertionVerified = false;
|
package/src/verify/premise.js
CHANGED
|
@@ -33,11 +33,7 @@ export default function verifyQualifiedStatement(qualifiedStatementNode, assignm
|
|
|
33
33
|
if (qualifiedStatementVerified) {
|
|
34
34
|
const derived = false,
|
|
35
35
|
statementNode = statementNodeQuery(qualifiedStatementNode),
|
|
36
|
-
statementVerified = verifyStatement(statementNode, assignments, derived, localContext
|
|
37
|
-
const verifiedAhead = true;
|
|
38
|
-
|
|
39
|
-
return verifiedAhead;
|
|
40
|
-
});
|
|
36
|
+
statementVerified = verifyStatement(statementNode, assignments, derived, localContext);
|
|
41
37
|
|
|
42
38
|
qualifiedStatementVerified = statementVerified; ///
|
|
43
39
|
}
|
|
@@ -169,7 +165,7 @@ function verifyQualifiedStatementAAgainstConjecture(qualifiedStatementNode, meta
|
|
|
169
165
|
return qualifiedStatementVerifiedAgainstConjecture;
|
|
170
166
|
}
|
|
171
167
|
|
|
172
|
-
function verifyStatement(statementNode, assignments, derived, localContext
|
|
168
|
+
function verifyStatement(statementNode, assignments, derived, localContext) {
|
|
173
169
|
let statementVerified;
|
|
174
170
|
|
|
175
171
|
const statementString = localContext.nodeAsString(statementNode);
|
|
@@ -182,7 +178,7 @@ function verifyStatement(statementNode, assignments, derived, localContext, veri
|
|
|
182
178
|
];
|
|
183
179
|
|
|
184
180
|
verifyStatementFunctions.some((verifyStatementFunction) => {
|
|
185
|
-
const statementVerified = verifyStatementFunction(statementNode, assignments, derived, localContext
|
|
181
|
+
const statementVerified = verifyStatementFunction(statementNode, assignments, derived, localContext);
|
|
186
182
|
|
|
187
183
|
if (statementVerified) {
|
|
188
184
|
return true;
|
|
@@ -21,11 +21,7 @@ export default function verifyUnqualifiedStatement(unqualifiedStatementNode, ass
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
if (!unqualifiedStatementVerified) {
|
|
24
|
-
const statementVerified = verifyStatement(statementNode, assignments, derived, localContext
|
|
25
|
-
const verifiedAhead = true;
|
|
26
|
-
|
|
27
|
-
return verifiedAhead;
|
|
28
|
-
});
|
|
24
|
+
const statementVerified = verifyStatement(statementNode, assignments, derived, localContext);
|
|
29
25
|
|
|
30
26
|
unqualifiedStatementVerified = statementVerified; ///
|
|
31
27
|
}
|
package/src/verify/statement.js
CHANGED
|
@@ -10,12 +10,12 @@ import statementAgainstCombinatorNodesVerifier from "../verifier/nodes/statement
|
|
|
10
10
|
import { nodeQuery } from "../utilities/query";
|
|
11
11
|
|
|
12
12
|
const equalityNodeQuery = nodeQuery("/statement/equality!"),
|
|
13
|
-
statementNodeQuery = nodeQuery("/containedAssertion/
|
|
13
|
+
statementNodeQuery = nodeQuery("/containedAssertion/statement!"),
|
|
14
14
|
typeAssertionNodeQuery = nodeQuery("/statement/typeAssertion!"),
|
|
15
15
|
definedAssertionNodeQuery = nodeQuery("/statement/definedAssertion!"),
|
|
16
16
|
containedAssertionNodeQuery = nodeQuery("/statement/containedAssertion!");
|
|
17
17
|
|
|
18
|
-
function verifyStatement(statementNode, assignments, derived, localContext
|
|
18
|
+
function verifyStatement(statementNode, assignments, derived, localContext) {
|
|
19
19
|
let statementVerified;
|
|
20
20
|
|
|
21
21
|
const statementString = localContext.nodeAsString(statementNode);
|
|
@@ -31,7 +31,7 @@ function verifyStatement(statementNode, assignments, derived, localContext, veri
|
|
|
31
31
|
];
|
|
32
32
|
|
|
33
33
|
statementVerified = verifyStatementFunctions.some((verifyStatementFunction) => {
|
|
34
|
-
const statementVerified = verifyStatementFunction(statementNode, assignments, derived, localContext
|
|
34
|
+
const statementVerified = verifyStatementFunction(statementNode, assignments, derived, localContext);
|
|
35
35
|
|
|
36
36
|
if (statementVerified) {
|
|
37
37
|
return true;
|
|
@@ -45,7 +45,7 @@ function verifyStatement(statementNode, assignments, derived, localContext, veri
|
|
|
45
45
|
return statementVerified;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
export function verifyStandaloneStatement(statementNode, localContext
|
|
48
|
+
export function verifyStandaloneStatement(statementNode, localContext) {
|
|
49
49
|
let standaloneStatementVerified;
|
|
50
50
|
|
|
51
51
|
const statementString = localContext.nodeAsString(statementNode);
|
|
@@ -54,7 +54,7 @@ export function verifyStandaloneStatement(statementNode, localContext, verifyAhe
|
|
|
54
54
|
|
|
55
55
|
const derived = false,
|
|
56
56
|
assignments = [],
|
|
57
|
-
statementVerified = verifyStatement(statementNode, assignments, derived
|
|
57
|
+
statementVerified = verifyStatement(statementNode, assignments, derived);
|
|
58
58
|
|
|
59
59
|
standaloneStatementVerified = statementVerified; ///
|
|
60
60
|
|
|
@@ -71,7 +71,7 @@ Object.assign(statementAgainstCombinatorNodesVerifier, {
|
|
|
71
71
|
|
|
72
72
|
export default verifyStatement;
|
|
73
73
|
|
|
74
|
-
export function verifyStatementAsEquality(statementNode, assignments, derived, localContext
|
|
74
|
+
export function verifyStatementAsEquality(statementNode, assignments, derived, localContext) {
|
|
75
75
|
let statementVerifiedAsEquality = false;
|
|
76
76
|
|
|
77
77
|
const equalityNode = equalityNodeQuery(statementNode);
|
|
@@ -81,7 +81,11 @@ export function verifyStatementAsEquality(statementNode, assignments, derived, l
|
|
|
81
81
|
|
|
82
82
|
localContext.trace(`Verifying the '${statementString}' statement as an equality...`, equalityNode);
|
|
83
83
|
|
|
84
|
-
const equalityVerified = verifyEquality(equalityNode, assignments, derived, localContext,
|
|
84
|
+
const equalityVerified = verifyEquality(equalityNode, assignments, derived, localContext, () => {
|
|
85
|
+
const verifiedAhead = true;
|
|
86
|
+
|
|
87
|
+
return verifiedAhead;
|
|
88
|
+
});
|
|
85
89
|
|
|
86
90
|
statementVerifiedAsEquality = equalityVerified; ///
|
|
87
91
|
|
|
@@ -93,7 +97,7 @@ export function verifyStatementAsEquality(statementNode, assignments, derived, l
|
|
|
93
97
|
return statementVerifiedAsEquality;
|
|
94
98
|
}
|
|
95
99
|
|
|
96
|
-
export function verifyStatementAsTypeAssertion(statementNode, assignments, derived, localContext
|
|
100
|
+
export function verifyStatementAsTypeAssertion(statementNode, assignments, derived, localContext) {
|
|
97
101
|
let statementVerifiedAsTypeAssertion = false;
|
|
98
102
|
|
|
99
103
|
const typeAssertionNode = typeAssertionNodeQuery(statementNode);
|
|
@@ -103,7 +107,11 @@ export function verifyStatementAsTypeAssertion(statementNode, assignments, deriv
|
|
|
103
107
|
|
|
104
108
|
localContext.trace(`Verifying the '${statementString}' statement as a type assertion...`, typeAssertionNode);
|
|
105
109
|
|
|
106
|
-
const typeAssertionVerified = verifyTypeAssertion(typeAssertionNode, assignments, derived, localContext,
|
|
110
|
+
const typeAssertionVerified = verifyTypeAssertion(typeAssertionNode, assignments, derived, localContext, () => {
|
|
111
|
+
const verifiedAhead = true;
|
|
112
|
+
|
|
113
|
+
return verifiedAhead;
|
|
114
|
+
});
|
|
107
115
|
|
|
108
116
|
statementVerifiedAsTypeAssertion = typeAssertionVerified; ///
|
|
109
117
|
|
|
@@ -115,7 +123,7 @@ export function verifyStatementAsTypeAssertion(statementNode, assignments, deriv
|
|
|
115
123
|
return statementVerifiedAsTypeAssertion;
|
|
116
124
|
}
|
|
117
125
|
|
|
118
|
-
function verifyStatementAsDefinedAssertion(statementNode, assignments, derived, localContext
|
|
126
|
+
function verifyStatementAsDefinedAssertion(statementNode, assignments, derived, localContext) {
|
|
119
127
|
let statementVerifiedAsDefinedAssertion = false;
|
|
120
128
|
|
|
121
129
|
const definedAssertionNode = definedAssertionNodeQuery(statementNode);
|
|
@@ -125,7 +133,11 @@ function verifyStatementAsDefinedAssertion(statementNode, assignments, derived,
|
|
|
125
133
|
|
|
126
134
|
localContext.trace(`Verifying the '${statementString}' statement as a defined assertion...`, definedAssertionNode);
|
|
127
135
|
|
|
128
|
-
const definedAssertionVerified = verifyDefinedAssertion(definedAssertionNode, localContext,
|
|
136
|
+
const definedAssertionVerified = verifyDefinedAssertion(definedAssertionNode, localContext, () => {
|
|
137
|
+
const verifiedAhead = true;
|
|
138
|
+
|
|
139
|
+
return verifiedAhead;
|
|
140
|
+
});
|
|
129
141
|
|
|
130
142
|
statementVerifiedAsDefinedAssertion = definedAssertionVerified; ///
|
|
131
143
|
|
|
@@ -137,7 +149,7 @@ function verifyStatementAsDefinedAssertion(statementNode, assignments, derived,
|
|
|
137
149
|
return statementVerifiedAsDefinedAssertion;
|
|
138
150
|
}
|
|
139
151
|
|
|
140
|
-
function verifyStatementAsContainedAssertion(statementNode, assignments, derived, localContext
|
|
152
|
+
function verifyStatementAsContainedAssertion(statementNode, assignments, derived, localContext) {
|
|
141
153
|
let statementVerifiedAsContainedAssertion = false;
|
|
142
154
|
|
|
143
155
|
const containedAssertionNode = containedAssertionNodeQuery(statementNode);
|
|
@@ -160,7 +172,7 @@ function verifyStatementAsContainedAssertion(statementNode, assignments, derived
|
|
|
160
172
|
const statementVerified = verifyStatementFunctions.some((verifyStatementFunction) => {
|
|
161
173
|
const derived = false,
|
|
162
174
|
assignments = [],
|
|
163
|
-
statementVerified = verifyStatementFunction(statementNode, assignments, derived, localContext
|
|
175
|
+
statementVerified = verifyStatementFunction(statementNode, assignments, derived, localContext);
|
|
164
176
|
|
|
165
177
|
if (statementVerified) {
|
|
166
178
|
return true;
|
|
@@ -178,7 +190,7 @@ function verifyStatementAsContainedAssertion(statementNode, assignments, derived
|
|
|
178
190
|
return statementVerifiedAsContainedAssertion;
|
|
179
191
|
}
|
|
180
192
|
|
|
181
|
-
function verifyStatementAgainstCombinators(statementNode, assignments, derived, localContext
|
|
193
|
+
function verifyStatementAgainstCombinators(statementNode, assignments, derived, localContext) {
|
|
182
194
|
let statementVerifiedAgainstCombinators = false;
|
|
183
195
|
|
|
184
196
|
const equalityNode = equalityNodeQuery(statementNode),
|
|
@@ -195,7 +207,7 @@ function verifyStatementAgainstCombinators(statementNode, assignments, derived,
|
|
|
195
207
|
];
|
|
196
208
|
|
|
197
209
|
statementVerifiedAgainstCombinators = combinators.some((combinator) => {
|
|
198
|
-
const statementVerifiedAgainstCombinator = verifyStatementAgainstCombinator(statementNode, combinator, localContext
|
|
210
|
+
const statementVerifiedAgainstCombinator = verifyStatementAgainstCombinator(statementNode, combinator, localContext);
|
|
199
211
|
|
|
200
212
|
if (statementVerifiedAgainstCombinator) {
|
|
201
213
|
return true;
|
|
@@ -206,7 +218,7 @@ function verifyStatementAgainstCombinators(statementNode, assignments, derived,
|
|
|
206
218
|
return statementVerifiedAgainstCombinators;
|
|
207
219
|
}
|
|
208
220
|
|
|
209
|
-
function verifyStatementAgainstCombinator(statementNode, combinator, localContext
|
|
221
|
+
function verifyStatementAgainstCombinator(statementNode, combinator, localContext) {
|
|
210
222
|
let statementVerifiedAgainstCombinator;
|
|
211
223
|
|
|
212
224
|
const statementString = localContext.nodeAsString(statementNode),
|
|
@@ -217,7 +229,11 @@ function verifyStatementAgainstCombinator(statementNode, combinator, localContex
|
|
|
217
229
|
const combinatorStatementNode = combinator.getStatementNode(),
|
|
218
230
|
nonTerminalNodeA = statementNode, ///
|
|
219
231
|
nonTerminalNodeB = combinatorStatementNode, ///
|
|
220
|
-
nonTerminalNodeVerified = statementAgainstCombinatorNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, localContext,
|
|
232
|
+
nonTerminalNodeVerified = statementAgainstCombinatorNodesVerifier.verifyNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, localContext, () => {
|
|
233
|
+
const verifiedAhead = true;
|
|
234
|
+
|
|
235
|
+
return verifiedAhead;
|
|
236
|
+
});
|
|
221
237
|
|
|
222
238
|
statementVerifiedAgainstCombinator = nonTerminalNodeVerified; ///
|
|
223
239
|
|