occam-verify-cli 1.0.448 → 1.0.472

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 (222) hide show
  1. package/lib/constants.js +13 -5
  2. package/lib/context/ephemeral.js +270 -0
  3. package/lib/context/file.js +136 -128
  4. package/lib/context/liminal.js +120 -0
  5. package/lib/context/literal.js +92 -0
  6. package/lib/context/nominal.js +15 -1
  7. package/lib/context/release.js +68 -9
  8. package/lib/context/scoped.js +322 -0
  9. package/lib/context/synthetic.js +133 -0
  10. package/lib/element/assertion/contained.js +66 -66
  11. package/lib/element/assertion/defined.js +32 -32
  12. package/lib/element/assertion/property.js +39 -39
  13. package/lib/element/assertion/satisfies.js +22 -22
  14. package/lib/element/assumption.js +71 -87
  15. package/lib/element/combinator/bracketed.js +1 -10
  16. package/lib/element/conclusion.js +19 -15
  17. package/lib/element/constructor/bracketed.js +1 -10
  18. package/lib/element/constructor.js +2 -2
  19. package/lib/element/declaration/combinator.js +1 -2
  20. package/lib/element/declaration/metavariable.js +3 -3
  21. package/lib/element/declaration/variable.js +3 -3
  22. package/lib/element/deduction.js +26 -20
  23. package/lib/element/derivation.js +3 -3
  24. package/lib/element/equality.js +5 -5
  25. package/lib/element/equivalence.js +112 -107
  26. package/lib/element/equivalences.js +24 -10
  27. package/lib/element/error.js +3 -3
  28. package/lib/element/frame.js +73 -62
  29. package/lib/element/hypothesis.js +2 -2
  30. package/lib/element/judgement.js +40 -60
  31. package/lib/element/metaType.js +4 -4
  32. package/lib/element/metavariable.js +49 -38
  33. package/lib/element/parameter.js +13 -5
  34. package/lib/element/procedureCall.js +16 -16
  35. package/lib/element/proof.js +14 -13
  36. package/lib/element/proofAssertion/premise.js +319 -0
  37. package/lib/element/proofAssertion/step.js +309 -0
  38. package/lib/element/proofAssertion/supposition.js +333 -0
  39. package/lib/element/proofAssertion.js +20 -10
  40. package/lib/element/propertyRelation.js +2 -2
  41. package/lib/element/reference.js +72 -30
  42. package/lib/element/rule.js +26 -28
  43. package/lib/element/section.js +5 -5
  44. package/lib/element/signature.js +9 -6
  45. package/lib/element/statement.js +44 -36
  46. package/lib/element/subproof.js +18 -17
  47. package/lib/element/substitution/frame.js +86 -49
  48. package/lib/element/substitution/reference.js +101 -19
  49. package/lib/element/substitution/statement.js +128 -105
  50. package/lib/element/substitution/term.js +93 -57
  51. package/lib/element/substitution.js +20 -69
  52. package/lib/element/substitutions.js +49 -34
  53. package/lib/element/term.js +41 -30
  54. package/lib/element/topLevelAssertion/axiom.js +331 -0
  55. package/lib/element/{conjecture.js → topLevelAssertion/conjecture.js} +10 -10
  56. package/lib/element/{lemma.js → topLevelAssertion/lemma.js} +9 -9
  57. package/lib/element/{theorem.js → topLevelAssertion/theorem.js} +8 -8
  58. package/lib/element/topLevelAssertion.js +434 -0
  59. package/lib/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +8 -8
  60. package/lib/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +8 -8
  61. package/lib/element/topLevelMetaAssertion.js +293 -0
  62. package/lib/element/type.js +4 -4
  63. package/lib/element/variable.js +48 -40
  64. package/lib/index.js +3 -3
  65. package/lib/main.js +3 -3
  66. package/lib/metaTypes.js +18 -15
  67. package/lib/node/frame.js +2 -2
  68. package/lib/node/metavariable.js +4 -4
  69. package/lib/node/parameter.js +28 -7
  70. package/lib/node/proofAssertion/premise.js +116 -0
  71. package/lib/node/proofAssertion/step.js +152 -0
  72. package/lib/node/proofAssertion/supposition.js +116 -0
  73. package/lib/node/{premise.js → proofAssertion.js} +11 -18
  74. package/lib/node/statement.js +2 -2
  75. package/lib/node/substitution/frame.js +9 -31
  76. package/lib/node/substitution/reference.js +137 -0
  77. package/lib/node/substitution/statement.js +9 -31
  78. package/lib/node/substitution/term.js +9 -23
  79. package/lib/node/{axiom.js → topLevelAssertion/axiom.js} +7 -7
  80. package/lib/node/{conjecture.js → topLevelAssertion/conjecture.js} +7 -7
  81. package/lib/node/{lemma.js → topLevelAssertion/lemma.js} +7 -7
  82. package/lib/node/{theorem.js → topLevelAssertion/theorem.js} +7 -7
  83. package/lib/node/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +9 -9
  84. package/lib/node/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +7 -7
  85. package/lib/node/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +7 -7
  86. package/lib/node/{metaLemmaMetaTheorem.js → topLevelMetaAssertion.js} +9 -9
  87. package/lib/nonTerminalNodeMap.js +15 -14
  88. package/lib/preamble.js +10 -10
  89. package/lib/process/instantiate.js +6 -21
  90. package/lib/process/unify.js +11 -10
  91. package/lib/tokenTypes.js +22 -0
  92. package/lib/types.js +3 -3
  93. package/lib/utilities/bnf.js +5 -5
  94. package/lib/utilities/context.js +63 -0
  95. package/lib/utilities/element.js +235 -408
  96. package/lib/utilities/instance.js +12 -34
  97. package/lib/utilities/json.js +3 -2
  98. package/lib/utilities/string.js +56 -21
  99. package/lib/utilities/unification.js +38 -32
  100. package/lib/utilities/validation.js +47 -50
  101. package/package.json +2 -2
  102. package/src/constants.js +12 -1
  103. package/src/context/ephemeral.js +257 -0
  104. package/src/context/file.js +108 -116
  105. package/src/context/liminal.js +67 -0
  106. package/src/context/literal.js +51 -0
  107. package/src/context/nominal.js +12 -0
  108. package/src/context/release.js +48 -8
  109. package/src/context/{local.js → scoped.js} +43 -125
  110. package/src/context/synthetic.js +60 -0
  111. package/src/element/assertion/contained.js +49 -47
  112. package/src/element/assertion/defined.js +29 -27
  113. package/src/element/assertion/property.js +35 -35
  114. package/src/element/assertion/satisfies.js +19 -18
  115. package/src/element/assumption.js +71 -93
  116. package/src/element/combinator/bracketed.js +0 -7
  117. package/src/element/conclusion.js +25 -24
  118. package/src/element/constructor/bracketed.js +0 -7
  119. package/src/element/constructor.js +1 -1
  120. package/src/element/declaration/combinator.js +0 -1
  121. package/src/element/declaration/metavariable.js +2 -2
  122. package/src/element/declaration/variable.js +5 -5
  123. package/src/element/deduction.js +33 -31
  124. package/src/element/derivation.js +2 -2
  125. package/src/element/equality.js +4 -4
  126. package/src/element/equivalence.js +115 -135
  127. package/src/element/equivalences.js +9 -7
  128. package/src/element/error.js +4 -2
  129. package/src/element/frame.js +80 -65
  130. package/src/element/hypothesis.js +1 -1
  131. package/src/element/judgement.js +42 -62
  132. package/src/element/metaType.js +3 -4
  133. package/src/element/metavariable.js +59 -56
  134. package/src/element/parameter.js +10 -5
  135. package/src/element/procedureCall.js +20 -18
  136. package/src/element/proof.js +14 -16
  137. package/src/element/{premise.js → proofAssertion/premise.js} +57 -53
  138. package/src/element/{step.js → proofAssertion/step.js} +59 -62
  139. package/src/element/{supposition.js → proofAssertion/supposition.js} +67 -56
  140. package/src/element/proofAssertion.js +24 -13
  141. package/src/element/propertyRelation.js +1 -1
  142. package/src/element/reference.js +87 -37
  143. package/src/element/rule.js +31 -37
  144. package/src/element/section.js +5 -5
  145. package/src/element/signature.js +8 -8
  146. package/src/element/statement.js +52 -48
  147. package/src/element/subproof.js +16 -18
  148. package/src/element/substitution/frame.js +104 -50
  149. package/src/element/substitution/reference.js +120 -20
  150. package/src/element/substitution/statement.js +169 -130
  151. package/src/element/substitution/term.js +104 -63
  152. package/src/element/substitution.js +16 -58
  153. package/src/element/substitutions.js +43 -41
  154. package/src/element/term.js +47 -41
  155. package/src/element/{axiom.js → topLevelAssertion/axiom.js} +22 -20
  156. package/src/element/{conjecture.js → topLevelAssertion/conjecture.js} +5 -6
  157. package/src/element/{lemma.js → topLevelAssertion/lemma.js} +5 -6
  158. package/src/element/{theorem.js → topLevelAssertion/theorem.js} +5 -5
  159. package/src/element/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +37 -33
  160. package/src/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +5 -6
  161. package/src/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +5 -6
  162. package/src/element/{metaLemmaMetatheorem.js → topLevelMetaAssertion.js} +19 -17
  163. package/src/element/type.js +2 -4
  164. package/src/element/variable.js +47 -48
  165. package/src/index.js +2 -1
  166. package/src/main.js +2 -1
  167. package/src/metaTypes.js +25 -9
  168. package/src/node/frame.js +1 -1
  169. package/src/node/metavariable.js +3 -3
  170. package/src/node/parameter.js +32 -5
  171. package/src/node/proofAssertion/premise.js +16 -0
  172. package/src/node/{step.js → proofAssertion/step.js} +4 -18
  173. package/src/node/proofAssertion/supposition.js +16 -0
  174. package/src/node/proofAssertion.js +23 -0
  175. package/src/node/statement.js +1 -1
  176. package/src/node/substitution/frame.js +6 -32
  177. package/src/node/substitution/reference.js +38 -0
  178. package/src/node/substitution/statement.js +6 -32
  179. package/src/node/substitution/term.js +6 -22
  180. package/src/node/topLevelAssertion/axiom.js +13 -0
  181. package/src/node/topLevelAssertion/conjecture.js +13 -0
  182. package/src/node/topLevelAssertion/lemma.js +13 -0
  183. package/src/node/topLevelAssertion/theorem.js +13 -0
  184. package/src/node/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +1 -1
  185. package/src/node/topLevelMetaAssertion/metaLemma.js +13 -0
  186. package/src/node/topLevelMetaAssertion/metatheorem.js +13 -0
  187. package/src/node/{metaLemmaMetaTheorem.js → topLevelMetaAssertion.js} +1 -1
  188. package/src/nonTerminalNodeMap.js +15 -12
  189. package/src/preamble.js +9 -9
  190. package/src/process/instantiate.js +27 -36
  191. package/src/process/unify.js +10 -9
  192. package/src/tokenTypes.js +4 -0
  193. package/src/types.js +4 -2
  194. package/src/utilities/bnf.js +3 -2
  195. package/src/utilities/context.js +46 -0
  196. package/src/utilities/element.js +302 -509
  197. package/src/utilities/instance.js +19 -42
  198. package/src/utilities/json.js +3 -1
  199. package/src/utilities/string.js +69 -28
  200. package/src/utilities/unification.js +41 -38
  201. package/src/utilities/validation.js +66 -75
  202. package/lib/context/local.js +0 -605
  203. package/lib/context/temporary.js +0 -752
  204. package/lib/element/axiom.js +0 -329
  205. package/lib/element/axiomLemmaTheoremConjecture.js +0 -427
  206. package/lib/element/metaLemmaMetatheorem.js +0 -289
  207. package/lib/element/premise.js +0 -307
  208. package/lib/element/step.js +0 -311
  209. package/lib/element/supposition.js +0 -320
  210. package/lib/log.js +0 -150
  211. package/lib/node/step.js +0 -166
  212. package/lib/node/supposition.js +0 -130
  213. package/src/context/temporary.js +0 -476
  214. package/src/log.js +0 -118
  215. package/src/node/axiom.js +0 -13
  216. package/src/node/conjecture.js +0 -13
  217. package/src/node/lemma.js +0 -13
  218. package/src/node/metaLemma.js +0 -13
  219. package/src/node/metatheorem.js +0 -13
  220. package/src/node/premise.js +0 -30
  221. package/src/node/supposition.js +0 -30
  222. package/src/node/theorem.js +0 -13
