occam-verify-cli 1.0.457 → 1.0.473

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 (161) hide show
  1. package/lib/constants.js +13 -1
  2. package/lib/context/ephemeral.js +270 -0
  3. package/lib/context/file.js +102 -66
  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 +66 -7
  8. package/lib/context/scoped.js +48 -40
  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 +5 -8
  15. package/lib/element/conclusion.js +14 -13
  16. package/lib/element/constructor.js +2 -2
  17. package/lib/element/deduction.js +14 -13
  18. package/lib/element/derivation.js +3 -3
  19. package/lib/element/equality.js +5 -5
  20. package/lib/element/equivalence.js +112 -107
  21. package/lib/element/equivalences.js +24 -10
  22. package/lib/element/error.js +3 -3
  23. package/lib/element/frame.js +38 -21
  24. package/lib/element/hypothesis.js +2 -2
  25. package/lib/element/judgement.js +6 -5
  26. package/lib/element/metaType.js +1 -2
  27. package/lib/element/metavariable.js +46 -35
  28. package/lib/element/parameter.js +13 -5
  29. package/lib/element/procedureCall.js +16 -16
  30. package/lib/element/proof.js +14 -13
  31. package/lib/element/proofAssertion/premise.js +41 -30
  32. package/lib/element/proofAssertion/step.js +39 -35
  33. package/lib/element/proofAssertion/supposition.js +43 -32
  34. package/lib/element/proofAssertion.js +19 -5
  35. package/lib/element/propertyRelation.js +2 -2
  36. package/lib/element/reference.js +50 -9
  37. package/lib/element/rule.js +26 -28
  38. package/lib/element/section.js +2 -2
  39. package/lib/element/signature.js +9 -6
  40. package/lib/element/statement.js +44 -31
  41. package/lib/element/subproof.js +18 -17
  42. package/lib/element/substitution/frame.js +83 -46
  43. package/lib/element/substitution/reference.js +101 -19
  44. package/lib/element/substitution/statement.js +122 -75
  45. package/lib/element/substitution/term.js +93 -57
  46. package/lib/element/substitution.js +20 -69
  47. package/lib/element/substitutions.js +49 -34
  48. package/lib/element/term.js +30 -21
  49. package/lib/element/topLevelAssertion/axiom.js +8 -6
  50. package/lib/element/topLevelAssertion/conjecture.js +4 -4
  51. package/lib/element/topLevelAssertion/lemma.js +4 -4
  52. package/lib/element/topLevelAssertion/theorem.js +2 -2
  53. package/lib/element/topLevelAssertion.js +30 -23
  54. package/lib/element/topLevelMetaAssertion/metaLemma.js +2 -2
  55. package/lib/element/topLevelMetaAssertion/metatheorem.js +2 -2
  56. package/lib/element/topLevelMetaAssertion.js +16 -12
  57. package/lib/element/variable.js +30 -22
  58. package/lib/index.js +3 -3
  59. package/lib/main.js +3 -3
  60. package/lib/node/frame.js +2 -2
  61. package/lib/node/metavariable.js +4 -4
  62. package/lib/node/parameter.js +28 -7
  63. package/lib/node/substitution/frame.js +9 -31
  64. package/lib/node/substitution/reference.js +137 -0
  65. package/lib/node/substitution/statement.js +9 -31
  66. package/lib/node/substitution/term.js +9 -23
  67. package/lib/nonTerminalNodeMap.js +3 -2
  68. package/lib/process/instantiate.js +2 -14
  69. package/lib/process/unify.js +5 -5
  70. package/lib/tokenTypes.js +22 -0
  71. package/lib/utilities/context.js +54 -19
  72. package/lib/utilities/element.js +161 -336
  73. package/lib/utilities/instance.js +4 -4
  74. package/lib/utilities/string.js +18 -4
  75. package/lib/utilities/unification.js +24 -18
  76. package/lib/utilities/validation.js +31 -31
  77. package/package.json +2 -2
  78. package/src/constants.js +12 -0
  79. package/src/context/{transient.js → ephemeral.js} +15 -112
  80. package/src/context/file.js +66 -67
  81. package/src/context/liminal.js +67 -0
  82. package/src/context/{fragment.js → literal.js} +17 -4
  83. package/src/context/nominal.js +12 -0
  84. package/src/context/release.js +44 -6
  85. package/src/context/scoped.js +41 -31
  86. package/src/context/synthetic.js +60 -0
  87. package/src/element/assertion/contained.js +49 -47
  88. package/src/element/assertion/defined.js +29 -27
  89. package/src/element/assertion/property.js +35 -35
  90. package/src/element/assertion/satisfies.js +19 -18
  91. package/src/element/assumption.js +4 -10
  92. package/src/element/conclusion.js +16 -19
  93. package/src/element/constructor.js +1 -1
  94. package/src/element/deduction.js +16 -21
  95. package/src/element/derivation.js +2 -2
  96. package/src/element/equality.js +4 -4
  97. package/src/element/equivalence.js +115 -135
  98. package/src/element/equivalences.js +9 -7
  99. package/src/element/error.js +4 -2
  100. package/src/element/frame.js +50 -23
  101. package/src/element/hypothesis.js +1 -1
  102. package/src/element/judgement.js +9 -4
  103. package/src/element/metaType.js +0 -1
  104. package/src/element/metavariable.js +54 -53
  105. package/src/element/parameter.js +10 -5
  106. package/src/element/procedureCall.js +20 -18
  107. package/src/element/proof.js +14 -16
  108. package/src/element/proofAssertion/premise.js +46 -42
  109. package/src/element/proofAssertion/step.js +45 -40
  110. package/src/element/proofAssertion/supposition.js +56 -45
  111. package/src/element/proofAssertion.js +23 -5
  112. package/src/element/propertyRelation.js +1 -1
  113. package/src/element/reference.js +64 -16
  114. package/src/element/rule.js +31 -37
  115. package/src/element/section.js +1 -1
  116. package/src/element/signature.js +8 -8
  117. package/src/element/statement.js +51 -40
  118. package/src/element/subproof.js +16 -18
  119. package/src/element/substitution/frame.js +99 -42
  120. package/src/element/substitution/reference.js +120 -20
  121. package/src/element/substitution/statement.js +160 -89
  122. package/src/element/substitution/term.js +104 -63
  123. package/src/element/substitution.js +16 -58
  124. package/src/element/substitutions.js +43 -41
  125. package/src/element/term.js +37 -32
  126. package/src/element/topLevelAssertion/axiom.js +8 -6
  127. package/src/element/topLevelAssertion/conjecture.js +1 -2
  128. package/src/element/topLevelAssertion/lemma.js +2 -3
  129. package/src/element/topLevelAssertion/theorem.js +1 -1
  130. package/src/element/topLevelAssertion.js +31 -27
  131. package/src/element/topLevelMetaAssertion/metaLemma.js +1 -2
  132. package/src/element/topLevelMetaAssertion/metatheorem.js +1 -2
  133. package/src/element/topLevelMetaAssertion.js +15 -13
  134. package/src/element/variable.js +30 -31
  135. package/src/index.js +2 -1
  136. package/src/main.js +2 -1
  137. package/src/node/frame.js +1 -1
  138. package/src/node/metavariable.js +3 -3
  139. package/src/node/parameter.js +32 -5
  140. package/src/node/substitution/frame.js +6 -32
  141. package/src/node/substitution/reference.js +38 -0
  142. package/src/node/substitution/statement.js +6 -32
  143. package/src/node/substitution/term.js +6 -22
  144. package/src/nonTerminalNodeMap.js +3 -0
  145. package/src/process/instantiate.js +0 -8
  146. package/src/process/unify.js +4 -4
  147. package/src/tokenTypes.js +4 -0
  148. package/src/utilities/context.js +43 -17
  149. package/src/utilities/element.js +187 -401
  150. package/src/utilities/instance.js +3 -3
  151. package/src/utilities/string.js +21 -5
  152. package/src/utilities/unification.js +26 -23
  153. package/src/utilities/validation.js +47 -47
  154. package/lib/context/fragment.js +0 -77
  155. package/lib/context/transient.js +0 -371
  156. package/lib/log.js +0 -150
  157. package/lib/utilities/fragment.js +0 -23
  158. package/lib/utilities/node.js +0 -71
  159. package/src/log.js +0 -118
  160. package/src/utilities/fragment.js +0 -11
  161. package/src/utilities/node.js +0 -85
