occam-verify-cli 1.0.230 → 1.0.233

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 (109) hide show
  1. package/lib/context/local.js +1 -14
  2. package/lib/dom/axiom.js +22 -16
  3. package/lib/dom/combinator.js +5 -5
  4. package/lib/dom/conclusion.js +5 -5
  5. package/lib/dom/conjecture.js +9 -9
  6. package/lib/dom/constructor.js +5 -5
  7. package/lib/dom/declaration/combinator.js +14 -14
  8. package/lib/dom/declaration/complexType.js +35 -35
  9. package/lib/dom/declaration/constructor.js +19 -19
  10. package/lib/dom/declaration/metavariable.js +22 -22
  11. package/lib/dom/declaration/simpleType.js +23 -23
  12. package/lib/dom/declaration/variable.js +20 -20
  13. package/lib/dom/declaration.js +4 -2
  14. package/lib/dom/deduction.js +5 -5
  15. package/lib/dom/derivation.js +5 -5
  16. package/lib/dom/error.js +9 -9
  17. package/lib/dom/hypothesis.js +260 -0
  18. package/lib/dom/label.js +18 -24
  19. package/lib/dom/lemma.js +7 -7
  20. package/lib/dom/metaLemma.js +9 -9
  21. package/lib/dom/metaType.js +4 -10
  22. package/lib/dom/metatheorem.js +9 -9
  23. package/lib/dom/metavariable.js +7 -8
  24. package/lib/dom/parameter.js +2 -2
  25. package/lib/dom/premise.js +5 -5
  26. package/lib/dom/procedureCall.js +11 -10
  27. package/lib/dom/proof.js +3 -3
  28. package/lib/dom/property.js +9 -9
  29. package/lib/dom/reference.js +23 -22
  30. package/lib/dom/rule.js +25 -25
  31. package/lib/dom/section.js +146 -0
  32. package/lib/dom/signature.js +5 -5
  33. package/lib/dom/statement.js +25 -20
  34. package/lib/dom/step.js +3 -3
  35. package/lib/dom/subDerivation.js +5 -5
  36. package/lib/dom/subproof.js +7 -7
  37. package/lib/dom/substitution/statement.js +3 -3
  38. package/lib/dom/supposition.js +5 -5
  39. package/lib/dom/term.js +5 -6
  40. package/lib/dom/theorem.js +9 -9
  41. package/lib/dom/topLevelAssertion.js +22 -22
  42. package/lib/dom/topLevelMetaAssertion.js +14 -14
  43. package/lib/dom/type.js +21 -21
  44. package/lib/dom/variable.js +9 -15
  45. package/lib/index.js +3 -1
  46. package/lib/node/hypothesis.js +123 -0
  47. package/lib/node/section.js +116 -0
  48. package/lib/nonTerminalNodeMap.js +5 -3
  49. package/lib/ruleNames.js +9 -1
  50. package/lib/utilities/json.js +59 -59
  51. package/lib/utilities/subproof.js +10 -10
  52. package/lib/verifier/combinator.js +9 -10
  53. package/lib/verifier/constructor.js +10 -11
  54. package/lib/verifier/topLevel.js +38 -31
  55. package/package.json +2 -2
  56. package/src/context/local.js +0 -14
  57. package/src/dom/axiom.js +30 -29
  58. package/src/dom/combinator.js +4 -4
  59. package/src/dom/conclusion.js +5 -5
  60. package/src/dom/conjecture.js +8 -8
  61. package/src/dom/constructor.js +4 -4
  62. package/src/dom/declaration/combinator.js +14 -14
  63. package/src/dom/declaration/complexType.js +35 -35
  64. package/src/dom/declaration/constructor.js +20 -20
  65. package/src/dom/declaration/metavariable.js +22 -22
  66. package/src/dom/declaration/simpleType.js +22 -22
  67. package/src/dom/declaration/variable.js +21 -21
  68. package/src/dom/declaration.js +5 -3
  69. package/src/dom/deduction.js +5 -5
  70. package/src/dom/derivation.js +5 -5
  71. package/src/dom/error.js +8 -8
  72. package/src/dom/hypothesis.js +230 -0
  73. package/src/dom/label.js +17 -19
  74. package/src/dom/lemma.js +8 -8
  75. package/src/dom/metaLemma.js +8 -8
  76. package/src/dom/metaType.js +2 -6
  77. package/src/dom/metatheorem.js +8 -8
  78. package/src/dom/metavariable.js +9 -12
  79. package/src/dom/parameter.js +1 -1
  80. package/src/dom/premise.js +8 -8
  81. package/src/dom/procedureCall.js +9 -9
  82. package/src/dom/proof.js +2 -2
  83. package/src/dom/property.js +8 -8
  84. package/src/dom/reference.js +23 -27
  85. package/src/dom/rule.js +30 -30
  86. package/src/dom/section.js +70 -0
  87. package/src/dom/signature.js +4 -4
  88. package/src/dom/statement.js +24 -32
  89. package/src/dom/step.js +4 -4
  90. package/src/dom/subDerivation.js +5 -5
  91. package/src/dom/subproof.js +8 -8
  92. package/src/dom/substitution/statement.js +5 -5
  93. package/src/dom/supposition.js +7 -7
  94. package/src/dom/term.js +3 -8
  95. package/src/dom/theorem.js +7 -7
  96. package/src/dom/topLevelAssertion.js +29 -30
  97. package/src/dom/topLevelMetaAssertion.js +20 -20
  98. package/src/dom/type.js +22 -22
  99. package/src/dom/variable.js +8 -11
  100. package/src/index.js +2 -0
  101. package/src/node/hypothesis.js +23 -0
  102. package/src/node/section.js +16 -0
  103. package/src/nonTerminalNodeMap.js +7 -1
  104. package/src/ruleNames.js +2 -0
  105. package/src/utilities/json.js +58 -58
  106. package/src/utilities/subproof.js +10 -10
  107. package/src/verifier/combinator.js +6 -11
  108. package/src/verifier/constructor.js +9 -12
  109. package/src/verifier/topLevel.js +42 -30
