occam-verify-cli 1.0.438 → 1.0.448

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/context/file.js +42 -39
  2. package/lib/context/local.js +34 -34
  3. package/lib/context/release.js +3 -7
  4. package/lib/context/temporary.js +26 -26
  5. package/lib/element/assertion/contained.js +45 -45
  6. package/lib/element/assertion/defined.js +13 -13
  7. package/lib/element/assertion/property.js +23 -22
  8. package/lib/element/assertion/satisfies.js +7 -6
  9. package/lib/element/assertion/subproof.js +20 -17
  10. package/lib/element/assertion/type.js +3 -2
  11. package/lib/element/assertion.js +1 -23
  12. package/lib/element/assumption.js +24 -22
  13. package/lib/element/axiom.js +27 -30
  14. package/lib/element/axiomLemmaTheoremConjecture.js +50 -57
  15. package/lib/element/{statement/combinator → combinator}/bracketed.js +16 -16
  16. package/lib/element/combinator.js +229 -0
  17. package/lib/element/conclusion.js +11 -9
  18. package/lib/element/{term/constructor → constructor}/bracketed.js +5 -5
  19. package/lib/element/constructor.js +232 -0
  20. package/lib/element/declaration/combinator.js +2 -16
  21. package/lib/element/declaration/complexType.js +12 -12
  22. package/lib/element/declaration/constructor.js +13 -11
  23. package/lib/element/declaration/simpleType.js +4 -4
  24. package/lib/element/declaration/typePrefix.js +2 -2
  25. package/lib/element/declaration/variable.js +3 -3
  26. package/lib/element/deduction.js +11 -9
  27. package/lib/element/derivation.js +17 -20
  28. package/lib/element/equivalence.js +10 -10
  29. package/lib/element/equivalences.js +5 -5
  30. package/lib/element/frame.js +32 -38
  31. package/lib/element/hypothesis.js +16 -57
  32. package/lib/element/judgement.js +6 -4
  33. package/lib/element/label.js +8 -8
  34. package/lib/element/metaLemmaMetatheorem.js +6 -39
  35. package/lib/element/metaType.js +17 -80
  36. package/lib/element/metavariable.js +38 -34
  37. package/lib/element/parameter.js +3 -3
  38. package/lib/element/premise.js +92 -174
  39. package/lib/element/proof.js +7 -7
  40. package/lib/element/proofAssertion.js +203 -0
  41. package/lib/element/property.js +9 -9
  42. package/lib/element/propertyRelation.js +13 -13
  43. package/lib/element/reference.js +16 -17
  44. package/lib/element/rule.js +46 -46
  45. package/lib/element/signature.js +11 -11
  46. package/lib/element/statement.js +18 -18
  47. package/lib/element/step.js +73 -124
  48. package/lib/element/subDerivation.js +17 -20
  49. package/lib/element/subproof.js +16 -24
  50. package/lib/element/substitution/frame.js +1 -7
  51. package/lib/element/substitution/reference.js +2 -3
  52. package/lib/element/substitution/statement.js +44 -15
  53. package/lib/element/substitution/term.js +10 -57
  54. package/lib/element/substitution.js +5 -11
  55. package/lib/element/substitutions.js +29 -29
  56. package/lib/element/supposition.js +95 -177
  57. package/lib/element/term.js +21 -34
  58. package/lib/element/type.js +47 -60
  59. package/lib/element/typePrefix.js +5 -5
  60. package/lib/element/variable.js +9 -9
  61. package/lib/element.js +9 -3
  62. package/lib/metaTypes.js +63 -0
  63. package/lib/node/axiomLemmaTheoremConjecture.js +9 -9
  64. package/lib/node/body/axiom.js +2 -25
  65. package/lib/node/body/conjecture.js +2 -25
  66. package/lib/node/body/lemma.js +2 -25
  67. package/lib/node/body/metaLemma.js +2 -25
  68. package/lib/node/body/metatheorem.js +2 -25
  69. package/lib/node/body/rule.js +15 -1
  70. package/lib/node/body/theorem.js +2 -25
  71. package/lib/node/body.js +25 -2
  72. package/lib/node/combinator.js +11 -2
  73. package/lib/node/constructor.js +11 -2
  74. package/lib/node/declaration/combinator.js +5 -5
  75. package/lib/node/declaration/constructor.js +8 -8
  76. package/lib/node/declaration/property.js +15 -15
  77. package/lib/node/declaration/simpleType.js +31 -31
  78. package/lib/node/declaration/variable.js +8 -8
  79. package/lib/node/equality.js +8 -8
  80. package/lib/node/frame.js +20 -20
  81. package/lib/node/header.js +22 -22
  82. package/lib/node/metaLemmaMetaTheorem.js +16 -16
  83. package/lib/node/metavariable.js +15 -15
  84. package/lib/node/property.js +8 -8
  85. package/lib/node/propertyRelation.js +8 -8
  86. package/lib/node/rule.js +16 -16
  87. package/lib/node/statement.js +12 -12
  88. package/lib/node/step.js +22 -22
  89. package/lib/node/subDerivation.js +1 -8
  90. package/lib/node/subproof.js +5 -12
  91. package/lib/node/substitution/frame.js +19 -19
  92. package/lib/node/substitution/statement.js +19 -19
  93. package/lib/node/substitution/term.js +19 -19
  94. package/lib/node/term.js +35 -35
  95. package/lib/preamble.js +5 -5
  96. package/lib/process/instantiate.js +20 -2
  97. package/lib/process/unify.js +39 -42
  98. package/lib/process/validate.js +431 -0
  99. package/lib/process/verify.js +44 -135
  100. package/lib/types.js +27 -0
  101. package/lib/utilities/brackets.js +9 -14
  102. package/lib/utilities/element.js +91 -55
  103. package/lib/utilities/instance.js +41 -28
  104. package/lib/utilities/statement.js +2 -2
  105. package/lib/utilities/string.js +25 -14
  106. package/lib/utilities/unification.js +237 -0
  107. package/lib/utilities/validation.js +251 -0
  108. package/package.json +6 -6
  109. package/src/context/file.js +40 -34
  110. package/src/context/local.js +34 -34
  111. package/src/context/release.js +2 -6
  112. package/src/context/temporary.js +15 -15
  113. package/src/element/assertion/contained.js +19 -20
  114. package/src/element/assertion/defined.js +11 -12
  115. package/src/element/assertion/property.js +20 -20
  116. package/src/element/assertion/satisfies.js +6 -6
  117. package/src/element/assertion/subproof.js +17 -15
  118. package/src/element/assertion/type.js +2 -2
  119. package/src/element/assertion.js +0 -2
  120. package/src/element/assumption.js +22 -19
  121. package/src/element/axiom.js +33 -37
  122. package/src/element/axiomLemmaTheoremConjecture.js +54 -73
  123. package/src/element/{statement/combinator → combinator}/bracketed.js +7 -7
  124. package/src/element/combinator.js +90 -0
  125. package/src/element/conclusion.js +12 -10
  126. package/src/element/{term/constructor → constructor}/bracketed.js +5 -5
  127. package/src/element/{term/constructor.js → constructor.js} +17 -25
  128. package/src/element/declaration/combinator.js +1 -22
  129. package/src/element/declaration/complexType.js +11 -11
  130. package/src/element/declaration/constructor.js +13 -10
  131. package/src/element/declaration/simpleType.js +3 -3
  132. package/src/element/declaration/typePrefix.js +1 -1
  133. package/src/element/declaration/variable.js +2 -2
  134. package/src/element/deduction.js +12 -9
  135. package/src/element/derivation.js +15 -19
  136. package/src/element/equivalence.js +8 -8
  137. package/src/element/equivalences.js +4 -4
  138. package/src/element/frame.js +28 -30
  139. package/src/element/hypothesis.js +16 -18
  140. package/src/element/judgement.js +6 -3
  141. package/src/element/label.js +4 -4
  142. package/src/element/metaLemmaMetatheorem.js +5 -69
  143. package/src/element/metaType.js +9 -45
  144. package/src/element/metavariable.js +34 -31
  145. package/src/element/parameter.js +2 -2
  146. package/src/element/premise.js +124 -99
  147. package/src/element/proof.js +6 -6
  148. package/src/element/proofAssertion.js +76 -0
  149. package/src/element/property.js +6 -6
  150. package/src/element/propertyRelation.js +11 -11
  151. package/src/element/reference.js +14 -21
  152. package/src/element/rule.js +39 -38
  153. package/src/element/signature.js +10 -9
  154. package/src/element/statement.js +16 -18
  155. package/src/element/step.js +78 -78
  156. package/src/element/subDerivation.js +15 -19
  157. package/src/element/subproof.js +11 -19
  158. package/src/element/substitution/frame.js +0 -2
  159. package/src/element/substitution/reference.js +1 -5
  160. package/src/element/substitution/statement.js +44 -14
  161. package/src/element/substitution/term.js +10 -13
  162. package/src/element/substitution.js +3 -5
  163. package/src/element/substitutions.js +48 -30
  164. package/src/element/supposition.js +127 -108
  165. package/src/element/term.js +18 -28
  166. package/src/element/type.js +42 -36
  167. package/src/element/typePrefix.js +3 -3
  168. package/src/element/variable.js +7 -7
  169. package/src/element.js +3 -1
  170. package/src/metaTypes.js +55 -0
  171. package/src/node/axiomLemmaTheoremConjecture.js +6 -6
  172. package/src/node/body/axiom.js +0 -21
  173. package/src/node/body/conjecture.js +0 -23
  174. package/src/node/body/lemma.js +0 -23
  175. package/src/node/body/metaLemma.js +0 -23
  176. package/src/node/body/metatheorem.js +0 -23
  177. package/src/node/body/rule.js +12 -0
  178. package/src/node/body/theorem.js +0 -23
  179. package/src/node/body.js +23 -0
  180. package/src/node/combinator.js +9 -0
  181. package/src/node/constructor.js +9 -0
  182. package/src/node/declaration/combinator.js +5 -5
  183. package/src/node/declaration/constructor.js +8 -8
  184. package/src/node/declaration/property.js +14 -14
  185. package/src/node/declaration/simpleType.js +31 -31
  186. package/src/node/declaration/variable.js +7 -7
  187. package/src/node/equality.js +7 -7
  188. package/src/node/frame.js +21 -21
  189. package/src/node/header.js +22 -22
  190. package/src/node/metaLemmaMetaTheorem.js +14 -14
  191. package/src/node/metavariable.js +14 -14
  192. package/src/node/property.js +7 -7
  193. package/src/node/propertyRelation.js +7 -7
  194. package/src/node/rule.js +15 -15
  195. package/src/node/statement.js +12 -12
  196. package/src/node/step.js +21 -21
  197. package/src/node/subDerivation.js +0 -7
  198. package/src/node/subproof.js +4 -11
  199. package/src/node/substitution/frame.js +18 -18
  200. package/src/node/substitution/statement.js +18 -18
  201. package/src/node/substitution/term.js +18 -18
  202. package/src/node/term.js +34 -34
  203. package/src/preamble.js +4 -4
  204. package/src/process/instantiate.js +12 -0
  205. package/src/process/unify.js +53 -57
  206. package/src/process/validate.js +316 -0
  207. package/src/process/verify.js +50 -138
  208. package/src/types.js +18 -0
  209. package/src/utilities/brackets.js +15 -14
  210. package/src/utilities/element.js +125 -82
  211. package/src/utilities/instance.js +42 -24
  212. package/src/utilities/statement.js +2 -2
  213. package/src/utilities/string.js +38 -24
  214. package/src/{mixins/step/unify.js → utilities/unification.js} +99 -85
  215. package/src/{mixins/statement/validate.js → utilities/validation.js} +143 -69
  216. package/lib/element/statement/combinator.js +0 -105
  217. package/lib/element/term/constructor.js +0 -172
  218. package/lib/mixins/statement/validate.js +0 -198
  219. package/lib/mixins/step/unify.js +0 -228
  220. package/lib/mixins/term/verify.js +0 -65
  221. package/src/element/statement/combinator.js +0 -59
  222. package/src/mixins/term/verify.js +0 -81
