occam-verify-cli 1.0.444 → 1.0.457

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 (173) hide show
  1. package/lib/constants.js +1 -5
  2. package/lib/context/file.js +54 -82
  3. package/lib/context/fragment.js +77 -0
  4. package/lib/context/release.js +5 -9
  5. package/lib/context/scoped.js +314 -0
  6. package/lib/context/transient.js +371 -0
  7. package/lib/element/assumption.js +71 -84
  8. package/lib/element/combinator/bracketed.js +1 -10
  9. package/lib/element/conclusion.js +11 -8
  10. package/lib/element/constructor/bracketed.js +1 -10
  11. package/lib/element/declaration/combinator.js +1 -2
  12. package/lib/element/declaration/metavariable.js +3 -3
  13. package/lib/element/declaration/variable.js +3 -3
  14. package/lib/element/deduction.js +18 -13
  15. package/lib/element/derivation.js +14 -14
  16. package/lib/element/frame.js +40 -46
  17. package/lib/element/hypothesis.js +14 -55
  18. package/lib/element/judgement.js +35 -56
  19. package/lib/element/metaType.js +5 -4
  20. package/lib/element/metavariable.js +14 -10
  21. package/lib/element/proof.js +10 -10
  22. package/lib/element/proofAssertion/premise.js +308 -0
  23. package/lib/element/proofAssertion/step.js +305 -0
  24. package/lib/element/proofAssertion/supposition.js +322 -0
  25. package/lib/element/proofAssertion.js +199 -0
  26. package/lib/element/reference.js +28 -25
  27. package/lib/element/rule.js +29 -29
  28. package/lib/element/section.js +4 -4
  29. package/lib/element/statement.js +9 -14
  30. package/lib/element/subDerivation.js +14 -14
  31. package/lib/element/subproof.js +14 -14
  32. package/lib/element/substitution/frame.js +7 -7
  33. package/lib/element/substitution/statement.js +15 -39
  34. package/lib/element/substitution.js +5 -5
  35. package/lib/element/term.js +12 -10
  36. package/lib/element/topLevelAssertion/axiom.js +329 -0
  37. package/lib/element/{conjecture.js → topLevelAssertion/conjecture.js} +7 -7
  38. package/lib/element/{lemma.js → topLevelAssertion/lemma.js} +6 -6
  39. package/lib/element/{theorem.js → topLevelAssertion/theorem.js} +7 -7
  40. package/lib/element/topLevelAssertion.js +427 -0
  41. package/lib/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +7 -7
  42. package/lib/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +7 -7
  43. package/lib/element/topLevelMetaAssertion.js +289 -0
  44. package/lib/element/type.js +4 -4
  45. package/lib/element/variable.js +20 -20
  46. package/lib/metaTypes.js +33 -19
  47. package/lib/node/proofAssertion/premise.js +116 -0
  48. package/lib/node/proofAssertion/step.js +152 -0
  49. package/lib/node/proofAssertion/supposition.js +116 -0
  50. package/lib/node/{premise.js → proofAssertion.js} +11 -18
  51. package/lib/node/statement.js +2 -2
  52. package/lib/node/subDerivation.js +1 -8
  53. package/lib/node/subproof.js +1 -8
  54. package/lib/node/substitution/statement.js +2 -2
  55. package/lib/node/{axiom.js → topLevelAssertion/axiom.js} +7 -7
  56. package/lib/node/{conjecture.js → topLevelAssertion/conjecture.js} +7 -7
  57. package/lib/node/{lemma.js → topLevelAssertion/lemma.js} +7 -7
  58. package/lib/node/{theorem.js → topLevelAssertion/theorem.js} +7 -7
  59. package/lib/node/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +9 -9
  60. package/lib/node/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +7 -7
  61. package/lib/node/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +7 -7
  62. package/lib/node/{metaLemmaMetaTheorem.js → topLevelMetaAssertion.js} +9 -9
  63. package/lib/nonTerminalNodeMap.js +13 -13
  64. package/lib/preamble.js +10 -10
  65. package/lib/process/instantiate.js +6 -9
  66. package/lib/process/unify.js +7 -6
  67. package/lib/types.js +3 -3
  68. package/lib/utilities/bnf.js +5 -5
  69. package/lib/utilities/brackets.js +6 -11
  70. package/lib/utilities/context.js +28 -0
  71. package/lib/utilities/element.js +101 -99
  72. package/lib/utilities/fragment.js +23 -0
  73. package/lib/utilities/instance.js +12 -21
  74. package/lib/utilities/json.js +3 -2
  75. package/lib/utilities/string.js +44 -23
  76. package/lib/utilities/unification.js +36 -36
  77. package/lib/utilities/validation.js +22 -25
  78. package/package.json +6 -6
  79. package/src/constants.js +0 -1
  80. package/src/context/file.js +51 -58
  81. package/src/context/fragment.js +38 -0
  82. package/src/context/release.js +6 -11
  83. package/src/context/{local.js → scoped.js} +35 -127
  84. package/src/context/{temporary.js → transient.js} +9 -131
  85. package/src/element/assumption.js +69 -85
  86. package/src/element/combinator/bracketed.js +0 -7
  87. package/src/element/conclusion.js +14 -10
  88. package/src/element/constructor/bracketed.js +0 -7
  89. package/src/element/declaration/combinator.js +0 -1
  90. package/src/element/declaration/metavariable.js +2 -2
  91. package/src/element/declaration/variable.js +5 -5
  92. package/src/element/deduction.js +22 -15
  93. package/src/element/derivation.js +12 -12
  94. package/src/element/frame.js +36 -48
  95. package/src/element/hypothesis.js +14 -16
  96. package/src/element/judgement.js +33 -58
  97. package/src/element/metaType.js +4 -4
  98. package/src/element/metavariable.js +17 -10
  99. package/src/element/proof.js +9 -9
  100. package/src/element/{premise.js → proofAssertion/premise.js} +107 -75
  101. package/src/element/{step.js → proofAssertion/step.js} +43 -89
  102. package/src/element/{supposition.js → proofAssertion/supposition.js} +89 -88
  103. package/src/element/proofAssertion.js +69 -0
  104. package/src/element/reference.js +27 -23
  105. package/src/element/rule.js +25 -25
  106. package/src/element/section.js +4 -4
  107. package/src/element/statement.js +8 -15
  108. package/src/element/subDerivation.js +12 -12
  109. package/src/element/subproof.js +10 -10
  110. package/src/element/substitution/frame.js +10 -13
  111. package/src/element/substitution/statement.js +20 -52
  112. package/src/element/substitution.js +3 -3
  113. package/src/element/term.js +10 -9
  114. package/src/element/{axiom.js → topLevelAssertion/axiom.js} +41 -41
  115. package/src/element/{conjecture.js → topLevelAssertion/conjecture.js} +4 -4
  116. package/src/element/{lemma.js → topLevelAssertion/lemma.js} +3 -3
  117. package/src/element/{theorem.js → topLevelAssertion/theorem.js} +4 -4
  118. package/src/element/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +30 -49
  119. package/src/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +4 -4
  120. package/src/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +4 -4
  121. package/src/element/{metaLemmaMetatheorem.js → topLevelMetaAssertion.js} +7 -72
  122. package/src/element/type.js +2 -4
  123. package/src/element/variable.js +17 -17
  124. package/src/metaTypes.js +42 -13
  125. package/src/node/proofAssertion/premise.js +16 -0
  126. package/src/node/{step.js → proofAssertion/step.js} +4 -18
  127. package/src/node/proofAssertion/supposition.js +16 -0
  128. package/src/node/proofAssertion.js +23 -0
  129. package/src/node/statement.js +1 -1
  130. package/src/node/subDerivation.js +0 -7
  131. package/src/node/subproof.js +0 -7
  132. package/src/node/substitution/statement.js +1 -1
  133. package/src/node/topLevelAssertion/axiom.js +13 -0
  134. package/src/node/topLevelAssertion/conjecture.js +13 -0
  135. package/src/node/topLevelAssertion/lemma.js +13 -0
  136. package/src/node/topLevelAssertion/theorem.js +13 -0
  137. package/src/node/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +1 -1
  138. package/src/node/topLevelMetaAssertion/metaLemma.js +13 -0
  139. package/src/node/topLevelMetaAssertion/metatheorem.js +13 -0
  140. package/src/node/{metaLemmaMetaTheorem.js → topLevelMetaAssertion.js} +1 -1
  141. package/src/nonTerminalNodeMap.js +12 -12
  142. package/src/preamble.js +9 -9
  143. package/src/process/instantiate.js +31 -32
  144. package/src/process/unify.js +6 -5
  145. package/src/types.js +4 -2
  146. package/src/utilities/bnf.js +3 -2
  147. package/src/utilities/brackets.js +5 -8
  148. package/src/utilities/context.js +20 -0
  149. package/src/utilities/element.js +169 -162
  150. package/src/utilities/fragment.js +11 -0
  151. package/src/utilities/instance.js +19 -24
  152. package/src/utilities/json.js +3 -1
  153. package/src/utilities/string.js +57 -32
  154. package/src/utilities/unification.js +39 -39
  155. package/src/utilities/validation.js +26 -35
  156. package/lib/context/local.js +0 -605
  157. package/lib/context/temporary.js +0 -752
  158. package/lib/element/axiom.js +0 -329
  159. package/lib/element/axiomLemmaTheoremConjecture.js +0 -434
  160. package/lib/element/metaLemmaMetatheorem.js +0 -322
  161. package/lib/element/premise.js +0 -380
  162. package/lib/element/step.js +0 -390
  163. package/lib/element/supposition.js +0 -410
  164. package/lib/node/step.js +0 -166
  165. package/lib/node/supposition.js +0 -130
  166. package/src/node/axiom.js +0 -13
  167. package/src/node/conjecture.js +0 -13
  168. package/src/node/lemma.js +0 -13
  169. package/src/node/metaLemma.js +0 -13
  170. package/src/node/metatheorem.js +0 -13
  171. package/src/node/premise.js +0 -30
  172. package/src/node/supposition.js +0 -30
  173. package/src/node/theorem.js +0 -13
