occam-verify-cli 0.0.524 → 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.
Files changed (79) hide show
  1. package/lib/axiomLemmaTheorem.js +5 -5
  2. package/lib/combinator.js +5 -5
  3. package/lib/conclusion.js +3 -3
  4. package/lib/consequence.js +3 -3
  5. package/lib/constructor.js +6 -6
  6. package/lib/context/file.js +24 -8
  7. package/lib/context/metaproof.js +13 -1
  8. package/lib/context/proof.js +13 -1
  9. package/lib/equality.js +130 -7
  10. package/lib/label.js +5 -5
  11. package/lib/premise.js +3 -3
  12. package/lib/rule.js +5 -5
  13. package/lib/supposition.js +3 -3
  14. package/lib/type.js +5 -5
  15. package/lib/utilities/string.js +15 -10
  16. package/lib/variable.js +2 -2
  17. package/lib/verify/assertion/type.js +3 -3
  18. package/lib/verify/axiom.js +2 -2
  19. package/lib/verify/conclusion.js +2 -3
  20. package/lib/verify/consequence.js +3 -4
  21. package/lib/verify/derivation.js +3 -3
  22. package/lib/verify/label.js +2 -3
  23. package/lib/verify/lemma.js +2 -2
  24. package/lib/verify/metastatement/qualified.js +8 -9
  25. package/lib/verify/metastatement/unqualified.js +4 -4
  26. package/lib/verify/metastatement.js +2 -2
  27. package/lib/verify/premise.js +3 -4
  28. package/lib/verify/rule.js +2 -2
  29. package/lib/verify/ruleDerivation.js +3 -3
  30. package/lib/verify/statement/qualified.js +5 -5
  31. package/lib/verify/statement/unqualified.js +4 -4
  32. package/lib/verify/statement.js +56 -39
  33. package/lib/verify/statementAsCombinator.js +28 -18
  34. package/lib/verify/supposition.js +3 -4
  35. package/lib/verify/term.js +3 -4
  36. package/lib/verify/termAsConstructor.js +19 -20
  37. package/lib/verify/theorem.js +2 -2
  38. package/lib/verify/type.js +2 -3
  39. package/lib/verify/variable.js +2 -3
  40. package/package.json +1 -1
  41. package/src/axiomLemmaTheorem.js +4 -4
  42. package/src/combinator.js +4 -4
  43. package/src/conclusion.js +2 -2
  44. package/src/consequence.js +2 -2
  45. package/src/constructor.js +6 -6
  46. package/src/context/file.js +20 -7
  47. package/src/context/metaproof.js +4 -0
  48. package/src/context/proof.js +4 -0
  49. package/src/equality.js +202 -5
  50. package/src/label.js +4 -4
  51. package/src/premise.js +2 -2
  52. package/src/rule.js +4 -4
  53. package/src/supposition.js +2 -2
  54. package/src/type.js +4 -4
  55. package/src/utilities/string.js +23 -15
  56. package/src/variable.js +1 -1
  57. package/src/verify/assertion/type.js +2 -2
  58. package/src/verify/axiom.js +1 -1
  59. package/src/verify/conclusion.js +1 -2
  60. package/src/verify/consequence.js +2 -3
  61. package/src/verify/derivation.js +4 -2
  62. package/src/verify/label.js +1 -2
  63. package/src/verify/lemma.js +1 -1
  64. package/src/verify/metastatement/qualified.js +7 -10
  65. package/src/verify/metastatement/unqualified.js +3 -3
  66. package/src/verify/metastatement.js +1 -1
  67. package/src/verify/premise.js +2 -3
  68. package/src/verify/rule.js +1 -1
  69. package/src/verify/ruleDerivation.js +4 -2
  70. package/src/verify/statement/qualified.js +5 -5
  71. package/src/verify/statement/unqualified.js +4 -3
  72. package/src/verify/statement.js +67 -39
  73. package/src/verify/statementAsCombinator.js +48 -26
  74. package/src/verify/supposition.js +2 -3
  75. package/src/verify/term.js +2 -3
  76. package/src/verify/termAsConstructor.js +24 -26
  77. package/src/verify/theorem.js +1 -1
  78. package/src/verify/type.js +1 -2
  79. package/src/verify/variable.js +1 -2
@@ -20,16 +20,16 @@ export default class Constructor {
20
20
  return this.type;
21
21
  }
