occam-verify-cli 0.0.1111 → 0.0.1114

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 (197) hide show
  1. package/lib/combinator/bracketed.js +15 -65
  2. package/lib/combinator.js +4 -8
  3. package/lib/constructor/bracketed.js +24 -101
  4. package/lib/constructor.js +4 -8
  5. package/lib/context/file.js +41 -12
  6. package/lib/context/local.js +45 -25
  7. package/lib/context/release.js +2 -2
  8. package/lib/dom/assertion/contained.js +287 -0
  9. package/lib/dom/assertion/defined.js +266 -0
  10. package/lib/dom/assertion/subproof.js +210 -0
  11. package/lib/dom/assertion/type.js +240 -0
  12. package/lib/{axiom.js → dom/axiom.js} +18 -8
  13. package/lib/dom/conclusion.js +171 -0
  14. package/lib/{conjecture.js → dom/conjecture.js} +18 -8
  15. package/lib/dom/consequent.js +171 -0
  16. package/lib/dom/declaration/combinator.js +105 -0
  17. package/lib/dom/declaration/constructor.js +140 -0
  18. package/lib/dom/declaration/metavariable.js +154 -0
  19. package/lib/dom/declaration/type.js +140 -0
  20. package/lib/dom/declaration/variable.js +155 -0
  21. package/lib/{declaration.js → dom/declaration.js} +62 -18
  22. package/lib/dom/derivation.js +137 -0
  23. package/lib/dom/equality.js +260 -0
  24. package/lib/dom/error.js +85 -0
  25. package/lib/dom/frame.js +372 -0
  26. package/lib/dom/judgement.js +198 -0
  27. package/lib/dom/label.js +190 -0
  28. package/lib/{lemma.js → dom/lemma.js} +19 -9
  29. package/lib/{metaLemma.js → dom/metaLemma.js} +19 -9
  30. package/lib/dom/metaType.js +261 -0
  31. package/lib/dom/metatheorem.js +273 -0
  32. package/lib/dom/metavariable.js +463 -0
  33. package/lib/dom/premise.js +221 -0
  34. package/lib/dom/proof.js +154 -0
  35. package/lib/dom/proofStep.js +239 -0
  36. package/lib/dom/reference.js +218 -0
  37. package/lib/dom/rule.js +311 -0
  38. package/lib/dom/statement.js +379 -0
  39. package/lib/dom/subDerivation.js +137 -0
  40. package/lib/dom/subproof.js +211 -0
  41. package/lib/dom/supposition.js +221 -0
  42. package/lib/dom/term.js +354 -0
  43. package/lib/{theorem.js → dom/theorem.js} +18 -8
  44. package/lib/dom/topLevelAssertion.js +306 -0
  45. package/lib/dom/type.js +327 -0
  46. package/lib/dom/variable.js +328 -0
  47. package/lib/dom.js +27 -0
  48. package/lib/equivalences.js +307 -0
  49. package/lib/index.js +40 -35
  50. package/lib/mixins/proofStep/unify.js +86 -0
  51. package/lib/mixins/statement/verify.js +27 -2
  52. package/lib/mixins/term/verify.js +24 -4
  53. package/lib/substitution/frame.js +3 -3
  54. package/lib/substitution/statement.js +17 -16
  55. package/lib/substitution/term.js +10 -7
  56. package/lib/substitution.js +4 -31
  57. package/lib/substitutions.js +24 -56
  58. package/lib/unifier/equality.js +2 -3
  59. package/lib/unifier/label.js +3 -3
  60. package/lib/unifier/metaLevel.js +9 -8
  61. package/lib/unifier/metavariable.js +3 -3
  62. package/lib/unifier/statementWithCombinator.js +5 -5
  63. package/lib/unifier/termWithConstructor.js +3 -3
  64. package/lib/utilities/json.js +26 -40
  65. package/lib/utilities/string.js +6 -8
  66. package/lib/utilities/subproof.js +2 -2
  67. package/lib/utilities/substitutions.js +7 -6
  68. package/lib/utilities/verification.js +22 -14
  69. package/lib/verifier/combinator.js +4 -4
  70. package/lib/verifier/constructor.js +3 -3
  71. package/lib/verifier/topLevel.js +15 -21
  72. package/package.json +1 -1
  73. package/src/combinator/bracketed.js +11 -4
  74. package/src/combinator.js +3 -10
  75. package/src/constructor/bracketed.js +17 -5
  76. package/src/constructor.js +3 -9
  77. package/src/context/file.js +42 -11
  78. package/src/context/local.js +26 -34
  79. package/src/context/release.js +1 -1
  80. package/src/{assertion → dom/assertion}/contained.js +11 -8
  81. package/src/{assertion → dom/assertion}/defined.js +14 -11
  82. package/src/{assertion → dom/assertion}/subproof.js +11 -62
  83. package/src/{assertion → dom/assertion}/type.js +11 -8
  84. package/src/{axiom.js → dom/axiom.js} +6 -9
  85. package/src/dom/conclusion.js +95 -0
  86. package/src/{conjecture.js → dom/conjecture.js} +5 -8
  87. package/src/dom/consequent.js +95 -0
  88. package/src/{declaration → dom/declaration}/combinator.js +8 -5
  89. package/src/{declaration → dom/declaration}/constructor.js +8 -4
  90. package/src/{declaration → dom/declaration}/metavariable.js +8 -5
  91. package/src/{declaration → dom/declaration}/type.js +8 -4
  92. package/src/{declaration → dom/declaration}/variable.js +9 -6
  93. package/src/{declaration.js → dom/declaration.js} +11 -16
  94. package/src/{derivation.js → dom/derivation.js} +9 -12
  95. package/src/{equality.js → dom/equality.js} +11 -14
  96. package/src/{error.js → dom/error.js} +6 -3
  97. package/src/{frame.js → dom/frame.js} +14 -23
  98. package/src/{judgement.js → dom/judgement.js} +8 -11
  99. package/src/{label.js → dom/label.js} +9 -16
  100. package/src/{lemma.js → dom/lemma.js} +5 -9
  101. package/src/{metaLemma.js → dom/metaLemma.js} +6 -9
  102. package/src/{metaType.js → dom/metaType.js} +7 -10
  103. package/src/{metatheorem.js → dom/metatheorem.js} +6 -10
  104. package/src/{metavariable.js → dom/metavariable.js} +79 -77
  105. package/src/dom/premise.js +173 -0
  106. package/src/{proof.js → dom/proof.js} +8 -11
  107. package/src/dom/proofStep.js +173 -0
  108. package/src/{reference.js → dom/reference.js} +48 -20
  109. package/src/{rule.js → dom/rule.js} +13 -17
  110. package/src/{statement.js → dom/statement.js} +142 -71
  111. package/src/{subDerivation.js → dom/subDerivation.js} +9 -12
  112. package/src/{subproof.js → dom/subproof.js} +14 -47
  113. package/src/dom/supposition.js +173 -0
  114. package/src/{term.js → dom/term.js} +24 -45
  115. package/src/{theorem.js → dom/theorem.js} +5 -8
  116. package/src/{topLevelAssertion.js → dom/topLevelAssertion.js} +12 -14
  117. package/src/{type.js → dom/type.js} +9 -12
  118. package/src/{variable.js → dom/variable.js} +20 -28
  119. package/src/dom.js +13 -0
  120. package/src/equivalences.js +278 -0
  121. package/src/index.js +39 -34
  122. package/src/mixins/proofStep/unify.js +115 -0
  123. package/src/mixins/statement/verify.js +33 -1
  124. package/src/mixins/term/verify.js +33 -3
  125. package/src/substitution/frame.js +2 -2
  126. package/src/substitution/statement.js +20 -18
  127. package/src/substitution/term.js +12 -5
  128. package/src/substitution.js +4 -29
  129. package/src/substitutions.js +35 -73
  130. package/src/unifier/equality.js +1 -2
  131. package/src/unifier/label.js +2 -2
  132. package/src/unifier/metaLevel.js +9 -7
  133. package/src/unifier/metavariable.js +2 -2
  134. package/src/unifier/statementWithCombinator.js +4 -4
  135. package/src/unifier/termWithConstructor.js +2 -2
  136. package/src/utilities/json.js +23 -42
  137. package/src/utilities/string.js +8 -6
  138. package/src/utilities/subproof.js +2 -2
  139. package/src/utilities/substitutions.js +7 -5
  140. package/src/utilities/verification.js +29 -13
  141. package/src/verifier/combinator.js +3 -3
  142. package/src/verifier/constructor.js +3 -3
  143. package/src/verifier/topLevel.js +20 -21
  144. package/lib/assertion/contained.js +0 -232
  145. package/lib/assertion/defined.js +0 -211
  146. package/lib/assertion/subproof.js +0 -203
  147. package/lib/assertion/type.js +0 -185
  148. package/lib/conclusion.js +0 -130
  149. package/lib/consequent.js +0 -130
  150. package/lib/declaration/combinator.js +0 -90
  151. package/lib/declaration/constructor.js +0 -90
  152. package/lib/declaration/metavariable.js +0 -104
  153. package/lib/declaration/type.js +0 -90
  154. package/lib/declaration/variable.js +0 -105
  155. package/lib/derivation.js +0 -91
  156. package/lib/equality.js +0 -209
  157. package/lib/error.js +0 -70
  158. package/lib/frame.js +0 -331
  159. package/lib/judgement.js +0 -147
  160. package/lib/label.js +0 -141
  161. package/lib/metaType.js +0 -255
  162. package/lib/metatheorem.js +0 -263
  163. package/lib/metavariable.js +0 -399
  164. package/lib/mixins/statement/qualified/unify.js +0 -69
  165. package/lib/mixins/statement/unify.js +0 -42
  166. package/lib/mixins/statement/unifyIndependenntly.js +0 -46
  167. package/lib/mixins/term/unify.js +0 -40
  168. package/lib/premise.js +0 -184
  169. package/lib/proof.js +0 -103
  170. package/lib/proofStep.js +0 -179
  171. package/lib/reference.js +0 -145
  172. package/lib/rule.js +0 -259
  173. package/lib/shim.js +0 -14
  174. package/lib/statement/qualified.js +0 -152
  175. package/lib/statement/unqualified.js +0 -175
  176. package/lib/statement.js +0 -270
  177. package/lib/subDerivation.js +0 -91
  178. package/lib/subproof.js +0 -181
  179. package/lib/supposition.js +0 -184
  180. package/lib/term.js +0 -318
  181. package/lib/topLevelAssertion.js +0 -305
  182. package/lib/type.js +0 -321
  183. package/lib/utilities/equivalences.js +0 -178
  184. package/lib/variable.js +0 -281
  185. package/src/conclusion.js +0 -96
  186. package/src/consequent.js +0 -96
  187. package/src/mixins/statement/qualified/unify.js +0 -103
  188. package/src/mixins/statement/unify.js +0 -41
  189. package/src/mixins/statement/unifyIndependenntly.js +0 -58
  190. package/src/mixins/term/unify.js +0 -36
  191. package/src/premise.js +0 -183
  192. package/src/proofStep.js +0 -181
  193. package/src/shim.js +0 -5
  194. package/src/statement/qualified.js +0 -133
  195. package/src/statement/unqualified.js +0 -166
  196. package/src/supposition.js +0 -183
  197. package/src/utilities/equivalences.js +0 -183