@@ -4,7 +4,7 @@ import { arrayUtilities } from "necessary";
4
4
 
5
5
  import Element from "../element";
6
6
  import elements from "../elements";
7
- import LocalContext from "../context/local";
7
+ import ScopedContext from "../context/scoped";
8
8
 
9
9
  import { labelsFromJSON,
10
10
  deductionFromJSON,
@@ -19,7 +19,7 @@ import { labelsFromJSON,
19
19
 
20
20
  const { extract, reverse, correlate, backwardsEvery } = arrayUtilities;
21
21
 
22
- export default class AxiomLemmaTheoremConjecture extends Element {
22
+ export default class TopLevelAssertion extends Element {
23
23
  constructor(context, string, node, labels, suppositions, deduction, proof, signature, hypotheses) {
24
24
  super(context, string, node);
25
25
 
@@ -99,21 +99,21 @@ export default class AxiomLemmaTheoremConjecture extends Element {
99
99
  const hypothetical = this.isHypothetical();
100
100
 
101
101
  if (hypothetical) {
102
- const steps = context.getSteps(),
102
+ const proofAssertions = context.getProofAssertions(),
103
103
  topLevelAssertionString = this.getString(); ///
104
104
 
105
- context.trace(`Correlating the hypotheses of the '${topLevelAssertionString}' axiom, lemma, theorem or conjecture...`, this.node);
105
+ context.trace(`Correlating the hypotheses of the '${topLevelAssertionString}' top level assertion...`, this.node);
106
106
 
107
- correlatesToHypotheses = correlate(this.hypotheses, steps, (hypothesis, step) => {
108
- const hypothesesEqualToStep = hypothesis.isEqualToStep(step, context);
107
+ correlatesToHypotheses = correlate(this.hypotheses, proofAssertions, (hypothesis, proofAssertion) => {
108
+ const hypothesesComparesToStep = hypothesis.compareProofAssertion(proofAssertion, context);
109
109
 
110
- if (hypothesesEqualToStep) {
110
+ if (hypothesesComparesToStep) {
111
111
  return true;
112
112
  }
113
113
  });
114
114
 
115
115
  if (correlatesToHypotheses) {
116
- context.debug(`...correlated the hypotheses of the '${topLevelAssertionString}' axiom, lemma, theorem or conjecture.`, this.node);
116
+ context.debug(`...correlated the hypotheses of the '${topLevelAssertionString}' top level assertion.`, this.node);
117
117
  }
118
118
  } else {
119
119
  correlatesToHypotheses = true
@@ -128,8 +128,8 @@ export default class AxiomLemmaTheoremConjecture extends Element {
128
128
  const labelsVerify = this.verifyLabels();
129
129
 
130
130
  if (labelsVerify) {
131
- const localContext = LocalContext.fromNothing(this.context),
132
- context = localContext, ///
131
+ const scopedContext = ScopedContext.fromNothing(this.context),
132
+ context = scopedContext, ///
133
133
  suppositionsVerify = this.verifySuppositions(context);
134
134
 
135
135
  if (suppositionsVerify) {
@@ -212,7 +212,7 @@ export default class AxiomLemmaTheoremConjecture extends Element {
212
212
  return statementUnifiesWithDeduction;
213
213
  }
214
214
 
215
- unifyStatementAndStepsOrSubproofs(statement, stepsOrSubproofs, substitutions, context) {
215
+ unifyStatementAndStepsOrSubproofs(statement, subproofOrProofAssertions, substitutions, context) {
216
216
  let statementAndStepsOrSubproofsUnifies = false;
217
217
 
218
218
  const correlatesToHypotheses = this.correlateHypotheses(context);
@@ -221,9 +221,9 @@ export default class AxiomLemmaTheoremConjecture extends Element {
221
221
  const statementUnifiesWithDeduction = this.unifyStatementWithDeduction(statement, substitutions, context);
222
222
 
223
223
  if (statementUnifiesWithDeduction) {
224
- const stepsOrSubproofsUnifyWithSuppositions = this.unifyStepsOrSubproofsWithSuppositions(stepsOrSubproofs, substitutions, context);
224
+ const subproofOrProofAssertionsUnifyWithSuppositions = this.unifyStepsOrSubproofsWithSuppositions(subproofOrProofAssertions, substitutions, context);
225
225
 
226
- if (stepsOrSubproofsUnifyWithSuppositions) {
226
+ if (subproofOrProofAssertionsUnifyWithSuppositions) {
227
227
  const substitutionsResolved = substitutions.areResolved();
228
228
 
229
229
  if (substitutionsResolved) {
@@ -236,43 +236,43 @@ export default class AxiomLemmaTheoremConjecture extends Element {
236
236
  return statementAndStepsOrSubproofsUnifies;
237
237
  }
238
238
 
239
- unifyStepsOrSubproofsWithSupposition(stepsOrSubproofs, supposition, substitutions, generalContext, specificContext) {
240
- let stepsOrSubproofsUnifiesWithSupposition = false;
239
+ unifyStepsOrSubproofsWithSupposition(subproofOrProofAssertions, supposition, substitutions, generalContext, specificContext) {
240
+ let subproofOrProofAssertionsUnifiesWithSupposition = false;
241
241
 
242
242
  const context = specificContext, ///
243
243
  suppositionUnifiesIndependently = supposition.unifyIndependently(substitutions, context);
244
244
 
245
245
  if (suppositionUnifiesIndependently) {
246
- stepsOrSubproofsUnifiesWithSupposition = true;
246
+ subproofOrProofAssertionsUnifiesWithSupposition = true;
247
247
  } else {
248
- const stepOrSubproof = extract(stepsOrSubproofs, (stepOrSubproof) => {
249
- const stepOrSubproofUnifies = supposition.unifyStepOrSubproof(stepOrSubproof, substitutions, generalContext, specificContext);
248
+ const subproofOrProofAssertion = extract(subproofOrProofAssertions, (subproofOrProofAssertion) => {
249
+ const subproofOrProofAssertionUnifies = supposition.unifySubproofOrProofAssertion(subproofOrProofAssertion, substitutions, generalContext, specificContext);
250
250
 
251
- if (stepOrSubproofUnifies) {
251
+ if (subproofOrProofAssertionUnifies) {
252
252
  return true;
253
253
  }
254
254
  }) || null;
255
255
 
256
- if (stepOrSubproof !== null) {
257
- stepsOrSubproofsUnifiesWithSupposition = true;
256
+ if (subproofOrProofAssertion !== null) {
257
+ subproofOrProofAssertionsUnifiesWithSupposition = true;
258
258
  }
259
259
  }
260
260
 
261
- return stepsOrSubproofsUnifiesWithSupposition;
261
+ return subproofOrProofAssertionsUnifiesWithSupposition;
262
262
  }
263
263
 
264
- unifyStepsOrSubproofsWithSuppositions(stepsOrSubproofs, substitutions, generalContext, specificContext) {
265
- stepsOrSubproofs = reverse(stepsOrSubproofs); ///
264
+ unifyStepsOrSubproofsWithSuppositions(subproofOrProofAssertions, substitutions, generalContext, specificContext) {
265
+ subproofOrProofAssertions = reverse(subproofOrProofAssertions); ///
266
266
 
267
- const stepsOrSubproofsUnifyWithSuppositions = backwardsEvery(this.suppositions, (supposition) => {
268
- const stepsOrSubproofsUnifiesWithSupposition = this.unifyStepsOrSubproofsWithSupposition(stepsOrSubproofs, supposition, substitutions, generalContext, specificContext);
267
+ const subproofOrProofAssertionsUnifyWithSuppositions = backwardsEvery(this.suppositions, (supposition) => {
268
+ const subproofOrProofAssertionsUnifiesWithSupposition = this.unifyStepsOrSubproofsWithSupposition(subproofOrProofAssertions, supposition, substitutions, generalContext, specificContext);
269
269
 
270
- if (stepsOrSubproofsUnifiesWithSupposition) {
270
+ if (subproofOrProofAssertionsUnifiesWithSupposition) {
271
271
  return true;
272
272
  }
273
273
  });
274
274
 
275
- return stepsOrSubproofsUnifyWithSuppositions;
275
+ return subproofOrProofAssertionsUnifyWithSuppositions;
276
276
  }
277
277
 
278
278
  toJSON() {
@@ -306,27 +306,8 @@ export default class AxiomLemmaTheoremConjecture extends Element {
306
306
  node = null,
307
307
  proof = null,
308
308
  string = stringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction),
309
- axiomLemmaTheoremConjecture = new Class(context, string, node, labels, suppositions, deduction, proof, signature, hypotheses);
309
+ topLevelAssertion = new Class(context, string, node, labels, suppositions, deduction, proof, signature, hypotheses);
310
310
 
311
- return axiomLemmaTheoremConjecture;
312
- }
313
-
314
- static fromNode(Class, node, context) {
315
- const topLevelAssertionNode = node, ///
316
- proofNode = topLevelAssertionNode.getProofNode(),
317
- labelNodes = topLevelAssertionNode.getLabelNodes(),
318
- deductionNode = topLevelAssertionNode.getDeductionNode(),
319
- suppositionNodes = topLevelAssertionNode.getSuppositionNodes(),
320
- signatureNode = topLevelAssertionNode.getSignatureNode(),
321
- proof = proofFromProofNode(proofNode, context),
322
- labels = labelsFromLabelNodes(labelNodes, context),
323
- deduction = deductionFromDeductionNode(deductionNode, context),
324
- suppositions = suppositionsFromSuppositionNodes(suppositionNodes, context),
325
- signature = signatureFromSignatureNode(signatureNode, context),
326
- hypotheses = [],
327
- string = stringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction),
328
- axiomLemmaTheoremConjecture = new Class(context, string, node, labels, suppositions, deduction, proof, signature, hypotheses);
329
-
330
- return axiomLemmaTheoremConjecture;
311
+ return topLevelAssertion;
331
312
  }
332
313
  }
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
 
3
- import MetaLemmaMetatheorem from "./metaLemmaMetatheorem";
3
+ import TopLevelMetaAssertion from "./../topLevelMetaAssertion";
4
4
 
5
- import { define } from "../elements";
5
+ import { define } from "../../elements";
6
6
 
7
- export default define(class MetaLemma extends MetaLemmaMetatheorem {
7
+ export default define(class MetaLemma extends TopLevelMetaAssertion {
8
8
  verify() {
9
9
  let verifies;
10
10
 
@@ -30,5 +30,5 @@ export default define(class MetaLemma extends MetaLemmaMetatheorem {
30
30
 
31
31
  static name = "MetaLemma";
32
32
 
33
- static fromJSON(json, context) { return MetaLemmaMetatheorem.fromJSON(MetaLemma, json, context); }
33
+ static fromJSON(json, context) { return TopLevelMetaAssertion.fromJSON(MetaLemma, json, context); }
34
34
  });
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
 
3
- import MetaLemmaMetatheorem from "./metaLemmaMetatheorem";
3
+ import TopLevelMetaAssertion from "../topLevelMetaAssertion";
4
4
 
5
- import { define } from "../elements";
5
+ import { define } from "../../elements";
6
6
 
7
- export default define(class Metatheorem extends MetaLemmaMetatheorem {
7
+ export default define(class Metatheorem extends TopLevelMetaAssertion {
8
8
  verify() {
9
9
  let verifies;
10
10
 
@@ -30,5 +30,5 @@ export default define(class Metatheorem extends MetaLemmaMetatheorem {
30
30
 
31
31
  static name = "Metatheorem";
32
32
 
33
- static fromJSON(json, context) { return MetaLemmaMetatheorem.fromJSON(Metatheorem, json, context); }
33
+ static fromJSON(json, context) { return TopLevelMetaAssertion.fromJSON(Metatheorem, json, context); }
34
34
  });
@@ -1,10 +1,8 @@
1
1
  "use strict";
2
2
 
3
3
  import Element from "../element";
4
- import elements from "../elements";
5
- import LocalContext from "../context/local";
4
+ import ScopedContext from "../context/scoped";
6
5
 
7
- import { proofFromProofNode, deductionFromDeductionNode, suppositionsFromSuppositionNodes } from "./axiomLemmaTheoremConjecture";
8
6
  import { labelFromJSON,
9
7
  labelToLabelJSON,
10
8
  deductionFromJSON,
@@ -14,7 +12,7 @@ import { labelFromJSON,
14
12
  suppositionsToSuppositionsJSON,
15
13
  substitutionsToSubstitutionsJSON } from "../utilities/json";
16
14
 
17
- export default class MetaLemmaMetatheorem extends Element {
15
+ export default class TopLevelMetaAssertion extends Element {
18
16
  constructor(context, string, node, label, suppositions, deduction, proof, substitutions) {
19
17
  super(context, string, node);
20
18
 
@@ -61,8 +59,8 @@ export default class MetaLemmaMetatheorem extends Element {
61
59
  const labelVerifies = this.verifyLabel();
62
60
 
63
61
  if (labelVerifies) {
64
- const localContext = LocalContext.fromNothing(this.context),
65
- context = localContext, ///
62
+ const scopedContext = ScopedContext.fromNothing(this.context),
63
+ context = scopedContext, ///
66
64
  suppositionsVerify = this.verifySuppositions(context);
67
65
 
68
66
  if (suppositionsVerify) {
@@ -150,72 +148,9 @@ export default class MetaLemmaMetatheorem extends Element {
150
148
  substitutions = substitutionsFromJSON(json, context),
151
149
  node = null,
152
150
  proof = null,
153
- string = stringFromLabelASuppositionsAndDeduction(label, suppositions, deduction),
154
- metaLemmaMetatheorem = new Class(context, string, node, label, suppositions, deduction, proof, substitutions);
151
+ string = topLevelMetaAssertionStringFromLabelASuppositionsAndDeduction(label, suppositions, deduction),
152
+ topLevelMetaAssertion = new Class(context, string, node, label, suppositions, deduction, proof, substitutions);
155
153
 
156
- return metaLemmaMetatheorem;
154
+ return topLevelMetaAssertion;
157
155
  }
158
-
159
- static fromNode(Class, node, context) {
160
- const { Substitutions } = elements,
161
- topLevelAssertionNode = node, ///
162
- proofNode = topLevelAssertionNode.getProofNode(),
163
- labelNode = topLevelAssertionNode.getLabelNode(),
164
- deductionNode = topLevelAssertionNode.getDeductionNode(),
165
- suppositionNodes = topLevelAssertionNode.getSuppositionNodes(),
166
- proof = proofFromProofNode(proofNode, context),
167
- label = labelFromLabelNode(labelNode, context),
168
- deduction = deductionFromDeductionNode(deductionNode, context),
169
- suppositions = suppositionsFromSuppositionNodes(suppositionNodes, context),
170
- substitutions = Substitutions.fromNothing(),
171
- string = stringFromLabelASuppositionsAndDeduction(label, suppositions, deduction),
172
- metaLemmaMetatheorem = new Class(context, string, node, label, suppositions, deduction, proof, substitutions);
173
-
174
- return metaLemmaMetatheorem;
175
- }
176
- }
177
-
178
- function labelFromLabelNode(labelNode, context) {
179
- let label = null;
180
-
181
- const { Label } = elements;
182
-
183
- if (labelNode !== null) {
184
- label = Label.fromLabelNode(labelNode, context);
185
- }
186
-
187
- return label;
188
- }
189
-
190
- function labelStringFromLabel(label) {
191
- const labelsString = (label !== null) ?
192
- label.getString() :
193
- null;
194
-
195
- return labelsString;
196
- }
197
-
198
- function suppositionsStringFromSuppositions(suppositions) {
199
- const suppositionsString = suppositions.reduce((suppositionsString, supposition) => {
200
- const suppositionString = supposition.getString();
201
-
202
- suppositionsString = (suppositionsString !== null) ?
203
- `${suppositionsString}, ${suppositionString}` :
204
- suppositionString; ///
205
-
206
- return suppositionsString;
207
- }, null);
208
-
209
- return suppositionsString;
210
- }
211
-
212
- function stringFromLabelASuppositionsAndDeduction(label, suppositions, deduction) {
213
- const suppositionsString = suppositionsStringFromSuppositions(suppositions),
214
- deductionString = deduction.getString(),
215
- labelString = labelStringFromLabel(label),
216
- string = (labelString === null) ?
217
- deductionString : ///
218
- `${labelString} :: [${suppositionsString}] ... ${deductionString}`;
219
-
220
- return string;
221
156
  }
@@ -321,14 +321,12 @@ export default define(class Type extends Element {
321
321
  return type;
322
322
  }
323
323
 
324
- static fromName(name) {
325
- const context = null,
326
- string = name, ///
324
+ static fromNameAndProvisional(name, provisional, context) {
325
+ const string = name, ///
327
326
  node = null,
328
327
  prefixName = null,
329
328
  superTypes = [],
330
329
  properties = [],
331
- provisional = false,
332
330
  type = new Type(context, string, node, name, prefixName, superTypes, properties, provisional);
333
331
 
334
332
  return type;
@@ -48,12 +48,12 @@ export default define(class Variable extends Element {
48
48
  return comparesToVariablbeIdentifier;
49
49
  }
50
50
 
51
- verify(context) {
52
- let verifies;
51
+ validate(context) {
52
+ let validates;
53
53
 
54
- const variableString = this.string; ///
54
+ const variableString = this.getString(); ///
55
55
 
56
- context.trace(`Verifying the '${variableString}' variable...`);
56
+ context.trace(`Validating the '${variableString}' variable...`);
57
57
 
58
58
  const variableIdentifier = this.identifier,
59
59
  variable = context.findVariableByVariableIdentifier(variableIdentifier);
@@ -63,24 +63,24 @@ export default define(class Variable extends Element {
63
63
 
64
64
  this.type = type;
65
65
 
66
- verifies = true;
66
+ validates = true;
67
67
  } else {
68
68
  context.debug(`The '${variableString}' variable is not present.`);
69
69
  }
70
70
 
71
- if (verifies) {
72
- context.debug(`...verified the '${variableString}' variable.`);
71
+ if (validates) {
72
+ context.debug(`...validated the '${variableString}' variable.`);
73
73
  }
74
74
 
75
- return verifies;
75
+ return validates;
76
76
  }
77
77
 
78
- verifyType(context) {
79
- let typeVerifies = false;
78
+ validateType(context) {
79
+ let typeValidates = false;
80
80
 
81
81
  const typeString = this.type.getString();
82
82
 
83
- context.trace(`Verifying the '${typeString}' type...`);
83
+ context.trace(`Validating the '${typeString}' type...`);
84
84
 
85
85
  const prefixedTypeName = this.type.getPrefixedName(),
86
86
  type = context.findTypeByPrefixedTypeName(prefixedTypeName);
@@ -90,21 +90,21 @@ export default define(class Variable extends Element {
90
90
  } else {
91
91
  this.type = type; ///
92
92
 
93
- typeVerifies = true;
93
+ typeValidates = true;
94
94
  }
95
95
 
96
- if (typeVerifies) {
97
- context.debug(`...verified the '${typeString}' type.`);
96
+ if (typeValidates) {
97
+ context.debug(`...validated the '${typeString}' type.`);
98
98
  }
99
99
 
100
- return typeVerifies;
100
+ return typeValidates;
101
101
  }
102
102
 
103
103
  unifyTerm(term, substitutions, generalContext, specificContext) {
104
104
  let termUnifies = false;
105
105
 
106
106
  const termString = term.getString(),
107
- variableString = this.string; ///
107
+ variableString = this.getString(); ///
108
108
 
109
109
  specificContext.trace(`Unifying the '${termString}' term with the '${variableString}' variable...`);
110
110
 
@@ -160,7 +160,7 @@ export default define(class Variable extends Element {
160
160
 
161
161
  toJSON() {
162
162
  const typeJSON = typeToTypeJSON(this.type),
163
- string = this.string, ///
163
+ string = this.getString(), ///
164
164
  type = typeJSON, ///
165
165
  json = {
166
166
  type,
package/src/metaTypes.js CHANGED
@@ -8,35 +8,64 @@ let frameMetaType = null,
8
8
  referenceMetaType = null,
9
9
  statementMetaType = null;
10
10
 
11
- export function frameMetaTypeFromNothing() {
11
+ export function getMetaTypes() {
12
+ const frameMetaType = frameMetaTypeFromNothing(),
13
+ referenceMetaType = referenceMetaTypeFromNothing(),
14
+ statementMetaType = statementMetaTypeFromNothing(),
15
+ metaTypes = [
16
+ frameMetaType,
17
+ referenceMetaType,
18
+ statementMetaType
19
+ ];
20
+
21
+ return metaTypes;
22
+ }
23
+
24
+ export function findMetaTypeByMetaTypeName(metaTypeName) {
25
+ const metaTypes = getMetaTypes(),
26
+ metaType = metaTypes.find((metaType) => {
27
+ const metaTypeComparesToMetaTypeName = metaType.compareMetaTypeName(metaTypeName);
28
+
29
+ if (metaTypeComparesToMetaTypeName) {
30
+ return true;
31
+ }
32
+ }) || null;
33
+
34
+ return metaType;
35
+ }
36
+
37
+ function frameMetaTypeFromNothing() {
12
38
  if (frameMetaType === null) {
13
39
  const { MetaType } = elements,
14
- name = FRAME_META_TYPE_NAME; ///
40
+ name = FRAME_META_TYPE_NAME, ///
41
+ context = null;
15
42
 
16
- frameMetaType = MetaType.fromName(name);
43
+ frameMetaType = MetaType.fromName(name, context);
17
44
  }
18
45
 
19
46
  return frameMetaType;
20
47
  }
21
48
 
22
- export function referenceMetaTypeFromNothing() {
23
- if (referenceMetaType === null) {
49
+ function statementMetaTypeFromNothing() {
50
+ if (statementMetaType === null) {
24
51
  const { MetaType } = elements,
25
- name = REFERENCE_META_TYPE_NAME; ///
52
+ name = STATEMENT_META_TYPE_NAME, ///
53
+ context = null;
26
54
 
27
- referenceMetaType = MetaType.fromName(name);
55
+ statementMetaType = MetaType.fromName(name, context);
28
56
  }
29
57
 
30
- return referenceMetaType;
58
+ return statementMetaType;
31
59
  }
32
60
 
33
- export function statementMetaTypeFromNothing() {
34
- if (statementMetaType === null) {
61
+ function referenceMetaTypeFromNothing() {
62
+ if (referenceMetaType === null) {
35
63
  const { MetaType } = elements,
36
- name = STATEMENT_META_TYPE_NAME; ///
64
+ name = REFERENCE_META_TYPE_NAME, ///
65
+ context = null;
37
66
 
38
- statementMetaType = MetaType.fromName(name);
67
+ referenceMetaType = MetaType.fromName(name, context);
39
68
  }
40
69
 
41
- return statementMetaType;
70
+ return referenceMetaType;
42
71
  }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ import ProofAssertionNode from "../../node/proofAssertion";
4
+
5
+ import { PROCEDURE_CALL_RULE_NAME } from "../../ruleNames";
6
+
7
+ export default class PremiseNode extends ProofAssertionNode {
8
+ getProcedureCallNode() {
9
+ const ruleName = PROCEDURE_CALL_RULE_NAME,
10
+ procedureCallNode = this.getNodeByRuleName(ruleName);
11
+
12
+ return procedureCallNode;
13
+ }
14
+
15
+ static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return ProofAssertionNode.fromRuleNameChildNodesOpacityAndPrecedence(PremiseNode, ruleName, childNodes, opacity, precedence); }
16
+ }
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
 
3
- import NonTerminalNode from "../nonTerminalNode";
3
+ import ProofAssertionNode from "../../node/proofAssertion";
4
4
 
5
- import { NONSENSE_RULE_NAME, STATEMENT_RULE_NAME, QUALIFICATION_RULE_NAME } from "../ruleNames";
5
+ import { QUALIFICATION_RULE_NAME } from "../../ruleNames";
6
6
 
7
- export default class StepNode extends NonTerminalNode {
7
+ export default class StepNode extends ProofAssertionNode {
8
8
  isStepNode() {
9
9
  const stepNode = true;
10
10
 
@@ -41,20 +41,6 @@ export default class StepNode extends NonTerminalNode {
41
41
  return satisfiedAssertionNode;
42
42
  }
43
43
 
44
- getNonsenseNode() {
45
- const ruleName = NONSENSE_RULE_NAME,
46
- nonsenseNode = this.getNodeByRuleName(ruleName);
47
-
48
- return nonsenseNode;
49
- }
50
-
51
- getStatementNode() {
52
- const ruleName = STATEMENT_RULE_NAME,
53
- statementNode = this.getNodeByRuleName(ruleName);
54
-
55
- return statementNode;
56
- }
57
-
58
44
  getQualificationNode() {
59
45
  const ruleName = QUALIFICATION_RULE_NAME,
60
46
  qualificationNode = this.getNodeByRuleName(ruleName);
@@ -62,5 +48,5 @@ export default class StepNode extends NonTerminalNode {
62
48
  return qualificationNode;
63
49
  }
64
50
 
65
- static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(StepNode, ruleName, childNodes, opacity, precedence); }
51
+ static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return ProofAssertionNode.fromRuleNameChildNodesOpacityAndPrecedence(StepNode, ruleName, childNodes, opacity, precedence); }
66
52
  }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ import ProofAssertionNode from "../../node/proofAssertion";
4
+
5
+ import { PROCEDURE_CALL_RULE_NAME } from "../../ruleNames";
6
+
7
+ export default class SuppositionNode extends ProofAssertionNode {
8
+ getProcedureCallNode() {
9
+ const ruleName = PROCEDURE_CALL_RULE_NAME,
10
+ procedureCallNode = this.getNodeByRuleName(ruleName);
11
+
12
+ return procedureCallNode;
13
+ }
14
+
15
+ static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return ProofAssertionNode.fromRuleNameChildNodesOpacityAndPrecedence(SuppositionNode, ruleName, childNodes, opacity, precedence); }
16
+ }
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ import NonTerminalNode from "../nonTerminalNode";
4
+
5
+ import { NONSENSE_RULE_NAME, STATEMENT_RULE_NAME } from "../ruleNames";
6
+
7
+ export default class ProofAssertionNode extends NonTerminalNode {
8
+ getNonsenseNode() {
9
+ const ruleName = NONSENSE_RULE_NAME,
10
+ nonsenseNode = this.getNodeByRuleName(ruleName);
11
+
12
+ return nonsenseNode;
13
+ }
14
+
15
+ getStatementNode() {
16
+ const ruleName = STATEMENT_RULE_NAME,
17
+ statementNode = this.getNodeByRuleName(ruleName);
18
+
19
+ return statementNode;
20
+ }
21
+
22
+ static fromRuleNameChildNodesOpacityAndPrecedence(Class, ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(Class, ruleName, childNodes, opacity, precedence); }
23
+ }
@@ -36,7 +36,7 @@ export default class StatementNode extends NonTerminalNode {
36
36
 
37
37
  const metavariableNode = this.getMetavariableNode();
38
38
 
39
- if (metavariableName !== null) {
39
+ if (metavariableNode !== null) {
40
40
  metavariableName = metavariableNode.getMetavariableName();
41
41
  }
42
42
 
@@ -5,13 +5,6 @@ import NonTerminalNode from "../nonTerminalNode";
5
5
  import { STEP_RULE_NAME, SUBPROOF_RULE_NAME } from "../ruleNames";
6
6
 
7
7
  export default class SubDerivationNode extends NonTerminalNode {
8
- getLastStepNode() {
9
- const ruleName = STEP_RULE_NAME,
10
- lastStepNode = this.getLastNodeByRuleName(ruleName);
11
-
12
- return lastStepNode;
13
- }
14
-
15
8
  getStepOrSubproofNodes() {
16
9
  const ruleNames = [
17
10
  STEP_RULE_NAME,
@@ -17,13 +17,6 @@ export default class SubproofNode extends NonTerminalNode {
17
17
  return subproofNode;
18
18
  }
19
19
 
20
- getLastStepNode() {
21
- const subDerivationNode = this.getSubDerivationNode(),
22
- lastStepNode = subDerivationNode.getLastStepNode();
23
-
24
- return lastStepNode;
25
- }
26
-
27
20
  getSuppositionNodes() {
28
21
  const ruleName = SUPPOSITION_RULE_NAME,
29
22
  suppositionNodes = this.getNodesByRuleName(ruleName);
@@ -13,7 +13,7 @@ export default class StatementSubstitutionNode extends SubstitutionNode {
13
13
  }
14
14
 
15
15
  getMetavariableNode() {
16
- const lastMetavariableNode = this.getLastVariableNode(),
16
+ const lastMetavariableNode = this.getLastMetavariableNode(),
17
17
  metavariableNode = lastMetavariableNode; ///
18
18
 
19
19
  return metavariableNode;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ import TopLevelAssertionNode from "../../node/topLevelAssertion";
4
+
5
+ import { AXIOM_BODY_RULE_NAME, AXIOM_HEADER_RULE_NAME } from "../../ruleNames";
6
+
7
+ export default class AxiomNode extends TopLevelAssertionNode {
8
+ static bodyRuleName = AXIOM_BODY_RULE_NAME;
9
+
10
+ static headerRuleName = AXIOM_HEADER_RULE_NAME;
11
+
12
+ static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return TopLevelAssertionNode.fromRuleNameChildNodesOpacityAndPrecedence(AxiomNode, ruleName, childNodes, opacity, precedence); }
13
+ }