occam-verify-cli 1.0.800 → 1.0.809

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 (92) hide show
  1. package/lib/context/bounded.js +242 -0
  2. package/lib/context/branching.js +2 -2
  3. package/lib/context/ephemeral.js +186 -69
  4. package/lib/context/file/nominal.js +87 -52
  5. package/lib/context/liminal.js +2 -2
  6. package/lib/context/synoptic.js +212 -0
  7. package/lib/context.js +57 -17
  8. package/lib/element/assertion/defined.js +3 -3
  9. package/lib/element/assumption/metaLevel.js +6 -4
  10. package/lib/element/combinator.js +4 -2
  11. package/lib/element/conclusion.js +4 -2
  12. package/lib/element/constructor.js +4 -2
  13. package/lib/element/declaration/metavariable.js +10 -9
  14. package/lib/element/declaration/variable.js +7 -7
  15. package/lib/element/deduction.js +4 -2
  16. package/lib/element/derivation.js +1 -7
  17. package/lib/element/label.js +9 -5
  18. package/lib/element/metavariable.js +34 -34
  19. package/lib/element/procedureCall.js +2 -2
  20. package/lib/element/proof.js +2 -2
  21. package/lib/element/proofAssertion/premise.js +4 -3
  22. package/lib/element/proofAssertion/step.js +5 -3
  23. package/lib/element/reference.js +6 -4
  24. package/lib/element/rule.js +2 -2
  25. package/lib/element/statement.js +9 -1
  26. package/lib/element/subproof.js +2 -2
  27. package/lib/element/substitution/frame.js +43 -29
  28. package/lib/element/substitution/reference.js +38 -28
  29. package/lib/element/substitution/statement.js +52 -42
  30. package/lib/element/substitution/term.js +49 -35
  31. package/lib/element/topLevelAssertion.js +2 -2
  32. package/lib/element/topLevelMetaAssertion.js +2 -2
  33. package/lib/element/variable.js +6 -7
  34. package/lib/preamble.js +1 -2
  35. package/lib/process/assign.js +11 -10
  36. package/lib/process/equate.js +3 -2
  37. package/lib/process/unify.js +7 -7
  38. package/lib/utilities/context.js +51 -44
  39. package/lib/utilities/element.js +1 -1
  40. package/lib/utilities/equivalences.js +131 -0
  41. package/lib/utilities/instance.js +3 -3
  42. package/lib/utilities/json.js +59 -1
  43. package/lib/utilities/validation.js +4 -3
  44. package/package.json +4 -4
  45. package/src/context/{proof.js → bounded.js} +84 -85
  46. package/src/context/branching.js +2 -2
  47. package/src/context/ephemeral.js +421 -237
  48. package/src/context/file/nominal.js +127 -77
  49. package/src/context/liminal.js +2 -2
  50. package/src/context/synoptic.js +290 -0
  51. package/src/context.js +81 -20
  52. package/src/element/assertion/defined.js +4 -4
  53. package/src/element/assumption/metaLevel.js +8 -6
  54. package/src/element/combinator.js +4 -2
  55. package/src/element/conclusion.js +4 -2
  56. package/src/element/constructor.js +4 -2
  57. package/src/element/declaration/metavariable.js +10 -8
  58. package/src/element/declaration/variable.js +8 -7
  59. package/src/element/deduction.js +4 -2
  60. package/src/element/derivation.js +0 -2
  61. package/src/element/label.js +11 -7
  62. package/src/element/metavariable.js +11 -11
  63. package/src/element/procedureCall.js +2 -2
  64. package/src/element/proof.js +2 -2
  65. package/src/element/proofAssertion/premise.js +4 -4
  66. package/src/element/proofAssertion/step.js +6 -4
  67. package/src/element/reference.js +7 -5
  68. package/src/element/rule.js +2 -2
  69. package/src/element/statement.js +14 -0
  70. package/src/element/subproof.js +2 -2
  71. package/src/element/substitution/frame.js +47 -32
  72. package/src/element/substitution/reference.js +44 -34
  73. package/src/element/substitution/statement.js +69 -58
  74. package/src/element/substitution/term.js +53 -38
  75. package/src/element/topLevelAssertion.js +2 -2
  76. package/src/element/topLevelMetaAssertion.js +2 -2
  77. package/src/element/variable.js +6 -7
  78. package/src/preamble.js +0 -1
  79. package/src/process/assign.js +17 -14
  80. package/src/process/equate.js +3 -1
  81. package/src/process/unify.js +10 -13
  82. package/src/utilities/context.js +54 -49
  83. package/src/utilities/element.js +1 -0
  84. package/src/utilities/equivalences.js +158 -0
  85. package/src/utilities/instance.js +3 -3
  86. package/src/utilities/json.js +66 -0
  87. package/src/utilities/validation.js +6 -5
  88. package/lib/context/proof.js +0 -242
  89. package/lib/context/synthetic.js +0 -135
  90. package/lib/element/equivalences.js +0 -173
  91. package/src/context/synthetic.js +0 -180
  92. package/src/element/equivalences.js +0 -237