22
22
 
23
- asString() {
23
+ asString(tokens) {
24
24
  let string;
25
25
 
26
- const termString = nodeAsString(this.termNode);
26
+ const termString = nodeAsString(this.termNode, tokens);
27
27
 
28
28
  if (this.type === null) {
29
29
  string = `${termString}`;
30
30
  } else {
31
31
  const noSuperType = true,
32
- typeString = this.type.asString(noSuperType);
32
+ typeString = this.type.asString(tokens, noSuperType);
33
33
 
34
34
  string = `${termString}:${typeString}`;
35
35
  }
@@ -37,11 +37,11 @@ export default class Constructor {
37
37
  return string;
38
38
  }
39
39
 
40
- toJSON() {
41
- const termString = nodeAsString(this.termNode),
40
+ toJSON(tokens) {
41
+ const termString = nodeAsString(this.termNode, tokens),
42
42
  typeJSON = (this.type === null) ?
43
43
  null :
44
- this.type.toJSON(),
44
+ this.type.toJSON(tokens),
45
45
  kind = CONSTRUCTOR_KIND,
46
46
  term = termString, ///
47
47
  type = typeJSON, ///
@@ -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
  });
@@ -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 = [],
@@ -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/equality.js CHANGED
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
 
3
3
  import { nodeQuery } from "./utilities/query";
4
+ import { TERM_RULE_NAME } from "./ruleNames";
4
5
 
5
- const leftTermNodeQuery = nodeQuery("/statement/term[0]"),
6
- rightTermNodeQuery = nodeQuery("/statement/term[1]");
6
+ const leftTermNodeQuery = nodeQuery("/statement/argument[0]/term!"),
7
+ rightTermNodeQuery = nodeQuery("/statement/argument[1]/term!");
7
8
 
8
9
  export default class Equality {
9
10
  constructor(leftTermNode, rightTermNode) {
@@ -11,7 +12,7 @@ export default class Equality {
11
12
  this.rightTermNode = rightTermNode;
12
13
  }
13
14
 
14
- getLdftTermNode() {
15
+ getLeftTermNode() {
15
16
  return this.leftTermNode;
16
17
  }
17
18
 
@@ -19,8 +20,79 @@ export default class Equality {
19
20
  return this.rightTermNode;
20
21
  }
21
22
 
22
- assert(proofContext) {
23
- debugger
23
+ match(equality, equalities) {
24
+ let matches = false;
25
+
26
+ const leftTermNode = equality.getLeftTermNode(),
27
+ rightTermNode = equality.getRightTermNode();
28
+
29
+ if (!matches) {
30
+ const reversed = false,
31
+ leftTermNodeAndRightTermNodeMatch = this.matchLeftTermNodeAndRightTermNode(leftTermNode, rightTermNode, reversed, equalities);
32
+
33
+ matches = leftTermNodeAndRightTermNodeMatch; ///
34
+ }
35
+
36
+ if (!matches) {
37
+ const reversed = true,
38
+ leftTermNodeAndRightTermNodeMatch = this.matchLeftTermNodeAndRightTermNode(leftTermNode, rightTermNode, reversed, equalities);
39
+
40
+ matches = leftTermNodeAndRightTermNodeMatch; ///
41
+ }
42
+
43
+ return matches;
44
+ }
45
+
46
+ matchLeftTermNodeAndRightTermNode(leftTermNode, rightTermNode, reversed, equalities) {
47
+ let leftTermNodeAndRightTermNodeMatch = true;
48
+
49
+ if (leftTermNodeAndRightTermNodeMatch) {
50
+ const leftNonTerminalNode = reversed ?
51
+ this.rightTermNode :
52
+ this.leftTermNode, ///
53
+ rightNonTerminalNode = leftTermNode, ///
54
+ nonTerminalNodeEquates = equateNonTerminalNode(leftNonTerminalNode, rightNonTerminalNode, equalities);
55
+
56
+ leftTermNodeAndRightTermNodeMatch = nonTerminalNodeEquates; ///
57
+ }
58
+
59
+ if (leftTermNodeAndRightTermNodeMatch) {
60
+ const leftNonTerminalNode = reversed ?
61
+ this.leftTermNode :
62
+ this.rightTermNode, ///
63
+ rightNonTerminalNode = rightTermNode, ///
64
+ nonTerminalNodeEquates = equateNonTerminalNode(leftNonTerminalNode, rightNonTerminalNode, equalities);
65
+
66
+ leftTermNodeAndRightTermNodeMatch = nonTerminalNodeEquates; ///
67
+ }
68
+
69
+ return leftTermNodeAndRightTermNodeMatch;
70
+ }
71
+
72
+ equate(equalities) {
73
+ const leftNonTerminalNode = this.leftTermNode, ///
74
+ rightNonTerminalNode = this.rightTermNode, ///
75
+ nonTerminalNodeEquates = equateNonTerminalNode(leftNonTerminalNode, rightNonTerminalNode, equalities),
76
+ equates = nonTerminalNodeEquates; ///
77
+
78
+ return equates;
79
+ }
80
+
81
+ static fromProofStep(proofStep) {
82
+ let equality = null;
83
+
84
+ const statementNode = proofStep.getStatementNode();
85
+
86
+ if (statementNode !== null) {
87
+ const leftTermNode = leftTermNodeQuery(statementNode),
88
+ rightTermNode = rightTermNodeQuery(statementNode);
89
+
90
+ if ((leftTermNode !== null) && (rightTermNode !== null)) {
91
+ equality = new Equality(leftTermNode, rightTermNode);
92
+ }
93
+ }
94
+
95
+ return equality;
24
96
  }
25
97
 
26
98
  static fromStatementNode(statementNode) {
@@ -30,4 +102,129 @@ export default class Equality {
30
102
 
31
103
  return equality;
32
104
  }
105
+
106
+ static fromLeftTermNodeAndRightTermNode(leftTermNode, rightTermNode) {
107
+ const equality = new Equality(leftTermNode, rightTermNode);
108
+
109
+ return equality;
110
+ }
111
+ }
112
+
113
+ function equateNode(nodeA, nodeB, equalities) {
114
+ let nodeEquates = false;
115
+
116
+ const nodeATerminalNode = nodeA.isTerminalNode(),
117
+ nodeBTerminalNode = nodeB.isTerminalNode();
118
+
119
+ if (nodeATerminalNode === nodeBTerminalNode) {
120
+ if (nodeATerminalNode) {
121
+ const terminalNodeA = nodeA, ///
122
+ terminalNodeB = nodeB, ///
123
+ terminalNodeEquates = equateTerminalNode(terminalNodeA, terminalNodeB, equalities);
124
+
125
+ nodeEquates = terminalNodeEquates; ///
126
+ } else {
127
+ const nonTerminalNodeA = nodeA, ///
128
+ nonTerminalNodeB = nodeB, ///
129
+ nonTerminalNodeEquates = equateNonTerminalNode(nonTerminalNodeA, nonTerminalNodeB, equalities);
130
+
131
+ nodeEquates = nonTerminalNodeEquates; ///
132
+ }
133
+ }
134
+
135
+ return nodeEquates;
136
+ }
137
+
138
+ function equateNodes(leftNodes, rightNodes, equalities) {
139
+ let nodesEquate = false;
140
+
141
+ const leftNodesLength = leftNodes.length,
142
+ rightNodesLength = rightNodes.length;
143
+
144
+ if (leftNodesLength === rightNodesLength) {
145
+ nodesEquate = leftNodes.every((LeftNode, index) => {
146
+ const rightNode = rightNodes[index],
147
+ nodeEquates = equateNode(LeftNode, rightNode, equalities);
148
+
149
+ if (nodeEquates) {
150
+ return true;
151
+ }
152
+ });
153
+ }
154
+
155
+ return nodesEquate;
156
+ }
157
+
158
+ function equateTerminalNode(terminalNodeA, terminalNodeB, equalities) {
159
+ const matches = terminalNodeA.match(terminalNodeB),
160
+ terminalNodeEquates = matches; ///
161
+
162
+ return terminalNodeEquates;
163
+ }
164
+
165
+ function equateNonTerminalNode(leftNonTerminalNode, rightNonTerminalNode, equalities) {
166
+ let nonTerminalNodeEquates = false;
167
+
168
+ const leftNonTerminalNodeRuleName = leftNonTerminalNode.getRuleName(),
169
+ rightNonTerminalNodeRuleName = rightNonTerminalNode.getRuleName();
170
+
171
+ if (leftNonTerminalNodeRuleName === rightNonTerminalNodeRuleName) {
172
+ const ruleName = leftNonTerminalNodeRuleName, ///
173
+ ruleNameTermRuleName = (ruleName === TERM_RULE_NAME);
174
+
175
+ if (ruleNameTermRuleName) {
176
+ const leftTermNode = leftNonTerminalNode, ///
177
+ rightTermNode = rightNonTerminalNode, ///
178
+ termNodeEquates = equateTermNode(leftTermNode, rightTermNode, equalities);
179
+
180
+ nonTerminalNodeEquates = termNodeEquates; ///
181
+ }
182
+
183
+ if (!nonTerminalNodeEquates) {
184
+ const leftNonTerminalNodeChildNodes = leftNonTerminalNode.getChildNodes(),
185
+ rightNonTerminalNodeChildNodes = rightNonTerminalNode.getChildNodes(),
186
+ leftNodes = leftNonTerminalNodeChildNodes, ///
187
+ rightNodes = rightNonTerminalNodeChildNodes, ///
188
+ nodesEquate = equateNodes(leftNodes, rightNodes, equalities);
189
+
190
+ nonTerminalNodeEquates = nodesEquate; ///
191
+ }
192
+ }
193
+
194
+ return nonTerminalNodeEquates;
195
+ }
196
+
197
+ function equateTermNode(leftTermNode, rightTermNode, equalities) {
198
+ const equality = Equality.fromLeftTermNodeAndRightTermNode(leftTermNode, rightTermNode),
199
+ equalityA = equality, ///
200
+ equalityMatches = equalities.some((equality) => { ///
201
+ let equalitiesB = equalities; ///
202
+
203
+ const equalityB = equality; ///
204
+
205
+ equalitiesB = filterEqualities(equalitiesB, equalityB); ///
206
+
207
+ const equalityAMatchesEqualityB = equalityA.match(equalityB, equalitiesB);
208
+
209
+ if (equalityAMatchesEqualityB) {
210
+ return true;
211
+ }
212
+ }),
213
+ termNodeEquates = equalityMatches; ///
214
+
215
+ return termNodeEquates;
216
+ }
217
+
218
+ function filterEqualities(equalities, equality) {
219
+ const equalityA = equality; ///
220
+
221
+ equalities = equalities.filter((equality) => {
222
+ const equalityB = equality; ///
223
+
224
+ if (equalityA !== equalityB) {
225
+ return true;
226
+ }
227
+ });
228
+
229
+ return equalities;
33
230
  }
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, ///
@@ -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, ///
@@ -1,17 +1,14 @@
1
1
  "use strict";
2
2
 
3
- import { COMMA } from "../constants";
4
3
  import { nodeQuery } from "../utilities/query";
5
- import { LABEL_RULE_NAME,
6
- UNQUALIFIED_STATEMENT_RULE_NAME,
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
- childNodes = nonTerminalNode.getChildNodes();
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
- childNodes.forEach((childNode) => {
30
- const nodeString = nodeAsString(childNode);
31
+ tokens = tokens.slice(start, end); ///
31
32
 
32
- string = (string === null) ?
33
- nodeString : ///
34
- `${string}${nodeString}`;
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
@@ -45,7 +45,7 @@ export default class Variable {
45
45
  return equalTo;
46
46
  }
47
47
 
48
- asString() {
48
+ asString(tokens) {
49
49
  let string;
50
50
 
51
51
  if (this.type === null) {
@@ -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);
@@ -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...`);
@@ -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 = [],
@@ -107,8 +107,10 @@ function verifyChild(childNode, proofContext) {
107
107
  }
108
108
 
109
109
  case QUALIFIED_STATEMENT_RULE_NAME: {
110
- const qualifiedStatementNode = childNode, ///
111
- qualifiedStatementVerified = verifyQualifiedStatement(qualifiedStatementNode, proofContext);
110
+ const derived = true,
111
+ assertions = [],
112
+ qualifiedStatementNode = childNode, ///
113
+ qualifiedStatementVerified = verifyQualifiedStatement(qualifiedStatementNode, assertions, derived, proofContext);
112
114
 
113
115
  if (qualifiedStatementVerified) {
114
116
  const statementNode = statementNodeQuery(qualifiedStatementNode),
@@ -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 {
@@ -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) ?