package/src/dom/rule.js CHANGED
@@ -3,7 +3,6 @@
3
3
  import { arrayUtilities } from "necessary";
4
4
 
5
5
  import dom from "../dom";
6
- import LocalContext from "../context/local";
7
6
  import Substitutions from "../substitutions";
8
7
 
9
8
  import { domAssigned } from "../dom";
@@ -14,12 +13,13 @@ import { labelsFromJSON,
14
13
  labelsToLabelsJSON,
15
14
  premisesToPremisesJSON,
16
15
  conclusionToConclusionJSON } from "../utilities/json";
16
+ import LocalContext from "../context/local";
17
17
 
18
18
  const { reverse, extract, backwardsEvery } = arrayUtilities;
19
19
 
20
20
  export default domAssigned(class Rule {
21
- constructor(fileContext, string, labels, premises, conclusion, proof) {
22
- this.fileContext = fileContext;
21
+ constructor(context, string, labels, premises, conclusion, proof) {
22
+ this.context = context;
23
23
  this.string = string;
24
24
  this.labels = labels;
25
25
  this.premises = premises;
@@ -27,8 +27,8 @@ export default domAssigned(class Rule {
27
27
  this.proof = proof;
28
28
  }
29
29
 
30
- getFileContext() {
31
- return this.fileContext;
30
+ getContext() {
31
+ return this.context;
32
32
  }
33
33
 
34
34
  getString() {
@@ -66,8 +66,7 @@ export default domAssigned(class Rule {
66
66
  unifyStatementAndStepsOrSubproofs(statement, stepsOrSubproofs, context) {
67
67
  let statementAndStepsOrSubproofsUnify = false;
68
68
 
69
- const localContext = LocalContext.fromFileContext(this.fileContext),
70
- generalContext = localContext, ///
69
+ const generalContext = this.context, ///
71
70
  specificContext = context; ///
72
71
 
73
72
  const substitutions = Substitutions.fromNothing(),
@@ -148,12 +147,13 @@ export default domAssigned(class Rule {
148
147
 
149
148
  const ruleString = this.string; ///
150
149
 
151
- this.fileContext.trace(`Verifying the '${ruleString}' rule...`);
150
+ this.context.trace(`Verifying the '${ruleString}' rule...`);
152
151
 
153
152
  const labelsVerify = this.verifyLabels();
154
153
 
155
154
  if (labelsVerify) {
156
- const context = LocalContext.fromFileContext(this.fileContext),
155
+ const localContext = LocalContext.fromContext(this.context),
156
+ context = localContext, ///
157
157
  premisesVerify = this.verifyPremises(context);
158
158
 
159
159
  if (premisesVerify) {
@@ -165,7 +165,7 @@ export default domAssigned(class Rule {
165
165
  if (proofVerifies) {
166
166
  const rule = this; ///
167
167
 
168
- this.fileContext.addRule(rule);
168
+ this.context.addRule(rule);
169
169
 
170
170
  verifies = true;
171
171
  }
@@ -174,7 +174,7 @@ export default domAssigned(class Rule {
174
174
  }
175
175
 
176
176
  if (verifies) {
177
- this.fileContext.debug(`...verified the '${ruleString}' rule.`);
177
+ this.context.debug(`...verified the '${ruleString}' rule.`);
178
178
  }
179
179
 
180
180
  return verifies;
@@ -249,45 +249,45 @@ export default domAssigned(class Rule {
249
249
 
250
250
  static name = "Rule";
251
251
 
252
- static fromJSON(json, fileContext) {
252
+ static fromJSON(json, context) {
253
253
  let rule;
254
254
 
255
255
  const proof = null,
256
- labels = labelsFromJSON(json, fileContext),
257
- premises = premisesFromJSON(json, fileContext),
258
- conclusion = conclusionFromJSON(json, fileContext),
256
+ labels = labelsFromJSON(json, context),
257
+ premises = premisesFromJSON(json, context),
258
+ conclusion = conclusionFromJSON(json, context),
259
259
  string = stringFromLabelsPremisesAndConclusion(labels, premises, conclusion);
260
260
 
261
- rule = new Rule(fileContext, string, labels, premises, conclusion, proof);
261
+ rule = new Rule(context, string, labels, premises, conclusion, proof);
262
262
 
263
263
  return rule;
264
264
  }
265
265
 
266
- static fromRuleNode(ruleNode, fileContext) {
267
- const proof = proofFromRuleNode(ruleNode, fileContext),
268
- labels = labelsFromRuleNode(ruleNode, fileContext),
269
- premises = premisesFromRuleNode(ruleNode, fileContext),
270
- conclusion = conclusionFromRuleNode(ruleNode, fileContext),
266
+ static fromRuleNode(ruleNode, context) {
267
+ const proof = proofFromRuleNode(ruleNode, context),
268
+ labels = labelsFromRuleNode(ruleNode, context),
269
+ premises = premisesFromRuleNode(ruleNode, context),
270
+ conclusion = conclusionFromRuleNode(ruleNode, context),
271
271
  string = stringFromLabelsPremisesAndConclusion(labels, premises, conclusion),
272
- rule = new Rule(fileContext, string, labels, premises, conclusion, proof);
272
+ rule = new Rule(context, string, labels, premises, conclusion, proof);
273
273
 
274
274
  return rule;
275
275
  }
276
276
  });
277
277
 
278
- function proofFromRuleNode(ruleNode, fileContext) {
278
+ function proofFromRuleNode(ruleNode, context) {
279
279
  const { Proof } = dom,
280
280
  proofNode = ruleNode.getProofNode(),
281
- proof = Proof.fromProofNode(proofNode, fileContext);
281
+ proof = Proof.fromProofNode(proofNode, context);
282
282
 
283
283
  return proof;
284
284
  }
285
285
 
286
- function labelsFromRuleNode(ruleNode, fileContext) {
286
+ function labelsFromRuleNode(ruleNode, context) {
287
287
  const { Label } = dom,
288
288
  labelNodes = ruleNode.getLabelNodes(),
289
289
  labels = labelNodes.map((labelNode) => {
290
- const label = Label.fromLabelNode(labelNode, fileContext);
290
+ const label = Label.fromLabelNode(labelNode, context);
291
291
 
292
292
  return label;
293
293
  });
@@ -295,11 +295,11 @@ function labelsFromRuleNode(ruleNode, fileContext) {
295
295
  return labels;
296
296
  }
297
297
 
298
- function premisesFromRuleNode(ruleNode, fileContext) {
298
+ function premisesFromRuleNode(ruleNode, context) {
299
299
  const { Premise } = dom,
300
300
  premiseNodes = ruleNode.getPremiseNodes(),
301
301
  premises = premiseNodes.map((premiseNode) => {
302
- const premise = Premise.fromPremiseNode(premiseNode, fileContext);
302
+ const premise = Premise.fromPremiseNode(premiseNode, context);
303
303
 
304
304
  return premise;
305
305
  });
@@ -307,10 +307,10 @@ function premisesFromRuleNode(ruleNode, fileContext) {
307
307
  return premises;
308
308
  }
309
309
 
310
- function conclusionFromRuleNode(ruleNode, fileContext) {
310
+ function conclusionFromRuleNode(ruleNode, context) {
311
311
  const { Conclusion } = dom,
312
312
  conclusionNode = ruleNode.getConclusionNode(),
313
- conclusion = Conclusion.fromConclusionNode(conclusionNode, fileContext);
313
+ conclusion = Conclusion.fromConclusionNode(conclusionNode, context);
314
314
 
315
315
  return conclusion;
316
316
  }
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+
3
+ import { arrayUtilities } from "necessary";
4
+
5
+ import dom from "../dom";
6
+
7
+ import { domAssigned } from "../dom";
8
+
9
+ const { first } = arrayUtilities;
10
+
11
+ export default domAssigned(class Section {
12
+ constructor(context, string, hypotheses) {
13
+ this.context = context;
14
+ this.string = string;
15
+ this.hypotheses = hypotheses;
16
+ }
17
+
18
+ getContext() {
19
+ return this.context;
20
+ }
21
+
22
+ getString() {
23
+ return this.string;
24
+ }
25
+
26
+ getHypotheses() {
27
+ return this.hypotheses;
28
+ }
29
+
30
+ verify() {
31
+ let verifies = false;
32
+
33
+ const sectionString = this.string; ///
34
+
35
+ debugger
36
+
37
+ return verifies;
38
+ }
39
+
40
+ static name = "Section";
41
+
42
+ static fromSectionNode(sectionNode, context) {
43
+ const hypothesisNodes = sectionNode.getHypothesisNodes(),
44
+ hypotheses = hypothesesFromHypothesisNodes(hypothesisNodes, context),
45
+ string = stringFromHypotheses(hypotheses, context),
46
+ section = new Section(context, string, hypotheses);
47
+
48
+ return section;
49
+ }
50
+ });
51
+
52
+ function hypothesesFromHypothesisNodes(hypothesisNodes, context) {
53
+ const hypotheses = hypothesisNodes.map((hypothesisNode) => {
54
+ const { Hypothesis } = dom,
55
+ hypothesis = Hypothesis.fromHypothesisNode(hypothesisNode, context);
56
+
57
+ return hypothesis;
58
+ });
59
+
60
+ return hypotheses;
61
+ }
62
+
63
+ function stringFromHypotheses(hypotheses, context) {
64
+ const firstHypothesis = first(hypotheses),
65
+ hypothesis = firstHypothesis, ///
66
+ hypothesisString = hypothesis.getString(),
67
+ string = `'${hypothesisString}'...`;
68
+
69
+ return string;
70
+ }
@@ -157,17 +157,17 @@ export default domAssigned(class Signature {
157
157
 
158
158
  static name = "Signature";
159
159
 
160
- static fromJSON(json, fileContext) {
161
- const terms = termsFromJSON(json, fileContext),
160
+ static fromJSON(json, context) {
161
+ const terms = termsFromJSON(json, context),
162
162
  string = stringFromTerms(terms),
163
163
  signature = new Signature(string, terms);
164
164
 
165
165
  return signature;
166
166
  }
167
167
 
168
- static fromSignatureNode(signatureNode, fileContext) {
168
+ static fromSignatureNode(signatureNode, context) {
169
169
  const termNodes = signatureNode.getTermNodes(),
170
- terms = termsFromTermNodes(termNodes, fileContext),
170
+ terms = termsFromTermNodes(termNodes, context),
171
171
  string = stringFromTerms(terms),
172
172
  signature = new Signature(string, terms);
173
173
 
@@ -2,7 +2,6 @@
2
2
 
3
3
  import { arrayUtilities } from "necessary";
4
4
 
5
- import LocalContext from "../context/local";
6
5
  import verifyMixins from "../mixins/statement/verify";
7
6
  import StatementPartialContext from "../context/partial/statement";
8
7
 
@@ -250,10 +249,10 @@ export default domAssigned(class Statement {
250
249
 
251
250
  static name = "Statement";
252
251
 
253
- static fromJSON(json, fileContext) {
252
+ static fromJSON(json, context) {
254
253
  const { string } = json,
255
- lexer = fileContext.getLexer(),
256
- parser = fileContext.getParser(),
254
+ lexer = context.getLexer(),
255
+ parser = context.getParser(),
257
256
  statementPartialContext = StatementPartialContext.fromStringLexerAndParser(string, lexer, parser),
258
257
  node = statementPartialContext.getNode(),
259
258
  tokens = statementPartialContext.getTokens(),
@@ -262,27 +261,24 @@ export default domAssigned(class Statement {
262
261
  return statement;
263
262
  }
264
263
 
265
- static fromStepNode(stepNode, fileContext) {
264
+ static fromStepNode(stepNode, context) {
266
265
  let statement = null;
267
266
 
268
267
  const statementNode = stepNode.getStatementNode();
269
268
 
270
269
  if (statementNode !== null) {
271
- statement = statementFromStatementNode(statementNode, fileContext);
270
+ statement = statementFromStatementNode(statementNode, context);
272
271
  }
273
272
 
274
273
  return statement;
275
274
  }
276
275
 
277
- static fromPremiseNode(premiseNode, fileContext) {
276
+ static fromPremiseNode(premiseNode, context) {
278
277
  let statement = null;
279
278
 
280
279
  const statementNode = premiseNode.getStatementNode();
281
280
 
282
281
  if (statementNode !== null) {
283
- const localContext = LocalContext.fromFileContext(fileContext),
284
- context = localContext; ///
285
-
286
282
  statement = statementFromStatementNode(statementNode, context);
287
283
  }
288
284
 
@@ -295,84 +291,80 @@ export default domAssigned(class Statement {
295
291
  return statement;
296
292
  }
297
293
 
298
- static fromDeductionNode(deductionNode, fileContext) {
294
+ static fromDeductionNode(deductionNode, context) {
299
295
  let statement = null;
300
296
 
301
297
  const statementNode = deductionNode.getStatementNode();
302
298
 
303
299
  if (statementNode !== null) {
304
- const localContext = LocalContext.fromFileContext(fileContext),
305
- context = localContext; ///
300
+ statement = statementFromStatementNode(statementNode, context);
301
+ }
302
+
303
+ return statement;
304
+ }
305
+
306
+ static fromHypothesisNode(hypothesisNode, context) {
307
+ let statement = null;
308
+
309
+ const statementNode = hypothesisNode.getStatementNode();
306
310
 
311
+ if (statementNode !== null) {
307
312
  statement = statementFromStatementNode(statementNode, context);
308
313
  }
309
314
 
310
315
  return statement;
311
316
  }
312
317
 
313
- static fromConclusionNode(conclusionNode, fileContext) {
318
+ static fromConclusionNode(conclusionNode, context) {
314
319
  let statement = null;
315
320
 
316
321
  const statementNode = conclusionNode.getStatementNode();
317
322
 
318
323
  if (statementNode !== null) {
319
- const localContext = LocalContext.fromFileContext(fileContext),
320
- context = localContext; ///
321
-
322
324
  statement = statementFromStatementNode(statementNode, context);
323
325
  }
324
326
 
325
327
  return statement;
326
328
  }
327
329
 
328
- static fromSuppositionNode(suppositionNode, fileContext) {
330
+ static fromSuppositionNode(suppositionNode, context) {
329
331
  let statement = null;
330
332
 
331
333
  const statementNode = suppositionNode.getStatementNode();
332
334
 
333
335
  if (statementNode !== null) {
334
- const localContext = LocalContext.fromFileContext(fileContext),
335
- context = localContext; ///
336
-
337
336
  statement = statementFromStatementNode(statementNode, context);
338
337
  }
339
338
 
340
339
  return statement;
341
340
  }
342
341
 
343
- static fromDeclarationNode(declarationNode, fileContext) {
342
+ static fromDeclarationNode(declarationNode, context) {
344
343
  let statementNode;
345
344
 
346
345
  statementNode = declarationNode.getStatementNode(); ///
347
346
 
348
347
  statementNode = stripBracketsFromStatementNode(statementNode); ///
349
348
 
350
- const localContext = LocalContext.fromFileContext(fileContext),
351
- context = localContext, ///
352
- statement = statementFromStatementNode(statementNode, context);
349
+ const statement = statementFromStatementNode(statementNode, context);
353
350
 
354
351
  return statement;
355
352
  }
356
353
 
357
- static fromContainedAssertionNode(containedAssertionNode, fileContext) {
354
+ static fromContainedAssertionNode(containedAssertionNode, context) {
358
355
  let statement = null;
359
356
 
360
357
  const statementNode = containedAssertionNode.getStatementNode();
361
358
 
362
359
  if (statementNode !== null) {
363
- const localContext = LocalContext.fromFileContext(fileContext),
364
- context = localContext; ///
365
-
366
360
  statement = statementFromStatementNode(statementNode, context);
367
361
  }
368
362
 
369
363
  return statement;
370
364
  }
371
365
 
372
- static fromCombinatorDeclarationNode(combinatorDeclarationNode, fileContext) {
366
+ static fromCombinatorDeclarationNode(combinatorDeclarationNode, context) {
373
367
  const statementNode = combinatorDeclarationNode.getStatementNode(),
374
- localContext = LocalContext.fromFileContext(fileContext),
375
- context = localContext, ///
376
368
  statement = statementFromStatementNode(statementNode, context);
377
369
 
378
370
  return statement;
package/src/dom/step.js CHANGED
@@ -164,7 +164,7 @@ export default domAssigned(class Step {
164
164
  return step;
165
165
  }
166
166
 
167
- static fromStepOrSubproofNode(stepOrSubproofNode, fileContext) {
167
+ static fromStepOrSubproofNode(stepOrSubproofNode, context) {
168
168
  let step = null;
169
169
 
170
170
  const stepNode = stepOrSubproofNode.isStepNode();
@@ -173,9 +173,9 @@ export default domAssigned(class Step {
173
173
  const { Statement, Reference } = dom,
174
174
  stepNode = stepOrSubproofNode, ///
175
175
  node = stepNode, ///
176
- string = fileContext.nodeAsString(node),
177
- statement = Statement.fromStepNode(stepNode, fileContext),
178
- reference = Reference.fromStepNode(stepNode, fileContext);
176
+ string = context.nodeAsString(node),
177
+ statement = Statement.fromStepNode(stepNode, context),
178
+ reference = Reference.fromStepNode(stepNode, context);
179
179
 
180
180
  step = new Step(string, statement, reference);
181
181
  }
@@ -52,20 +52,20 @@ export default domAssigned(class SubDerivation {
52
52
 
53
53
  static name = "SubDerivation";
54
54
 
55
- static fromSubDerivationNode(subDerivationNode, fileContext) {
56
- const stepsOrSubproofs = stepOrSubproofFromSubDerivationNode(subDerivationNode, fileContext),
55
+ static fromSubDerivationNode(subDerivationNode, context) {
56
+ const stepsOrSubproofs = stepOrSubproofFromSubDerivationNode(subDerivationNode, context),
57
57
  subDerivation = new SubDerivation(stepsOrSubproofs);
58
58
 
59
59
  return subDerivation;
60
60
  }
61
61
  });
62
62
 
63
- function stepOrSubproofFromSubDerivationNode(subDerivationNode, fileContext) {
63
+ function stepOrSubproofFromSubDerivationNode(subDerivationNode, context) {
64
64
  const { Step, Subproof } = dom,
65
65
  stepOrSubproofNodes = subDerivationNode.getStepOrSubproofNodes(),
66
66
  stepsOrSubproofs = stepOrSubproofNodes.map((stepOrSubproofNode) => {
67
- const subproof = Subproof.fromStepOrSubproofNode(stepOrSubproofNode, fileContext),
68
- step = Step.fromStepOrSubproofNode(stepOrSubproofNode, fileContext),
67
+ const subproof = Subproof.fromStepOrSubproofNode(stepOrSubproofNode, context),
68
+ step = Step.fromStepOrSubproofNode(stepOrSubproofNode, context),
69
69
  stepOrSubproof = (step || subproof);
70
70
 
71
71
  return stepOrSubproof;
@@ -134,16 +134,16 @@ export default domAssigned(class Subproof {
134
134
 
135
135
  static name = "Subproof";
136
136
 
137
- static fromStepOrSubproofNode(sStepOrSubproofNode, fileContext) {
137
+ static fromStepOrSubproofNode(sStepOrSubproofNode, context) {
138
138
  let subproof = null;
139
139
 
140
140
  const subproofNode = sStepOrSubproofNode.isSubproofNode();
141
141
 
142
142
  if (subproofNode) {
143
143
  const subproofNode = sStepOrSubproofNode, ///
144
- suppositions = suppositionsFromSubproofNode(subproofNode, fileContext),
145
- subDerivation = subDerivationFromSubproofNode(subproofNode, fileContext),
146
- subproofString = subproofStringFromSubproofNode(subproofNode, fileContext),
144
+ suppositions = suppositionsFromSubproofNode(subproofNode, context),
145
+ subDerivation = subDerivationFromSubproofNode(subproofNode, context),
146
+ subproofString = subproofStringFromSubproofNode(subproofNode, context),
147
147
  string = subproofString; ///
148
148
 
149
149
  subproof = new Subproof(string, suppositions, subDerivation);
@@ -153,11 +153,11 @@ export default domAssigned(class Subproof {
153
153
  }
154
154
  });
155
155
 
156
- function suppositionsFromSubproofNode(subproofNode, fileContext) {
156
+ function suppositionsFromSubproofNode(subproofNode, context) {
157
157
  const { Supposition } = dom,
158
158
  suppositionNodes = subproofNode.getSuppositionNodes(),
159
159
  suppositions = suppositionNodes.map((suppositionNode) => {
160
- const supposition = Supposition.fromSuppositionNode(suppositionNode, fileContext);
160
+ const supposition = Supposition.fromSuppositionNode(suppositionNode, context);
161
161
 
162
162
  return supposition;
163
163
  });
@@ -165,10 +165,10 @@ function suppositionsFromSubproofNode(subproofNode, fileContext) {
165
165
  return suppositions;
166
166
  }
167
167
 
168
- function subDerivationFromSubproofNode(subproofNode, fileContext) {
168
+ function subDerivationFromSubproofNode(subproofNode, context) {
169
169
  const { SubDerivation } = dom,
170
170
  subDerivationNode = subproofNode.getSubDerivationNode(),
171
- subDerivation = SubDerivation.fromSubDerivationNode(subDerivationNode, fileContext);
171
+ subDerivation = SubDerivation.fromSubDerivationNode(subDerivationNode, context);
172
172
 
173
173
  return subDerivation;
174
174
  }
@@ -171,16 +171,16 @@ export default domAssigned(class StatementSubstitution extends Substitution {
171
171
  return json;
172
172
  }
173
173
 
174
- static fromJSON(json, fileContext) {
174
+ static fromJSON(json, context) {
175
175
  const { string } = json,
176
- lexer = fileContext.getLexer(),
177
- parser = fileContext.getParser(),
176
+ lexer = context.getLexer(),
177
+ parser = context.getParser(),
178
178
  statementSubstitutionPartialContext = StatementSubstitutionPartialContext.fromStringLexerAndParser(string, lexer, parser),
179
179
  node = statementSubstitutionPartialContext.getNode(),
180
180
  tokens = statementSubstitutionPartialContext.getTokens(),
181
181
  resolved = true,
182
- statement = statementFromJSON(json, fileContext),
183
- metavariable = metavariableFromJSON(json, fileContext),
182
+ statement = statementFromJSON(json, context),
183
+ metavariable = metavariableFromJSON(json, context),
184
184
  substitution = null, ///
185
185
  statementSubstitution = new StatementSubstitution(string, node, tokens, resolved, statement, metavariable, substitution);
186
186
 
@@ -220,9 +220,9 @@ export default domAssigned(class Supposition {
220
220
 
221
221
  static name = "Supposition";
222
222
 
223
- static fromJSON(json, fileContext) {
224
- const statement = statementFromJSON(json, fileContext),
225
- procedureCall = procedureCallFromJSON(json, fileContext);
223
+ static fromJSON(json, context) {
224
+ const statement = statementFromJSON(json, context),
225
+ procedureCall = procedureCallFromJSON(json, context);
226
226
 
227
227
  let string;
228
228
 
@@ -239,12 +239,12 @@ export default domAssigned(class Supposition {
239
239
  return supposition;
240
240
  }
241
241
 
242
- static fromSuppositionNode(suppositionNode, fileContext) {
242
+ static fromSuppositionNode(suppositionNode, context) {
243
243
  const { Statement, ProcedureCall } = dom,
244
244
  node = suppositionNode, ///
245
- string = fileContext.nodeAsString(node),
246
- statement = Statement.fromSuppositionNode(suppositionNode, fileContext),
247
- procedureCall = ProcedureCall.fromSuppositionNode(suppositionNode, fileContext),
245
+ string = context.nodeAsString(node),
246
+ statement = Statement.fromSuppositionNode(suppositionNode, context),
247
+ procedureCall = ProcedureCall.fromSuppositionNode(suppositionNode, context),
248
248
  supposition = new Supposition(string, statement, procedureCall);
249
249
 
250
250
  return supposition
package/src/dom/term.js CHANGED
@@ -3,7 +3,6 @@
3
3
  import { arrayUtilities } from "necessary";
4
4
 
5
5
  import dom from "../dom";
6
- import LocalContext from "../context/local";
7
6
  import verifyMixins from "../mixins/term/verify";
8
7
 
9
8
  import { domAssigned } from "../dom";
@@ -188,14 +187,12 @@ export default domAssigned(class Term {
188
187
 
189
188
  static name = "Term";
190
189
 
191
- static fromJSON(json, fileContext) {
190
+ static fromJSON(json, context) {
192
191
  const { string } = json,
193
- localContext = LocalContext.fromFileContext(fileContext),
194
- context = localContext, ///
195
192
  termString = string, ///
196
193
  termNode = termNodeFromTermString(termString, context),
197
194
  node = termNode, ///
198
- type = typeFromJSON(json, fileContext),
195
+ type = typeFromJSON(json, context),
199
196
  term = new Term(string, node, type);
200
197
 
201
198
  return term;
@@ -265,11 +262,9 @@ export default domAssigned(class Term {
265
262
  return term;
266
263
  }
267
264
 
268
- static fromConstructorDeclarationNode(constructorDeclarationNode, fileContext) {
265
+ static fromConstructorDeclarationNode(constructorDeclarationNode, context) {
269
266
  const { Type } = dom,
270
267
  termNode = constructorDeclarationNode.getTermNode(),
271
- localContext = LocalContext.fromFileContext(fileContext),
272
- context = localContext, ///
273
268
  term = termFromTermNode(termNode, context),
274
269
  type = Type.fromConstructorDeclarationNode(constructorDeclarationNode, context);
275
270
 
@@ -8,19 +8,19 @@ export default domAssigned(class Theorem extends TopLevelAssertion {
8
8
  verify() {
9
9
  let verifies;
10
10
 
11
- const fileContext = this.getFileContext(),
11
+ const context = this.getContext(),
12
12
  theoremString = this.string; ///
13
13
 
14
- fileContext.trace(`Verifying the '${theoremString}' theorem...`);
14
+ context.trace(`Verifying the '${theoremString}' theorem...`);
15
15
 
16
16
  verifies = super.verify();
17
17
 
18
18
  if (verifies) {
19
19
  const theorem = this; ///
20
20
 
21
- fileContext.addTheorem(theorem);
21
+ context.addTheorem(theorem);
22
22
 
23
- fileContext.debug(`...verified the '${theoremString}' theorem.`);
23
+ context.debug(`...verified the '${theoremString}' theorem.`);
24
24
  }
25
25
 
26
26
  return verifies;
@@ -28,11 +28,11 @@ export default domAssigned(class Theorem extends TopLevelAssertion {
28
28
 
29
29
  static name = "Theorem";
30
30
 
31
- static fromJSON(json, fileContext) { return TopLevelAssertion.fromJSON(Theorem, json, fileContext); }
31
+ static fromJSON(json, context) { return TopLevelAssertion.fromJSON(Theorem, json, context); }
32
32
 
33
- static fromTheoremNode(theoremNode, fileContext) {
33
+ static fromTheoremNode(theoremNode, context) {
34
34
  const node = theoremNode, ///
35
- theorem = TopLevelAssertion.fromNode(Theorem, node, fileContext);
35
+ theorem = TopLevelAssertion.fromNode(Theorem, node, context);
36
36
 
37
37
  return theorem;
38
38
  }