@@ -2,10 +2,11 @@
2
2
 
3
3
  import { arrayUtilities } from "necessary";
4
4
 
5
- import shim from "../shim";
5
+ import Equivalences from "../equivalences";
6
+ import Substitutions from "../substitutions";
6
7
 
7
- import { objectType } from "../type";
8
- import { frameMetaType, referenceMetaType, statementMetaType } from "../metaType";
8
+ import { objectType } from "../dom/type";
9
+ import { frameMetaType, referenceMetaType, statementMetaType } from "../dom/metaType";
9
10
  import { nodeAsTokens, nodeAsString, nodesAsString, tokensAsString } from "../utilities/string";
10
11
  import { typesFromJSON,
11
12
  rulesFromJSON,
@@ -87,7 +88,7 @@ export default class FileContext {
87
88
  }
88
89
 
89
90
  getEquivalences() {
90
- const equivalences = []; ///
91
+ const equivalences = Equivalences.fromNothing();
91
92
 
92
93
  return equivalences;
93
94
  }
@@ -511,8 +512,7 @@ export default class FileContext {
511
512
  const metaLemmas = this.getMetaLemmas();
512
513
 
513
514
  filter(metaLemmas, (metaLemma) => {
514
- const { Substitutions } = shim,
515
- context = this, ///
515
+ const context = this, ///
516
516
  substitutions = Substitutions.fromNothing(),
517
517
  referenceUnified = metaLemma.unifyReference(reference, substitutions, context);
518
518
 
@@ -528,8 +528,7 @@ export default class FileContext {
528
528
  const metatheorems = this.getMetatheorems();
529
529
 
530
530
  filter(metatheorems, (metatheorem) => {
531
- const { Substitutions } = shim,
532
- context = this, ///
531
+ const context = this, ///
533
532
  substitutions = Substitutions.fromNothing(),
534
533
  referenceUnified = metatheorem.unifyReference(reference, substitutions, context);
535
534
 
@@ -541,6 +540,16 @@ export default class FileContext {
541
540
  return metatheorems;
542
541
  }
543
542
 
543
+ findAxiomLemmaTheoremConjectureByReference(reference) {
544
+ const axiom = this.findAxiomByReference(reference),
545
+ lemma = this.findLemmaByReference(reference),
546
+ theorem = this.findTheoremByReference(reference),
547
+ conjecture = this.findConjectureByReference(reference),
548
+ axiomLemmaTheoremConjecture = (axiom || lemma || theorem || conjecture);
549
+
550
+ return axiomLemmaTheoremConjecture;
551
+ }
552
+
544
553
  findVariable(variable) {
545
554
  const specificVariable = variable, ///
546
555
  variables = this.getVariables();
@@ -606,6 +615,13 @@ export default class FileContext {
606
615
  return metavariable;
607
616
  }
608
617
 
618
+ isRulePresentByReference(reference) {
619
+ const rule = this.findRuleByReference(reference),
620
+ rulePresent = (rule !== null);
621
+
622
+ return rulePresent;
623
+ }
624
+
609
625
  isAxiomPresentByReference(reference) {
610
626
  const axiom = this.findAxiomByReference(reference),
611
627
  axiomPresent = (axiom !== null);
@@ -634,7 +650,14 @@ export default class FileContext {
634
650
  return conjecturePresent;
635
651
  }
636
652
 
637
- areMetaLemmaPresentByReference(reference) {
653
+ isAxiomLemmaTheoremConjecturePresentByReference(reference) {
654
+ const axiomLemmaTheoremConjecture = this.findAxiomLemmaTheoremConjectureByReference(reference),
655
+ axiomLemmaTheoremConjecturePresent = (axiomLemmaTheoremConjecture !== null);
656
+
657
+ return axiomLemmaTheoremConjecturePresent;
658
+ }
659
+
660
+ areMetaLemmasPresentByReference(reference) {
638
661
  const metaLemmas = this.findMetaLemmasByReference(reference),
639
662
  metaLemmasLength = metaLemmas.length,
640
663
  metaLemmasPresent = (metaLemmasLength > 0);
@@ -642,7 +665,7 @@ export default class FileContext {
642
665
  return metaLemmasPresent;
643
666
  }
644
667
 
645
- areMetatheoremPresentByReference(reference) {
668
+ areMetatheoremsPresentByReference(reference) {
646
669
  const metatheorems = this.findMetatheoremsByReference(reference),
647
670
  metatheoremsLength = metatheorems.length, ///
648
671
  metatheoremsPresent = (metatheoremsLength > 0);
@@ -650,6 +673,14 @@ export default class FileContext {
650
673
  return metatheoremsPresent;
651
674
  }
652
675
 
676
+ areMetaLemmasMetaTheoremsPresentByReference(reference) {
677
+ const metaLemmasPresent = this.areMetaLemmasPresentByReference(reference),
678
+ metatheoremsPresent = this.areMetatheoremsPresentByReference(reference),
679
+ metaLemmasMetaTheoremsPresent = (metaLemmasPresent || metatheoremsPresent);
680
+
681
+ return metaLemmasMetaTheoremsPresent;
682
+ }
683
+
653
684
  nodeAsString(node, tokens = null) {
654
685
  if (tokens === null) {
655
686
  tokens = this.tokens;
@@ -751,7 +782,7 @@ export default class FileContext {
751
782
  error(message) { this.releaseContext.error(message, this.filePath); }
752
783
 
753
784
  initialise(json) {
754
- const fileContext = this;
785
+ const fileContext = this; ///
755
786
 
756
787
  this.types = [];
757
788
 
@@ -3,8 +3,7 @@
3
3
  import { arrayUtilities } from "necessary";
4
4
 
5
5
  import Equivalence from "../equivalence";
6
-
7
- import { mergeEquivalences, findEquivalenceByTerm, groundedTermsAndDefinedVariablesFromFromEquivalences } from "../utilities/equivalences";
6
+ import Equivalences from "../equivalences";
8
7
 
9
8
  const { last } = arrayUtilities;
10
9
 
@@ -68,10 +67,7 @@ class LocalContext {
68
67
  getEquivalences() {
69
68
  let equivalences = this.context.getEquivalences();
70
69
 
71
- const equivalencesA = this.equivalences, ///
72
- equivalencesB = equivalences;
73
-
74
- equivalences = mergeEquivalences(equivalencesA, equivalencesB); ///
70
+ equivalences = this.equivalences.mergedWith(equivalences); ///
75
71
 
76
72
  return equivalences;
77
73
  }
@@ -116,8 +112,8 @@ class LocalContext {
116
112
  } else {
117
113
  const leftTerm = equality.getLeftTerm(),
118
114
  rightTerm = equality.getRightTerm(),
119
- leftEquivalence = findEquivalenceByTerm(this.equivalences, leftTerm),
120
- rightEquivalence = findEquivalenceByTerm(this.equivalences, rightTerm);
115
+ leftEquivalence = this.equivalences.findEquivalenceByTerm(leftTerm),
116
+ rightEquivalence = this.equivalences.findEquivalenceByTerm(rightTerm);
121
117
 
122
118
  if (false) {
123
119
  ///
@@ -143,9 +139,9 @@ class LocalContext {
143
139
  } else {
144
140
  equivalence = Equivalence.merge(leftEquivalence, rightEquivalence);
145
141
 
146
- this.removeEquivalence(leftEquivalence);
142
+ this.removeEquivalence(leftEquivalence, context);
147
143
 
148
- this.removeEquivalence(rightEquivalence);
144
+ this.removeEquivalence(rightEquivalence, context);
149
145
 
150
146
  this.addEquivalence(equivalence);
151
147
  }
@@ -180,21 +176,9 @@ class LocalContext {
180
176
  this.proofSteps.push(proofStep);
181
177
  }
182
178
 
183
- addEquivalence(equivalence, context) {
184
- const equivalenceString = equivalence.asString();
185
-
186
- context.trace(`Added the '${equivalenceString}' equivalence.`);
179
+ addEquivalence(equivalence, context) { return this.equivalences.addEquivalence(equivalence, context); }
187
180
 
188
- this.equivalences.push(equivalence);
189
- }
190
-
191
- removeEquivalence(equivalence) {
192
- const index = this.equivalences.indexOf(equivalence),
193
- start = index, ///
194
- deleteCount = 1;
195
-
196
- this.equivalences.splice(start, deleteCount);
197
- }
181
+ removeEquivalence(equivalence, context) { return this.equivalences.removeEquivalence(equivalence, context); }
198
182
 
199
183
  addJudgement(judgement) {
200
184
  let judgementAdded = false;
@@ -215,7 +199,7 @@ class LocalContext {
215
199
  let termType;
216
200
 
217
201
  const equivalences = this.getEquivalences(),
218
- equivalence = findEquivalenceByTerm(equivalences, term);
202
+ equivalence = equivalences.findEquivalenceByTerm(term);
219
203
 
220
204
  if (equivalence !== null) {
221
205
  const LocalContext = this, ///
@@ -230,12 +214,12 @@ class LocalContext {
230
214
  }
231
215
 
232
216
  isTermGrounded(term) {
233
- const context = this,
217
+ const context = this, ///
234
218
  equivalences = this.getEquivalences(),
235
219
  groundedTerms = [],
236
220
  definedVariables = [];
237
221
 
238
- groundedTermsAndDefinedVariablesFromFromEquivalences(equivalences, groundedTerms, definedVariables, context);
222
+ equivalences.separateGroundedTermsAndDefinedVariables(groundedTerms, definedVariables, context);
239
223
 
240
224
  const termMatchesGroundedTerm = groundedTerms.some((groundedTerm) => {
241
225
  const groundedTermNode = groundedTerm.getNode(),
@@ -251,12 +235,12 @@ class LocalContext {
251
235
  }
252
236
 
253
237
  isVariableDefined(variable) {
254
- const context = this,
238
+ const context = this, ///
255
239
  equivalences = this.getEquivalences(),
256
240
  groundedTerms = [],
257
241
  definedVariables = [];
258
242
 
259
- groundedTermsAndDefinedVariablesFromFromEquivalences(equivalences, groundedTerms, definedVariables, context);
243
+ equivalences.separateGroundedTermsAndDefinedVariables(groundedTerms, definedVariables, context);
260
244
 
261
245
  const variableMatchesDefinedVariable = definedVariables.some((definedVariable) => {
262
246
  const definedVariableEqualToVariable = definedVariable.isEqualTo(variable);
@@ -353,6 +337,10 @@ class LocalContext {
353
337
 
354
338
  findMetatheoremsByReference(reference) { return this.context.findMetatheoremsByReference(reference); }
355
339
 
340
+ findAxiomLemmaTheoremConjectureByReference(reference) { return this.context.findAxiomLemmaTheoremConjectureByReference(reference); }
341
+
342
+ isRulePresentByReference(reference) { return this.context.isRulePresentByReference(reference); }
343
+
356
344
  isAxiomPresentByReference(reference) { return this.context.isAxiomPresentByReference(reference); }
357
345
 
358
346
  isLemmaPresentByReference(reference) { return this.context.isLemmaPresentByReference(reference); }
@@ -361,9 +349,13 @@ class LocalContext {
361
349
 
362
350
  isConjecturePresentByReference(reference) { return this.context.isConjecturePresentByReference(reference); }
363
351
 
364
- areMetaLemmaPresentByReference(reference) { return this.context.areMetaLemmaPresentByReference(reference); }
352
+ areMetaLemmasPresentByReference(reference) { return this.context.areMetaLemmasPresentByReference(reference); }
353
+
354
+ areMetatheoremsPresentByReference(reference) { return this.context.areMetatheoremsPresentByReference(reference); }
355
+
356
+ areMetaLemmasMetaTheoremsPresentByReference(reference) { return this.context.areMetaLemmasMetaTheoremsPresentByReference(reference); }
365
357
 
366
- areMetatheoremPresentByReference(reference) { return this.context.areMetatheoremPresentByReference(reference); }
358
+ isAxiomLemmaTheoremConjecturePresentByReference(reference) { return this.context.isAxiomLemmaTheoremConjecturePresentByReference(reference) }
367
359
 
368
360
  nodeAsString(node, tokens = null) {
369
361
  if (tokens === null) {
@@ -422,7 +414,7 @@ class LocalContext {
422
414
  variables = [],
423
415
  proofSteps = [],
424
416
  judgements = [],
425
- equivalences = [],
417
+ equivalences = Equivalences.fromNothing(),
426
418
  localContext = new LocalContext(context, tokens, variables, proofSteps, judgements, equivalences);
427
419
 
428
420
  return localContext;
@@ -434,7 +426,7 @@ class LocalContext {
434
426
  variables = [],
435
427
  proofSteps = [],
436
428
  judgements = [],
437
- equivalences = [],
429
+ equivalences = Equivalences.fromNothing(),
438
430
  localContext = new LocalContext(context, tokens, variables, proofSteps, judgements, equivalences);
439
431
 
440
432
  return localContext;
@@ -444,7 +436,7 @@ class LocalContext {
444
436
  const variables = [],
445
437
  proofSteps = [],
446
438
  judgements = [],
447
- equivalences = [],
439
+ equivalences = Equivalences.fromNothing(),
448
440
  localContext = new LocalContext(context, tokens, variables, proofSteps, judgements, equivalences);
449
441
 
450
442
  return localContext;
@@ -8,7 +8,7 @@ import topLevelVerifier from "../verifier/topLevel";
8
8
  import { filePathUtilities } from "occam-entities";
9
9
  import { lexersUtilities, parsersUtilities } from "occam-custom-grammars";
10
10
 
11
- import { objectType } from "../type";
11
+ import { objectType } from "../dom/type";
12
12
  import { customGrammarFromNameAndEntries, combinedCustomGrammarFromReleaseContexts } from "../utilities/customGrammar";
13
13
 
14
14
  const { isFilePathNominalFilePath } = filePathUtilities,
@@ -1,15 +1,16 @@
1
1
  "use strict";
2
2
 
3
- import shim from "../shim";
4
- import LocalContext from "../context/local";
3
+ import dom from "../../dom";
4
+ import LocalContext from "../../context/local";
5
5
 
6
- import { nodeQuery } from "../utilities/query";
7
- import { isAssertionNegated } from "../utilities/assertion";
8
- import { termFromTermAndSubstitutions, frameFromFrameAndSubstitutions, statementFromStatementAndSubstitutions } from "../utilities/substitutions";
6
+ import { nodeQuery } from "../../utilities/query";
7
+ import { domAssigned } from "../../dom";
8
+ import { isAssertionNegated } from "../../utilities/assertion";
9
+ import { termFromTermAndSubstitutions, frameFromFrameAndSubstitutions, statementFromStatementAndSubstitutions } from "../../utilities/substitutions";
9
10
 
10
11
  const containedAssertionNodeQuery = nodeQuery("/statement/containedAssertion");
11
12
 
12
- export default class ContainedAssertion {
13
+ export default domAssigned(class ContainedAssertion {
13
14
  constructor(string, node, tokens, term, frame, negated, statement) {
14
15
  this.string = string;
15
16
  this.node = node;
@@ -174,13 +175,15 @@ export default class ContainedAssertion {
174
175
  return verifiedWhenDerived;
175
176
  }
176
177
 
178
+ static name = "ContainedAssertion";
179
+
177
180
  static fromStatementNode(statementNode, context) {
178
181
  let containedAssertion = null;
179
182
 
180
183
  const containedAssertionNode = containedAssertionNodeQuery(statementNode);
181
184
 
182
185
  if (containedAssertionNode !== null) {
183
- const { Term, Frame, Statement } = shim,
186
+ const { Term, Frame, Statement } = dom,
184
187
  node = containedAssertionNode, ///
185
188
  string = context.nodeAsString(node),
186
189
  tokens = context.nodeAsTokens(node),
@@ -195,7 +198,7 @@ export default class ContainedAssertion {
195
198
 
196
199
  return containedAssertion;
197
200
  }
198
- }
201
+ });
199
202
 
200
203
  function verifyWhenDerived(term, frame, statement, negated, context) {
201
204
  let verifiedWhenDerived = false;
@@ -1,15 +1,16 @@
1
1
  "use strict";
2
2
 
3
- import shim from "../shim";
4
- import LocalContext from "../context/local";
3
+ import dom from "../../dom";
4
+ import LocalContext from "../../context/local";
5
5
 
6
- import { nodeQuery } from "../utilities/query";
7
- import { isAssertionNegated } from "../utilities/assertion";
8
- import { termFromTermAndSubstitutions, frameFromFrameAndSubstitutions } from "../utilities/substitutions";
6
+ import { nodeQuery } from "../../utilities/query";
7
+ import { domAssigned } from "../../dom";
8
+ import { isAssertionNegated } from "../../utilities/assertion";
9
+ import { termFromTermAndSubstitutions, frameFromFrameAndSubstitutions } from "../../utilities/substitutions";
9
10
 
10
11
  const definedAssertionNodeQuery = nodeQuery("/statement/definedAssertion");
11
12
 
12
- export default class DefinedAssertion {
13
+ export default domAssigned(class DefinedAssertion {
13
14
  constructor(string, node, tokens, term, frame, negated) {
14
15
  this.string = string;
15
16
  this.node = node;
@@ -153,13 +154,15 @@ export default class DefinedAssertion {
153
154
  return verifiedWhenDerived;
154
155
  }
155
156
 
157
+ static name = "DefinedAssertion";
158
+
156
159
  static fromStatementNode(statementNode, context) {
157
160
  let definedAssertion = null;
158
161
 
159
162
  const definedAssertionNode = definedAssertionNodeQuery(statementNode);
160
163
 
161
164
  if (definedAssertionNode !== null) {
162
- const { Term, Frame } = shim,
165
+ const { Term, Frame } = dom,
163
166
  node = definedAssertionNode, ///
164
167
  string = context.nodeAsString(node),
165
168
  tokens = context.nodeAsTokens(node),
@@ -173,13 +176,13 @@ export default class DefinedAssertion {
173
176
 
174
177
  return definedAssertion;
175
178
  }
176
- }
179
+ });
177
180
 
178
181
  function verifyWhenDerived(term, frame, negated, context) {
179
182
  let verifiedWhenDerived = false;
180
183
 
181
184
  if (term !== null) {
182
- const { Variable } = shim,
185
+ const { Variable } = dom,
183
186
  termNode = term.getNode(),
184
187
  variable = Variable.fromTermNode(termNode, context),
185
188
  generalContext = context, ///
@@ -195,7 +198,7 @@ function verifyWhenDerived(term, frame, negated, context) {
195
198
  }
196
199
 
197
200
  if (frame!== null) {
198
- const { Metavariable } = shim,
201
+ const { Metavariable } = dom,
199
202
  frameNode = frame.getNode(),
200
203
  metavariable = Metavariable.fromFrameNode(frameNode, context),
201
204
  metavariableDefined = context.isMetavariableDefined(metavariable);
@@ -210,4 +213,4 @@ function verifyWhenDerived(term, frame, negated, context) {
210
213
  }
211
214
 
212
215
  return verifiedWhenDerived;
213
- }
216
+ }
@@ -2,17 +2,18 @@
2
2
 
3
3
  import { arrayUtilities } from "necessary";
4
4
 
5
- import shim from "../shim";
5
+ import dom from "../../dom";
6
6
 
7
- import { unifyStatement } from "../utilities/unification";
8
- import { nodeQuery, nodesQuery } from "../utilities/query";
7
+ import { domAssigned } from "../../dom";
8
+ import { unifyStatement } from "../../utilities/unification";
9
+ import { nodeQuery, nodesQuery } from "../../utilities/query";
9
10
 
10
11
  const { front, last, match } = arrayUtilities;
11
12
 
12
13
  const statementNodesQuery = nodesQuery("/subproofAssertion/statement"),
13
14
  subproofAssertionNodeQuery = nodeQuery("/statement/subproofAssertion");
14
15
 
15
- export default class SubproofAssertion {
16
+ export default domAssigned(class SubproofAssertion {
16
17
  constructor(string, node, statements) {
17
18
  this.string = string;
18
19
  this.node = node;
@@ -68,20 +69,7 @@ export default class SubproofAssertion {
68
69
 
69
70
  const statementsVerified = this.verifyStatements(assignments, stated, context);
70
71
 
71
- if (statementsVerified) {
72
- let verifiedWhenStated = false,
73
- verifiedWhenDerived = false;
74
-
75
- if (stated) {
76
- verifiedWhenStated = this.verifyWhenStated(context);
77
- } else {
78
- verifiedWhenDerived = this.verifyWhenDerived(context);
79
- }
80
-
81
- if (verifiedWhenStated || verifiedWhenDerived) {
82
- verified = true; ///
83
- }
84
- }
72
+ verified = statementsVerified; ///
85
73
 
86
74
  if (verified) {
87
75
  context.debug(`...verified the '${subproofAssertionString}' subproof assertion.`);
@@ -106,46 +94,7 @@ export default class SubproofAssertion {
106
94
  return statementsVerified;
107
95
  }
108
96
 
109
- verifyWhenStated(context) {
110
- let verifiedWhenStated;
111
-
112
- const subproofAssertionString = this.string; ///
113
-
114
- context.trace(`Verifying the '${subproofAssertionString}' stated subproof assertion...`);
115
-
116
- verifiedWhenStated = true;
117
-
118
- if (verifiedWhenStated) {
119
- context.debug(`...verified the '${subproofAssertionString}' stated subproof assertion.`);
120
- }
121
-
122
- return verifiedWhenStated;
123
- }
124
-
125
- verifyWhenDerived(context) {
126
- let derivedSubproofAssertionVerified;
127
-
128
- const subproofAssertionString = this.string; ///
129
-
130
- context.trace(`Verifying the '${subproofAssertionString}' derived subproof assertion...`);
131
-
132
- const proofSteps = context.getProofSteps();
133
-
134
- derivedSubproofAssertionVerified = proofSteps.some((proofStep) => {
135
- const subproofAssertion = this,
136
- subproofAssertionUnified = proofStep.unifySubproofAssertion(subproofAssertion, context);
137
-
138
- if (subproofAssertionUnified) {
139
- return true;
140
- }
141
- });
142
-
143
- if (derivedSubproofAssertionVerified) {
144
- context.debug(`...verified the '${subproofAssertionString}' derived subproof assertion.`);
145
- }
146
-
147
- return derivedSubproofAssertionVerified;
148
- }
97
+ static name = "SubproofAssertion";
149
98
 
150
99
  static fromStatementNode(statementNode, context) {
151
100
  let subproofAssertion = null;
@@ -153,7 +102,7 @@ export default class SubproofAssertion {
153
102
  const subproofAssertionNode = subproofAssertionNodeQuery(statementNode);
154
103
 
155
104
  if (subproofAssertionNode !== null) {
156
- const { Statement } = shim,
105
+ const { Statement } = dom,
157
106
  statementNodes = statementNodesQuery(subproofAssertionNode),
158
107
  statement = Statement.fromStatementNode(statementNode, context),
159
108
  statementString = statement.getString(),
@@ -175,7 +124,7 @@ export default class SubproofAssertion {
175
124
  let subproofAssertion = null;
176
125
 
177
126
  if (subproofAssertionNode !== null) {
178
- const { Statement } = shim,
127
+ const { Statement } = dom,
179
128
  statementNodes = statementNodesQuery(subproofAssertionNode),
180
129
  statements = statementNodes.map((statementNode) => {
181
130
  const statement = Statement.fromStatementNode(statementNode, context);
@@ -190,7 +139,7 @@ export default class SubproofAssertion {
190
139
 
191
140
  return subproofAssertion;
192
141
  }
193
- }
142
+ });
194
143
 
195
144
  function stringFromStatements(statements) {
196
145
  const frontStatements = front(statements),
@@ -214,4 +163,4 @@ function statementsStringFromStatements(statements) {
214
163
  }, null);
215
164
 
216
165
  return statementsString
217
- }
166
+ }
@@ -1,17 +1,18 @@
1
1
  "use strict";
2
2
 
3
- import shim from "../shim";
4
- import VariableAssignment from "../assignment/variable";
3
+ import dom from "../../dom";
4
+ import VariableAssignment from "../../assignment/variable";
5
5
 
6
- import { nodeQuery } from "../utilities/query";
7
- import { objectType } from "../type";
6
+ import { nodeQuery } from "../../utilities/query";
7
+ import { objectType } from "../../dom/type";
8
+ import { domAssigned } from "../../dom";
8
9
 
9
10
  const termNodeQuery = nodeQuery("/typeAssertion/term"),
10
11
  typeNodeQuery = nodeQuery("/typeAssertion/type"),
11
12
  variableNodeQuery = nodeQuery("/term/variable!"),
12
13
  typeAssertionNodeQuery = nodeQuery("/statement/typeAssertion");
13
14
 
14
- export default class TypeAssertion {
15
+ export default domAssigned(class TypeAssertion {
15
16
  constructor(string, term, type) {
16
17
  this.string = string;
17
18
  this.term = term;
@@ -111,7 +112,7 @@ export default class TypeAssertion {
111
112
 
112
113
  if (termVerified) {
113
114
  if (assignments !== null) {
114
- const { Variable } = shim,
115
+ const { Variable } = dom,
115
116
  termNode = this.term.getNode(),
116
117
  variableNode = variableNodeQuery(termNode),
117
118
  variable = Variable.fromVariableNodeAndType(variableNode, this.type, context);
@@ -161,13 +162,15 @@ export default class TypeAssertion {
161
162
  return verifiedWhenDerived;
162
163
  }
163
164
 
165
+ static name = "TypeAssertion";
166
+
164
167
  static fromStatementNode(statementNode, context) {
165
168
  let typeAssertion = null;
166
169
 
167
170
  const typeAssertionNode = typeAssertionNodeQuery(statementNode);
168
171
 
169
172
  if (typeAssertionNode !== null) {
170
- const { Term, Type } = shim,
173
+ const { Term, Type } = dom,
171
174
  termNode = termNodeQuery(typeAssertionNode),
172
175
  typeNode = typeNodeQuery(typeAssertionNode),
173
176
  term = Term.fromTermNode(termNode, context),
@@ -179,7 +182,7 @@ export default class TypeAssertion {
179
182
 
180
183
  return typeAssertion;
181
184
  }
182
- }
185
+ });
183
186
 
184
187
  function stringFromTermAndType(term, type) {
185
188
  const termString = term.getString(),
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
 
3
- import shim from "./shim";
4
3
  import TopLevelAssertion from "./topLevelAssertion";
5
4
 
6
- class Axiom extends TopLevelAssertion {
5
+ import { domAssigned } from "../dom";
6
+
7
+ export default domAssigned(class Axiom extends TopLevelAssertion {
7
8
  verify() {
8
9
  let verified;
9
10
 
@@ -26,13 +27,9 @@ class Axiom extends TopLevelAssertion {
26
27
  return verified;
27
28
  }
28
29
 
30
+ static name = "TopLevelAssertion";
31
+
29
32
  static fromJSON(json, fileContext) { return TopLevelAssertion.fromJSON(Axiom, json, fileContext); }
30
33
 
31
34
  static fromAxiomNode(axiomNode, fileContext) { return TopLevelAssertion.fromNode(Axiom, axiomNode, fileContext); }
32
- }
33
-
34
- Object.assign(shim, {
35
- Axiom
36
- });
37
-
38
- export default Axiom;
35
+ });