@@ -3,9 +3,8 @@
3
3
  import { arrayUtilities } from "necessary";
4
4
 
5
5
  import Element from "../element";
6
- import elements from "../elements";
7
- import LocalContext from "../context/local";
8
6
 
7
+ import { scope, attempt } from "../utilities/context";
9
8
  import { labelsFromJSON,
10
9
  deductionFromJSON,
11
10
  signatureFromJSON,
@@ -19,7 +18,7 @@ import { labelsFromJSON,
19
18
 
20
19
  const { extract, reverse, correlate, backwardsEvery } = arrayUtilities;
21
20
 
22
- export default class AxiomLemmaTheoremConjecture extends Element {
21
+ export default class TopLevelAssertion extends Element {
23
22
  constructor(context, string, node, labels, suppositions, deduction, proof, signature, hypotheses) {
24
23
  super(context, string, node);
25
24
 
@@ -100,9 +99,9 @@ export default class AxiomLemmaTheoremConjecture extends Element {
100
99
 
101
100
  if (hypothetical) {
102
101
  const proofAssertions = context.getProofAssertions(),
103
- axiomLemmaTheoremConjectureString = this.getString(); ///
102
+ topLevelAssertionString = this.getString(); ///
104
103
 
105
- context.trace(`Correlating the hypotheses of the '${axiomLemmaTheoremConjectureString}' axiom, lemma, theorem or conjecture...`, this.node);
104
+ context.trace(`Correlating the hypotheses of the '${topLevelAssertionString}' top level assertion...`, this.node);
106
105
 
107
106
  correlatesToHypotheses = correlate(this.hypotheses, proofAssertions, (hypothesis, proofAssertion) => {
108
107
  const hypothesesComparesToStep = hypothesis.compareProofAssertion(proofAssertion, context);
@@ -113,7 +112,7 @@ export default class AxiomLemmaTheoremConjecture extends Element {
113
112
  });
114
113
 
115
114
  if (correlatesToHypotheses) {
116
- context.debug(`...correlated the hypotheses of the '${axiomLemmaTheoremConjectureString}' axiom, lemma, theorem or conjecture.`, this.node);
115
+ context.debug(`...correlated the hypotheses of the '${topLevelAssertionString}' top level assertion.`, this.node);
117
116
  }
118
117
  } else {
119
118
  correlatesToHypotheses = true
@@ -125,25 +124,27 @@ export default class AxiomLemmaTheoremConjecture extends Element {
125
124
  verify() {
126
125
  let verifies = false;
127
126
 
128
- const labelsVerify = this.verifyLabels();
127
+ const context = this.getContext();
129
128
 
130
- if (labelsVerify) {
131
- const localContext = LocalContext.fromNothing(this.context),
132
- context = localContext, ///
133
- suppositionsVerify = this.verifySuppositions(context);
129
+ scope((context) => {
130
+ const labelsVerify = this.verifyLabels();
134
131
 
135
- if (suppositionsVerify) {
136
- const deductionVerifies = this.verifyDeduction(context);
132
+ if (labelsVerify) {
133
+ const suppositionsVerify = this.verifySuppositions(context);
137
134
 
138
- if (deductionVerifies) {
139
- const proofVerifies = this.verifyProof(context);
135
+ if (suppositionsVerify) {
136
+ const deductionVerifies = this.verifyDeduction(context);
140
137
 
141
- if (proofVerifies) {
142
- verifies = true;
138
+ if (deductionVerifies) {
139
+ const proofVerifies = this.verifyProof(context);
140
+
141
+ if (proofVerifies) {
142
+ verifies = true;
143
+ }
143
144
  }
144
145
  }
145
146
  }
146
- }
147
+ }, context);
147
148
 
148
149
  return verifies;
149
150
  }
@@ -186,15 +187,14 @@ export default class AxiomLemmaTheoremConjecture extends Element {
186
187
  }
187
188
 
188
189
  verifyProof(context) {
189
- let proofVerifies;
190
+ let proofVerifies = true; ///
190
191
 
191
- if (this.proof === null) {
192
- proofVerifies = true;
193
- } else {
194
- const { Substitutions } = elements,
195
- substitutions = Substitutions.fromNothing();
192
+ if (this.proof !== null) {
193
+ proofVerifies = attempt((context) => {
194
+ const proofVerifies = this.proof.verify(this.deduction, context);
196
195
 
197
- proofVerifies = this.proof.verify(substitutions, this.deduction, context);
196
+ return proofVerifies;
197
+ }, context);
198
198
  }
199
199
 
200
200
  return proofVerifies;
@@ -239,12 +239,7 @@ export default class AxiomLemmaTheoremConjecture extends Element {
239
239
  unifyStepsOrSubproofsWithSupposition(subproofOrProofAssertions, supposition, substitutions, generalContext, specificContext) {
240
240
  let subproofOrProofAssertionsUnifiesWithSupposition = false;
241
241
 
242
- const context = specificContext, ///
243
- suppositionUnifiesIndependently = supposition.unifyIndependently(substitutions, context);
244
-
245
- if (suppositionUnifiesIndependently) {
246
- subproofOrProofAssertionsUnifiesWithSupposition = true;
247
- } else {
242
+ if (!subproofOrProofAssertionsUnifiesWithSupposition) {
248
243
  const subproofOrProofAssertion = extract(subproofOrProofAssertions, (subproofOrProofAssertion) => {
249
244
  const subproofOrProofAssertionUnifies = supposition.unifySubproofOrProofAssertion(subproofOrProofAssertion, substitutions, generalContext, specificContext);
250
245
 
@@ -258,6 +253,15 @@ export default class AxiomLemmaTheoremConjecture extends Element {
258
253
  }
259
254
  }
260
255
 
256
+ if (!subproofOrProofAssertionsUnifiesWithSupposition) {
257
+ const context = specificContext, ///
258
+ suppositionUnifiesIndependently = supposition.unifyIndependently(substitutions, context);
259
+
260
+ if (suppositionUnifiesIndependently) {
261
+ subproofOrProofAssertionsUnifiesWithSupposition = true;
262
+ }
263
+ }
264
+
261
265
  return subproofOrProofAssertionsUnifiesWithSupposition;
262
266
  }
263
267
 
@@ -306,8 +310,8 @@ export default class AxiomLemmaTheoremConjecture extends Element {
306
310
  node = null,
307
311
  proof = null,
308
312
  string = stringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction),
309
- axiomLemmaTheoremConjecture = new Class(context, string, node, labels, suppositions, deduction, proof, signature, hypotheses);
313
+ topLevelAssertion = new Class(context, string, node, labels, suppositions, deduction, proof, signature, hypotheses);
310
314
 
311
- return axiomLemmaTheoremConjecture;
315
+ return topLevelAssertion;
312
316
  }
313
317
  }
@@ -1,17 +1,16 @@
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
 
11
11
  const node = this.getNode(),
12
12
  context = this.getContext(),
13
- metaLemma = this, ///
14
- metaLemmaString = metaLemma.getString();
13
+ metaLemmaString = this.getString(); ///
15
14
 
16
15
  context.trace(`Verifying the '${metaLemmaString}' meta-lemma...`, node);
17
16
 
@@ -30,5 +29,5 @@ export default define(class MetaLemma extends MetaLemmaMetatheorem {
30
29
 
31
30
  static name = "MetaLemma";
32
31
 
33
- static fromJSON(json, context) { return MetaLemmaMetatheorem.fromJSON(MetaLemma, json, context); }
32
+ static fromJSON(json, context) { return TopLevelMetaAssertion.fromJSON(MetaLemma, json, context); }
34
33
  });
@@ -1,17 +1,16 @@
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
 
11
11
  const node = this.getNode(),
12
12
  context = this.getContext(),
13
- metaLemma = this, ///
14
- metaLemmaString = metaLemma.getString();
13
+ metaLemmaString = this.getString(); ///
15
14
 
16
15
  context.trace(`Verifying the '${metaLemmaString}' metatheorem...`, node);
17
16
 
@@ -30,5 +29,5 @@ export default define(class Metatheorem extends MetaLemmaMetatheorem {
30
29
 
31
30
  static name = "Metatheorem";
32
31
 
33
- static fromJSON(json, context) { return MetaLemmaMetatheorem.fromJSON(Metatheorem, json, context); }
32
+ static fromJSON(json, context) { return TopLevelMetaAssertion.fromJSON(Metatheorem, json, context); }
34
33
  });
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
 
3
3
  import Element from "../element";
4
- import LocalContext from "../context/local";
5
4
 
5
+ import { scope } from "../utilities/context";
6
6
  import { labelFromJSON,
7
7
  labelToLabelJSON,
8
8
  deductionFromJSON,
@@ -12,7 +12,7 @@ import { labelFromJSON,
12
12
  suppositionsToSuppositionsJSON,
13
13
  substitutionsToSubstitutionsJSON } from "../utilities/json";
14
14
 
15
- export default class MetaLemmaMetatheorem extends Element {
15
+ export default class TopLevelMetaAssertion extends Element {
16
16
  constructor(context, string, node, label, suppositions, deduction, proof, substitutions) {
17
17
  super(context, string, node);
18
18
 
@@ -56,25 +56,27 @@ export default class MetaLemmaMetatheorem extends Element {
56
56
  verify() {
57
57
  let verifies = false;
58
58
 
59
- const labelVerifies = this.verifyLabel();
59
+ const context = this.getContext();
60
60
 
61
- if (labelVerifies) {
62
- const localContext = LocalContext.fromNothing(this.context),
63
- context = localContext, ///
64
- suppositionsVerify = this.verifySuppositions(context);
61
+ scope((context) => {
62
+ const labelVerifies = this.verifyLabel();
65
63
 
66
- if (suppositionsVerify) {
67
- const deductionVerifies = this.verifyDeduction(context);
64
+ if (labelVerifies) {
65
+ const suppositionsVerify = this.verifySuppositions(context);
68
66
 
69
- if (deductionVerifies) {
70
- const proofVerifies = this.verifyProof(context);
67
+ if (suppositionsVerify) {
68
+ const deductionVerifies = this.verifyDeduction(context);
71
69
 
72
- if (proofVerifies) {
73
- verifies = true;
70
+ if (deductionVerifies) {
71
+ const proofVerifies = this.verifyProof(context);
72
+
73
+ if (proofVerifies) {
74
+ verifies = true;
75
+ }
74
76
  }
75
77
  }
76
78
  }
77
- }
79
+ }, context);
78
80
 
79
81
  return verifies;
80
82
  }
@@ -148,9 +150,9 @@ export default class MetaLemmaMetatheorem extends Element {
148
150
  substitutions = substitutionsFromJSON(json, context),
149
151
  node = null,
150
152
  proof = null,
151
- string = metaLemmaMetatheoremStringFromLabelASuppositionsAndDeduction(label, suppositions, deduction),
152
- metaLemmaMetatheorem = new Class(context, string, node, label, suppositions, deduction, proof, substitutions);
153
+ string = topLevelMetaAssertionStringFromLabelASuppositionsAndDeduction(label, suppositions, deduction),
154
+ topLevelMetaAssertion = new Class(context, string, node, label, suppositions, deduction, proof, substitutions);
153
155
 
154
- return metaLemmaMetatheorem;
156
+ return topLevelMetaAssertion;
155
157
  }
156
158
  }
@@ -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;
@@ -4,8 +4,8 @@ import Element from "../element";
4
4
  import elements from "../elements";
5
5
 
6
6
  import { define } from "../elements";
7
- import { instantiateVariable } from "../process/instantiate";
8
- import { typeFromJSON, typeToTypeJSON } from "../utilities/json";
7
+ import { synthetically } from "../utilities/context";
8
+ import { typeToTypeJSON } from "../utilities/json";
9
9
 
10
10
  export default define(class Variable extends Element {
11
11
  constructor(context, string, node, type, identifier, propertyRelations) {
@@ -34,26 +34,34 @@ export default define(class Variable extends Element {
34
34
 
35
35
  getTypeString() { return this.type.getString(); }
36
36
 
37
- compareParameter(parameter) {
38
- const parameterName = parameter.getName(),
39
- identifierParamterName = (this.identifier === parameterName),
40
- comparesToParamter = identifierParamterName; ///
37
+ isIdentifierEqualTo(identifier) {
38
+ const identifierEqualTo = (this.identifier === identifier);
39
+
40
+ return identifierEqualTo;
41
+ }
42
+
43
+ compareParamter(parameter) {
44
+ const identifier = parameter.getIdentifier(),
45
+ identifierEqualTo = this.isIdentifierEqualTo(identifier),
46
+ comparesToParamter = identifierEqualTo; ///
41
47
 
42
48
  return comparesToParamter;
43
49
  }
44
50
 
45
51
  compareVariableIdentifier(variableIdentifier) {
46
- const comparesToVariablbeIdentifier = (this.identifier === variableIdentifier);
52
+ const identifier = variableIdentifier, ///
53
+ identifierEqualTo = this.isIdentifierEqualTo(identifier),
54
+ comparesToVariableIdentifier = identifierEqualTo; ///
47
55
 
48
- return comparesToVariablbeIdentifier;
56
+ return comparesToVariableIdentifier;
49
57
  }
50
58
 
51
- verify(context) {
52
- let verifies;
59
+ validate(context) {
60
+ let validates;
53
61
 
54
- const variableString = this.string; ///
62
+ const variableString = this.getString(); ///
55
63
 
56
- context.trace(`Verifying the '${variableString}' variable...`);
64
+ context.trace(`Validating the '${variableString}' variable...`);
57
65
 
58
66
  const variableIdentifier = this.identifier,
59
67
  variable = context.findVariableByVariableIdentifier(variableIdentifier);
@@ -63,24 +71,24 @@ export default define(class Variable extends Element {
63
71
 
64
72
  this.type = type;
65
73
 
66
- verifies = true;
74
+ validates = true;
67
75
  } else {
68
76
  context.debug(`The '${variableString}' variable is not present.`);
69
77
  }
70
78
 
71
- if (verifies) {
72
- context.debug(`...verified the '${variableString}' variable.`);
79
+ if (validates) {
80
+ context.debug(`...validated the '${variableString}' variable.`);
73
81
  }
74
82
 
75
- return verifies;
83
+ return validates;
76
84
  }
77
85
 
78
- verifyType(context) {
79
- let typeVerifies = false;
86
+ validateType(context) {
87
+ let typeValidates = false;
80
88
 
81
89
  const typeString = this.type.getString();
82
90
 
83
- context.trace(`Verifying the '${typeString}' type...`);
91
+ context.trace(`Validating the '${typeString}' type...`);
84
92
 
85
93
  const prefixedTypeName = this.type.getPrefixedName(),
86
94
  type = context.findTypeByPrefixedTypeName(prefixedTypeName);
@@ -90,40 +98,40 @@ export default define(class Variable extends Element {
90
98
  } else {
91
99
  this.type = type; ///
92
100
 
93
- typeVerifies = true;
101
+ typeValidates = true;
94
102
  }
95
103
 
96
- if (typeVerifies) {
97
- context.debug(`...verified the '${typeString}' type.`);
104
+ if (typeValidates) {
105
+ context.debug(`...validated the '${typeString}' type.`);
98
106
  }
99
107
 
100
- return typeVerifies;
108
+ return typeValidates;
101
109
  }
102
110
 
103
111
  unifyTerm(term, substitutions, generalContext, specificContext) {
104
112
  let termUnifies = false;
105
113
 
106
- const termString = term.getString(),
107
- variableString = this.string; ///
114
+ const context = specificContext, ///
115
+ termString = term.getString(),
116
+ variableString = this.getString(); ///
108
117
 
109
- specificContext.trace(`Unifying the '${termString}' term with the '${variableString}' variable...`);
118
+ context.trace(`Unifying the '${termString}' term with the '${variableString}' variable...`);
110
119
 
111
- let context,
112
- variable;
120
+ let variable;
113
121
 
114
122
  variable = this; ///
115
123
 
116
124
  const substitution = substitutions.findSubstitutionByVariable(variable);
117
125
 
118
126
  if (substitution !== null) {
119
- context = specificContext; ///
120
-
121
- const substitutionTermEqualToTerm = substitution.isTermEqualToTerm(term, context);
127
+ const substitutionComparesToTerm = substitution.compareTerm(term, context);
122
128
 
123
- if (substitutionTermEqualToTerm) {
129
+ if (substitutionComparesToTerm) {
124
130
  termUnifies = true;
125
131
  }
126
132
  } else {
133
+ let context;
134
+
127
135
  context = generalContext; ///
128
136
 
129
137
  const variableIdentifier = variable.getIdentifier();
@@ -141,18 +149,18 @@ export default define(class Variable extends Element {
141
149
  termTypeEqualToOrSubTypeOfVariableType = termType.isEqualToOrSubTypeOf(variableType);
142
150
 
143
151
  if (termTypeEqualToOrSubTypeOfVariableType) {
144
- const { TermSubstitution } = elements,
145
- termSubstitution = TermSubstitution.fromTernAndVariable(term, variable, context),
146
- substitution = termSubstitution; ///
152
+ synthetically((context) => {
153
+ const { TermSubstitution } = elements;
147
154
 
148
- substitutions.addSubstitution(substitution, context);
155
+ TermSubstitution.fromTermAndVariable(term, variable, context);
156
+ }, generalContext, specificContext);
149
157
 
150
158
  termUnifies = true;
151
159
  }
152
160
  }
153
161
 
154
162
  if (termUnifies) {
155
- specificContext.debug(`...unified the '${termString}' term with the '${variableString}' variable.`);
163
+ context.debug(`...unified the '${termString}' term with the '${variableString}' variable.`);
156
164
  }
157
165
 
158
166
  return termUnifies;
@@ -160,7 +168,7 @@ export default define(class Variable extends Element {
160
168
 
161
169
  toJSON() {
162
170
  const typeJSON = typeToTypeJSON(this.type),
163
- string = this.string, ///
171
+ string = this.getString(), ///
164
172
  type = typeJSON, ///
165
173
  json = {
166
174
  type,
@@ -173,15 +181,6 @@ export default define(class Variable extends Element {
173
181
  static name = "Variable";
174
182
 
175
183
  static fromJSON(json, context) {
176
- const { string } = json,
177
- variableNode = instantiateVariable(string, context),
178
- variableIdentifier = variableNode.getVariableIdentifier(),
179
- node = variableNode,
180
- identifier = variableIdentifier, ///
181
- type = typeFromJSON(json, context),
182
- propertyRelations = [],
183
- variable = new Variable(context, string, node, type, identifier, propertyRelations);
184
-
185
- return variable;
184
+ ///
186
185
  }
187
186
  });
package/src/index.js CHANGED
@@ -2,7 +2,8 @@
2
2
 
3
3
  import "./preamble";
4
4
 
5
- export { default as Log } from "./log";
5
+ export { Log } from "occam-furtle";
6
+
6
7
  export { default as FileContext } from "./context/file";
7
8
  export { default as ReleaseContext } from "./context/release";
8
9
  export { default as releaseUtilities } from "./utilities/release";
package/src/main.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
 
3
- import Log from "./log";
3
+ import { Log } from "occam-furtle";
4
+
4
5
  import helpAction from "./action/help";
5
6
  import verifyAction from "./action/verify";
6
7
  import versionAction from "./action/version";
package/src/metaTypes.js CHANGED
@@ -21,34 +21,50 @@ export function getMetaTypes() {
21
21
  return metaTypes;
22
22
  }
23
23
 
24
- export function frameMetaTypeFromNothing() {
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() {
25
38
  if (frameMetaType === null) {
26
39
  const { MetaType } = elements,
27
- name = FRAME_META_TYPE_NAME; ///
40
+ name = FRAME_META_TYPE_NAME, ///
41
+ context = null;
28
42
 
29
- frameMetaType = MetaType.fromName(name);
43
+ frameMetaType = MetaType.fromName(name, context);
30
44
  }
31
45
 
32
46
  return frameMetaType;
33
47
  }
34
48
 
35
- export function statementMetaTypeFromNothing() {
49
+ function statementMetaTypeFromNothing() {
36
50
  if (statementMetaType === null) {
37
51
  const { MetaType } = elements,
38
- name = STATEMENT_META_TYPE_NAME; ///
52
+ name = STATEMENT_META_TYPE_NAME, ///
53
+ context = null;
39
54
 
40
- statementMetaType = MetaType.fromName(name);
55
+ statementMetaType = MetaType.fromName(name, context);
41
56
  }
42
57
 
43
58
  return statementMetaType;
44
59
  }
45
60
 
46
- export function referenceMetaTypeFromNothing() {
61
+ function referenceMetaTypeFromNothing() {
47
62
  if (referenceMetaType === null) {
48
63
  const { MetaType } = elements,
49
- name = REFERENCE_META_TYPE_NAME; ///
64
+ name = REFERENCE_META_TYPE_NAME, ///
65
+ context = null;
50
66
 
51
- referenceMetaType = MetaType.fromName(name);
67
+ referenceMetaType = MetaType.fromName(name, context);
52
68
  }
53
69
 
54
70
  return referenceMetaType;
package/src/node/frame.js CHANGED
@@ -22,7 +22,7 @@ export default class FrameNode extends NonTerminalNode {
22
22
 
23
23
  const metavariableNode = this.getMetavariableNode();
24
24
 
25
- if (metavariableName !== null) {
25
+ if (metavariableNode !== null) {
26
26
  metavariableName = metavariableNode.getMetavariableName();
27
27
  }
28
28
 
@@ -6,7 +6,7 @@ import { TERM_RULE_NAME, TYPE_RULE_NAME } from "../ruleNames";
6
6
 
7
7
  export default class MetavariableNode extends NonTerminalNode {
8
8
  getMetavariableName() {
9
- let metaVariableName;
9
+ let metavariableName;
10
10
 
11
11
  this.someChildNode((childNode) => {
12
12
  const childNodeTerminalNode = childNode.isTerminalNode();
@@ -15,13 +15,13 @@ export default class MetavariableNode extends NonTerminalNode {
15
15
  const terminalNode = childNode, ///
16
16
  content = terminalNode.getContent();
17
17
 
18
- metaVariableName = content; ///
18
+ metavariableName = content; ///
19
19
 
20
20
  return true;
21
21
  }
22
22
  });
23
23
 
24
- return metaVariableName;
24
+ return metavariableName;
25
25
  }
26
26
 
27
27
  getTermNode() {
@@ -2,22 +2,49 @@
2
2
 
3
3
  import NonTerminalNode from "../nonTerminalNode";
4
4
 
5
+ import { NAME_TOKEN_TYPE, IDENTIFIER_TOKEN_TYPE } from "../tokenTypes";
6
+
5
7
  export default class ParameterNode extends NonTerminalNode {
6
- getParameterName() {
7
- let parameterName;
8
+ getName() {
9
+ let name = null;
8
10
 
9
11
  this.someChildNode((childNode, index) => {
10
12
  const terminalNode = childNode, ///
11
- content = terminalNode.getContent();
13
+ type = terminalNode.getType();
14
+
15
+ if (type === NAME_TOKEN_TYPE) {
16
+ const content = terminalNode.getContent();
17
+
18
+ name = content; ///
19
+ }
20
+
21
+ if (index === 0) {
22
+ return true;
23
+ }
24
+ });
12
25
 
13
- parameterName = content; ///
26
+ return name;
27
+ }
28
+
29
+ getIdentifier() {
30
+ let identifier = null;
31
+
32
+ this.someChildNode((childNode, index) => {
33
+ const terminalNode = childNode, ///
34
+ type = terminalNode.getType();
35
+
36
+ if (type === IDENTIFIER_TOKEN_TYPE) {
37
+ const content = terminalNode.getContent();
38
+
39
+ identifier = content; ///
40
+ }
14
41
 
15
42
  if (index === 0) {
16
43
  return true;
17
44
  }
18
45
  });
19
46
 
20
- return parameterName;
47
+ return identifier;
21
48
  }
22
49
 
23
50
  static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(ParameterNode, ruleName, childNodes, opacity, precedence); }
@@ -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
+ }