occam-verify-cli 1.0.951 → 1.0.956

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 (55) hide show
  1. package/lib/context/aphasic.js +27 -0
  2. package/lib/context/ephemeral.js +28 -0
  3. package/lib/context/liminal.js +2 -2
  4. package/lib/context/synoptic.js +6 -2
  5. package/lib/element/assertion/signature.js +2 -2
  6. package/lib/element/assertion/subproof.js +2 -2
  7. package/lib/element/conclusion.js +2 -2
  8. package/lib/element/constructor.js +2 -2
  9. package/lib/element/deduction.js +2 -2
  10. package/lib/element/label.js +8 -6
  11. package/lib/element/metavariable.js +3 -3
  12. package/lib/element/parameter.js +2 -2
  13. package/lib/element/procedureCall.js +1 -1
  14. package/lib/element/proofAssertion/step.js +3 -3
  15. package/lib/element/property.js +1 -2
  16. package/lib/element/reference.js +7 -5
  17. package/lib/element/section.js +1 -1
  18. package/lib/element/signature.js +7 -5
  19. package/lib/element/statement.js +2 -2
  20. package/lib/element/substitution/frame.js +87 -13
  21. package/lib/element/substitution/reference.js +3 -3
  22. package/lib/element/substitution/statement.js +53 -58
  23. package/lib/element/substitution/term.js +75 -4
  24. package/lib/element/substitution.js +1 -5
  25. package/lib/element/variable.js +2 -2
  26. package/lib/process/unify.js +2 -51
  27. package/lib/utilities/context.js +50 -14
  28. package/package.json +4 -4
  29. package/src/context/aphasic.js +15 -0
  30. package/src/context/ephemeral.js +17 -0
  31. package/src/context/liminal.js +1 -1
  32. package/src/context/synoptic.js +9 -1
  33. package/src/element/assertion/signature.js +1 -1
  34. package/src/element/assertion/subproof.js +1 -2
  35. package/src/element/conclusion.js +2 -2
  36. package/src/element/constructor.js +1 -1
  37. package/src/element/deduction.js +2 -2
  38. package/src/element/label.js +9 -7
  39. package/src/element/metavariable.js +2 -2
  40. package/src/element/parameter.js +1 -1
  41. package/src/element/procedureCall.js +1 -1
  42. package/src/element/proofAssertion/step.js +3 -2
  43. package/src/element/property.js +0 -1
  44. package/src/element/reference.js +8 -6
  45. package/src/element/section.js +1 -1
  46. package/src/element/signature.js +8 -6
  47. package/src/element/statement.js +1 -1
  48. package/src/element/substitution/frame.js +159 -22
  49. package/src/element/substitution/reference.js +3 -3
  50. package/src/element/substitution/statement.js +84 -83
  51. package/src/element/substitution/term.js +137 -4
  52. package/src/element/substitution.js +0 -6
  53. package/src/element/variable.js +1 -1
  54. package/src/process/unify.js +0 -76
  55. package/src/utilities/context.js +68 -19
@@ -7,7 +7,7 @@ import { breakPointFromJSON } from "../../utilities/breakPoint";
7
7
  import { instantiateFrameSubstitution } from "../../process/instantiate";
8
8
  import { frameSubstitutionFromFrameSubstitutionNode } from "../../utilities/element";
9
9
  import { frameSubstitutionStringFromFrameAndMetavariable } from "../../utilities/string";
10
- import { ablate, ablates, manifest, attempts, descend, instantiate, unserialises } from "../../utilities/context";
10
+ import { join, ablate, ablates, manifest, attempts, reconcile, sequester, instantiate, unserialises } from "../../utilities/context";
11
11
 