@@ -3,10 +3,10 @@
3
3
  import Substitution from "../substitution";
4
4
 
5
5
  import { define } from "../../elements";
6
- import { attempt, instantiate } from "../../utilities/context";
7
6
  import { instantiateFrameSubstitution } from "../../process/instantiate";
7
+ import { frameSubstitutionFromFrameSubstitutionNode } from "../../utilities/element";
8
+ import { join, ablate, descend, attempt, instantiate } from "../../utilities/context";
8
9
  import { frameSubstitutionStringFromFrameAndMetavariable } from "../../utilities/string";
9
- import { frameSubstitutionFromStatementNode, frameSubstitutionFromFrameSubstitutionNode } from "../../utilities/element";
10
10
 
11
11
  export default define(class FrameSubstitution extends Substitution {
12
12
  constructor(context, string, node, targetFrame, replacementFrame) {
@@ -87,24 +87,26 @@ export default define(class FrameSubstitution extends Substitution {
87
87
 
88
88
  context.debug(`...the '${frameSubstitutionString}' frame substitution is already valid.`);
89
89
  } else {
90
- const context = this.getContext(),
91
- specificContext = context; ///
90
+ const context = this.getContext();
92
91
 
93
- attempt((specificContext) => {
94
- const targetFrameValidates = this.validateTargetFrame(generalContext, specificContext);
92
+ join((context) => {
93
+ attempt((context) => {
94
+ const specificContext = context, ///,
95
+ targetFrameValidates = this.validateTargetFrame(generalContext, specificContext);
95
96
 
96
- if (targetFrameValidates) {
97
- const replacementFrameValidates = this.validateReplacementFrame(generalContext, specificContext);
97
+ if (targetFrameValidates) {
98
+ const replacementFrameValidates = this.validateReplacementFrame(generalContext, specificContext);
98
99
 
99
- if (replacementFrameValidates) {
100
- validates = true;
100
+ if (replacementFrameValidates) {
101
+ validates = true;
102
+ }
101
103
  }
102
- }
103
104
 
104
- if (validates) {
105
- specificContext.commit(this);
106
- }
107
- }, specificContext);
105
+ if (validates) {
106
+ context.commit(this);
107
+ }
108
+ }, context);
109
+ }, specificContext, context);
108
110
  }
109
111
 
110
112
  if (validates) {
@@ -132,13 +134,15 @@ export default define(class FrameSubstitution extends Substitution {
132
134
  const targetFrameSingular = this.targetFrame.isSingular();
133
135
 
134
136
  if (targetFrameSingular) {
135
- const tragetFrame = this.targetFrame.validate(context);
137
+ descend((context) => {
138
+ const tragetFrame = this.targetFrame.validate(context);
136
139
 
137
- if (tragetFrame !== null) {
138
- this.targetFrame = tragetFrame;
140
+ if (tragetFrame !== null) {
141
+ this.targetFrame = tragetFrame;
139
142
 
140
- targetFrameValidates = true;
141
- }
143
+ targetFrameValidates = true;
144
+ }
145
+ }, context);
142
146
  } else {
143
147
  context.debug(`The '${frameSubstitutionString}' frame substitution's '${targetFrameString}' target frame is not singular.`);
144
148
  }
@@ -159,13 +163,15 @@ export default define(class FrameSubstitution extends Substitution {
159
163
 
160
164
  context.trace(`Validating the '${frameSubstitutionString}' frame substitution's '${replacementFrameString}' replacement frame...`);
161
165
 
162
- const replacementFrame = this.replacementFrame.validate(context);
166
+ descend((context) => {
167
+ const replacementFrame = this.replacementFrame.validate(context);
163
168
 
164
- if (replacementFrame !== null) {
165
- this.replacementFrame = replacementFrame;
169
+ if (replacementFrame !== null) {
170
+ this.replacementFrame = replacementFrame;
166
171
 
167
- replacementFrameValidates = true;
168
- }
172
+ replacementFrameValidates = true;
173
+ }
174
+ }, context);
169
175
 
170
176
  if (replacementFrameValidates) {
171
177
  context.debug(`...validated the '${frameSubstitutionString}' frame substitution's '${replacementFrameString}' replacement frame.`);
@@ -197,8 +203,15 @@ export default define(class FrameSubstitution extends Substitution {
197
203
  }
198
204
 
199
205
  static fromStatement(statement, context) {
200
- const statementNode = statement.getNode(),
201
- frameSubstitution = frameSubstitutionFromStatementNode(statementNode, context);
206
+ let frameSubstitution = null;
207
+
208
+ const frameSubstitutionNode = statement.getFrameSubstitutionNode();
209
+
210
+ if (frameSubstitutionNode !== null) {
211
+ ablate((context) => {
212
+ frameSubstitution = frameSubstitutionFromFrameSubstitutionNode(frameSubstitutionNode, context);
213
+ }, context);
214
+ }
202
215
 
203
216
  return frameSubstitution;
204
217
  }
@@ -206,12 +219,14 @@ export default define(class FrameSubstitution extends Substitution {
206
219
  static fromFrameAndMetavariable(frame, metavariable, context) {
207
220
  let frameSubstitution
208
221
 
209
- instantiate((context) => {
210
- const frameSubstitutionString = frameSubstitutionStringFromFrameAndMetavariable(frame, metavariable),
211
- string = frameSubstitutionString, ///
212
- frameSubstitutionNode = instantiateFrameSubstitution(string, context);
222
+ ablate((context) => {
223
+ instantiate((context) => {
224
+ const frameSubstitutionString = frameSubstitutionStringFromFrameAndMetavariable(frame, metavariable),
225
+ string = frameSubstitutionString, ///
226
+ frameSubstitutionNode = instantiateFrameSubstitution(string, context);
213
227
 
214
- frameSubstitution = frameSubstitutionFromFrameSubstitutionNode(frameSubstitutionNode, context);
228
+ frameSubstitution = frameSubstitutionFromFrameSubstitutionNode(frameSubstitutionNode, context);
229
+ }, context);
215
230
  }, context);
216
231
 
217
232
  return frameSubstitution;
@@ -3,8 +3,8 @@
3
3
  import Substitution from "../substitution";
4
4
 
5
5
  import { define } from "../../elements";
6
- import { attempt, instantiate } from "../../utilities/context";
7
6
  import { instantiateReferenceSubstitution } from "../../process/instantiate";
7
+ import { join, descend, ablate, attempt, instantiate } from "../../utilities/context";
8
8
  import { referenceSubstitutionFromReferenceSubstitutionNode } from "../../utilities/element";
9
9
  import { referenceSubstitutionStringFromReferenceAndMetavariable } from "../../utilities/string";
10
10
 
@@ -104,24 +104,26 @@ export default define(class ReferenceSubstitution extends Substitution {
104
104
 
105
105
  context.debug(`...the '${referenceSubstitutionString}' reference substitution is already valid.`);
106
106
  } else {
107
- const context = this.getContext(),
108
- specificContext = context; ///
107
+ const context = this.getContext();
109
108
 
110
- attempt((specificContext) => {
111
- const targetReferenceValidates = this.validateTargetReference(generalContext, specificContext);
109
+ join((context) => {
110
+ attempt((context) => {
111
+ const specificContext = context, ///
112
+ targetReferenceValidates = this.validateTargetReference(generalContext, specificContext);
112
113
 
113
- if (targetReferenceValidates) {
114
- const replacementReferenceValidates = this.validateReplacementReference(generalContext, specificContext);
114
+ if (targetReferenceValidates) {
115
+ const replacementReferenceValidates = this.validateReplacementReference(generalContext, specificContext);
115
116
 
116
- if (replacementReferenceValidates) {
117
- validates = true;
117
+ if (replacementReferenceValidates) {
118
+ validates = true;
119
+ }
118
120
  }
119
- }
120
121
 
121
- if (validates) {
122
- specificContext.commit(this);
123
- }
124
- }, specificContext);
122
+ if (validates) {
123
+ context.commit(this);
124
+ }
125
+ }, context);
126
+ }, specificContext, context);
125
127
  }
126
128
 
127
129
  if (validates) {
@@ -146,11 +148,13 @@ export default define(class ReferenceSubstitution extends Substitution {
146
148
 
147
149
  context.trace(`Validating the '${referenceSubstitutionString}' reference substitution's '${targetReferenceString}' target reference...`);
148
150
 
149
- const targetReference = this.targetReference.validate(context);
151
+ descend((context) => {
152
+ const targetReference = this.targetReference.validate(context);
150
153
 
151
- if (targetReference !== null) {
152
- targetReferenceValidates = true;
153
- }
154
+ if (targetReference !== null) {
155
+ targetReferenceValidates = true;
156
+ }
157
+ }, context);
154
158
 
155
159
  if (targetReferenceValidates) {
156
160
  context.debug(`...validated the '${referenceSubstitutionString}' reference substitution's '${targetReferenceString}' target reference...`);
@@ -168,11 +172,13 @@ export default define(class ReferenceSubstitution extends Substitution {
168
172
 
169
173
  context.trace(`Validating the '${referenceSubstitutionString}' reference substitution's '${replacementReferenceString}' replacement reference...`);
170
174
 
171
- const replacementReference = this.replacementReference.validate(context);
175
+ descend((context) => {
176
+ const replacementReference = this.replacementReference.validate(context);
172
177
 
173
- if (replacementReference !== null) {
174
- replacementReferenceValidates = true;
175
- }
178
+ if (replacementReference !== null) {
179
+ replacementReferenceValidates = true;
180
+ }
181
+ }, context);
176
182
 
177
183
  if (replacementReferenceValidates) {
178
184
  context.debug(`...validated the '${referenceSubstitutionString}' reference substitution's '${replacementReferenceString}' replacement reference.`);
@@ -206,12 +212,14 @@ export default define(class ReferenceSubstitution extends Substitution {
206
212
  static fromReferenceAndMetavariable(reference, metavariable, context) {
207
213
  let referenceSubstitution;
208
214
 
209
- instantiate((context) => {
210
- const referenceSubstitutionString = referenceSubstitutionStringFromReferenceAndMetavariable(reference, metavariable),
211
- string = referenceSubstitutionString, ///
212
- referenceSubstitutionNode = instantiateReferenceSubstitution(string, context);
215
+ ablate((context) => {
216
+ instantiate((context) => {
217
+ const referenceSubstitutionString = referenceSubstitutionStringFromReferenceAndMetavariable(reference, metavariable),
218
+ string = referenceSubstitutionString, ///
219
+ referenceSubstitutionNode = instantiateReferenceSubstitution(string, context);
213
220
 
214
- referenceSubstitution = referenceSubstitutionFromReferenceSubstitutionNode(referenceSubstitutionNode, context);
221
+ referenceSubstitution = referenceSubstitutionFromReferenceSubstitutionNode(referenceSubstitutionNode, context);
222
+ }, context);
215
223
  }, context);
216
224
 
217
225
  return referenceSubstitution;
@@ -220,14 +228,16 @@ export default define(class ReferenceSubstitution extends Substitution {
220
228
  static fromAssumptionAndMetaLevelAssumption(assumption, metaLevelAssumption, context) {
221
229
  let referenceSubstitution;
222
230
 
223
- instantiate((context) => {
224
- const reference = metaLevelAssumption.getReference(),
225
- metavariable = assumption.getMetavariable(),
226
- referenceSubstitutionString = referenceSubstitutionStringFromReferenceAndMetavariable(reference, metavariable),
227
- string = referenceSubstitutionString, ///
228
- referenceSubstitutionNode = instantiateReferenceSubstitution(string, context);
231
+ ablate((context) => {
232
+ instantiate((context) => {
233
+ const reference = metaLevelAssumption.getReference(),
234
+ metavariable = assumption.getMetavariable(),
235
+ referenceSubstitutionString = referenceSubstitutionStringFromReferenceAndMetavariable(reference, metavariable),
236
+ string = referenceSubstitutionString, ///
237
+ referenceSubstitutionNode = instantiateReferenceSubstitution(string, context);
229
238
 
230
- referenceSubstitution = referenceSubstitutionFromReferenceSubstitutionNode(referenceSubstitutionNode, context);
239
+ referenceSubstitution = referenceSubstitutionFromReferenceSubstitutionNode(referenceSubstitutionNode, context);
240
+ }, context);
231
241
  }, context);
232
242
 
233
243
  return referenceSubstitution;
@@ -6,8 +6,8 @@ import { define } from "../../elements";
6
6
  import { unifySubstitution } from "../../process/unify";
7
7
  import { stripBracketsFromStatement } from "../../utilities/brackets";
8
8
  import { instantiateStatementSubstitution } from "../../process/instantiate";
9
- import { join, attempt, descend, reconcile, instantiate } from "../../utilities/context";
10
9
  import { statementSubstitutionFromStatementSubstitutionNode } from "../../utilities/element";
10
+ import { join, ablate, attempt, descend, reconcile, instantiate } from "../../utilities/context";
11
11
  import { statementSubstitutionStringFromStatementAndMetavariable, statementSubstitutionStringFromStatementMetavariableAndSubstitution } from "../../utilities/string";
12
12
 
13
13
  export default define(class StatementSubstitution extends Substitution {
@@ -122,28 +122,30 @@ export default define(class StatementSubstitution extends Substitution {
122
122
 
123
123
  context.debug(`...the '${statementSubstitutionString}' statement substitution is already valid.`);
124
124
  } else {
125
- const context = this.getContext(),
126
- specificContext = context; ///
125
+ const context = this.getContext();
127
126
 
128
- attempt((specificContext) => {
129
- const targetStatementValidates = this.validateTargetStatement(generalContext, specificContext);
127
+ join((context) => {
128
+ attempt((context) => {
129
+ const specificContext = context, ///
130
+ targetStatementValidates = this.validateTargetStatement(generalContext, specificContext);
130
131
 
131
- if (targetStatementValidates) {
132
- const replacementStatementValidates = this.validateReplacementStatement(generalContext, specificContext);
132
+ if (targetStatementValidates) {
133
+ const replacementStatementValidates = this.validateReplacementStatement(generalContext, specificContext);
133
134
 
134
- if (replacementStatementValidates) {
135
- const substitutionValidates = this.validateSubstitution(generalContext, specificContext);
135
+ if (replacementStatementValidates) {
136
+ const substitutionValidates = this.validateSubstitution(generalContext, specificContext);
136
137
 
137
- if (substitutionValidates) {
138
- validates = true;
138
+ if (substitutionValidates) {
139
+ validates = true;
140
+ }
139
141
  }
140
142
  }
141
- }
142
143
 
143
- if (validates) {
144
- specificContext.commit(this);
145
- }
146
- }, specificContext);
144
+ if (validates) {
145
+ context.commit(this);
146
+ }
147
+ }, context);
148
+ }, specificContext, context);
147
149
  }
148
150
 
149
151
  if (validates) {
@@ -169,15 +171,17 @@ export default define(class StatementSubstitution extends Substitution {
169
171
 
170
172
  context.trace(`Validating the '${statementSubstitutionString}' statement substitution's '${substitutionString}' substitution...`);
171
173
 
172
- specificContext = generalContext; ///
173
-
174
- const substitution = this.substitution.validate(generalContext, specificContext);
174
+ descend((context) => {
175
+ const generalContext = context, ///
176
+ specificContext = context, ///
177
+ substitution = this.substitution.validate(generalContext, specificContext);
175
178
 
176
- if (substitution !== null) {
177
- this.substitution = substitution;
179
+ if (substitution !== null) {
180
+ this.substitution = substitution;
178
181
 
179
- substitutionValidates = true;
180
- }
182
+ substitutionValidates = true;
183
+ }
184
+ }, context);
181
185
 
182
186
  if (substitutionValidates) {
183
187
  context.debug(`...validatewd the '${statementSubstitutionString}' statement substitution's '${substitutionString}' substitution.`);
@@ -190,7 +194,7 @@ export default define(class StatementSubstitution extends Substitution {
190
194
  validateTargetStatement(generalContext, specificContext) {
191
195
  let targetStatementValidates = false;
192
196
 
193
- const context = generalContext, ///
197
+ const context = generalContext, ///
194
198
  targetStatementString = this.targetStatement.getString(),
195
199
  statementSubstitutionString = this.getString(); ///
196
200
 
@@ -344,38 +348,41 @@ export default define(class StatementSubstitution extends Substitution {
344
348
  let resolved = false;
345
349
 
346
350
  const context = specificContext, ///
347
- substitutionString = this.getString(); ///
348
-
349
- context.trace(`Resolving the ${substitutionString} substitution...`);
350
-
351
- const metavariableName = this.getMetavariableName(),
351
+ metavariableName = this.getMetavariableName(),
352
352
  simpleSubstitution = context.findSimpleSubstitutionByMetavariableName(metavariableName);
353
353
 
354
354
  if (simpleSubstitution !== null) {
355
+ const substitutionString = this.getString(); ///
356
+
357
+ context.trace(`Resolving the ${substitutionString} substitution...`);
358
+
355
359
  const substitution = this.unifyWithSimpleSubstitution(simpleSubstitution, generalContext, specificContext); ///
356
360
 
357
361
  if (substitution !== null) {
358
- const complexSubstitution = this, ///
359
- simpleSubstitutionContext = simpleSubstitution.getContext(),
360
- complexSubstitutionContext = complexSubstitution.getContext();
361
-
362
- join((context) => {
363
- const substitutionContext = this.substitution.getContext(),
364
- generalContext = substitutionContext, ///
365
- specificContext = context, ///
366
- substitutionUnifies = this.unifySubstitution(substitution, generalContext, specificContext);
367
-
368
- if (substitutionUnifies) {
369
- resolved = true;
370
- }
371
- }, complexSubstitutionContext, simpleSubstitutionContext, context);
372
- }
373
- }
362
+ let context;
363
+
364
+ context = substitution.getContext();
365
+
366
+ const specificContext = context; ///
367
+
368
+ context = this.substitution.getContext();
374
369
 
375
- if (resolved) {
376
- this.resolved = true;
370
+ const generalContext = context; ///
371
+
372
+ context = specificContext; ///
373
+
374
+ const substitutionUnifies = this.unifySubstitution(substitution, generalContext, specificContext);
375
+
376
+ if (substitutionUnifies) {
377
+ resolved = true;
378
+ }
377
379
 
378
- context.debug(`...resolved the '${substitutionString}' substitution.`);
380
+ if (resolved) {
381
+ this.resolved = true;
382
+
383
+ context.debug(`...resolved the '${substitutionString}' substitution.`);
384
+ }
385
+ }
379
386
  }
380
387
  }
381
388
 
@@ -406,12 +413,14 @@ export default define(class StatementSubstitution extends Substitution {
406
413
 
407
414
  let statementSubstitution;
408
415
 
409
- instantiate((context) => {
410
- const statementSubstitutionString = statementSubstitutionStringFromStatementAndMetavariable(statement, metavariable, context),
411
- string = statementSubstitutionString, ///
412
- statementSubstitutionNode = instantiateStatementSubstitution(string, context);
416
+ ablate((context) => {
417
+ instantiate((context) => {
418
+ const statementSubstitutionString = statementSubstitutionStringFromStatementAndMetavariable(statement, metavariable, context),
419
+ string = statementSubstitutionString, ///
420
+ statementSubstitutionNode = instantiateStatementSubstitution(string, context);
413
421
 
414
- statementSubstitution = statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, context);
422
+ statementSubstitution = statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, context);
423
+ }, context);
415
424
  }, context);
416
425
 
417
426
  return statementSubstitution;
@@ -422,12 +431,14 @@ export default define(class StatementSubstitution extends Substitution {
422
431
 
423
432
  let statementSubstitution;
424
433
 
425
- instantiate((context) => {
426
- const statementSubstitutionString = statementSubstitutionStringFromStatementMetavariableAndSubstitution(statement, metavariable, substitution),
427
- string = statementSubstitutionString, ///
428
- statementSubstitutionNode = instantiateStatementSubstitution(string, context);
434
+ ablate((context) => {
435
+ instantiate((context) => {
436
+ const statementSubstitutionString = statementSubstitutionStringFromStatementMetavariableAndSubstitution(statement, metavariable, substitution),
437
+ string = statementSubstitutionString, ///
438
+ statementSubstitutionNode = instantiateStatementSubstitution(string, context);
429
439
 
430
- statementSubstitution = statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, context);
440
+ statementSubstitution = statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, context);
441
+ }, context);
431
442
  }, context);
432
443
 
433
444
  return statementSubstitution;
@@ -3,11 +3,11 @@
3
3
  import Substitution from "../substitution";
4
4
 
5
5
  import { define } from "../../elements";
6
- import { attempt, instantiate } from "../../utilities/context";
7
6
  import { stripBracketsFromTerm } from "../../utilities/brackets";
8
7
  import { instantiateTermSubstitution } from "../../process/instantiate";
8
+ import { termSubstitutionFromTermSubstitutionNode } from "../../utilities/element";
9
9
  import { termSubstitutionStringFromTermAndVariable } from "../../utilities/string";
10
- import { termSubstitutionFromStatementNode, termSubstitutionFromTermSubstitutionNode } from "../../utilities/element";
10
+ import { join, ablate, descend, attempt, instantiate } from "../../utilities/context";
11
11
 
12
12
  export default define(class TermSubstitution extends Substitution {
13
13
  constructor(context, string, node, targetTerm, replacementTerm) {
@@ -90,24 +90,26 @@ export default define(class TermSubstitution extends Substitution {
90
90
 
91
91
  context.debug(`...the '${termSubstitutionString}' term substitution is already valid.`);
92
92
  } else {
93
- const context = this.getContext(),
94
- specificContext = context; ///
93
+ const context = this.getContext();
95
94
 
96
- attempt((specificContext) => {
97
- const targetTermValidates = this.validateTargetTerm(generalContext, specificContext);
95
+ join((context) => {
96
+ attempt((context) => {
97
+ const specificContext = context, ///
98
+ targetTermValidates = this.validateTargetTerm(generalContext, specificContext);
98
99
 
99
- if (targetTermValidates) {
100
- const replacementTermValidates = this.validateReplacementTerm(generalContext, specificContext);
100
+ if (targetTermValidates) {
101
+ const replacementTermValidates = this.validateReplacementTerm(generalContext, specificContext);
101
102
 
102
- if (replacementTermValidates) {
103
- validates = true;
103
+ if (replacementTermValidates) {
104
+ validates = true;
105
+ }
104
106
  }
105
- }
106
107
 
107
- if (validates) {
108
- specificContext.commit(this);
109
- }
110
- }, specificContext);
108
+ if (validates) {
109
+ context.commit(this);
110
+ }
111
+ }, context);
112
+ }, specificContext, context);
111
113
  }
112
114
 
113
115
  if (validates) {
@@ -135,17 +137,19 @@ export default define(class TermSubstitution extends Substitution {
135
137
  const targetTermSingular = this.targetTerm.isSingular();
136
138
 
137
139
  if (targetTermSingular) {
138
- const targetTerm = this.targetTerm.validate(context, (targetTerm) => {
139
- const validatesForwards = true;
140
+ descend((context) => {
141
+ const targetTerm = this.targetTerm.validate(context, (targetTerm) => {
142
+ const validatesForwards = true;
140
143
 
141
- return validatesForwards;
142
- });
144
+ return validatesForwards;
145
+ });
143
146
 
144
- if (targetTerm !== null) {
145
- this.targetTerm = targetTerm;
147
+ if (targetTerm !== null) {
148
+ this.targetTerm = targetTerm;
146
149
 
147
- targetTermValidates = true;
148
- }
150
+ targetTermValidates = true;
151
+ }
152
+ }, context);
149
153
  } else {
150
154
  context.debug(`The '${termSubstitutionString}' term substitution's '${targetTermString}' target term is not singular.`);
151
155
  }
@@ -166,17 +170,19 @@ export default define(class TermSubstitution extends Substitution {
166
170
 
167
171
  context.trace(`Validating the '${termSubstitutionString}' term substitution's '${replacementTermString}' replacement term...`);
168
172
 
169
- const replacementTerm = this.replacementTerm.validate(context, (replacementTerm) => {
170
- const validatesForwards = true;
173
+ descend((context) => {
174
+ const replacementTerm = this.replacementTerm.validate(context, (replacementTerm) => {
175
+ const validatesForwards = true;
171
176
 
172
- return validatesForwards;
173
- });
177
+ return validatesForwards;
178
+ });
174
179
 
175
- if (replacementTerm !== null) {
176
- this.replacementTerm = replacementTerm;
180
+ if (replacementTerm !== null) {
181
+ this.replacementTerm = replacementTerm;
177
182
 
178
- replacementTermValidates = true;
179
- }
183
+ replacementTermValidates = true;
184
+ }
185
+ }, context);
180
186
 
181
187
  if (replacementTermValidates) {
182
188
  context.debug(`...validated the '${termSubstitutionString}' term substitution's '${replacementTermString}' replacement term...`);
@@ -208,8 +214,15 @@ export default define(class TermSubstitution extends Substitution {
208
214
  }
209
215
 
210
216
  static fromStatement(statement, context) {
211
- const statementNode = statement.getNode(),
212
- termSubstitution = termSubstitutionFromStatementNode(statementNode, context);
217
+ let termSubstitution = null;
218
+
219
+ const termSubstitutionNode = statement.getTermSubstitutionNode();
220
+
221
+ if (termSubstitutionNode !== null) {
222
+ ablate((context) => {
223
+ termSubstitution = termSubstitutionFromTermSubstitutionNode(termSubstitutionNode, context);
224
+ }, context);
225
+ }
213
226
 
214
227
  return termSubstitution;
215
228
  }
@@ -219,12 +232,14 @@ export default define(class TermSubstitution extends Substitution {
219
232
 
220
233
  let termSubstitution;
221
234
 
222
- instantiate((context) => {
223
- const termSubstitutionString = termSubstitutionStringFromTermAndVariable(term, variable),
224
- string = termSubstitutionString, ///
225
- termSubstitutionNode = instantiateTermSubstitution(string, context);
235
+ ablate((context) => {
236
+ instantiate((context) => {
237
+ const termSubstitutionString = termSubstitutionStringFromTermAndVariable(term, variable),
238
+ string = termSubstitutionString, ///
239
+ termSubstitutionNode = instantiateTermSubstitution(string, context);
226
240
 
227
- termSubstitution = termSubstitutionFromTermSubstitutionNode(termSubstitutionNode, context);
241
+ termSubstitution = termSubstitutionFromTermSubstitutionNode(termSubstitutionNode, context);
242
+ }, context);
228
243
  }, context);
229
244
 
230
245
  return termSubstitution;
@@ -3,7 +3,7 @@
3
3
  import { arrayUtilities } from "necessary";
4
4
  import { Element, asynchronousUtilities } from "occam-languages";
5
5
 
6
- import { asyncRestrict } from "../utilities/context";
6
+ import { enclose } from "../utilities/context";
7
7
  import { topLevelAssertionStringFromLabelsSuppositionsAndDeduction } from "../utilities/string";
8
8
  import { labelsFromJSON,
9
9
  deductionFromJSON,
@@ -150,7 +150,7 @@ export default class TopLevelAssertion extends Element {
150
150
 
151
151
  context.trace(`Verifying the '${topLevelAssertionString}' top level assertion...`);
152
152
 
153
- await asyncRestrict(async (context) => {
153
+ await enclose(async (context) => {
154
154
  const labelsVerify = this.verifyLabels();
155
155
 
156
156
  if (labelsVerify) {
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { Element, asynchronousUtilities } from "occam-languages";
4
4
 
5
- import { asyncRestrict } from "../utilities/context";
5
+ import { enclose } from "../utilities/context";
6
6
  import { topLevelMetaAssertionStringFromLabelSuppositionsDeductionAndMetaLevelAssumptions } from "../utilities/string";
7
7
  import { labelFromJSON,
8
8
  labelToLabelJSON,
@@ -103,7 +103,7 @@ export default class TopLevelMetaAssertion extends Element {
103
103
 
104
104
  context.trace(`Verifying the '${topLevelMetaAssertionString}' top level meta assertion...`);
105
105
 
106
- await asyncRestrict(async (context) => {
106
+ await enclose(async (context) => {
107
107
  const labelVerifies = this.verifyLabel();
108
108
 
109
109
  if (labelVerifies) {