@@ -7,54 +7,12 @@ export default class Substitution extends Element {
7
7
  super(context, string, node);
8
8
  }
9
9
 
10
- getTerm() {
11
- const term = null;
12
-
13
- return term;
14
- }
15
-
16
- getFrame() {
17
- const frame = null;
18
-
19
- return frame;
20
- }
21
-
22
- getVariable() {
23
- const variable = null;
24
-
25
- return variable;
26
- }
27
-
28
- getReference() {
29
- const reference = null;
30
-
31
- return reference;
32
- }
33
-
34
- getStatement() {
35
- const statement = null;
36
-
37
- return statement;
38
- }
39
-
40
- getMetavariable() {
41
- const metavariableNode = null;
42
-
43
- return metavariableNode;
44
- }
45
-
46
10
  getSubstitution() {
47
11
  const substitution = null;
48
12
 
49
13
  return substitution;
50
14
  }
51
15
 
52
- getReplacementNode() {
53
- const replacementNode = null;
54
-
55
- return replacementNode;
56
- }
57
-
58
16
  isSimple() {
59
17
  const simple = true;
60
18
 
@@ -74,40 +32,34 @@ export default class Substitution extends Element {
74
32
  return trivial;
75
33
  }
76
34
 
77
- isTermEqualToTerm(term, context) {
78
- const termEqualToTerm = false;
79
-
80
- return termEqualToTerm;
81
- }
82
-
83
35
  isFrameEqualToFrame(frame) {
84
36
  const frameEqualToFrame = false;
85
37
 
86
38
  return frameEqualToFrame;
87
39
  }
88
40
 
89
- isReferenceEqualToReference(reference, context) {
41
+ isReferenceEqualToReference(reference) {
90
42
  const referenceEqualToReference = false;
91
43
 
92
44
  return referenceEqualToReference;
93
45
  }
94
46
 
95
- compareStatement(statement, context) {
96
- const comparesToStatement = false;
97
-
98
- return comparesToStatement;
99
- }
100
-
101
47
  isMetavariableEqualToMetavariable(metavariable) {
102
48
  const metavariableEqualToMetavariable = false;
103
49
 
104
50
  return metavariableEqualToMetavariable;
105
51
  }
106
52
 
107
- isSubstitutionEqualToSubstitution(substitution) {
108
- const substitutionEqualToSubstitution = (substitution === null);
53
+ compareTerm(term, context) {
54
+ const comparesToTerm = false;
109
55
 
110
- return substitutionEqualToSubstitution;
56
+ return comparesToTerm;
57
+ }
58
+
59
+ compareStatement(statement) {
60
+ const comparesToStatement = false;
61
+
62
+ return comparesToStatement;
111
63
  }
112
64
 
113
65
  compareParameter(parameter) {
@@ -116,6 +68,12 @@ export default class Substitution extends Element {
116
68
  return comparesToParameter;
117
69
  }
118
70
 
71
+ compareSubstitution(substitution) {
72
+ const comparesToSubstitution = false;
73
+
74
+ return comparesToSubstitution;
75
+ }
76
+
119
77
  resolve(substitutions, context) {
120
78
  const resolved = true;
121
79
 
@@ -8,7 +8,7 @@ import { define } from "../elements";
8
8
  import { EMPTY_STRING } from "../constants";
9
9
  import { substitutionsStringFromSubstitutions } from "../utilities/string";
10
10
 
11
- const { find, first, clear, prune, filter, compress, correlate } = arrayUtilities;
11
+ const { find, first, clear, prune, filter, extract, compress, correlate } = arrayUtilities;
12
12
 
13
13
  export default define(class Substitutions extends Element {
14
14
  constructor(context, string, node, array, savedArray) {
@@ -78,7 +78,7 @@ export default define(class Substitutions extends Element {
78
78
 
79
79
  mapSubstitution(callback) { return this.array.map(callback); }
80
80
 
81
- findSubstitution(callback) { return this.array.find(callback) || null; } ///
81
+ findSubstitution(callback) { return this.array.find(callback) }
82
82
 
83
83
  someSubstitution(callback) { return this.array.some(callback); }
84
84
 
@@ -88,9 +88,23 @@ export default define(class Substitutions extends Element {
88
88
 
89
89
  forEachSubstitution(callback) { this.array.forEach(callback); }
90
90
 
91
+ extractSubstitution(callbcak) { return extract(this.array, callbcak); }
92
+
91
93
  findSubstitutions(callback) {
94
+ let string;
95
+
92
96
  const array = find(this.array, callback),
93
- substitutions = Substitutions.fromArray(array);
97
+ context = null;
98
+
99
+ string = null;
100
+
101
+ const node = null,
102
+ savedArray = [],
103
+ substitutions = new Substitutions(context, string, node, array, savedArray);
104
+
105
+ string = substitutions.asString();
106
+
107
+ substitutions.setString(string);
94
108
 
95
109
  return substitutions;
96
110
  }
@@ -106,7 +120,7 @@ export default define(class Substitutions extends Element {
106
120
  return true;
107
121
  }
108
122
  }
109
- });
123
+ }) || null;
110
124
 
111
125
  return substitution;
112
126
  }
@@ -135,7 +149,7 @@ export default define(class Substitutions extends Element {
135
149
  return true;
136
150
  }
137
151
  }
138
- });
152
+ }) || null;
139
153
 
140
154
  return simpleSubstitution;
141
155
  }
@@ -165,13 +179,13 @@ export default define(class Substitutions extends Element {
165
179
 
166
180
  if (substitutionMetavariableEqualToMetavariable) {
167
181
  const substitutionB = substitution, ///
168
- substitutionBSubstitutionEqualToSubstitutionA = substitutionB.isSubstitutionEqualToSubstitution(substitutionA);
182
+ substitutionBSubstitutionComparesToSubstitutionA = substitutionB.compareSubstitution(substitutionA);
169
183
 
170
- if (substitutionBSubstitutionEqualToSubstitutionA) {
184
+ if (substitutionBSubstitutionComparesToSubstitutionA) {
171
185
  return true;
172
186
  }
173
187
  }
174
- });
188
+ }) || null;
175
189
 
176
190
  return substitution;
177
191
  }