12
12
  export default define(class FrameSubstitution extends Substitution {
13
13
  constructor(contexts, string, node, breakPoint, targetFrame, replacementFrame) {
@@ -136,7 +136,7 @@ export default define(class FrameSubstitution extends Substitution {
136
136
 
137
137
  if (targetFrameSingular) {
138
138
  manifest((context) => {
139
- descend((context) => {
139
+ sequester((context) => {
140
140
  const tragetFrame = this.targetFrame.validate(context);
141
141
 
142
142
  if (tragetFrame !== null) {
@@ -167,7 +167,7 @@ export default define(class FrameSubstitution extends Substitution {
167
167
 
168
168
  context.trace(`Validating the '${frameSubstitutionString}' frame substitution's replacement frame...`);
169
169
 
170
- descend((context) => {
170
+ sequester((context) => {
171
171
  const replacementFrame = this.replacementFrame.validate(context);
172
172
 
173
173
  if (replacementFrame !== null) {
@@ -184,6 +184,127 @@ export default define(class FrameSubstitution extends Substitution {
184
184
  return replacementFrameValidates;
185
185
  }
186
186
 
187
+ unifySubstitution(substitution, context) {
188
+ let substitutionUnifies = false;
189
+
190
+ const generalSubstitution = this, ///
191
+ specificSubstitution = substitution,
192
+ generalSubstitutionString = generalSubstitution.getString(),
193
+ specificSubstitutionString = specificSubstitution.getString();
194
+
195
+ context.trace(`Unifying the '${specificSubstitutionString}' substitution with the '${generalSubstitutionString}' substitution...`);
196
+
197
+ reconcile((context) => {
198
+ const replacementFrameUnifies = this.unifyReplacementFrame(substitution, context);
199
+
200
+ if (replacementFrameUnifies) {
201
+ const targetFrameUnifies = this.unifyTargetFrame(substitution, context);
202
+
203
+ if (targetFrameUnifies) {
204
+ context.commit();
205
+
206
+ substitutionUnifies = true;
207
+ }
208
+ }
209
+ }, context);
210
+
211
+ if (substitutionUnifies) {
212
+ context.debug(`...unified the '${specificSubstitutionString}' substitution with the '${generalSubstitutionString}' substitution.`);
213
+ }
214
+
215
+ return substitutionUnifies;
216
+ }
217
+
218
+ unifyTargetFrame(substitution, context) {
219
+ let targetFrameUnifies = false;
220
+
221
+ const generalSubstitution = this, ///
222
+ specificSubstitution = substitution,
223
+ generalSubstitutionString = generalSubstitution.getString(),
224
+ specificSubstitutionString = specificSubstitution.getString();
225
+
226
+ context.trace(`Unifying the '${specificSubstitutionString}' substitution's target frame with the '${generalSubstitutionString}' substitution's target frame...`);
227
+
228
+ const generalSubstitutionGeneralContext = generalSubstitution.getGeneralContext(),
229
+ specificSubstitutionGeneralContext = specificSubstitution.getGeneralContext(),
230
+ generalSubstitutionTargetFrame = generalSubstitution.getTargetFrame(),
231
+ specificSubstitutionTargetFrame = specificSubstitution.getTargetFrame(),
232
+ generalContext = generalSubstitutionGeneralContext, ///
233
+ specificContext = specificSubstitutionGeneralContext, ///
234
+ generalFrame = generalSubstitutionTargetFrame, ///
235
+ specificFrame = specificSubstitutionTargetFrame; ///
236
+
237
+ join((specificContext) => {
238
+ reconcile((specificContext) => {
239
+ const generalFrameNode = generalFrame.getNode(),
240
+ generalMetavariable = metavariableFromFrameNode(generalFrameNode, generalContext);
241
+
242
+ if (generalMetavariable !== null) {
243
+ const frame = specificFrame, ///
244
+ metavariable = generalMetavariable, ///
245
+ frameUnifies = metavariable.unifyFrame(frame, generalContext, specificContext);
246
+
247
+ if (frameUnifies) {
248
+ specificContext.commit(context);
249
+
250
+ targetFrameUnifies = true;
251
+ }
252
+ }
253
+ }, specificContext);
254
+ }, specificContext, context);
255
+
256
+ if (targetFrameUnifies) {
257
+ context.trace(`...unified the '${specificSubstitutionString}' substitution's target frame with the '${generalSubstitutionString}' substitution's target frame.`);
258
+ }
259
+
260
+ return targetFrameUnifies;
261
+ }
262
+
263
+ unifyReplacementFrame(substitution, context) {
264
+ let replacementFrameUnifies = false;
265
+
266
+ const generalSubstitution = this, ///
267
+ specificSubstitution = substitution,
268
+ generalSubstitutionString = generalSubstitution.getString(),
269
+ specificSubstitutionString = specificSubstitution.getString();
270
+
271
+ context.trace(`Unifying the '${specificSubstitutionString}' substitution's replacement frame with the '${generalSubstitutionString}' substitution's replacement frame...`);
272
+
273
+ const generalSubstitutionSpecificContext = generalSubstitution.getSpecificContext(),
274
+ specificSubstitutionSpecificContext = specificSubstitution.getSpecificContext(),
275
+ generalSubstitutionReplacementFrame = generalSubstitution.getReplacementFrame(),
276
+ specificSubstitutionReplacementFrame = specificSubstitution.getReplacementFrame(),
277
+ generalContext = generalSubstitutionSpecificContext, ///
278
+ specificContext = specificSubstitutionSpecificContext, ///
279
+ generalFrame = generalSubstitutionReplacementFrame, ///
280
+ specificFrame = specificSubstitutionReplacementFrame; ///
281
+
282
+ join((specificContext) => {
283
+ reconcile((specificContext) => {
284
+ const generalFrameNode = generalFrame.getNode(),
285
+ generalMetavariable = metavariableFromFrameNode(generalFrameNode, generalContext);
286
+
287
+ if (generalMetavariable !== null) {
288
+ const frame = specificFrame, ///
289
+ metavariable = generalMetavariable, ///
290
+ frameUnifies = metavariable.unifyFrame(frame, generalContext, specificContext);
291
+
292
+ if (frameUnifies) {
293
+ specificContext.commit(context);
294
+
295
+ replacementFrameUnifies = true;
296
+ }
297
+ }
298
+ }, specificContext);
299
+ }, specificContext, context);
300
+
301
+ if (replacementFrameUnifies) {
302
+ context.trace(`...unified the '${specificSubstitutionString}' substitution's replacement frame with the '${generalSubstitutionString}' substitution's replacement frame.`);
303
+ }
304
+
305
+ return replacementFrameUnifies;
306
+ }
307
+
187
308
  static name = "FrameSubstitution";
188
309
 
189
310
  static fromJSON(json, context) {
@@ -192,25 +313,29 @@ export default define(class FrameSubstitution extends Substitution {
192
313
  const { name } = json;
193
314
 
194
315
  if (this.name === name) {
195
- unserialises((json, generalContext, specificContext) => {
196
- const context = specificContext; ///
197
-
198
- instantiate((context) => {
199
- const { string } = json,
200
- frameSubstitutionNode = instantiateFrameSubstitution(string, context),
201
- node = frameSubstitutionNode, ///
202
- breakPoint = breakPointFromJSON(json),
203
- targetFrame = targetFrameFromFrameSubstitutionNode(frameSubstitutionNode, context),
204
- replacementFrame = replacementFrameFromFrameSubstitutionNode(frameSubstitutionNode, context),
205
- specificContext = context, ///
206
- contexts = [
207
- generalContext,
208
- specificContext
209
- ];
210
-
211
- frameSubstitutionn = new FrameSubstitution(contexts, string, node, breakPoint, targetFrame, replacementFrame);
212
- }, context);
213
- }, json, context);
316
+ const forced = true;
317
+
318
+ ablate((context) => {
319
+ unserialises((json, generalContext, specificContext) => {
320
+ const context = specificContext; ///
321
+
322
+ instantiate((context) => {
323
+ const { string } = json,
324
+ frameSubstitutionNode = instantiateFrameSubstitution(string, context),
325
+ node = frameSubstitutionNode, ///
326
+ breakPoint = breakPointFromJSON(json),
327
+ targetFrame = targetFrameFromFrameSubstitutionNode(frameSubstitutionNode, context),
328
+ replacementFrame = replacementFrameFromFrameSubstitutionNode(frameSubstitutionNode, context),
329
+ specificContext = context, ///
330
+ contexts = [
331
+ generalContext,
332
+ specificContext
333
+ ];
334
+
335
+ frameSubstitutionn = new FrameSubstitution(contexts, string, node, breakPoint, targetFrame, replacementFrame);
336
+ }, context);
337
+ }, json, context);
338
+ }, forced, context);
214
339
  }
215
340
 
216
341
  return frameSubstitutionn;
@@ -253,6 +378,18 @@ export default define(class FrameSubstitution extends Substitution {
253
378
  }
254
379
  });
255
380
 
381
+ function metavariableFromFrameNode(frameNode, context) {
382
+ let metavariable = null;
383
+
384
+ const metavariableNode = frameNode.getMetavariableNode();
385
+
386
+ if (metavariableNode !== null) {
387
+ metavariable = context.findMetavariableByMetavariableNode(metavariableNode);
388
+ }
389
+
390
+ return metavariable;
391
+ }
392
+
256
393
  function targetFrameFromFrameSubstitutionNode(frameSubstitutionNode, context) {
257
394
  const targetFrameNode = frameSubstitutionNode.getTargetFrameNode(),
258
395
  targetFrame = context.findFrameByFrameNode(targetFrameNode);
@@ -7,7 +7,7 @@ import { breakPointFromJSON } from "../../utilities/breakPoint";
7
7
  import { instantiateReferenceSubstitution } from "../../process/instantiate";
8
8
  import { referenceSubstitutionFromReferenceSubstitutionNode } from "../../utilities/element";
9
9
  import { referenceSubstitutionStringFromReferenceAndMetavariable } from "../../utilities/string";
10
- import { ablates, manifest, attempts, descend, instantiate, unserialises } from "../../utilities/context";
10
+ import { ablates, manifest, attempts, sequester, instantiate, unserialises } from "../../utilities/context";
11
11
 
12
12
  export default define(class ReferenceSubstitution extends Substitution {
13
13
  constructor(context, string, node, breakPoint, targetReference, replacementReference) {
@@ -150,7 +150,7 @@ export default define(class ReferenceSubstitution extends Substitution {
150
150
  context.trace(`Validating the '${referenceSubstitutionString}' reference substitution's target reference...`);
151
151
 
152
152
  manifest((context) => {
153
- descend((context) => {
153
+ sequester((context) => {
154
154
  const targetReference = this.targetReference.validate(context);
155
155
 
156
156
  if (targetReference !== null) {
@@ -174,7 +174,7 @@ export default define(class ReferenceSubstitution extends Substitution {
174
174
 
175
175
  context.trace(`Validating the '${referenceSubstitutionString}' reference substitution's replacement reference...`);
176
176
 
177
- descend((context) => {
177
+ sequester((context) => {
178
178
  const replacementReference = this.replacementReference.validate(context);
179
179
 
180
180
  if (replacementReference !== null) {
@@ -3,12 +3,11 @@
3
3
  import Substitution from "../substitution";
4
4
 
5
5
  import { define } from "../../elements";
6
- import { unifySubstitution } from "../../process/unify";
7
- import { stripBracketsFromStatement } from "../../utilities/brackets";
8
6
  import { breakPointFromJSON } from "../../utilities/breakPoint";
7
+ import { stripBracketsFromStatement } from "../../utilities/brackets";
9
8
  import { instantiateStatementSubstitution } from "../../process/instantiate";
10
9
  import { statementSubstitutionFromStatementSubstitutionNode } from "../../utilities/element";
11
- import { join, ablates, manifest, attempts, descend, reconcile, instantiate, unserialises } from "../../utilities/context";
10
+ import { join, ablates, manifest, attempts, sequester, reconcile, instantiate, unserialises } from "../../utilities/context";
12
11
  import { statementSubstitutionStringFromStatementAndMetavariable, statementSubstitutionStringFromStatementMetavariableAndSubstitution } from "../../utilities/string";
13
12
 
14
13
  export default define(class StatementSubstitution extends Substitution {
@@ -174,7 +173,7 @@ export default define(class StatementSubstitution extends Substitution {
174
173
 
175
174
  if (targetStatementSingular) {
176
175
  manifest((context) => {
177
- descend((context) => {
176
+ sequester((context) => {
178
177
  const targetStatement = this.targetStatement.validate(context);
179
178
 
180
179
  if (targetStatement !== null) {
@@ -203,7 +202,7 @@ export default define(class StatementSubstitution extends Substitution {
203
202
 
204
203
  context.trace(`Validating the '${statementSubstitutionString}' statement substitution's replacement statement...`);
205
204
 
206
- descend((context) => {
205
+ sequester((context) => {
207
206
  const replacementStatement = this.replacementStatement.validate(context);
208
207
 
209
208
  if (replacementStatement !== null) {
@@ -218,132 +217,134 @@ export default define(class StatementSubstitution extends Substitution {
218
217
  return replacementStatementValidates;
219
218
  }
220
219
 
221
- unifySimpleSubstitution(simpleSubstitution, context) {
222
- let simpleSubstitutionUnifies;
220
+ unifyTargetStatement(substitution, context) {
221
+ let targetStatemnentUnifies = false;
223
222
 
224
- const substitutionString = this.substitution.getString(),
225
- simpleSubstitutionString = simpleSubstitution.getString();
223
+ const generalSubstitution = this, ///
224
+ specificSubstitution = substitution,
225
+ generalSubstitutionString = generalSubstitution.getString(),
226
+ specificSubstitutionString = specificSubstitution.getString();
226
227
 
227
- context.trace(`Unifying the '${simpleSubstitutionString}' simple substitution with the '${substitutionString}' substitution...`);
228
+ context.trace(`Unifying the '${specificSubstitutionString}' substitution's target statement with the '${generalSubstitutionString}' substitution's target statement...`);
228
229
 
229
- const specificSubstitution = simpleSubstitution, ///
230
- generalSubstitution = this.substitution, ///
231
- specificContexts = specificSubstitution.getContexts(), ///
232
- generalContexts = generalSubstitution.getContexts();
230
+ const generalSubstitutionGeneralContext = generalSubstitution.getGeneralContext(),
231
+ specificSubstitutionGeneralContext = specificSubstitution.getGeneralContext(),
232
+ generalSubstitutionTargetStatement = generalSubstitution.getTargetStatement(),
233
+ specificSubstitutionTargetStatement = specificSubstitution.getTargetStatement(),
234
+ generalContext = generalSubstitutionGeneralContext, ///
235
+ specificContext = specificSubstitutionGeneralContext, ///
236
+ generalStatement = generalSubstitutionTargetStatement, ///
237
+ specificStatement = specificSubstitutionTargetStatement; ///
233
238
 
234
239
  join((specificContext) => {
235
- join((generalContext) => {
236
- reconcile((specificContext) => {
237
- simpleSubstitutionUnifies = unifySubstitution(generalSubstitution, specificSubstitution, generalContext, specificContext);
240
+ reconcile((specificContext) => {
241
+ const statementUnifies = generalStatement.unifyStatement(specificStatement, generalContext, specificContext);
238
242
 
239
- if (simpleSubstitutionUnifies) {
240
- specificContext.commit(context);
241
- }
242
- }, specificContext)
243
- }, ...generalContexts);
244
- }, ...specificContexts, context);
243
+ if (statementUnifies) {
244
+ specificContext.commit(context);
245
245
 
246
- if (simpleSubstitutionUnifies) {
247
- context.trace(`...unified the '${simpleSubstitutionString}' simple substitution with the '${substitutionString}' substitution.`);
246
+ targetStatemnentUnifies = true;
247
+ }
248
+ }, specificContext);
249
+ }, specificContext, context);
250
+
251
+ if (targetStatemnentUnifies) {
252
+ context.trace(`...unified the '${specificSubstitutionString}' substitution's target statement with the '${generalSubstitutionString}' substitution's target statement.`);
248
253
  }
249
254
 
250
- return simpleSubstitutionUnifies;
255
+ return targetStatemnentUnifies;
251
256
  }
252
257
 
253
- unifyComplexSubstitution(complexSubstitution, context) {
254
- let substitution = null;
255
-
256
- const simpleSubstitutionString = this.getString(), ///
257
- complexSubstitutionString = complexSubstitution.getString(); ///
258
-
259
- context.trace(`Unifying the '${complexSubstitutionString}' complex substitution with the '${simpleSubstitutionString}' simple substitution...`);
258
+ unifyReplacementStatement(substitution, context) {
259
+ let replacementStatemnentUnifies = false;
260
260
 
261
- const simpleSubstitution = this, ///
262
- simpleSubstitutionGSpecificContext = simpleSubstitution.getSpecificContext(),
263
- complexSubstitutionGSpecificContext = complexSubstitution.getSpecificContext(),
264
- generalContext = simpleSubstitutionGSpecificContext, ///
265
- specificContext = complexSubstitutionGSpecificContext; ///
261
+ const generalSubstitution = this, ///
262
+ specificSubstitution = substitution,
263
+ generalSubstitutionString = generalSubstitution.getString(),
264
+ specificSubstitutionString = specificSubstitution.getString();
266
265
 
267
- let simpleSubstitutionUnifies = false;
266
+ context.trace(`Unifying the '${specificSubstitutionString}' substitution's replacement statement with the '${generalSubstitutionString}' substitution's replacement statement...`);
268
267
 
269
- join((context) => {
270
- const specificContext = context; ///
268
+ const generalSubstitutionSpecificContext = generalSubstitution.getSpecificContext(),
269
+ specificSubstitutionSpecificContext = specificSubstitution.getSpecificContext(),
270
+ generalSubstitutionReplacementStatement = generalSubstitution.getReplacementStatement(),
271
+ specificSubstitutionReplacementStatement = specificSubstitution.getReplacementStatement(),
272
+ generalContext = generalSubstitutionSpecificContext, ///
273
+ specificContext = specificSubstitutionSpecificContext, ///
274
+ generalStatement = generalSubstitutionReplacementStatement, ///
275
+ specificStatement = specificSubstitutionReplacementStatement; ///
271
276
 
277
+ join((specificContext) => {
272
278
  reconcile((specificContext) => {
273
- const replacementStatement = complexSubstitution.getReplacementStatement(),
274
- replacementStatementUnifies = this.unifyReplacementStatement(replacementStatement, generalContext, specificContext);
279
+ const statementUnifies = generalStatement.unifyStatement(specificStatement, generalContext, specificContext);
275
280
 
276
- if (replacementStatementUnifies) {
277
- const context = specificContext, ///
278
- soleNonTrivialDerivedSubstitution = context.getSoleNonTrivialDerivedSubstitution();
281
+ if (statementUnifies) {
282
+ specificContext.commit(context);
279
283
 
280
- substitution = soleNonTrivialDerivedSubstitution; ///
284
+ replacementStatemnentUnifies = true;
281
285
  }
282
286
  }, specificContext);
283
287
  }, specificContext, context);
284
288
 
285
- if (substitution !== null) {
286
- substitution = substitution.validate(context); ///
287
-
288
- simpleSubstitutionUnifies = true;
289
- }
290
-
291
- if (simpleSubstitutionUnifies) {
292
- context.debug(`...unified the '${complexSubstitutionString}' complex substitution with the '${simpleSubstitutionString}' simple substitution.`);
289
+ if (replacementStatemnentUnifies) {
290
+ context.trace(`...unified the '${specificSubstitutionString}' substitution's replacement statement with the '${generalSubstitutionString}' substitution's replacement statement.`);
293
291
  }
294
292
 
295
- return substitution;
293
+ return replacementStatemnentUnifies;
296
294
  }
297
295
 
298
- unifyReplacementStatement(replacementStatement, generalContext, specificContext) {
299
- let replacementStatemnentUnifies = false;
296
+ unifyComplexSubstitution(complexSubstitution, context) {
297
+ let substitution = null;
300
298
 
301
- const context = specificContext, ///
302
- replacementStatementString = replacementStatement.getString(),
303
- substitutionReplacementStatementString = this.replacementStatement.getString(); ///
299
+ const simpleSubstitution = this, ///
300
+ simpleSubstitutionString = simpleSubstitution.getString(), ///
301
+ complexSubstitutionString = complexSubstitution.getString(); ///
302
+
303
+ context.trace(`Unifying the '${complexSubstitutionString}' complex substitution with the '${simpleSubstitutionString}' simple substitution...`);
304
+
305
+ let simpleSubstitutionUnifies = false;
304
306
 
305
- context.trace(`Unifying the '${replacementStatementString}' replacement statement with the '${substitutionReplacementStatementString}' replacement statement...`);
307
+ reconcile((context) => {
308
+ const replacementStatementUnifies = this.unifyReplacementStatement(complexSubstitution, context);
306
309
 
307
- const statementUnifies = this.replacementStatement.unifyStatement(replacementStatement, generalContext, specificContext);
310
+ if (replacementStatementUnifies) {
311
+ const soleNonTrivialDerivedSubstitution = context.getSoleNonTrivialDerivedSubstitution();
308
312
 
309
- if (statementUnifies) {
310
- replacementStatemnentUnifies = true;
313
+ substitution = soleNonTrivialDerivedSubstitution; ///
314
+ }
315
+ }, context);
316
+
317
+ if (substitution !== null) {
318
+ simpleSubstitutionUnifies = true;
311
319
  }
312
320
 
313
- if (replacementStatemnentUnifies) {
314
- context.debug(`...unified the '${replacementStatementString}' replacement statement with the '${substitutionReplacementStatementString}' replacement statement.`);
321
+ if (simpleSubstitutionUnifies) {
322
+ context.debug(`...unified the '${complexSubstitutionString}' complex substitution with the '${simpleSubstitutionString}' simple substitution.`);
315
323
  }
316
324
 
317
- return replacementStatemnentUnifies;
325
+ return substitution;
318
326
  }
319
327
 
320
328
  resolve(context) {
321
- let resolved = false;
322
-
323
329
  const metavariableNode = this.getMetavariableNode(),
324
- simpleDerivedSubstitution = context.findSimpleDerivedSubstitutionByMetavariableNode(metavariableNode), ///
325
- complexSubstitution = this,
326
- simpleSubstitution = simpleDerivedSubstitution; ///
330
+ simpleDerivedSubstitution = context.findSimpleDerivedSubstitutionByMetavariableNode(metavariableNode);
327
331
 
328
- if (simpleSubstitution !== null) {
329
- const substitutionString = this.getString(); ///
332
+ if (simpleDerivedSubstitution !== null) {
333
+ const simpleSubstitution = simpleDerivedSubstitution, ///
334
+ complexSubstitution = this, ///
335
+ complexSubstitutionString = complexSubstitution.getString();
330
336
 
331
- context.trace(`Resolving the ${substitutionString} substitution...`);
337
+ context.trace(`Resolving the ${complexSubstitutionString}' complex substitution...`);
332
338
 
333
339
  const substitution = simpleSubstitution.unifyComplexSubstitution(complexSubstitution, context);
334
340
 
335
341
  if (substitution !== null) {
336
- const simpleSubstitution = substitution, ///
337
- simpleSubstitutionUnifies = complexSubstitution.unifySimpleSubstitution(simpleSubstitution, context);
342
+ const simpleSubstitutionUnifies = this.substitution.unifySubstitution(substitution, context);
338
343
 
339
344
  if (simpleSubstitutionUnifies) {
340
- resolved = true;
341
- }
342
-
343
- if (resolved) {
344
345
  this.resolved = true;
345
346
 
346
- context.debug(`...resolved the '${substitutionString}' substitution.`);
347
+ context.debug(`...resolved the '${complexSubstitutionString}' complex substitution.`);
347
348
  }
348
349
  }
349
350
  }