occam-verify-cli 1.0.758 → 1.0.762

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 (85) hide show
  1. package/lib/context/synthetic.js +82 -2
  2. package/lib/element/assertion/contained.js +4 -3
  3. package/lib/element/assertion/defined.js +4 -3
  4. package/lib/element/assertion/property.js +5 -4
  5. package/lib/element/assertion/satisfies.js +4 -3
  6. package/lib/element/assertion/subproof.js +64 -54
  7. package/lib/element/assertion/type.js +4 -3
  8. package/lib/element/combinator.js +2 -3
  9. package/lib/element/conclusion.js +2 -3
  10. package/lib/element/constructor.js +2 -3
  11. package/lib/element/deduction.js +2 -3
  12. package/lib/element/equality.js +2 -3
  13. package/lib/element/frame.js +2 -3
  14. package/lib/element/hypothesis.js +2 -3
  15. package/lib/element/judgement.js +2 -3
  16. package/lib/element/label.js +2 -3
  17. package/lib/element/metavariable.js +11 -26
  18. package/lib/element/parameter.js +2 -3
  19. package/lib/element/procedureCall.js +2 -3
  20. package/lib/element/procedureReference.js +2 -3
  21. package/lib/element/proofAssertion/premise.js +11 -10
  22. package/lib/element/proofAssertion/step.js +11 -10
  23. package/lib/element/proofAssertion/supposition.js +11 -10
  24. package/lib/element/property.js +2 -3
  25. package/lib/element/propertyRelation.js +2 -3
  26. package/lib/element/reference.js +2 -3
  27. package/lib/element/signature.js +2 -3
  28. package/lib/element/statement.js +2 -3
  29. package/lib/element/substitution/frame.js +4 -3
  30. package/lib/element/substitution/metaLevel.js +2 -3
  31. package/lib/element/substitution/reference.js +4 -3
  32. package/lib/element/substitution/statement.js +6 -5
  33. package/lib/element/substitution/term.js +4 -3
  34. package/lib/element/term.js +2 -3
  35. package/lib/element/type.js +2 -3
  36. package/lib/element/typePrefix.js +2 -3
  37. package/lib/element/variable.js +5 -10
  38. package/lib/process/unify.js +1 -12
  39. package/lib/utilities/context.js +53 -4
  40. package/lib/utilities/instance.js +5 -13
  41. package/lib/utilities/unification.js +4 -9
  42. package/lib/utilities/validation.js +14 -8
  43. package/package.json +4 -4
  44. package/src/context/synthetic.js +125 -1
  45. package/src/element/assertion/contained.js +4 -2
  46. package/src/element/assertion/defined.js +4 -2
  47. package/src/element/assertion/property.js +5 -3
  48. package/src/element/assertion/satisfies.js +4 -2
  49. package/src/element/assertion/subproof.js +80 -73
  50. package/src/element/assertion/type.js +4 -2
  51. package/src/element/combinator.js +1 -3
  52. package/src/element/conclusion.js +1 -3
  53. package/src/element/constructor.js +1 -3
  54. package/src/element/deduction.js +1 -3
  55. package/src/element/equality.js +1 -3
  56. package/src/element/frame.js +1 -3
  57. package/src/element/hypothesis.js +1 -3
  58. package/src/element/judgement.js +1 -3
  59. package/src/element/label.js +1 -3
  60. package/src/element/metavariable.js +17 -36
  61. package/src/element/parameter.js +1 -3
  62. package/src/element/procedureCall.js +1 -3
  63. package/src/element/procedureReference.js +1 -3
  64. package/src/element/proofAssertion/premise.js +12 -12
  65. package/src/element/proofAssertion/step.js +11 -9
  66. package/src/element/proofAssertion/supposition.js +12 -12
  67. package/src/element/property.js +1 -3
  68. package/src/element/propertyRelation.js +1 -3
  69. package/src/element/reference.js +1 -3
  70. package/src/element/signature.js +1 -3
  71. package/src/element/statement.js +1 -3
  72. package/src/element/substitution/frame.js +4 -2
  73. package/src/element/substitution/metaLevel.js +1 -3
  74. package/src/element/substitution/reference.js +4 -2
  75. package/src/element/substitution/statement.js +6 -4
  76. package/src/element/substitution/term.js +4 -2
  77. package/src/element/term.js +1 -3
  78. package/src/element/type.js +1 -3
  79. package/src/element/typePrefix.js +2 -3
  80. package/src/element/variable.js +5 -12
  81. package/src/process/unify.js +0 -16
  82. package/src/utilities/context.js +85 -3
  83. package/src/utilities/instance.js +5 -11
  84. package/src/utilities/unification.js +5 -11
  85. package/src/utilities/validation.js +17 -9