@@ -199,11 +213,12 @@ export default define(class Substitutions extends Element {
199
213
  }
200
214
 
201
215
  addSubstitution(substitution, context) {
216
+ const substitutionString = substitution.getString(),
217
+ substitutionsString = this.asString(); ///
218
+
202
219
  this.array.push(substitution);
203
220
 
204
- const string = this.asString(),
205
- substitutionString = substitution.getString(),
206
- substitutionsString = string; ///
221
+ const string = this.asString();
207
222
 
208
223
  this.setString(string);
209
224
 
@@ -295,13 +310,21 @@ export default define(class Substitutions extends Element {
295
310
  return resolved;
296
311
  }
297
312
 
298
- snapshot() {
313
+ snapshot(context) {
314
+ const substitutionsString = this.getString(); ///
315
+
316
+ context.trace(`Taking a snapshot of the '${substitutionsString}' substitutions.`);
317
+
299
318
  this.savedArray = [
300
319
  ...this.array
301
320
  ];
302
321
  }
303
322
 
304
323
  rollback(context) {
324
+ const substitutionsString = this.getString(); ///
325
+
326
+ context.trace(`Rolling back the '${substitutionsString}' substitutions.`);
327
+
305
328
  const array = [
306
329
  ...this.array
307
330
  ];
@@ -323,7 +346,11 @@ export default define(class Substitutions extends Element {
323
346
  this.setString(string);
324
347
  }
325
348
 
326
- continue() {
349
+ continue(context) {
350
+ const substitutionsString = this.getString(); ///
351
+
352
+ context.trace(`Continuing with the '${substitutionsString}' substitutions.`);
353
+
327
354
  this.savedArray = null;
328
355
  }
329
356
 
@@ -344,40 +371,15 @@ export default define(class Substitutions extends Element {
344
371
  return string;
345
372
  }
346
373
 
347
- static fromArray(array) {
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);
361
-
362
- return substitutions;
363
- }
364
-
365
- static fromNothing() {
366
- let string;
367
-
368
- const context = null;
369
-
370
- string = null;
374
+ static name = "Substitutions";
371
375
 
376
+ static fromNothing(context) {
372
377
  const node = null,
378
+ string = EMPTY_STRING,
373
379
  array = [],
374
380
  savedArray = [],
375
381
  substitutions = new Substitutions(context, string, node, array, savedArray);
376
382
 
377
- string = substitutions.asString();
378
-
379
- substitutions.setString(string);
380
-
381
383
  return substitutions;
382
384
  }
383
385
  });
@@ -6,8 +6,7 @@ import Element from "../element";
6
6
 
7
7
  import { define } from "../elements";
8
8
  import { validateTerms } from "../utilities/validation";
9
- import { instantiateTerm } from "../process/instantiate";
10
- import { typeFromJSON, typeToTypeJSON } from "../utilities/json";
9
+ import { typeToTypeJSON } from "../utilities/json";
11
10
 
12
11
  const { filter, compress } = arrayUtilities;
13
12
 
@@ -26,30 +25,15 @@ export default define(class Term extends Element {
26
25
  this.type = type;
27
26
  }
28
27
 
29
- isSingular() { return this.node.isSingular(); }
28
+ isSingular() {
29
+ const node = this.getNode(),
30
+ singular = node.isSingular();
30
31
 
31
- isProvisional() { return this.type.isProvisional(); }
32
-
33
- compareVariable(variable) {
34
- let comparesToVaraible = false;
35
-
36
- const singular = this.isSingular();
37
-
38
- if (singular) {
39
- const variableNode = variable.getNode(),
40
- singularVariableNode = this.node.getSingularVariableNode(),
41
- variableNodeA = variableNode, ///
42
- variableNodeB = singularVariableNode, ///
43
- matches = variableNodeA.match(variableNodeB);
44
-
45
- if (matches) {
46
- comparesToVaraible = true;
47
- }
48
- }
49
-
50
- return comparesToVaraible;
32
+ return singular;
51
33
  }
52
34
 
35
+ isProvisional() { return this.type.isProvisional(); }
36
+
53
37
  isGrounded(definedVariables, context) {
54
38
  const term = this, ///
55
39
  variables = variablesFromTerm(term, context);
@@ -85,10 +69,37 @@ export default define(class Term extends Element {
85
69
  return implicitlyGrounded;
86
70
  }
87
71
 
72
+ getVariableIdentifier() {
73
+ const node = this.getNode(),
74
+ variableIdentifier = node.getVariableIdentifier();
75
+
76
+ return variableIdentifier;
77
+ }
78
+
79
+ compareParameter(parameter) {
80
+ let comparesToParamter = false;
81
+
82
+ const singular = this.isSingular();
83
+
84
+ if (singular) {
85
+ const parameterIdentifier = parameter.getIdentifier();
86
+
87
+ if (parameterIdentifier !== null) {
88
+ const variableIdentifier = this.getVariableIdentifier();
89
+
90
+ if (parameterIdentifier === variableIdentifier) {
91
+ comparesToParamter = true;
92
+ }
93
+ }
94
+ }
95
+
96
+ return comparesToParamter;
97
+ }
98
+
88
99
  validate(context, verifyAhead) {
89
100
  let validates;
90
101
 
91
- const termString = this.string; ///
102
+ const termString = this.getString(); ///
92
103
 
93
104
  context.trace(`Validating the '${termString}' term...`);
94
105
 
@@ -145,7 +156,7 @@ export default define(class Term extends Element {
145
156
 
146
157
  toJSON() {
147
158
  const typeJSON = typeToTypeJSON(this.type),
148
- string = this.string, ///
159
+ string = this.getString(), ///
149
160
  type = typeJSON, ///
150
161
  json = {
151
162
  type,
@@ -158,13 +169,7 @@ export default define(class Term extends Element {
158
169
  static name = "Term";
159
170
 
160
171
  static fromJSON(json, context) {
161
- const { string } = json,
162
- termNode = instantiateTerm(string, context),
163
- node = termNode, ///
164
- type = typeFromJSON(json, context),
165
- term = new Term(context, string, node, type);
166
-
167
- return term;
172
+ ///
168
173
  }
169
174
  });
170
175
 
@@ -15,10 +15,9 @@ export default define(class Axiom extends TopLevelAssertion {
15
15
  verify() {
16
16
  let verifies;
17
17
 
18
- const axiom = this, ///
19
- node = this.getNode(),
18
+ const node = this.getNode(),
20
19
  context = this.getContext(),
21
- axiomString = axiom.getString();
20
+ axiomString = this.getString(); ///
22
21
 
23
22
  context.trace(`Verifying the '${axiomString}' axiom...`, node);
24
23
 
@@ -237,12 +236,15 @@ export default define(class Axiom extends TopLevelAssertion {
237
236
  const hypothesesCorrelate = topLevelAssertion.correlateHypotheses(context);
238
237
 
239
238
  if (hypothesesCorrelate) {
240
- const deduction = topLevelAssertion.getDeduction(), ///
241
- specificContext = context; ///
239
+ const specificContext = context; ///
242
240
 
243
241
  context = this.getContext();
244
242
 
245
- const generalContext = context, ///
243
+ const generalContext = context; ///
244
+
245
+ context = specificContext; ///
246
+
247
+ const deduction = topLevelAssertion.getDeduction(),
246
248
  deductionUnifies = this.unifyDeduction(deduction, substitutions, generalContext, specificContext);
247
249
 
248
250
  if (deductionUnifies) {
@@ -10,8 +10,7 @@ export default define(class Conjecture extends TopLevelAssertion {
10
10
 
11
11
  const node = this.getNode(),
12
12
  context = this.getContext(),
13
- conjecture = this, ///
14
- conjectureString = conjecture.getString();
13
+ conjectureString = this.getString(); ///
15
14
 
16
15
  context.trace(`Verifying the '${conjectureString}' conjecture...`, node);
17
16
 
@@ -8,10 +8,9 @@ export default define(class Lemma extends TopLevelAssertion {
8
8
  verify() {
9
9
  let verifies;
10
10
 
11
- const lemma = this, ///
12
- node = this.getNode(),
11
+ const node = this.getNode(),
13
12
  context = this.getContext(),
14
- lemmaString = lemma.getString();
13
+ lemmaString = this.getString(); ///
15
14
 
16
15
  (lemmaString === null) ?
17
16
  context.trace(`Verifying a lemma...`, node) :
@@ -10,7 +10,7 @@ export default define(class Theorem extends TopLevelAssertion {
10
10
 
11
11
  const node = this.getNode(),
12
12
  context = this.getContext(),
13
- theoremString = this.string; ///
13
+ theoremString = this.getString(); ///
14
14
 
15
15
  context.trace(`Verifying the '${theoremString}' theorem...`, node);
16
16
 
@@ -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 ScopedContext from "../context/scoped";
8
6
 
7
+ import { scope, attempt } from "../utilities/context";
9
8
  import { labelsFromJSON,
10
9
  deductionFromJSON,
11
10
  signatureFromJSON,
@@ -125,25 +124,27 @@ export default class TopLevelAssertion 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 scopedContext = ScopedContext.fromNothing(this.context),
132
- context = scopedContext, ///
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 TopLevelAssertion 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 TopLevelAssertion 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 TopLevelAssertion 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
 
@@ -10,8 +10,7 @@ export default define(class MetaLemma extends TopLevelMetaAssertion {
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
 
@@ -10,8 +10,7 @@ export default define(class Metatheorem extends TopLevelMetaAssertion {
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
 
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
 
3
3
  import Element from "../element";
4
- import ScopedContext from "../context/scoped";
5
4
 
5
+ import { scope } from "../utilities/context";
6
6
  import { labelFromJSON,
7
7
  labelToLabelJSON,
8
8
  deductionFromJSON,
@@ -56,25 +56,27 @@ export default class TopLevelMetaAssertion 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 scopedContext = ScopedContext.fromNothing(this.context),
63
- context = scopedContext, ///
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
  }