occam-verify-cli 0.0.525 → 0.0.526
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/axiomLemmaTheorem.js +5 -5
- package/lib/combinator.js +5 -5
- package/lib/conclusion.js +3 -3
- package/lib/consequence.js +3 -3
- package/lib/constructor.js +6 -6
- package/lib/context/file.js +24 -8
- package/lib/context/metaproof.js +13 -1
- package/lib/context/proof.js +13 -1
- package/lib/label.js +5 -5
- package/lib/premise.js +3 -3
- package/lib/rule.js +5 -5
- package/lib/supposition.js +3 -3
- package/lib/type.js +5 -5
- package/lib/utilities/string.js +15 -10
- package/lib/variable.js +2 -2
- package/lib/verify/assertion/type.js +3 -3
- package/lib/verify/axiom.js +2 -2
- package/lib/verify/conclusion.js +2 -3
- package/lib/verify/consequence.js +3 -4
- package/lib/verify/label.js +2 -3
- package/lib/verify/lemma.js +2 -2
- package/lib/verify/metastatement/qualified.js +3 -3
- package/lib/verify/metastatement/unqualified.js +3 -3
- package/lib/verify/premise.js +3 -4
- package/lib/verify/rule.js +2 -2
- package/lib/verify/statement/qualified.js +3 -3
- package/lib/verify/statement/unqualified.js +3 -3
- package/lib/verify/statement.js +4 -5
- package/lib/verify/statementAsCombinator.js +2 -3
- package/lib/verify/supposition.js +3 -4
- package/lib/verify/term.js +3 -4
- package/lib/verify/termAsConstructor.js +4 -5
- package/lib/verify/theorem.js +2 -2
- package/lib/verify/type.js +2 -3
- package/lib/verify/variable.js +2 -3
- package/package.json +1 -1
- package/src/axiomLemmaTheorem.js +4 -4
- package/src/combinator.js +4 -4
- package/src/conclusion.js +2 -2
- package/src/consequence.js +2 -2
- package/src/constructor.js +6 -6
- package/src/context/file.js +20 -7
- package/src/context/metaproof.js +4 -0
- package/src/context/proof.js +4 -0
- package/src/label.js +4 -4
- package/src/premise.js +2 -2
- package/src/rule.js +4 -4
- package/src/supposition.js +2 -2
- package/src/type.js +4 -4
- package/src/utilities/string.js +23 -15
- package/src/variable.js +1 -1
- package/src/verify/assertion/type.js +2 -2
- package/src/verify/axiom.js +1 -1
- package/src/verify/conclusion.js +1 -2
- package/src/verify/consequence.js +2 -3
- package/src/verify/label.js +1 -2
- package/src/verify/lemma.js +1 -1
- package/src/verify/metastatement/qualified.js +2 -2
- package/src/verify/metastatement/unqualified.js +2 -2
- package/src/verify/premise.js +2 -3
- package/src/verify/rule.js +1 -1
- package/src/verify/statement/qualified.js +2 -2
- package/src/verify/statement/unqualified.js +2 -2
- package/src/verify/statement.js +3 -4
- package/src/verify/statementAsCombinator.js +1 -2
- package/src/verify/supposition.js +2 -3
- package/src/verify/term.js +2 -3
- package/src/verify/termAsConstructor.js +3 -4
- package/src/verify/theorem.js +1 -1
- package/src/verify/type.js +1 -2
- package/src/verify/variable.js +1 -2
package/src/context/file.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
import { rewriteNodes } from "occam-grammar-utilities";
|
|
4
4
|
|
|
5
5
|
import { push } from "../utilities/array";
|
|
6
|
+
import { nodeAsString, nodesAsString } from "../utilities/string";
|
|
6
7
|
import { leastLineIndexFromNodeAndTokens, greatestLineIndexFromNodeAndTokens } from "../utilities/tokens";
|
|
7
8
|
|
|
8
9
|
export default class FileContext {
|
|
@@ -343,6 +344,18 @@ export default class FileContext {
|
|
|
343
344
|
this.constructors.push(constructor);
|
|
344
345
|
}
|
|
345
346
|
|
|
347
|
+
nodeAsString(node) {
|
|
348
|
+
const string = nodeAsString(node, this.tokens);
|
|
349
|
+
|
|
350
|
+
return string;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
nodesAsString(node) {
|
|
354
|
+
const string = nodesAsString(node, this.tokens);
|
|
355
|
+
|
|
356
|
+
return string;
|
|
357
|
+
}
|
|
358
|
+
|
|
346
359
|
trace(message) { this.releaseContext.trace(message); }
|
|
347
360
|
|
|
348
361
|
debug(message) { this.releaseContext.debug(message); }
|
|
@@ -380,43 +393,43 @@ export default class FileContext {
|
|
|
380
393
|
const json = [];
|
|
381
394
|
|
|
382
395
|
this.types.forEach((type) => {
|
|
383
|
-
const typeJSON = type.toJSON();
|
|
396
|
+
const typeJSON = type.toJSON(this.tokens);
|
|
384
397
|
|
|
385
398
|
json.push(typeJSON);
|
|
386
399
|
});
|
|
387
400
|
|
|
388
401
|
this.rules.forEach((rule) => {
|
|
389
|
-
const ruleJSON = rule.toJSON();
|
|
402
|
+
const ruleJSON = rule.toJSON(this.tokens);
|
|
390
403
|
|
|
391
404
|
json.push(ruleJSON);
|
|
392
405
|
});
|
|
393
406
|
|
|
394
407
|
this.axioms.forEach((axiom) => {
|
|
395
|
-
const axiomJSON = axiom.toJSON();
|
|
408
|
+
const axiomJSON = axiom.toJSON(this.tokens);
|
|
396
409
|
|
|
397
410
|
json.push(axiomJSON);
|
|
398
411
|
});
|
|
399
412
|
|
|
400
413
|
this.lemmas.forEach((lemma) => {
|
|
401
|
-
const lemmaJSON = lemma.toJSON();
|
|
414
|
+
const lemmaJSON = lemma.toJSON(this.tokens);
|
|
402
415
|
|
|
403
416
|
json.push(lemmaJSON);
|
|
404
417
|
});
|
|
405
418
|
|
|
406
419
|
this.theorems.forEach((theorem) => {
|
|
407
|
-
const theoremJSON = theorem.toJSON();
|
|
420
|
+
const theoremJSON = theorem.toJSON(this.tokens);
|
|
408
421
|
|
|
409
422
|
json.push(theoremJSON);
|
|
410
423
|
});
|
|
411
424
|
|
|
412
425
|
this.combinators.forEach((combinator) => {
|
|
413
|
-
const combinatorJSON = combinator.toJSON();
|
|
426
|
+
const combinatorJSON = combinator.toJSON(this.tokens);
|
|
414
427
|
|
|
415
428
|
json.push(combinatorJSON);
|
|
416
429
|
});
|
|
417
430
|
|
|
418
431
|
this.constructors.forEach((constructor) => {
|
|
419
|
-
const constructorJSON = constructor.toJSON();
|
|
432
|
+
const constructorJSON = constructor.toJSON(this.tokens);
|
|
420
433
|
|
|
421
434
|
json.push(constructorJSON)
|
|
422
435
|
});
|
package/src/context/metaproof.js
CHANGED
|
@@ -61,6 +61,10 @@ class MetaproofContext {
|
|
|
61
61
|
return metastatementMatches;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
+
nodeAsString(node) { return this.context.nodeAsString(node); }
|
|
65
|
+
|
|
66
|
+
nodesAsString(node) { return this.context.nodesAsString(node); }
|
|
67
|
+
|
|
64
68
|
static fromFileContext(fileContext) {
|
|
65
69
|
const context = fileContext, ///
|
|
66
70
|
metaproofSteps = [],
|
package/src/context/proof.js
CHANGED
|
@@ -121,6 +121,10 @@ class ProofContext {
|
|
|
121
121
|
|
|
122
122
|
isTypePresentByTypeName(typeName) { return this.context.isTypePresentByTypeName(typeName); }
|
|
123
123
|
|
|
124
|
+
nodeAsString(node) { return this.context.nodeAsString(node); }
|
|
125
|
+
|
|
126
|
+
nodesAsString(node) { return this.context.nodesAsString(node); }
|
|
127
|
+
|
|
124
128
|
static fromFileContext(fileContext) {
|
|
125
129
|
const context = fileContext, ///
|
|
126
130
|
variables = [],
|
package/src/label.js
CHANGED
|
@@ -21,14 +21,14 @@ export default class Label {
|
|
|
21
21
|
return matchesName;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
asString() {
|
|
25
|
-
const string = nodeAsString(this.node);
|
|
24
|
+
asString(tokens) {
|
|
25
|
+
const string = nodeAsString(this.node, tokens);
|
|
26
26
|
|
|
27
27
|
return string;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
toJSON() {
|
|
31
|
-
const string = nodeAsString(this.node),
|
|
30
|
+
toJSON(tokens) {
|
|
31
|
+
const string = nodeAsString(this.node, tokens),
|
|
32
32
|
json = string; ///
|
|
33
33
|
|
|
34
34
|
return json;
|
package/src/premise.js
CHANGED
|
@@ -106,8 +106,8 @@ export default class Premise {
|
|
|
106
106
|
return metastatementNodeMatches;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
toJSON() {
|
|
110
|
-
const metastatementString = nodeAsString(this.metastatementNode),
|
|
109
|
+
toJSON(tokens) {
|
|
110
|
+
const metastatementString = nodeAsString(this.metastatementNode, tokens),
|
|
111
111
|
metastatement = metastatementString, ///
|
|
112
112
|
json = {
|
|
113
113
|
metastatement
|
package/src/rule.js
CHANGED
|
@@ -108,18 +108,18 @@ export default class Rule {
|
|
|
108
108
|
return metastatementNatches;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
toJSON() {
|
|
111
|
+
toJSON(tokens) {
|
|
112
112
|
const labelsJSON = this.labels.map((label) => {
|
|
113
|
-
const labelJSON = label.toJSON();
|
|
113
|
+
const labelJSON = label.toJSON(tokens);
|
|
114
114
|
|
|
115
115
|
return labelJSON;
|
|
116
116
|
}),
|
|
117
117
|
premisesJSON = this.premises.map((premise) => {
|
|
118
|
-
const premiseJSON = premise.toJSON();
|
|
118
|
+
const premiseJSON = premise.toJSON(tokens);
|
|
119
119
|
|
|
120
120
|
return premiseJSON;
|
|
121
121
|
}),
|
|
122
|
-
conclusionJSON = this.conclusion.toJSON(),
|
|
122
|
+
conclusionJSON = this.conclusion.toJSON(tokens),
|
|
123
123
|
kind = RULE_KIND,
|
|
124
124
|
labels = labelsJSON, ///
|
|
125
125
|
premises = premisesJSON, ///
|
package/src/supposition.js
CHANGED
|
@@ -61,8 +61,8 @@ export default class Supposition {
|
|
|
61
61
|
return statementNodeMatches;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
toJSON() {
|
|
65
|
-
const statementString = nodeAsString(this.statementNode),
|
|
64
|
+
toJSON(tokens) {
|
|
65
|
+
const statementString = nodeAsString(this.statementNode, tokens),
|
|
66
66
|
statement = statementString, ///
|
|
67
67
|
json = {
|
|
68
68
|
statement
|
package/src/type.js
CHANGED
|
@@ -96,7 +96,7 @@ export default class Type {
|
|
|
96
96
|
return matchesTypeName;
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
asString(noSuperType) {
|
|
99
|
+
asString(tokens, noSuperType) {
|
|
100
100
|
let string;
|
|
101
101
|
|
|
102
102
|
if (noSuperType) {
|
|
@@ -110,8 +110,8 @@ export default class Type {
|
|
|
110
110
|
return string;
|
|
111
111
|
}
|
|
112
112
|
|
|
113
|
-
toJSON() {
|
|
114
|
-
const superTypeJSON = this.superType.toJSON(),
|
|
113
|
+
toJSON(tokens) {
|
|
114
|
+
const superTypeJSON = this.superType.toJSON(tokens),
|
|
115
115
|
kind = TYPE_KIND,
|
|
116
116
|
name = this.name,
|
|
117
117
|
superType = superTypeJSON, ///
|
|
@@ -157,7 +157,7 @@ export default class Type {
|
|
|
157
157
|
}
|
|
158
158
|
|
|
159
159
|
class ObjectType extends Type {
|
|
160
|
-
toJSON() {
|
|
160
|
+
toJSON(tokens) {
|
|
161
161
|
const kind = TYPE_KIND,
|
|
162
162
|
name = this.name,
|
|
163
163
|
superType = null, ///
|
package/src/utilities/string.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { COMMA } from "../constants";
|
|
4
3
|
import { nodeQuery } from "../utilities/query";
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
CONSTRUCTOR_DECLARATIONRULE_NAME,
|
|
8
|
-
UNQUALIFIED_METASTATEMENT_RULE_NAME } from "../ruleNames";
|
|
4
|
+
import { COMMA, EMPTY_STRING } from "../constants";
|
|
5
|
+
import { LABEL_RULE_NAME, UNQUALIFIED_STATEMENT_RULE_NAME, CONSTRUCTOR_DECLARATIONRULE_NAME, UNQUALIFIED_METASTATEMENT_RULE_NAME } from "../ruleNames";
|
|
9
6
|
|
|
10
7
|
const termNodeQuery = nodeQuery("/constructorDeclaration/term!"),
|
|
11
8
|
statementNodeQuery = nodeQuery("/unqualifiedStatement/statement!"),
|
|
12
9
|
metastatementNodeQuery = nodeQuery("/unqualifiedMetastatement/metastatement!");
|
|
13
10
|
|
|
14
|
-
export function nodeAsString(node) {
|
|
11
|
+
export function nodeAsString(node, tokens) {
|
|
15
12
|
let string = null;
|
|
16
13
|
|
|
17
14
|
if (node !== null) {
|
|
@@ -24,24 +21,35 @@ export function nodeAsString(node) {
|
|
|
24
21
|
string = content; ///
|
|
25
22
|
} else {
|
|
26
23
|
const nonTerminalNode = node, ///
|
|
27
|
-
|
|
24
|
+
firstSignificantToken = nonTerminalNode.getFirstSignificantToken(),
|
|
25
|
+
lastSignificantToken = nonTerminalNode.getLastSignificantToken(),
|
|
26
|
+
firstSignificantTokenIndex = tokens.indexOf(firstSignificantToken),
|
|
27
|
+
lastSignificantTokenIndex = tokens.indexOf(lastSignificantToken),
|
|
28
|
+
start = firstSignificantTokenIndex, ///
|
|
29
|
+
end = lastSignificantTokenIndex + 1;
|
|
28
30
|
|
|
29
|
-
|
|
30
|
-
const nodeString = nodeAsString(childNode);
|
|
31
|
+
tokens = tokens.slice(start, end); ///
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
string = tokens.reduce((string, token) => {
|
|
34
|
+
const content = token.getContent();
|
|
35
|
+
|
|
36
|
+
string = `${string}${content}`;
|
|
37
|
+
|
|
38
|
+
return string;
|
|
39
|
+
}, EMPTY_STRING);
|
|
36
40
|
}
|
|
37
41
|
}
|
|
38
42
|
|
|
43
|
+
if (string !== null) {
|
|
44
|
+
string = string.replace(/[\r\n]/, EMPTY_STRING)
|
|
45
|
+
}
|
|
46
|
+
|
|
39
47
|
return string;
|
|
40
48
|
}
|
|
41
49
|
|
|
42
|
-
export function nodesAsString(nodes) {
|
|
50
|
+
export function nodesAsString(nodes, tokens) {
|
|
43
51
|
const string = nodes.reduce((string, node) => {
|
|
44
|
-
const nodeString = nodeAsString(node);
|
|
52
|
+
const nodeString = nodeAsString(node, tokens);
|
|
45
53
|
|
|
46
54
|
if (string === null) {
|
|
47
55
|
string = nodeString; ///
|
package/src/variable.js
CHANGED
|
@@ -15,7 +15,7 @@ export default function verifyTypeAssertion(typeAssertionNode, assertions, proof
|
|
|
15
15
|
|
|
16
16
|
proofContext.begin(typeAssertionNode);
|
|
17
17
|
|
|
18
|
-
const typeAssertionString = nodeAsString(typeAssertionNode);
|
|
18
|
+
const typeAssertionString = proofContext.nodeAsString(typeAssertionNode);
|
|
19
19
|
|
|
20
20
|
proofContext.debug(`Verifying the '${typeAssertionString}' type assertion...`);
|
|
21
21
|
|
|
@@ -110,7 +110,7 @@ function verifyTermTypeAssertion(typeAssertionNode, assertions, proofContext) {
|
|
|
110
110
|
assertedType = proofContext.findTypeByTypeName(assertedTypeName),
|
|
111
111
|
firstType = first(types),
|
|
112
112
|
termType = firstType,
|
|
113
|
-
termString = nodeAsString(termNode),
|
|
113
|
+
termString = proofContext.nodeAsString(termNode),
|
|
114
114
|
assertedTypeEqualToTermType = (termType === null) ?
|
|
115
115
|
true : ///
|
|
116
116
|
assertedType.isEqualTo(termType);
|
package/src/verify/axiom.js
CHANGED
|
@@ -20,7 +20,7 @@ export default function verifyAxiom(axiomNode, fileContext) {
|
|
|
20
20
|
fileContext.begin(axiomNode);
|
|
21
21
|
|
|
22
22
|
const labelNodes = labelNodesQuery(axiomNode),
|
|
23
|
-
labelsString = nodesAsString(labelNodes),
|
|
23
|
+
labelsString = fileContext.nodesAsString(labelNodes),
|
|
24
24
|
proofContext = ProofContext.fromFileContext(fileContext);
|
|
25
25
|
|
|
26
26
|
fileContext.debug(`Verifying the '${labelsString}' axiom...`);
|
package/src/verify/conclusion.js
CHANGED
|
@@ -4,7 +4,6 @@ import Conclusion from "../conclusion";
|
|
|
4
4
|
import verifyUnqualifiedMetastatement from "./metastatement/unqualified";
|
|
5
5
|
|
|
6
6
|
import { nodeQuery } from "../utilities/query";
|
|
7
|
-
import { nodeAsString } from "../utilities/string";
|
|
8
7
|
|
|
9
8
|
const metastatementNodeQuery = nodeQuery("/unqualifiedMetastatement/metastatement!"),
|
|
10
9
|
unqualifiedMetastatementNodeQuery = nodeQuery("/conclusion/unqualifiedMetastatement!");
|
|
@@ -14,7 +13,7 @@ export default function verifyConclusion(conclusionNode, conclusions, metaproofC
|
|
|
14
13
|
|
|
15
14
|
metaproofContext.begin(conclusionNode);
|
|
16
15
|
|
|
17
|
-
const conclusionString = nodeAsString(conclusionNode);
|
|
16
|
+
const conclusionString = metaproofContext.nodeAsString(conclusionNode);
|
|
18
17
|
|
|
19
18
|
metaproofContext.debug(`Verifying the '${conclusionString}' conclusion...`);
|
|
20
19
|
|
|
@@ -4,7 +4,6 @@ import Consequence from "../consequence";
|
|
|
4
4
|
import verifyUnqualifiedStatement from "./statement/unqualified";
|
|
5
5
|
|
|
6
6
|
import { nodeQuery } from "../utilities/query";
|
|
7
|
-
import { nodeAsString } from "../utilities/string";
|
|
8
7
|
|
|
9
8
|
const statementNodeQuery = nodeQuery("/unqualifiedStatement/statement!"),
|
|
10
9
|
unqualifiedStatementNodeQuery = nodeQuery("/consequence/unqualifiedStatement!");
|
|
@@ -14,9 +13,9 @@ export default function verifyConsequence(consequenceNode, consequences, proofCo
|
|
|
14
13
|
|
|
15
14
|
proofContext.begin(consequenceNode);
|
|
16
15
|
|
|
17
|
-
const consequenceString = nodeAsString(consequenceNode);
|
|
16
|
+
const consequenceString = proofContext.nodeAsString(consequenceNode);
|
|
18
17
|
|
|
19
|
-
proofContext.debug(`Verifying the ${consequenceString} consequence...`);
|
|
18
|
+
proofContext.debug(`Verifying the '${consequenceString}' consequence...`);
|
|
20
19
|
|
|
21
20
|
const derived = false,
|
|
22
21
|
assertions = [],
|
package/src/verify/label.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import Label from "../label";
|
|
4
4
|
|
|
5
|
-
import { nodeAsString } from "../utilities/string";
|
|
6
5
|
import { labelNameFromLabelNode } from "../utilities/query";
|
|
7
6
|
|
|
8
7
|
export default function verifyLabel(labelNode, labels, fileContext) {
|
|
@@ -14,7 +13,7 @@ export default function verifyLabel(labelNode, labels, fileContext) {
|
|
|
14
13
|
labelPresent = fileContext.isLabelPresentByLabelName(labelName);
|
|
15
14
|
|
|
16
15
|
if (labelPresent) {
|
|
17
|
-
const labelString = nodeAsString(labelNode);
|
|
16
|
+
const labelString = fileContext.nodeAsString(labelNode);
|
|
18
17
|
|
|
19
18
|
fileContext.error(`The '${labelString}' label is already present.`, labelNode);
|
|
20
19
|
} else {
|
package/src/verify/lemma.js
CHANGED
|
@@ -23,7 +23,7 @@ export default function verifyLemma(lemmaNode, fileContext) {
|
|
|
23
23
|
fileContext.begin(lemmaNode);
|
|
24
24
|
|
|
25
25
|
const labelNodes = labelNodesQuery(lemmaNode),
|
|
26
|
-
labelsString = nodesAsString(labelNodes),
|
|
26
|
+
labelsString = fileContext.nodesAsString(labelNodes),
|
|
27
27
|
proofContext = ProofContext.fromFileContext(fileContext);
|
|
28
28
|
|
|
29
29
|
(labelsString === EMPTY_STRING) ?
|
|
@@ -16,9 +16,9 @@ export default function verifyQualifiedMetastatement(qualifiedMetastatementNode,
|
|
|
16
16
|
const metastatementNode = metastatementNodeQuery(qualifiedMetastatementNode);
|
|
17
17
|
|
|
18
18
|
if (metastatementNode !== null) {
|
|
19
|
-
const metastatementString = nodeAsString(metastatementNode);
|
|
19
|
+
const metastatementString = metaproofContext.nodeAsString(metastatementNode);
|
|
20
20
|
|
|
21
|
-
metaproofContext.debug(`Verifying the ${metastatementString} qualified metastatement...`);
|
|
21
|
+
metaproofContext.debug(`Verifying the '${metastatementString}' qualified metastatement...`);
|
|
22
22
|
|
|
23
23
|
let ruleMatchesMetastatement = true;
|
|
24
24
|
|
|
@@ -15,9 +15,9 @@ export default function verifyUnqualifiedMetastatement(unqualifiedMetastatementN
|
|
|
15
15
|
const metastatementNode = metastatementNodeQuery(unqualifiedMetastatementNode);
|
|
16
16
|
|
|
17
17
|
if (metastatementNode !== null) {
|
|
18
|
-
const metastatementString = nodeAsString(metastatementNode);
|
|
18
|
+
const metastatementString = metaproofContext.nodeAsString(metastatementNode);
|
|
19
19
|
|
|
20
|
-
metaproofContext.debug(`Verifying the ${metastatementString} unqualified metastatement...`);
|
|
20
|
+
metaproofContext.debug(`Verifying the '${metastatementString}' unqualified metastatement...`);
|
|
21
21
|
|
|
22
22
|
let metastatementMatches = true;
|
|
23
23
|
|
package/src/verify/premise.js
CHANGED
|
@@ -5,7 +5,6 @@ import MetaproofStep from "../step/metaproof";
|
|
|
5
5
|
import verifyUnqualifiedMetastatement from "../verify/metastatement/unqualified";
|
|
6
6
|
|
|
7
7
|
import { nodeQuery } from "../utilities/query";
|
|
8
|
-
import { nodeAsString } from "../utilities/string";
|
|
9
8
|
|
|
10
9
|
const metastatementNodeQuery = nodeQuery("/unqualifiedMetastatement/metastatement!"),
|
|
11
10
|
unqualifiedMetastatementNodeQuery = nodeQuery("/premise/unqualifiedMetastatement!");
|
|
@@ -15,9 +14,9 @@ export default function verifyPremise(premiseNode, premises, metaproofContext) {
|
|
|
15
14
|
|
|
16
15
|
metaproofContext.begin(premiseNode);
|
|
17
16
|
|
|
18
|
-
const premiseString = nodeAsString(premiseNode);
|
|
17
|
+
const premiseString = metaproofContext.nodeAsString(premiseNode);
|
|
19
18
|
|
|
20
|
-
metaproofContext.debug(`Verifying the ${premiseString} premise...`);
|
|
19
|
+
metaproofContext.debug(`Verifying the '${premiseString}' premise...`);
|
|
21
20
|
|
|
22
21
|
const derived = false,
|
|
23
22
|
assertions = [],
|
package/src/verify/rule.js
CHANGED
|
@@ -22,7 +22,7 @@ export default function verifyRule(ruleNode, fileContext) {
|
|
|
22
22
|
fileContext.begin(ruleNode);
|
|
23
23
|
|
|
24
24
|
const labelNodes = labelNodesQuery(ruleNode),
|
|
25
|
-
labelsString = nodesAsString(labelNodes),
|
|
25
|
+
labelsString = fileContext.nodesAsString(labelNodes),
|
|
26
26
|
metaProofContext = MetaproofContext.fromFileContext(fileContext);
|
|
27
27
|
|
|
28
28
|
fileContext.debug(`Verifying the '${labelsString}' rule...`);
|
|
@@ -16,9 +16,9 @@ export default function verifyQualifiedStatement(qualifiedStatementNode, asserti
|
|
|
16
16
|
const statementNode = statementNodeQuery(qualifiedStatementNode);
|
|
17
17
|
|
|
18
18
|
if (statementNode !== null) {
|
|
19
|
-
const statementString = nodeAsString(statementNode);
|
|
19
|
+
const statementString = proofContext.nodeAsString(statementNode);
|
|
20
20
|
|
|
21
|
-
proofContext.debug(`Verifying the ${statementString} qualified statement...`);
|
|
21
|
+
proofContext.debug(`Verifying the '${statementString}' qualified statement...`);
|
|
22
22
|
|
|
23
23
|
let ruleMatchesStatement = true;
|
|
24
24
|
|
|
@@ -15,9 +15,9 @@ export default function verifyUnqualifiedStatement(unqualifiedStatementNode, ass
|
|
|
15
15
|
const statementNode = statementNodeQuery(unqualifiedStatementNode);
|
|
16
16
|
|
|
17
17
|
if (statementNode !== null) {
|
|
18
|
-
const statementString = nodeAsString(statementNode);
|
|
18
|
+
const statementString = proofContext.nodeAsString(statementNode);
|
|
19
19
|
|
|
20
|
-
proofContext.debug(`Verifying the ${statementString} unqualified statement...`);
|
|
20
|
+
proofContext.debug(`Verifying the '${statementString}' unqualified statement...`);
|
|
21
21
|
|
|
22
22
|
let statementMatches = true;
|
|
23
23
|
|
package/src/verify/statement.js
CHANGED
|
@@ -8,7 +8,6 @@ import verifyTypeAssertion from "../verify/assertion/type";
|
|
|
8
8
|
|
|
9
9
|
import { first } from "../utilities/array";
|
|
10
10
|
import { objectType } from "../type";
|
|
11
|
-
import { nodeAsString } from "../utilities/string";
|
|
12
11
|
import { OBJECT_TYPE_NAME } from "../typeNames";
|
|
13
12
|
import { STATEMENT_META_TYPE } from "../metaTypes";
|
|
14
13
|
import { MAXIMUM_INDEXES_LENGTH } from "../constants";
|
|
@@ -230,7 +229,7 @@ function verifyArgumentNode(argumentNode, combinatorArgumentNode, context) {
|
|
|
230
229
|
const termNode = termNodeQuery(argumentNode);
|
|
231
230
|
|
|
232
231
|
if (termNode === null) {
|
|
233
|
-
const argumentString = nodeAsString(argumentNode);
|
|
232
|
+
const argumentString = context.nodeAsString(argumentNode);
|
|
234
233
|
|
|
235
234
|
context.error(`The ${argumentString} argument should be a term, not a type`);
|
|
236
235
|
} else {
|
|
@@ -262,7 +261,7 @@ function verifyMetaargumentNode(metaArgumentNode, combinatorMetaargumentNode, co
|
|
|
262
261
|
const statementNode = statementNodeQuery(metaArgumentNode);
|
|
263
262
|
|
|
264
263
|
if (statementNode === null) {
|
|
265
|
-
const metaArgumentString = nodeAsString(metaArgumentNode);
|
|
264
|
+
const metaArgumentString = context.nodeAsString(metaArgumentNode);
|
|
266
265
|
|
|
267
266
|
context.error(`The '${metaArgumentString}' meta-argument should be a statement, not a meta-type.`);
|
|
268
267
|
} else {
|
|
@@ -282,7 +281,7 @@ function verifyMetaargumentNode(metaArgumentNode, combinatorMetaargumentNode, co
|
|
|
282
281
|
}
|
|
283
282
|
|
|
284
283
|
if (!metaArgumentNodeVerified) {
|
|
285
|
-
const combinatorMetaargumentString = nodeAsString(combinatorMetaargumentNode);
|
|
284
|
+
const combinatorMetaargumentString = context.nodeAsString(combinatorMetaargumentNode);
|
|
286
285
|
|
|
287
286
|
context.error(`The '${combinatorMetaargumentString}' combinator meta-argument should be the 'Statement' meta-type.`);
|
|
288
287
|
}
|
|
@@ -4,7 +4,6 @@ import Combinator from "../combinator";
|
|
|
4
4
|
import verifyTerm from "../verify/term";
|
|
5
5
|
import verifyStatement from "../verify/statement";
|
|
6
6
|
|
|
7
|
-
import { nodeAsString } from "../utilities/string";
|
|
8
7
|
import { typeNameFromTypeNode } from "../utilities/query";
|
|
9
8
|
import { TYPE_RULE_NAME, TERM_RULE_NAME, STATEMENT_RULE_NAME } from "../ruleNames";
|
|
10
9
|
|
|
@@ -13,7 +12,7 @@ export default function verifyStatementAsCombinator(statementNode, fileContext)
|
|
|
13
12
|
|
|
14
13
|
fileContext.begin(statementNode);
|
|
15
14
|
|
|
16
|
-
const statementString = nodeAsString(statementNode);
|
|
15
|
+
const statementString = fileContext.nodeAsString(statementNode);
|
|
17
16
|
|
|
18
17
|
fileContext.debug(`Verifying the '${statementString}' combinator....`);
|
|
19
18
|
|
|
@@ -5,7 +5,6 @@ import Supposition from "../supposition";
|
|
|
5
5
|
import verifyUnqualifiedStatement from "./statement/unqualified";
|
|
6
6
|
|
|
7
7
|
import { nodeQuery } from "../utilities/query";
|
|
8
|
-
import { nodeAsString } from "../utilities/string";
|
|
9
8
|
|
|
10
9
|
const statementNodeQuery = nodeQuery("/unqualifiedStatement/statement!"),
|
|
11
10
|
unqualifiedStatementNodeQuery = nodeQuery("/supposition/unqualifiedStatement!");
|
|
@@ -15,9 +14,9 @@ export default function verifySupposition(suppositionNode, suppositions, proofCo
|
|
|
15
14
|
|
|
16
15
|
proofContext.begin(suppositionNode);
|
|
17
16
|
|
|
18
|
-
const suppositionString = nodeAsString(suppositionNode);
|
|
17
|
+
const suppositionString = proofContext.nodeAsString(suppositionNode);
|
|
19
18
|
|
|
20
|
-
proofContext.debug(`Verifying the ${suppositionString} supposition...`);
|
|
19
|
+
proofContext.debug(`Verifying the '${suppositionString}' supposition...`);
|
|
21
20
|
|
|
22
21
|
const derived = false,
|
|
23
22
|
assertions = [],
|
package/src/verify/term.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import { first } from "../utilities/array";
|
|
4
4
|
import { objectType } from "../type";
|
|
5
|
-
import { nodeAsString } from "../utilities/string";
|
|
6
5
|
import { OBJECT_TYPE_NAME } from "../typeNames";
|
|
7
6
|
import { ARGUMENT_RULE_NAME } from "../ruleNames";
|
|
8
7
|
import { nodeQuery, typeNameFromTypeNode, variableNameFromVariableNode } from "../utilities/query";
|
|
@@ -16,7 +15,7 @@ export default function verifyTerm(termNode, types, context) {
|
|
|
16
15
|
|
|
17
16
|
context.begin(termNode);
|
|
18
17
|
|
|
19
|
-
const termString = nodeAsString(termNode);
|
|
18
|
+
const termString = context.nodeAsString(termNode);
|
|
20
19
|
|
|
21
20
|
context.debug(`Verifying the '${termString}' term...`);
|
|
22
21
|
|
|
@@ -218,7 +217,7 @@ function verifyArgumentNode(argumentNode, constructorArgumentNode, context) {
|
|
|
218
217
|
const termNode = termNodeQuery(argumentNode);
|
|
219
218
|
|
|
220
219
|
if (termNode === null) {
|
|
221
|
-
const argumentString = nodeAsString(argumentNode);
|
|
220
|
+
const argumentString = context.nodeAsString(argumentNode);
|
|
222
221
|
|
|
223
222
|
context.error(`The ${argumentString} argument should be a term, not a type`);
|
|
224
223
|
} else {
|
|
@@ -4,7 +4,6 @@ import verifyTerm from "../verify/term";
|
|
|
4
4
|
import Constructor from "../constructor";
|
|
5
5
|
|
|
6
6
|
import { first } from "../utilities/array";
|
|
7
|
-
import { nodeAsString } from "../utilities/string";
|
|
8
7
|
import { nodeQuery, typeNameFromTypeNode } from "../utilities/query";
|
|
9
8
|
import { TERM_RULE_NAME, ARGUMENT_RULE_NAME } from "../ruleNames";
|
|
10
9
|
|
|
@@ -18,7 +17,7 @@ export default function verifyTermAsConstructor(termNode, typeNode, fileContext)
|
|
|
18
17
|
let type = null;
|
|
19
18
|
|
|
20
19
|
const nonTerminalNode = termNode, ///
|
|
21
|
-
termString = nodeAsString(termNode);
|
|
20
|
+
termString = fileContext.nodeAsString(termNode);
|
|
22
21
|
|
|
23
22
|
fileContext.debug(`Verifying the '${termString}' constructor...`);
|
|
24
23
|
|
|
@@ -123,7 +122,7 @@ function verifyNonTerminalNode(nonTerminalNode, fileContext) {
|
|
|
123
122
|
type = firstType; ///
|
|
124
123
|
|
|
125
124
|
if (type !== null) {
|
|
126
|
-
const termString = nodeAsString(termNode);
|
|
125
|
+
const termString = fileContext.nodeAsString(termNode);
|
|
127
126
|
|
|
128
127
|
fileContext.error(`The type of the constructor's compound '${termString}' term node is not null.`);
|
|
129
128
|
} else {
|
|
@@ -153,7 +152,7 @@ function verifyArgumentNode(argumentNode, fileContext) {
|
|
|
153
152
|
const typeNode = typeNodeQuery(argumentNode);
|
|
154
153
|
|
|
155
154
|
if (typeNode === null) {
|
|
156
|
-
const argumentString = nodeAsString(argumentNode);
|
|
155
|
+
const argumentString = fileContext.nodeAsString(argumentNode);
|
|
157
156
|
|
|
158
157
|
fileContext.error(`The ${argumentString} argument should be a type.`);
|
|
159
158
|
} else {
|
package/src/verify/theorem.js
CHANGED
|
@@ -22,7 +22,7 @@ export default function verifyTheorem(theoremNode, fileContext) {
|
|
|
22
22
|
fileContext.begin(theoremNode);
|
|
23
23
|
|
|
24
24
|
const labelNodes = labelNodesQuery(theoremNode),
|
|
25
|
-
labelsString = nodesAsString(labelNodes),
|
|
25
|
+
labelsString = fileContext.nodesAsString(labelNodes),
|
|
26
26
|
proofContext = ProofContext.fromFileContext(fileContext);
|
|
27
27
|
|
|
28
28
|
fileContext.debug(`Verifying the '${labelsString}' theorem...`);
|
package/src/verify/type.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
import Type from "../type";
|
|
4
4
|
|
|
5
|
-
import { nodeAsString } from "../utilities/string";
|
|
6
5
|
import { typeNameFromTypeNode } from "../utilities/query";
|
|
7
6
|
|
|
8
7
|
export default function verifyType(typeNode, superTypeNode, fileContext) {
|
|
@@ -10,7 +9,7 @@ export default function verifyType(typeNode, superTypeNode, fileContext) {
|
|
|
10
9
|
|
|
11
10
|
fileContext.begin(typeNode);
|
|
12
11
|
|
|
13
|
-
const typeString = nodeAsString(typeNode);
|
|
12
|
+
const typeString = fileContext.nodeAsString(typeNode);
|
|
14
13
|
|
|
15
14
|
fileContext.debug(`Verifying the '${typeString}' type...`);
|
|
16
15
|
|
package/src/verify/variable.js
CHANGED
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import Variable from "../variable";
|
|
4
4
|
|
|
5
5
|
import { objectType } from "../type";
|
|
6
|
-
import { nodeAsString } from "../utilities/string";
|
|
7
6
|
import { typeNameFromTypeNode, variableNameFromVariableNode } from "../utilities/query";
|
|
8
7
|
|
|
9
8
|
export default function verifyVariable(variableNode, typeNode, fileContext) {
|
|
@@ -11,7 +10,7 @@ export default function verifyVariable(variableNode, typeNode, fileContext) {
|
|
|
11
10
|
|
|
12
11
|
fileContext.begin(variableNode);
|
|
13
12
|
|
|
14
|
-
const variableString = nodeAsString(variableNode);
|
|
13
|
+
const variableString = fileContext.nodeAsString(variableNode);
|
|
15
14
|
|
|
16
15
|
fileContext.debug(`Verifying the '${variableString}' variable...`);
|
|
17
16
|
|