@@ -6,7 +6,7 @@ import Assertion from "../assertion";
6
6
 
7
7
  import { define } from "../../elements";
8
8
  import { reconcile } from "../../utilities/context";
9
- import { instantiate } from "../../utilities/context";
9
+ import { join, instantiate } from "../../utilities/context";
10
10
  import { instantiateSubproofAssertion } from "../../process/instantiate";
11
11
 
12
12
  const { last, front, backwardsEvery } = arrayUtilities;
@@ -114,17 +114,21 @@ export default define(class SubproofAssertion extends Assertion {
114
114
 
115
115
  context.trace(`Unifying the '${subproofString}' subproof with the '${subproofAssertionString}' subproof assertion...`);
116
116
 
117
- const lastStep = subproof.getLastStep(),
118
- lastStepUnifies = this.unifyLastStep(lastStep, generalContext, specificContext);
117
+ reconcile((specificContext) => {
118
+ const lastStep = subproof.getLastStep(),
119
+ lastStepUnifies = this.unifyLastStep(lastStep, generalContext, specificContext);
119
120
 
120
- if (lastStepUnifies) {
121
- const suppositions = subproof.getSuppositions(),
122
- suppositionsUnify = this.unifySuppositions(suppositions, generalContext, specificContext);
121
+ if (lastStepUnifies) {
122
+ const suppositions = subproof.getSuppositions(),
123
+ suppositionsUnify = this.unifySuppositions(suppositions, generalContext, specificContext);
123
124
 
124
- if (suppositionsUnify) {
125
- subproofUnifies = true;
125
+ if (suppositionsUnify) {
126
+ specificContext.commit();
127
+
128
+ subproofUnifies = true;
129
+ }
126
130
  }
127
- }
131
+ }, specificContext);
128
132
 
129
133
  if (subproofUnifies) {
130
134
  context.debug(`...unified the '${subproofString}' subproof with the '${subproofAssertionString}' subproof assertion.`);
@@ -136,33 +140,32 @@ export default define(class SubproofAssertion extends Assertion {
136
140
  unifyLastStep(lastStep, generalContext, specificContext) {
137
141
  let lastStepUnifies = false;
138
142
 
139
- const lastStatement = this.getLastStatement(),
143
+ const context = specificContext, ///
144
+ lastStatement = this.getLastStatement(),
140
145
  lastStepString = lastStep.getString(),
141
- lastStepStatement = lastStep.getStatement(),
142
- lastStatementString = lastStatement.getString(),
143
- subproofAssertionString = this.getString(), ///
144
- lastStepStatementString = lastStepStatement.getString();
145
-
146
- let context;
146
+ lastStatementString = lastStatement.getString();
147
147
 
148
- context = specificContext; ///
148
+ context.trace(`Unifying the '${lastStepString}' last step with the '${lastStatementString}' last statement...`)
149
149
 
150
- context.trace(`Unifying the '${lastStepString}' last step's '${lastStepStatementString}' statement with the '${subproofAssertionString}' subproof assertion's '${lastStatementString}' last statement...`)
150
+ const lastStepContext = lastStep.getContext(),
151
+ lastStepStatement = lastStep.getStatement();
151
152
 
152
- context = lastStep.getContext();
153
+ specificContext = lastStepContext; ///
153
154
 
154
- specificContext = context; ///
155
+ join((specificContext) => {
156
+ reconcile((specificContext) => {
157
+ const lastStepStatementUnifies = lastStatement.unifyStatement(lastStepStatement, generalContext, specificContext);
155
158
 
156
- reconcile((specificContext) => {
157
- const lastStepStatementUnifies = lastStatement.unifyStatement(lastStepStatement, generalContext, specificContext);
159
+ if (lastStepStatementUnifies) {
160
+ specificContext.commit(context);
158
161
 
159
- if (lastStepStatementUnifies) {
160
- lastStepUnifies = true;
161
- }
162
- }, specificContext);
162
+ lastStepUnifies = true;
163
+ }
164
+ }, specificContext);
165
+ }, specificContext, context);
163
166
 
164
167
  if (lastStepUnifies) {
165
- context.debug(`...unified the '${lastStepString}' last step's '${lastStepStatementString}' statement with the '${subproofAssertionString}' subproof assertion's '${lastStatementString}' last statement.`)
168
+ context.debug(`...unified the '${lastStepString}' last step with the '${lastStatementString}' last statement.`)
166
169
  }
167
170
 
168
171
  return lastStepUnifies;
@@ -171,33 +174,32 @@ export default define(class SubproofAssertion extends Assertion {
171
174
  unifyDeduction(deduction, generalContext, specificContext) {
172
175
  let deductionUnifies = false;
173
176
 
174
- const lastStatement = this.getLastStatement(),
177
+ const context = specificContext, ///
178
+ lastStatement = this.getLastStatement(),
175
179
  deductionString = deduction.getString(),
176
- deductionStatement = deduction.getStatement(),
177
- lastStatementString = lastStatement.getString(),
178
- subproofAssertionString = this.getString(), ///
179
- deductionStatementString = deductionStatement.getString();
180
-
181
- let context;
180
+ lastStatementString = lastStatement.getString();
182
181
 
183
- context = specificContext; ///
182
+ context.trace(`Unifying the '${deductionString}' deduction with the '${lastStatementString}' last statement...`)
184
183
 
185
- context.trace(`Unifying the '${deductionString}' deduction's '${deductionStatementString}' statement with the '${subproofAssertionString}' subproof assertion's '${lastStatementString}' last statement...`)
184
+ const deductionContext = deduction.getContext(),
185
+ deductionStatement = deduction.getStatement();
186
186
 
187
- context = deduction.getContext();
187
+ specificContext = deductionContext; ///
188
188
 
189
- specificContext = context; ///
189
+ join((specificContext) => {
190
+ reconcile((specificContext) => {
191
+ const deductionStatementUnifies = lastStatement.unifyStatement(deductionStatement, generalContext, specificContext);
190
192
 
191
- reconcile((specificContext) => {
192
- const deductionStatementUnifies = lastStatement.unifyStatement(deductionStatement, generalContext, specificContext);
193
+ if (deductionStatementUnifies) {
194
+ specificContext.commit(context);
193
195
 
194
- if (deductionStatementUnifies) {
195
- deductionUnifies = true;
196
- }
197
- }, specificContext);
196
+ deductionUnifies = true;
197
+ }
198
+ }, specificContext);
199
+ }, specificContext, context);
198
200
 
199
201
  if (deductionUnifies) {
200
- context.debug(`...unified the '${deductionString}' deduction's '${deductionStatementString}' statement with the '${subproofAssertionString}' subproof assertion's '${lastStatementString}' last statement.`)
202
+ context.debug(`...unified the '${deductionString}' deduction with the '${lastStatementString}' last statement.`)
201
203
  }
202
204
 
203
205
  return deductionUnifies;
@@ -206,33 +208,32 @@ export default define(class SubproofAssertion extends Assertion {
206
208
  unifySupposition(supposition, index, generalContext, specificContext) {
207
209
  let suppositionUnifies = false;
208
210
 
209
- const supposedStatement = this.getSupposedStatement(index),
211
+ const context = specificContext, ///
212
+ supposedStatement = this.getSupposedStatement(index),
210
213
  suppositionString = supposition.getString(),
211
- suppositionStatement = supposition.getStatement(),
212
- subproofAssertionString = this.getString(), ///
213
- supposedStatementString = supposedStatement.getString(),
214
- suppositionStatementString = suppositionStatement.getString(); ///
215
-
216
- let context;
214
+ supposedStatementString = supposedStatement.getString();
217
215
 
218
- context = specificContext; ///
216
+ context.trace(`Unifying the '${suppositionString}' supposition with the '${supposedStatementString}' supposed statement...`)
219
217
 
220
- context.trace(`Unifying the '${suppositionString}' supposition's '${suppositionStatementString}' statement with the '${subproofAssertionString}' subproof assertion's '${supposedStatementString}' supposed statement...`)
218
+ const suppositionContext = supposition.getContext(),
219
+ suppositionStatement = supposition.getStatement();
221
220
 
222
- context = supposition.getContext();
221
+ specificContext = suppositionContext; ///
223
222
 
224
- specificContext = context; ///
223
+ join((specificContext) => {
224
+ reconcile((specificContext) => {
225
+ const suppositionStatementUnifies = supposedStatement.unifyStatement(suppositionStatement, generalContext, specificContext);
225
226
 
226
- reconcile((specificContext) => {
227
- const suppositionStatementUnifies = supposedStatement.unifyStatement(suppositionStatement, generalContext, specificContext);
227
+ if (suppositionStatementUnifies) {
228
+ specificContext.commit(context);
228
229
 
229
- if (suppositionStatementUnifies) {
230
- suppositionUnifies = true;
231
- }
232
- }, specificContext);
230
+ suppositionUnifies = true;
231
+ }
232
+ }, specificContext);
233
+ }, specificContext, context);
233
234
 
234
235
  if (suppositionUnifies) {
235
- context.debug(`...unified the '${suppositionString}' supposition's '${suppositionStatementString}' statement with the '${subproofAssertionString}' subproof assertion's '${supposedStatementString}' supposed statement.`)
236
+ context.debug(`...unified the '${suppositionString}' supposition with the '${supposedStatementString}' supposed statement.`)
236
237
  }
237
238
 
238
239
  return suppositionUnifies;
@@ -267,17 +268,21 @@ export default define(class SubproofAssertion extends Assertion {
267
268
 
268
269
  context.trace(`Unifying the '${topLevelMetaAssertionString}' top level meta-assertion with the '${subproofAssertionString}' subproof assertion...`);
269
270
 
270
- const deduction = topLevelMetaAssertion.getDeduction(),
271
- deductionUnifies = this.unifyDeduction(deduction, generalContext, specificContext);
271
+ reconcile((specificContext) => {
272
+ const deduction = topLevelMetaAssertion.getDeduction(),
273
+ deductionUnifies = this.unifyDeduction(deduction, generalContext, specificContext);
272
274
 
273
- if (deductionUnifies) {
274
- const suppositions = topLevelMetaAssertion.getSuppositions(),
275
- suppositionsUnify = this.unifySuppositions(suppositions, generalContext, specificContext);
275
+ if (deductionUnifies) {
276
+ const suppositions = topLevelMetaAssertion.getSuppositions(),
277
+ suppositionsUnify = this.unifySuppositions(suppositions, generalContext, specificContext);
276
278
 
277
- if (suppositionsUnify) {
278
- topLevelMetaAssertionUnifies = true;
279
+ if (suppositionsUnify) {
280
+ specificContext.commit();
281
+
282
+ topLevelMetaAssertionUnifies = true;
283
+ }
279
284
  }
280
- }
285
+ }, specificContext);
281
286
 
282
287
  if (topLevelMetaAssertionUnifies) {
283
288
  context.debug(`...unified the '${topLevelMetaAssertionString}' top level meta-assertion with the '${subproofAssertionString}' subproof assertion.`);
@@ -294,7 +299,7 @@ export default define(class SubproofAssertion extends Assertion {
294
299
  const { name } = json;
295
300
 
296
301
  if (this.name === name) {
297
- instantiate((context) => {
302
+ subproorAssertion = instantiate((context) => {
298
303
  const { string } = json,
299
304
  subproofAssertionNode = instantiateSubproofAssertion(string, context),
300
305
  statements = statementsFromSubproofAssertionNode(subproofAssertionNode, context),
@@ -302,7 +307,9 @@ export default define(class SubproofAssertion extends Assertion {
302
307
 
303
308
  context = null;
304
309
 
305
- subproorAssertion = new SubproofAssertion(context, string, node, statements);
310
+ const subproorAssertion = new SubproofAssertion(context, string, node, statements);
311
+
312
+ return subproorAssertion;
306
313
  }, context);
307
314
  }
308
315
 
@@ -214,7 +214,7 @@ export default define(class TypeAssertion extends Assertion {
214
214
  const { name } = json;
215
215
 
216
216
  if (this.name === name) {
217
- instantiate((context) => {
217
+ typeAssertion = instantiate((context) => {
218
218
  const { string } = json,
219
219
  typeAssertionNode = instantiateTypeAssertion(string, context),
220
220
  term = termFromTypeAssertionNode(typeAssertionNode, context),
@@ -223,7 +223,9 @@ export default define(class TypeAssertion extends Assertion {
223
223
 
224
224
  context = null;
225
225
 
226
- typeAssertion = new TypeAssertion(context, string, node, term, type);
226
+ const typeAssertion = new TypeAssertion(context, string, node, term, type);
227
+
228
+ return typeAssertion;
227
229
  }, context);
228
230
  }
229
231
 
@@ -128,7 +128,7 @@ export default define(class Combinator extends Element {
128
128
 
129
129
  context = ephemeralContext; ///
130
130
 
131
- const combinator = instantiate((context) => {
131
+ return instantiate((context) => {
132
132
  const { string } = json,
133
133
  combinatorNode = instantiateCombinator(string, context),
134
134
  node = combinatorNode, ///
@@ -137,7 +137,5 @@ export default define(class Combinator extends Element {
137
137
 
138
138
  return combinator;
139
139
  }, context);
140
-
141
- return combinator;
142
140
  }
143
141
  });
@@ -150,7 +150,7 @@ export default define(class Conclusion extends Element {
150
150
 
151
151
  context = ephemeralContext; ///
152
152
 
153
- const conclusion = instantiate((context) => {
153
+ return instantiate((context) => {
154
154
  const { string } = json,
155
155
  conclusionNode = instantiateConclusion(string, context),
156
156
  node = conclusionNode, ///
@@ -159,7 +159,5 @@ export default define(class Conclusion extends Element {
159
159
 
160
160
  return conclusion;
161
161
  }, context);
162
-
163
- return conclusion;
164
162
  }
165
163
  });
@@ -173,7 +173,7 @@ export default define(class Constructor extends Element {
173
173
 
174
174
  context = ephemeralContext; ///
175
175
 
176
- const constructor = instantiate((context) => {
176
+ return instantiate((context) => {
177
177
  const { string } = json,
178
178
  constructorNode = instantiateConstructor(string, context),
179
179
  node = constructorNode, ///
@@ -183,7 +183,5 @@ export default define(class Constructor extends Element {
183
183
 
184
184
  return constructor;
185
185
  }, context);
186
-
187
- return constructor;
188
186
  }
189
187
  });
@@ -175,7 +175,7 @@ export default define(class Deduction extends Element {
175
175
 
176
176
  context = ephemeralContext; ///
177
177
 
178
- const deduction = instantiate((context) => {
178
+ return instantiate((context) => {
179
179
  const { string } = json,
180
180
  deductionNode = instantiateDeduction(string, context),
181
181
  node = deductionNode, ///
@@ -184,7 +184,5 @@ export default define(class Deduction extends Element {
184
184
 
185
185
  return deduction;
186
186
  }, context);
187
-
188
- return deduction;
189
187
  }
190
188
  });
@@ -280,7 +280,7 @@ export default define(class Equality extends Element {
280
280
  }
281
281
 
282
282
  static fromJSON(json, context) {
283
- const equality = instantiate((context) => {
283
+ return instantiate((context) => {
284
284
  const { string } = json,
285
285
  equalityNode = instantiateEquality(string, context),
286
286
  node = equalityNode, ///
@@ -293,8 +293,6 @@ export default define(class Equality extends Element {
293
293
 
294
294
  return equality;
295
295
  }, context);
296
-
297
- return equality;
298
296
  }
299
297
  });
300
298
 
@@ -343,7 +343,7 @@ export default define(class Frame extends Element {
343
343
  static name = "Frame";
344
344
 
345
345
  static fromJSON(json, context) {
346
- const frame = instantiate((context) => {
346
+ return instantiate((context) => {
347
347
  const { string } = json,
348
348
  frameNode = instantiateFrame(string, context),
349
349
  node = frameNode, ///
@@ -356,8 +356,6 @@ export default define(class Frame extends Element {
356
356
 
357
357
  return frame;
358
358
  }, context);
359
-
360
- return frame;
361
359
  }
362
360
  });
363
361
 
@@ -100,7 +100,7 @@ export default define(class Hypothesis extends Element {
100
100
  static name = "Hypothesis";
101
101
 
102
102
  static fromJSON(json, context) {
103
- const hypothesis = instantiate((context) => {
103
+ return instantiate((context) => {
104
104
  const { string } = json,
105
105
  hypothesisNode = instantiateHypothesis(string, context),
106
106
  node = hypothesisNode, ///
@@ -112,7 +112,5 @@ export default define(class Hypothesis extends Element {
112
112
 
113
113
  return hypothesis;
114
114
  }, context);
115
-
116
- return hypothesis;
117
115
  }
118
116
  });
@@ -218,7 +218,7 @@ export default define(class Judgement extends Element {
218
218
  static name = "Judgement";
219
219
 
220
220
  static fromJSON(json, context) {
221
- const judgement = instantiate((context) => {
221
+ return instantiate((context) => {
222
222
  const { string } = json,
223
223
  judgementNode = instantiateJudgement(string, context),
224
224
  node = judgementNode, ///
@@ -231,8 +231,6 @@ export default define(class Judgement extends Element {
231
231
 
232
232
  return judgement;
233
233
  }, context);
234
-
235
- return judgement;
236
234
  }
237
235
  });
238
236
 
@@ -153,7 +153,7 @@ export default define(class Label extends Element {
153
153
 
154
154
  context = ephemeralContext; ///
155
155
 
156
- const label = instantiate((context) => {
156
+ return instantiate((context) => {
157
157
  const { string } = json,
158
158
  labelNode = instantiateLabel(string, context),
159
159
  metavariable = metavariableFromLabelNode(labelNode, context),
@@ -162,7 +162,5 @@ export default define(class Label extends Element {
162
162
 
163
163
  return label;
164
164
  }, context);
165
-
166
- return label;
167
165
  }
168
166
  });
@@ -305,19 +305,13 @@ export default define(class Metavariable extends Element {
305
305
  frameUnifies = true;
306
306
  }
307
307
  } else {
308
- const { FrameSubstitution } = elements;
308
+ const { FrameSubstitution } = elements,
309
+ metavariable = this, ///
310
+ frameSubstitution = FrameSubstitution.fromFrameAndMetavariable(frame, metavariable, context);
309
311
 
310
- let frameSubstitution;
312
+ frameSubstitution.validate(generalContext, specificContext);
311
313
 
312
- const metavariable = this; ///
313
-
314
- frameSubstitution = FrameSubstitution.fromFrameAndMetavariable(frame, metavariable, context);
315
-
316
- frameSubstitution = frameSubstitution.validate(generalContext, specificContext);
317
-
318
- if (frameSubstitution !== null) {
319
- frameUnifies = true;
320
- }
314
+ frameUnifies = true;
321
315
  }
322
316
  }
323
317
 
@@ -367,13 +361,10 @@ export default define(class Metavariable extends Element {
367
361
  statementUnifies = true;
368
362
  }
369
363
  } else {
370
- const { StatementSubstitution } = elements;
371
-
372
- let statementSubstitution;
373
-
374
- statementSubstitution = (substitution !== null) ?
375
- StatementSubstitution.fromStatementMetavariableAndSubstitution(statement, metavariable, substitution, context) :
376
- StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context);
364
+ const { StatementSubstitution } = elements,
365
+ statementSubstitution = (substitution !== null) ?
366
+ StatementSubstitution.fromStatementMetavariableAndSubstitution(statement, metavariable, substitution, context) :
367
+ StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context);
377
368
 
378
369
  if (substitution !== null) {
379
370
  const context = generalContext; ///
@@ -383,11 +374,9 @@ export default define(class Metavariable extends Element {
383
374
  substitution.setContext(context);
384
375
  }
385
376
 
386
- statementSubstitution = statementSubstitution.validate(generalContext, specificContext);
377
+ statementSubstitution.validate(generalContext, specificContext);
387
378
 
388
- if (statementSubstitution !== null) {
389
- statementUnifies = true;
390
- }
379
+ statementUnifies = true;
391
380
  }
392
381
  }
393
382
 
@@ -429,19 +418,13 @@ export default define(class Metavariable extends Element {
429
418
  referenceUnifies = true;
430
419
  }
431
420
  } else {
432
- const { ReferenceSubstitution } = elements;
433
-
434
- let referenceSubstitution;
435
-
436
- const metavariable = this;
437
-
438
- referenceSubstitution = ReferenceSubstitution.fromReferenceAndMetavariable(reference, metavariable, context);
421
+ const { ReferenceSubstitution } = elements,
422
+ metavariable = this, ///
423
+ referenceSubstitution = ReferenceSubstitution.fromReferenceAndMetavariable(reference, metavariable, context);
439
424
 
440
- referenceSubstitution = referenceSubstitution.validate(generalContext, specificContext); ///
425
+ referenceSubstitution.validate(generalContext, specificContext);
441
426
 
442
- if (referenceSubstitution !== null) {
443
- referenceUnifies = true;
444
- }
427
+ referenceUnifies = true;
445
428
  }
446
429
  }
447
430
 
@@ -609,7 +592,7 @@ export default define(class Metavariable extends Element {
609
592
  static name = "Metavariable";
610
593
 
611
594
  static fromJSON(json, context) {
612
- const metavariable = instantiate((context) => {
595
+ return instantiate((context) => {
613
596
  const { string } = json,
614
597
  metavariableNode = instantiateMetavariable(string, context),
615
598
  node = metavariableNode, ///
@@ -621,7 +604,5 @@ export default define(class Metavariable extends Element {
621
604
 
622
605
  return metavariable;
623
606
  }, context);
624
-
625
- return metavariable;
626
607
  }
627
608
  });
@@ -61,7 +61,7 @@ export default define(class Parameter extends Element {
61
61
  static name = "Parameter";
62
62
 
63
63
  static fromJSON(json, context) {
64
- const parameter = instantiate((context) => {
64
+ return instantiate((context) => {
65
65
  const { string } = json,
66
66
  parameterNode = instantiateParameter(string, context),
67
67
  node = parameterNode, ///
@@ -74,7 +74,5 @@ export default define(class Parameter extends Element {
74
74
 
75
75
  return parameter;
76
76
  }, context);
77
-
78
- return parameter;
79
77
  }
80
78
  });
@@ -125,7 +125,7 @@ export default define(class ProcedureCall extends Element {
125
125
  static name = "ProcedureCall";
126
126
 
127
127
  static fromJSON(json, context) {
128
- const procedureCall = instantiate((context) => {
128
+ return instantiate((context) => {
129
129
  const { string } = json,
130
130
  procedureCallNode = instantiateProcedureCall(string, context),
131
131
  node = procedureCallNode, ///
@@ -138,7 +138,5 @@ export default define(class ProcedureCall extends Element {
138
138
 
139
139
  return procedureCall;
140
140
  }, context);
141
-
142
- return procedureCall;
143
141
  }
144
142
  });
@@ -43,7 +43,7 @@ export default define(class ProcedureReference extends Element {
43
43
  static name = "ProcedureReference";
44
44
 
45
45
  static fromJSON(json, context) {
46
- const procedureReference = instantiate((context) => {
46
+ return instantiate((context) => {
47
47
  const { string } = json,
48
48
  procedureReferenceNode = instantiateProcedureReference(string, context),
49
49
  node = procedureReferenceNode, ///
@@ -55,7 +55,5 @@ export default define(class ProcedureReference extends Element {
55
55
 
56
56
  return procedureReference;
57
57
  }, context);
58
-
59
- return procedureReference;
60
58
  }
61
59
  });
@@ -5,7 +5,7 @@ import ProofAssertion from "../proofAssertion";
5
5
  import { define } from "../../elements";
6
6
  import { instantiatePremise } from "../../process/instantiate";
7
7
  import { procedureCallFromPremiseNode } from "../../utilities/element";
8
- import { attempt, reconcile, instantiate } from "../../utilities/context";
8
+ import { join, attempt, reconcile, instantiate } from "../../utilities/context";
9
9
  import { ephemeralContextFromJSON, ephemeralContextToEphemeralContextJSON } from "../../utilities/json";
10
10
 
11
11
  export default define(class Premise extends ProofAssertion {
@@ -169,16 +169,18 @@ export default define(class Premise extends ProofAssertion {
169
169
  generalContext = premiseContext, ///
170
170
  specificContext = proofAssertionContext; ///
171
171
 
172
- reconcile((specificContext) => {
173
- const statement = proofAssertion.getStatement(),
174
- statementUnifies = this.unifyStatement(statement, generalContext, specificContext);
172
+ join((specificContext) => {
173
+ reconcile((specificContext) => {
174
+ const statement = proofAssertion.getStatement(),
175
+ statementUnifies = this.unifyStatement(statement, generalContext, specificContext);
175
176
 
176
- if (statementUnifies) {
177
- specificContext.commit(context);
177
+ if (statementUnifies) {
178
+ specificContext.commit(context);
178
179
 
179
- proofAssertionUnifies = true;
180
- }
181
- }, specificContext);
180
+ proofAssertionUnifies = true;
181
+ }
182
+ }, specificContext);
183
+ }, specificContext, context);
182
184
 
183
185
  if (proofAssertionUnifies) {
184
186
  context.debug(`...unified the '${proofAssertionString}' proof assertion with the '${premiseString}' premise.`);
@@ -290,7 +292,7 @@ export default define(class Premise extends ProofAssertion {
290
292
 
291
293
  context = ephemeralContext; ///
292
294
 
293
- const premise = instantiate((context) => {
295
+ return instantiate((context) => {
294
296
  const { string } = json,
295
297
  premiseNode = instantiatePremise(string, context),
296
298
  node = premiseNode, ///
@@ -300,8 +302,6 @@ export default define(class Premise extends ProofAssertion {
300
302
 
301
303
  return premise;
302
304
  }, context);
303
-
304
- return premise;
305
305
  }
306
306
  });
307
307
 
@@ -190,17 +190,19 @@ export default define(class Step extends ProofAssertion {
190
190
  reference = this.getReference(),
191
191
  satisfiesAssertion = this.getSatisfiesAssertion();
192
192
 
193
- await asyncReconcile(async (context) => {
194
- await asyncSome(unifyStatements, async (unifyStatement) => {
195
- const statementUnifies = await unifyStatement(statement, reference, satisfiesAssertion, context);
193
+ await asyncSome(unifyStatements, async (unifyStatement) => {
194
+ let statementUnifies;
196
195
 
197
- if (statementUnifies) {
198
- unifies = true;
196
+ await asyncReconcile(async (context) => {
197
+ statementUnifies = await unifyStatement(statement, reference, satisfiesAssertion, context);
198
+ }, context);
199
199
 
200
- return true;
201
- }
202
- });
203
- }, context);
200
+ if (statementUnifies) {
201
+ unifies = true;
202
+
203
+ return true;
204
+ }
205
+ });
204
206
 
205
207
  if (unifies) {
206
208
  context.debug(`...unified the '${stepString}' step.`);