@@ -33,8 +33,6 @@ export default define(class FrameSubstitution extends Substitution {
33
33
 
34
34
  isMetavariableEqualToMetavariable(metavariable) { return this.metavariable.isEqualTo(metavariable); }
35
35
 
36
- matchParameter(parameter) { return this.metavariable.matchParameter(parameter); }
37
-
38
36
  verify(context) {
39
37
  let verifies = false;
40
38
 
@@ -22,11 +22,7 @@ export default define(class ReferenceSubstitution extends Substitution {
22
22
  return this.metavariable;
23
23
  }
24
24
 
25
- isReferenceEqualToReference(reference) {
26
- const referenceEqualToReference = this.reference.isEqualTo(reference);
27
-
28
- return referenceEqualToReference;
29
- }
25
+ isReferenceEqualToReference(reference) { return this.reference.isEqualTo(reference); }
30
26
 
31
27
  static name = "ReferenceSubstitution";
32
28
 
@@ -43,18 +43,16 @@ export default define(class StatementSubstitution extends Substitution {
43
43
  return replacementNode;
44
44
  }
45
45
 
46
- isSimple() {
47
- const simple = (this.substitution === null);
48
-
49
- return simple;
46
+ setStatement(statement) {
47
+ this.statement = statement;
50
48
  }
51
49
 
52
- isStatementEqualToStatement(statement, context) {
53
- statement = stripBracketsFromStatement(statement, context); ///
54
-
55
- const statementEqualToStatement = this.statement.isEqualTo(statement);
50
+ setMetavariable(metavariable) {
51
+ this.metavariable = metavariable;
52
+ }
56
53
 
57
- return statementEqualToStatement;
54
+ setSubstitution(substitution) {
55
+ this.substitution = substitution;
58
56
  }
59
57
 
60
58
  isMetavariableEqualToMetavariable(metavariable) { return this.metavariable.isEqualTo(metavariable); }
@@ -75,7 +73,19 @@ export default define(class StatementSubstitution extends Substitution {
75
73
  return substitutionEqualToSubstitution;
76
74
  }
77
75
 
78
- matchParameter(parameter) { return this.metavariable.matchParameter(parameter); }
76
+ isStatementEqualToStatement(statement, context) {
77
+ statement = stripBracketsFromStatement(statement, context); ///
78
+
79
+ const statementEqualToStatement = this.statement.isEqualTo(statement);
80
+
81
+ return statementEqualToStatement;
82
+ }
83
+
84
+ isSimple() {
85
+ const simple = (this.substitution === null);
86
+
87
+ return simple;
88
+ }
79
89
 
80
90
  unifyStatement(statement, context) {
81
91
  let substitution = null;
@@ -205,8 +215,17 @@ export default define(class StatementSubstitution extends Substitution {
205
215
  statement = stripBracketsFromStatement(statement, context); ///
206
216
 
207
217
  const string = stringFromStatementAndMetavariable(statement, metavariable),
208
- statementSubstitutionNode = instantiateStatementSubstitution(string, context),
209
- statementSubstitution = statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, context);
218
+ statementSubstitutionNode = instantiateStatementSubstitution(string, context);
219
+
220
+ context = {
221
+ nodeAsString: () => string
222
+ };
223
+
224
+ const statementSubstitution = statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, context);
225
+
226
+ statementSubstitution.setStatement(statement);
227
+
228
+ statementSubstitution.setMetavariable(metavariable);
210
229
 
211
230
  return statementSubstitution;
212
231
  }
@@ -215,8 +234,19 @@ export default define(class StatementSubstitution extends Substitution {
215
234
  statement = stripBracketsFromStatement(statement, context); ///
216
235
 
217
236
  const string = stringFromStatementMetavariableAndSubstitution(statement, metavariable, substitution, context),
218
- statementSubstitutionNode = instantiateStatementSubstitution(string, context),
219
- statementSubstitution = statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, substitution, context);
237
+ statementSubstitutionNode = instantiateStatementSubstitution(string, context);
238
+
239
+ context = {
240
+ nodeAsString: () => string
241
+ };
242
+
243
+ const statementSubstitution = statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, context);
244
+
245
+ statementSubstitution.setStatement(statement);
246
+
247
+ statementSubstitution.setMetavariable(metavariable);
248
+
249
+ statementSubstitution.setSubstitution(substitution);
220
250
 
221
251
  return statementSubstitution;
222
252
  }
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
 
3
- import elements from "../../elements";
4
3
  import Substitution from "../substitution";
5
4
 
6
5
  import { define } from "../../elements";
@@ -31,28 +30,26 @@ export default define(class TermSubstitution extends Substitution {
31
30
  return replacementNode;
32
31
  }
33
32
 
33
+ isTermEqualToTerm(term, context) {
34
+ term = stripBracketsFromTerm(term, context); ///
35
+
36
+ const termEqualToTerm = this.term.isEqualTo(term);
37
+
38
+ return termEqualToTerm;
39
+ }
40
+
34
41
  isTrivial() {
35
42
  let trivial = false;
36
43
 
37
- const termEqualToVariable = this.term.isEqualToVariable(this.variable);
44
+ const termComparesToVaraible = this.term.compareVariable(this.variable);
38
45
 
39
- if (termEqualToVariable) {
46
+ if (termComparesToVaraible) {
40
47
  trivial = true;
41
48
  }
42
49
 
43
50
  return trivial;
44
51
  }
45
52
 
46
- isTermEqualToTerm(term, context) {
47
- term = stripBracketsFromTerm(term, context); ///
48
-
49
- const termEqualToTerm = this.term.isEqualTo(term);
50
-
51
- return termEqualToTerm;
52
- }
53
-
54
- matchParameter(parameter) { return this.variable.matchParameter(parameter); }
55
-
56
53
  verify(context) {
57
54
  let verifies = false;
58
55
 
@@ -110,14 +110,12 @@ export default class Substitution extends Element {
110
110
  return substitutionEqualToSubstitution;
111
111
  }
112
112
 
113
- matchParameter(parameter) {
114
- const parameterMatches = false;
113
+ compareParameter(parameter) {
114
+ const comparesToParameter = false;
115
115
 
116
- return parameterMatches;
116
+ return comparesToParameter;
117
117
  }
118
118
 
119
- matchSubstitutionNode(substitutionNode) { return this.node.match(substitutionNode); }
120
-
121
119
  resolve(substitutions, context) {
122
120
  const resolved = true;
123
121
 
@@ -6,6 +6,7 @@ import Element from "../element";
6
6
 
7
7
  import { define } from "../elements";
8
8
  import { EMPTY_STRING } from "../constants";
9
+ import { substitutionsStringFromSubstitutions } from "../utilities/string";
9
10
 
10
11
  const { find, first, clear, prune, filter, compress, correlate } = arrayUtilities;
11
12
 
@@ -25,8 +26,6 @@ export default define(class Substitutions extends Element {
25
26
  return this.savedArray;
26
27
  }
27
28
 
28
- getLength() { return this.array.length; }
29
-
30
29
  getMetavariables() {
31
30
  const metavariables = [];
32
31
 
@@ -75,6 +74,8 @@ export default define(class Substitutions extends Element {
75
74
  return firstSubstitution;
76
75
  }
77
76
 
77
+ getLength() { return this.array.length; }
78
+
78
79
  mapSubstitution(callback) { return this.array.map(callback); }
79
80
 
80
81
  findSubstitution(callback) { return this.array.find(callback) || null; } ///
@@ -200,9 +201,13 @@ export default define(class Substitutions extends Element {
200
201
  addSubstitution(substitution, context) {
201
202
  this.array.push(substitution);
202
203
 
203
- const substitutionString = substitution.getString();
204
+ const string = this.asString(),
205
+ substitutionString = substitution.getString(),
206
+ substitutionsString = string; ///
204
207
 
205
- context.trace(`Added the '${substitutionString}' substitution.`);
208
+ this.setString(string);
209
+
210
+ context.trace(`Added the '${substitutionString}' substitution to the '${substitutionsString}' substitutions.`);
206
211
  }
207
212
 
208
213
  removeSubstitution(substitution, context) {
@@ -216,9 +221,13 @@ export default define(class Substitutions extends Element {
216
221
  }
217
222
  });
218
223
 
219
- const substitutionString = substitution.getString();
224
+ const string = this.asString(),
225
+ substitutionString = substitution.getString(),
226
+ substitutionsString = string; ///
227
+
228
+ this.setString(string);
220
229
 
221
- context.trace(`Removed the '${substitutionString}' substitution.`);
230
+ context.trace(`Removed the '${substitutionString}' substitution from the '${substitutionsString}' substitutions.`);
222
231
  }
223
232
 
224
233
  correlateSubstitutions(substitutions) {
@@ -236,16 +245,6 @@ export default define(class Substitutions extends Element {
236
245
  return correlates;
237
246
  }
238
247
 
239
- removeTrivialSubstitutions() {
240
- filter(this.array, (substitution) => {
241
- const trivial = substitution.isTrivial();
242
-
243
- if (!trivial) {
244
- return true;
245
- }
246
- });
247
- }
248
-
249
248
  clear() {
250
249
  clear(this.array);
251
250
 
@@ -318,6 +317,10 @@ export default define(class Substitutions extends Element {
318
317
  ];
319
318
 
320
319
  this.savedArray = null;
320
+
321
+ const string = this.asString();
322
+
323
+ this.setString(string);
321
324
  }
322
325
 
323
326
  continue() {
@@ -332,15 +335,8 @@ export default define(class Substitutions extends Element {
332
335
  if (length === 0) {
333
336
  string = EMPTY_STRING;
334
337
  } else {
335
- const substitutionsString = this.array.reduce((substitutionsString, substitution) => {
336
- const substitutionString = substitution.getString();
337
-
338
- substitutionsString = (substitutionsString === null) ?
339
- substitutionString :
340
- `${substitutionsString}, ${substitutionString}`;
341
-
342
- return substitutionsString;
343
- }, null);
338
+ const substitutions = this.array, ///
339
+ substitutionsString = substitutionsStringFromSubstitutions(substitutions);
344
340
 
345
341
  string = substitutionsString; ///
346
342
  }
@@ -349,16 +345,38 @@ export default define(class Substitutions extends Element {
349
345
  }
350
346
 
351
347
  static fromArray(array) {
352
- const savedArray = [],
353
- substitutions = new Substitutions(array, savedArray);
348
+ let string;
349
+
350
+ const context = null;
351
+
352
+ string = null;
353
+
354
+ const node = null,
355
+ savedArray = [],
356
+ substitutions = new Substitutions(context, string, node, array, savedArray);
357
+
358
+ string = substitutions.asString();
359
+
360
+ substitutions.setString(string);
354
361
 
355
362
  return substitutions;
356
363
  }
357
364
 
358
365
  static fromNothing() {
359
- const array = [],
360
- savedArray = null,
361
- substitutions = new Substitutions(array, savedArray);
366
+ let string;
367
+
368
+ const context = null;
369
+
370
+ string = null;
371
+
372
+ const node = null,
373
+ array = [],
374
+ savedArray = [],
375
+ substitutions = new Substitutions(context, string, node, array, savedArray);
376
+
377
+ string = substitutions.asString();
378
+
379
+ substitutions.setString(string);
362
380
 
363
381
  return substitutions;
364
382
  }
@@ -1,26 +1,19 @@
1
1
  "use strict";
2
2
 
3
- import Element from "../element";
4
- import elements from "../elements";
3
+ import ProofAssertion from "./proofAssertion";
5
4
  import TemporaryContext from "../context/temporary";
6
5
  import assignAssignments from "../process/assign";
7
6
 
8
7
  import { define } from "../elements";
9
- import { subproofAssertionFromStatement } from "../utilities/statement";
10
8
  import { termsFromJSON, framesFromJSON, statementFromJSON, procedureCallFromJSON, termsToTermsJSON, framesToFramesJSON, statementToStatementJSON, procedureCallToProcedureCallJSON } from "../utilities/json";
11
9
 
12
- export default define(class Supposition extends Element {
10
+ export default define(class Supposition extends ProofAssertion {
13
11
  constructor(context, string, node, statement, procedureCall) {
14
12
  super(context, string, node);
15
13
 
16
- this.statement = statement;
17
14
  this.procedureCall = procedureCall;
18
15
  }
19
16
 
20
- getStatement() {
21
- return this.statement;
22
- }
23
-
24
17
  getProcedureCall() {
25
18
  return this.procedureCall;
26
19
  }
@@ -32,84 +25,74 @@ export default define(class Supposition extends Element {
32
25
 
33
26
  context = temporaryContext; ///
34
27
 
35
- const suppositionString = this.string; ///
28
+ const node = this.getNode(),
29
+ suppositionString = this.getString(); ///
36
30
 
37
- context.trace(`Verifying the '${suppositionString}' supposition...`, this.node);
31
+ context.trace(`Verifying the '${suppositionString}' supposition...`, node);
38
32
 
39
- if (false) {
40
- ///
41
- } else if (this.statement !== null) {
42
- const stated = true,
43
- assignments = [],
44
- statementVerifies = this.statement.verify(assignments, stated, context);
33
+ const statement = this.getStatement();
45
34
 
46
- if (statementVerifies) {
47
- const assignmentsAssigned = assignAssignments(assignments, context);
35
+ if ((statement === null) && (this.procedureCall === null)) {
36
+ context.debug(`Unable to verify the '${suppositionString}' supposition because it is nonsense.`, node);
37
+ } else {
38
+ if (statement !== null) {
39
+ const stated = true,
40
+ assignments = [],
41
+ statementValidates = statement.validate(assignments, stated, context);
48
42
 
49
- if (assignmentsAssigned) {
50
- const { Step } = elements,
51
- step = Step.fromStatement(this.statement, context),
52
- stepOrSubproof = step; ///
43
+ if (statementValidates) {
44
+ const assignmentsAssigned = assignAssignments(assignments, context);
53
45
 
54
- context.addStepOrSubproof(stepOrSubproof);
46
+ if (assignmentsAssigned) {
47
+ const subproofOrProofAssertion = this; ///
55
48
 
56
- verifies = true;
49
+ context.addSubproofOrProofAssertion(subproofOrProofAssertion);
50
+
51
+ verifies = true;
52
+ }
57
53
  }
58
54
  }
59
- } else if (this.procedureCall !== null) {
60
- const stated = true,
61
- assignments = null,
62
- procedureCallVerifies = this.procedureCall.verify(assignments, stated, context);
63
55
 
64
- if (procedureCallVerifies) {
65
- verifies = true;
56
+ if (this.procedureCall !== null) {
57
+ const stated = true,
58
+ assignments = null,
59
+ procedureCallVerifies = this.procedureCall.verify(assignments, stated, context);
60
+
61
+ if (procedureCallVerifies) {
62
+ verifies = true;
63
+ }
66
64
  }
67
- } else {
68
- context.debug(`Unable to verify the '${suppositionString}' supposition because it is nonsense.`, this.node);
69
65
  }
70
66
 
71
67
  if (verifies) {
72
- this.context = context;
68
+ this.setContext(context);
73
69
 
74
- context.debug(`...verified the '${suppositionString}' supposition.`, this.node);
70
+ context.debug(`...verified the '${suppositionString}' supposition.`, node);
75
71
  }
76
72
 
77
73
  return verifies;
78
74
  }
79
75
 
80
- unifySupposition(supposition, substitutions, generalContext, specificContext) {
81
- let suppositionUnifies;
82
-
83
- const context = specificContext, ///
84
- specificSupposition = supposition, ///
85
- generalSuppositionString = this.string, ///
86
- specificSuppositionString = specificSupposition.getString();
87
-
88
- context.trace(`Unifying the '${specificSuppositionString}' supposition with the '${generalSuppositionString}' supposition...`, this.node);
76
+ unifyIndependently(substitutions, context) {
77
+ let unifiesIndependently = false;
89
78
 
90
- const statement = specificSupposition.getStatement(),
91
- statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
79
+ const node = this.getNode(),
80
+ suppositionString = this.getString();
92
81
 
93
- suppositionUnifies = statementUnifies; ///
82
+ context.trace(`Unifying the '${suppositionString}' supposition independently...`, node);
94
83
 
95
- if (suppositionUnifies) {
96
- context.debug(`...unified the '${specificSuppositionString}' supposition with the '${generalSuppositionString}' supposition.`, this.node);
97
- }
84
+ const specificContext = context; ///
98
85
 
99
- return suppositionUnifies;
100
- }
86
+ context = this.getContext();
101
87
 
102
- unifyIndependently(substitutions, context) {
103
- let unifiesIndependently = false;
88
+ const generalContext = context; ///
104
89
 
105
- const suppositionString = this.string, ///
106
- generalContext = this.context, ///
107
- specificContext = context; ///
90
+ context = specificContext; ///
108
91
 
109
- context.trace(`Unifying the '${suppositionString}' supposition independently...`, this.node);
92
+ const statement = this.getStatement();
110
93
 
111
- if (this.statement !== null) {
112
- const statementUnifiesIndependently = this.statement.unifyIndependently(substitutions, generalContext, specificContext);
94
+ if (statement !== null) {
95
+ const statementUnifiesIndependently = statement.unifyIndependently(substitutions, generalContext, specificContext);
113
96
 
114
97
  if (statementUnifiesIndependently) {
115
98
  unifiesIndependently = true;
@@ -125,57 +108,79 @@ export default define(class Supposition extends Element {
125
108
  }
126
109
 
127
110
  if (unifiesIndependently) {
128
- context.debug(`...unified the '${suppositionString}' supposition independenly.`, this.node);
111
+ context.debug(`...unified the '${suppositionString}' supposition independenly.`, node);
129
112
  }
130
113
 
131
114
  return unifiesIndependently;
132
115
  }
133
116
 
134
- unifyStepOrSubproof(stepOrSubproof, substitutions, context) {
135
- let stepOrSubproofUnifies = false;
117
+ unifySubproofOrProosAssertion(subproofOrProofAssertion, substitutions, context) {
118
+ let subproofOrProofAssertionUnifies = false;
136
119
 
137
- const stepOrSubProofStep = stepOrSubproof.isStep(),
138
- subproof = stepOrSubProofStep ?
120
+ const subproofOrProofAssertionProofAssertion = subproofOrProofAssertion.isProofAssertion(),
121
+ subproof = subproofOrProofAssertionProofAssertion ?
139
122
  null :
140
- stepOrSubproof,
141
- step = stepOrSubProofStep ?
142
- stepOrSubproof :
143
- null;
123
+ subproofOrProofAssertion,
124
+ proofAssertion = subproofOrProofAssertionProofAssertion ?
125
+ subproofOrProofAssertion :
126
+ null;
144
127
 
145
128
  substitutions.snapshot();
146
129
 
147
130
  if (subproof !== null) {
148
131
  const subproofUnifies = this.unifySubproof(subproof, substitutions, context);
149
132
 
150
- stepOrSubproofUnifies = subproofUnifies; ///
133
+ if (subproofUnifies) {
134
+ subproofOrProofAssertionUnifies = true;
135
+ }
151
136
  }
152
137
 
153
- if (step !== null) {
154
- const statementUnifies = this.unifyStep(step, substitutions, context);
138
+ if (proofAssertion !== null) {
139
+ const proofAssertionUnifies = this.unifyProofAssertion(proofAssertion, substitutions, context);
155
140
 
156
- stepOrSubproofUnifies = statementUnifies; ///
141
+ if (proofAssertionUnifies) {
142
+ subproofOrProofAssertionUnifies = true;
143
+ }
157
144
  }
158
145
 
159
- if (stepOrSubproofUnifies) {
146
+ if (subproofOrProofAssertionUnifies) {
160
147
  substitutions.resolve(context);
161
148
  }
162
149
 
163
- stepOrSubproofUnifies ?
150
+ subproofOrProofAssertionUnifies ?
164
151
  substitutions.continue() :
165
152
  substitutions.rollback(context);
166
153
 
167
- return stepOrSubproofUnifies;
154
+ return subproofOrProofAssertionUnifies;
168
155
  }
169
156
 
170
- unifyStep(step, substitutions, context) {
171
- let stepUnifies;
157
+ unifyProofAssertion(proofAssertion, substitutions, context) {
158
+ let stepUnifies = false;
172
159
 
173
- context = step.getContext();
160
+ const node = this.getNode(),
161
+ suppositionString = this.getString(),
162
+ proofAssertionString = proofAssertion.getString();
174
163
 
175
- const statement = step.getStatement(),
176
- statementUnifies = this.unifyStatement(statement, substitutions, context);
164
+ context.trace(`Unifying the '${proofAssertionString}' proof assertion with the '${suppositionString}' supposition...`, node);
177
165
 
178
- stepUnifies = statementUnifies; ///
166
+ const specificContext = context; ///
167
+
168
+ context = this.getContext();
169
+
170
+ const generalContext = context; ///
171
+
172
+ context = specificContext; ///
173
+
174
+ const statement = proofAssertion.getStatement(),
175
+ statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
176
+
177
+ if (statementUnifies) {
178
+ stepUnifies = true;
179
+ }
180
+
181
+ if (stepUnifies) {
182
+ context.debug(`...unified the '${proofAssertionString}' proof assertion with the '${suppositionString}' supposition.`, node);
183
+ }
179
184
 
180
185
  return stepUnifies;
181
186
  }
@@ -183,53 +188,67 @@ export default define(class Supposition extends Element {
183
188
  unifySubproof(subproof, substitutions, context) {
184
189
  let subproofUnifies = false;
185
190
 
186
- const supposition = this, ///
191
+ const node = this.getNode(),
187
192
  subproofString = subproof.getString(),
188
- suppositionStatement = supposition.getStatement(),
189
- suppositionStatementString = suppositionStatement.getString();
193
+ suppositionString = this.getString();
194
+
195
+ context.trace(`Unifying the '${subproofString}' subproof with the '${suppositionString}' supposition...`, node);
196
+
197
+ const specificContext = context; ///
190
198
 
191
- context.trace(`Unifying the '${subproofString}' subproof with the supposition's '${suppositionStatementString}' statement...`);
199
+ context = this.getContext();
192
200
 
193
- if (this.statement !== null) {
194
- const context = generalContext, ///
195
- subproofAssertion = subproofAssertionFromStatement(this.statement, context);
201
+ const generalContext = context; ///
196
202
 
197
- if (subproofAssertion !== null) {
198
- const generalContext = this.context, ///
199
- specificContext = context; ///
203
+ context = specificContext; ///
204
+
205
+ const statement = this.getStatement();
206
+
207
+ if (statement !== null) {
208
+ const statementNode = statement.getNode(),
209
+ subproofAssertionNode = statementNode.getSubproofAssertionNode();
200
210
 
201
- subproofUnifies = subproofAssertion.unifySubproof(subproof, substitutions, generalContext, specificContext);
211
+ if (subproofAssertionNode !== null) {
212
+ const context = generalContext, ///
213
+ assertionNode = subproofAssertionNode, ///
214
+ assertion = context.findAssertionByAssertionNode(assertionNode)
215
+
216
+ if (assertion !== null) {
217
+ const subproofAssertion = assertion; ///
218
+
219
+ subproofUnifies = subproofAssertion.unifySubproof(subproof, substitutions, generalContext, specificContext);
220
+ }
202
221
  }
203
222
  }
204
223
 
205
224
  if (subproofUnifies) {
206
- context.debug(`...unified the '${subproofString}' subproof with the supposition's '${suppositionStatementString}' statement.`);
225
+ context.debug(`...unified the '${subproofString}' subproof with the '${suppositionString}' supposition.`, node);
207
226
  }
208
227
 
209
228
  return subproofUnifies;
210
229
  }
211
230
 
212
- unifyStatement(statement, substitutions, context) {
213
- let statementUnifies;
231
+ unifySupposition(supposition, substitutions, generalContext, specificContext) {
232
+ let suppositionUnifies;
214
233
 
215
- const supposition = this, ///
216
- statementString = statement.getString(),
217
- suppositionString = supposition.getString();
234
+ const node = this.getNode(),
235
+ context = specificContext, ///
236
+ specificSupposition = supposition, ///
237
+ generalSuppositionString = this.getString(), ///
238
+ specificSuppositionString = specificSupposition.getString();
218
239
 
219
- context.trace(`Unifying the '${statementString}' statement with the '${suppositionString}' supposition...`);
240
+ context.trace(`Unifying the '${specificSuppositionString}' supposition with the '${generalSuppositionString}' supposition...`, node);
220
241
 
221
- if (this.statement !== null) {
222
- const generalContext = this.context, ///
223
- specificContext = context; ///
242
+ const statement = specificSupposition.getStatement(),
243
+ statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
224
244
 
225
- statementUnifies = this.statement.unifyStatement(statement, substitutions, generalContext, specificContext);
226
- }
245
+ suppositionUnifies = statementUnifies; ///
227
246
 
228
- if (statementUnifies) {
229
- context.debug(`...unified the '${statementString}' statement with the '${suppositionString}' supposition.`);
247
+ if (suppositionUnifies) {
248
+ context.debug(`...unified the '${specificSuppositionString}' supposition with the '${generalSuppositionString}' supposition.`, node);
230
249
  }
231
250
 
232
- return statementUnifies;
251
+ return suppositionUnifies;
233
252
  }
234
253
 
235
254
  toJSON() {