occam-verify-cli 1.0.768 → 1.0.776

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 (106) hide show
  1. package/lib/context/file/nominal.js +11 -11
  2. package/lib/context/illative.js +28 -0
  3. package/lib/context/nested.js +27 -0
  4. package/lib/context/proof.js +232 -0
  5. package/lib/context/thetic.js +28 -0
  6. package/lib/context.js +15 -21
  7. package/lib/element/assertion/contained.js +24 -22
  8. package/lib/element/assertion/defined.js +20 -19
  9. package/lib/element/assertion/property.js +14 -13
  10. package/lib/element/assertion/satisfies.js +8 -9
  11. package/lib/element/assertion/subproof.js +23 -26
  12. package/lib/element/assertion/type.js +9 -11
  13. package/lib/element/assumption.js +32 -39
  14. package/lib/element/combinator/bracketed.js +3 -3
  15. package/lib/element/combinator.js +20 -20
  16. package/lib/element/conclusion.js +33 -29
  17. package/lib/element/constructor.js +19 -18
  18. package/lib/element/deduction.js +33 -29
  19. package/lib/element/equality.js +13 -15
  20. package/lib/element/equivalence.js +59 -52
  21. package/lib/element/frame.js +41 -34
  22. package/lib/element/hypothesis.js +7 -5
  23. package/lib/element/judgement.js +32 -73
  24. package/lib/element/label.js +22 -22
  25. package/lib/element/metavariable.js +23 -7
  26. package/lib/element/proofAssertion/premise.js +48 -35
  27. package/lib/element/proofAssertion/step.js +35 -20
  28. package/lib/element/proofAssertion/supposition.js +48 -34
  29. package/lib/element/proofAssertion.js +1 -14
  30. package/lib/element/reference.js +80 -53
  31. package/lib/element/signature.js +44 -3
  32. package/lib/element/statement.js +28 -29
  33. package/lib/element/subproof.js +2 -2
  34. package/lib/element/substitution/frame.js +24 -19
  35. package/lib/element/substitution/metaLevel.js +31 -27
  36. package/lib/element/substitution/reference.js +11 -10
  37. package/lib/element/substitution/statement.js +30 -23
  38. package/lib/element/substitution/term.js +11 -10
  39. package/lib/element/term.js +24 -20
  40. package/lib/element/topLevelMetaAssertion.js +2 -2
  41. package/lib/element/variable.js +6 -2
  42. package/lib/process/assign.js +10 -4
  43. package/lib/process/unify.js +8 -8
  44. package/lib/process/validate.js +10 -8
  45. package/lib/utilities/context.js +68 -23
  46. package/lib/utilities/element.js +55 -27
  47. package/lib/utilities/json.js +8 -8
  48. package/lib/utilities/statement.js +1 -8
  49. package/lib/utilities/string.js +12 -1
  50. package/lib/utilities/unification.js +9 -7
  51. package/lib/utilities/validation.js +39 -31
  52. package/package.json +1 -1
  53. package/src/context/file/nominal.js +14 -16
  54. package/src/context/illative.js +17 -0
  55. package/src/context/nested.js +15 -0
  56. package/src/context/{scoped.js → proof.js} +73 -73
  57. package/src/context/thetic.js +17 -0
  58. package/src/context.js +23 -36
  59. package/src/element/assertion/contained.js +28 -28
  60. package/src/element/assertion/defined.js +23 -23
  61. package/src/element/assertion/property.js +15 -14
  62. package/src/element/assertion/satisfies.js +7 -9
  63. package/src/element/assertion/subproof.js +26 -31
  64. package/src/element/assertion/type.js +10 -12
  65. package/src/element/assumption.js +33 -54
  66. package/src/element/combinator/bracketed.js +2 -2
  67. package/src/element/combinator.js +23 -29
  68. package/src/element/conclusion.js +37 -40
  69. package/src/element/constructor.js +29 -34
  70. package/src/element/deduction.js +36 -39
  71. package/src/element/equality.js +16 -18
  72. package/src/element/equivalence.js +76 -67
  73. package/src/element/frame.js +42 -34
  74. package/src/element/hypothesis.js +7 -6
  75. package/src/element/judgement.js +34 -44
  76. package/src/element/label.js +25 -31
  77. package/src/element/metavariable.js +32 -12
  78. package/src/element/proofAssertion/premise.js +63 -49
  79. package/src/element/proofAssertion/step.js +43 -23
  80. package/src/element/proofAssertion/supposition.js +64 -50
  81. package/src/element/proofAssertion.js +0 -22
  82. package/src/element/reference.js +119 -80
  83. package/src/element/signature.js +5 -2
  84. package/src/element/statement.js +30 -35
  85. package/src/element/subproof.js +1 -1
  86. package/src/element/substitution/frame.js +27 -26
  87. package/src/element/substitution/metaLevel.js +38 -42
  88. package/src/element/substitution/reference.js +13 -14
  89. package/src/element/substitution/statement.js +35 -33
  90. package/src/element/substitution/term.js +13 -14
  91. package/src/element/term.js +42 -34
  92. package/src/element/topLevelMetaAssertion.js +1 -1
  93. package/src/element/variable.js +8 -1
  94. package/src/process/assign.js +9 -3
  95. package/src/process/unify.js +7 -7
  96. package/src/process/validate.js +9 -8
  97. package/src/utilities/context.js +82 -31
  98. package/src/utilities/element.js +68 -31
  99. package/src/utilities/json.js +13 -13
  100. package/src/utilities/statement.js +1 -9
  101. package/src/utilities/string.js +16 -2
  102. package/src/utilities/unification.js +10 -9
  103. package/src/utilities/validation.js +50 -38
  104. package/lib/context/scoped.js +0 -232
  105. package/lib/utilities/term.js +0 -17
  106. package/src/utilities/term.js +0 -10
@@ -3,23 +3,27 @@
3
3
  import { Element } from "occam-languages";
4
4
 
5
5
  import { define } from "../elements";
6
- import { instantiate } from "../utilities/context";
7
6
  import { instantiateReference } from "../process/instantiate";
8
7
  import { REFERENCE_META_TYPE_NAME } from "../metaTypeNames";
9
- import { metavariableFromReferenceNode } from "../utilities/element";
10
- import { unifyMetavariableIntrinsically } from "../process/unify";
8
+ import { serialise, reconcile, unserialise, instantiate } from "../utilities/context";
9
+ import { metavariableFromReferenceNode, topLevelMetaAssertionFromReferenceNode } from "../utilities/element";
11
10
 
12
11
  export default define(class Reference extends Element {
13
- constructor(context, string, node, metavariable) {
12
+ constructor(context, string, node, metavariable, topLevelMetaAssertion) {
14
13
  super(context, string, node);
15
14
 
16
15
  this.metavariable = metavariable;
16
+ this.topLevelMetaAssertion = topLevelMetaAssertion;
17
17
  }
18
18
 
19
19
  getMetavariable() {
20
20
  return this.metavariable;
21
21
  }
22
22
 
23
+ getTopLevelMetaAssertion() {
24
+ return this.topLevelMetaAssertion;
25
+ }
26
+
23
27
  getReferenceNode() {
24
28
  const node = this.getNode(),
25
29
  referenceNode = node; ///
@@ -27,8 +31,6 @@ export default define(class Reference extends Element {
27
31
  return referenceNode;
28
32
  }
29
33
 
30
- getName() { return this.metavariable.getName(); }
31
-
32
34
  getMetavariableName() {
33
35
  const metavariableName = this.metavariable.getName();
34
36
 
@@ -41,6 +43,14 @@ export default define(class Reference extends Element {
41
43
  return metavariableNode;
42
44
  }
43
45
 
46
+ isEqualTo(reference) {
47
+ const referenceNode = reference.getNode(),
48
+ referenceNodeMatches = this.matchReferenceNode(referenceNode),
49
+ equalTo = referenceNodeMatches; ///
50
+
51
+ return equalTo;
52
+ }
53
+
44
54
  matchReferenceNode(referenceNode) {
45
55
  const node = referenceNode, ///
46
56
  nodeMatches = this.matchNode(node),
@@ -49,21 +59,7 @@ export default define(class Reference extends Element {
49
59
  return referenceNodeMatches;
50
60
  }
51
61
 
52
- findValidRefernece(context) {
53
- const metavariableNode = this.getMetavariableNode(),
54
- reference = context.findReferenceByMetavariableNode(metavariableNode),
55
- validReference = reference; ///
56
-
57
- return validReference;
58
- }
59
-
60
- isEqualTo(reference) {
61
- const referenceNode = reference.getNode(),
62
- referenceNodeMatches = this.matchReferenceNode(referenceNode),
63
- equalTo = referenceNodeMatches; ///
64
-
65
- return equalTo;
66
- }
62
+ matchMetavariableNode(metavariableNode) { return this.metavariable.matchMetavariableNode(metavariableNode); }
67
63
 
68
64
  compareParameter(parameter) {
69
65
  let comparesToParamter = false;
@@ -103,7 +99,36 @@ export default define(class Reference extends Element {
103
99
 
104
100
  compareMetavariableName(metavariableName) { return this.metavariable.compareMetavariableName(metavariableName); }
105
101
 
106
- matchMetavariableNode(metavariableNode) { return this.metavariable.matchMetavariableNode(metavariableNode); }
102
+ compareTopLevelMetaAssertion(topLevelMetaAssertion) {
103
+ let topLevelMetaAssertionCompares = false;
104
+
105
+ const context = this.getContext(),
106
+ referenceString = this.getString(), ///
107
+ topLevelMetaAssertionString = topLevelMetaAssertion.getString();
108
+
109
+ context.trace(`Comparing the '${topLevelMetaAssertionString}' top level meta-assertion to the '${referenceString}' reference...`);
110
+
111
+ const label = topLevelMetaAssertion.getLabel(),
112
+ labelUnifies = this.unifyLabel(label);
113
+
114
+ if (labelUnifies) {
115
+ topLevelMetaAssertionCompares = true;
116
+ }
117
+
118
+ if (topLevelMetaAssertionCompares) {
119
+ context.trace(`...compared the '${topLevelMetaAssertionString}' top level meta-assertion to the '${referenceString}' reference.`);
120
+ }
121
+
122
+ return topLevelMetaAssertionCompares;
123
+ }
124
+
125
+ findValidRefernece(context) {
126
+ const metavariableNode = this.getMetavariableNode(),
127
+ reference = context.findReferenceByMetavariableNode(metavariableNode),
128
+ validReference = reference; ///
129
+
130
+ return validReference;
131
+ }
107
132
 
108
133
  validate(context) {
109
134
  let reference = null;
@@ -112,10 +137,10 @@ export default define(class Reference extends Element {
112
137
 
113
138
  context.trace(`Validating the '${referenceString}' reference...`);
114
139
 
115
- const validRefernece = this.findValidRefernece(context);
140
+ const validReference = this.findValidRefernece(context);
116
141
 
117
- if (validRefernece !== null) {
118
- reference = validRefernece; ///
142
+ if (validReference !== null) {
143
+ reference = validReference; ///
119
144
 
120
145
  context.debug(`...the '${referenceString}' reference is already valid.`);
121
146
  } else {
@@ -130,7 +155,7 @@ export default define(class Reference extends Element {
130
155
 
131
156
  if (metaType === null) {
132
157
  const reference = this, ///
133
- labelPresent = context.isLabelPresentByReference(reference, context);
158
+ labelPresent = context.isLabelPresentByReference(reference);
134
159
 
135
160
  if (labelPresent) {
136
161
  validates = true;
@@ -170,6 +195,8 @@ export default define(class Reference extends Element {
170
195
  const referenceString = this.getString(), ///
171
196
  metavariableString = this.metavariable.getString();
172
197
 
198
+ context = this.getContext();
199
+
173
200
  context.trace(`Validating the '${referenceString}' reference's '${metavariableString}' metavariable...'`);
174
201
 
175
202
  const metavariable = this.metavariable.validate(context);
@@ -187,29 +214,23 @@ export default define(class Reference extends Element {
187
214
  return metavariableValidates;
188
215
  }
189
216
 
190
- unifyLabel(label, context) {
191
- let labelUnifies;
192
-
193
- const specificContext = context; ///
194
-
195
- context = this.getContext();
196
-
197
- const generalContext = context; ///
217
+ unifyLabel(label) {
218
+ let labelUnifies = false;
198
219
 
199
- context = specificContext; ///
200
-
201
- const reference = this, ///
220
+ const context = label.getContext(),
202
221
  labelString = label.getString(),
203
- referenceString = reference.getString();
222
+ referenceString = this.getString(); ///
204
223
 
205
224
  context.trace(`Unifying the '${labelString}' label with the '${referenceString}' reference...`);
206
225
 
207
- const labelMetavariable = label.getMetavariable(),
208
- generalMetavariable = this.metavariable, ///
209
- specificMetavariable = labelMetavariable, ///
210
- metavariableUnifiesIntrinsically = unifyMetavariableIntrinsically(generalMetavariable, specificMetavariable, generalContext, specificContext);
226
+ reconcile((context) => {
227
+ const metavariable = label.getMetavariable(),
228
+ metavariableUnifies = this.unifyMetavariable(metavariable, context);
211
229
 
212
- labelUnifies = metavariableUnifiesIntrinsically; ///
230
+ if (metavariableUnifies) {
231
+ labelUnifies = true;
232
+ }
233
+ }, context);
213
234
 
214
235
  if (labelUnifies) {
215
236
  context.debug(`...unified the '${labelString}' label with the '${referenceString}' reference.`);
@@ -221,22 +242,20 @@ export default define(class Reference extends Element {
221
242
  unifyMetavariable(metavariable, context) {
222
243
  let metavariableUnifies = false;
223
244
 
224
- const specificContext = context; ///
245
+ const referenceString = this.getString(), ///
246
+ metavariableString = metavariable.getString();
225
247
 
226
- context = this.getContext();
248
+ context.trace(`Unifying the '${metavariableString}' metavariable with the '${referenceString}' reference...`);
227
249
 
228
- const generalContext = context; ///
250
+ const specificContext = context; ///
229
251
 
230
- context = specificContext; ///
252
+ context = this.getContext();
231
253
 
232
- const referenceString = this.getString(), ///
233
- metavariableString = metavariable.getString();
254
+ const generalContext = context; ///
234
255
 
235
- context.trace(`Unifying the '${metavariableString}' metavariable with the '${referenceString}' reference...`);
256
+ context = specificContext; ///
236
257
 
237
- const generalMetavariable = this.metavariable, ///
238
- specificMetavariable = metavariable, ///
239
- metavariableUnifiesIntrinsically = unifyMetavariableIntrinsically(generalMetavariable, specificMetavariable, generalContext, specificContext);
258
+ const metavariableUnifiesIntrinsically = this.metavariable.unifyMetavariableIntrinsically(metavariable, generalContext, specificContext);
240
259
 
241
260
  if (metavariableUnifiesIntrinsically) {
242
261
  metavariableUnifies = true;
@@ -249,52 +268,72 @@ export default define(class Reference extends Element {
249
268
  return metavariableUnifies;
250
269
  }
251
270
 
252
- compareTopLevelMetaAssertion(topLevelMetaAssertion, context) {
253
- let topLevelMetaAssertionCompares = false;
271
+ unifyTopLevelMetaAssertion(topLevelMetaAssertion, context) {
272
+ let topLevelMetaAssertionUUnifies = false;
254
273
 
255
- const reference = this, ///
256
- referenceString = reference.getString(),
274
+ const label = topLevelMetaAssertion.getLabel(),
275
+ referenceString = this.getString(), ///
257
276
  topLevelMetaAssertionString = topLevelMetaAssertion.getString();
258
277
 
259
- context.trace(`Comparing the '${topLevelMetaAssertionString}' top level meta-assertion to the '${referenceString}' reference...`);
278
+ context.trace(`Unifying the '${topLevelMetaAssertionString}' top level meta-assertion with the '${referenceString}' reference...`);
260
279
 
261
- const label = topLevelMetaAssertion.getLabel(),
262
- labelUnifies = this.unifyLabel(label, context);
280
+ const specificContext = context; ///
263
281
 
264
- if (labelUnifies) {
265
- topLevelMetaAssertionCompares = true;
266
- }
282
+ context = label.getContext();
267
283
 
268
- if (topLevelMetaAssertionCompares) {
269
- context.trace(`...compared the '${topLevelMetaAssertionString}' top level meta-assertion to the '${referenceString}' reference.`);
284
+ reconcile((context) => {
285
+ const metavariable = label.getMetavariable(),
286
+ metavariableUnifies = this.unifyMetavariable(metavariable, context);
287
+
288
+ if (metavariableUnifies) {
289
+ this.topLevelMetaAssertion = topLevelMetaAssertion;
290
+
291
+ context.commit(specificContext);
292
+
293
+ topLevelMetaAssertionUUnifies = true;
294
+ }
295
+ }, context);
296
+
297
+ context = specificContext; ///
298
+
299
+ if (topLevelMetaAssertionUUnifies) {
300
+ context.debug(`...unified the '${topLevelMetaAssertionString}' top level meta-assertion with the '${referenceString}' reference.`);
270
301
  }
271
302
 
272
- return topLevelMetaAssertionCompares;
303
+ return topLevelMetaAssertionUUnifies;
273
304
  }
274
305
 
275
306
  toJSON() {
276
- const string = this.getString(),
277
- json = {
278
- string
279
- };
307
+ const context = this.getContext();
308
+
309
+ return serialise((context) => {
310
+ const string = this.getString(),
311
+ json = {
312
+ context,
313
+ string
314
+ };
280
315
 
281
- return json;
316
+ return json;
317
+ }, context);
282
318
  }
283
319
 
284
320
  static name = "Reference";
285
321
 
286
322
  static fromJSON(json, context) {
287
- return instantiate((context) => {
288
- const { string } = json,
289
- referenceNode = instantiateReference(string, context),
290
- node = referenceNode, ///
291
- metavariable = metavariableFromReferenceNode(referenceNode, context);
323
+ let reference;
292
324
 
293
- context = null;
325
+ unserialise((json, context) => {
326
+ instantiate((context) => {
327
+ const { string } = json,
328
+ referenceNode = instantiateReference(string, context),
329
+ node = referenceNode, ///
330
+ metavariable = metavariableFromReferenceNode(referenceNode, context),
331
+ topLevelMetaAssertion = topLevelMetaAssertionFromReferenceNode(referenceNode, context);
294
332
 
295
- const reference = new Reference(context, string, node, metavariable);
333
+ reference = new Reference(context, string, node, metavariable, topLevelMetaAssertion);
334
+ }, context);
335
+ }, json, context);
296
336
 
297
- return reference;
298
- }, context);
337
+ return reference;
299
338
  }
300
339
  });
@@ -3,6 +3,8 @@
3
3
  import { Element } from "occam-languages";
4
4
  import { arrayUtilities } from "necessary";
5
5
 
6
+ import elements from "../elements";
7
+
6
8
  import { define } from "../elements";
7
9
  import { instantiate } from "../utilities/context";
8
10
  import { instantiateSignature } from "../process/instantiate";
@@ -125,9 +127,10 @@ export default define(class Signature extends Element {
125
127
  termsA = this.terms, ///
126
128
  termsB = terms, ///
127
129
  matches = match(termsA, termsB, (termA, termB) => {
128
- const term = termB, ///
130
+ const { Variable } = elements,
131
+ term = termB, ///
129
132
  context = generalContext, ///
130
- variable = variableFromTerm(term, context);
133
+ variable = Variable.fromTerm(term, context);
131
134
 
132
135
  if (variable !== null) {
133
136
  const term = termA, ///
@@ -7,7 +7,7 @@ import { define } from "../elements";
7
7
  import { unifyStatement } from "../process/unify";
8
8
  import { validateStatements } from "../utilities/validation";
9
9
  import { instantiateStatement } from "../process/instantiate";
10
- import { reconcile, instantiate } from "../utilities/context";
10
+ import { join, reconcile, instantiate } from "../utilities/context";
11
11
 
12
12
  const { backwardsSome } = arrayUtilities;
13
13
 
@@ -184,7 +184,7 @@ export default define(class Statement extends Element {
184
184
  return frameContained;
185
185
  }
186
186
 
187
- validate(stated, context) {
187
+ validate(context) {
188
188
  let statement = null;
189
189
 
190
190
  const statementString = this.getString(); ///
@@ -200,7 +200,7 @@ export default define(class Statement extends Element {
200
200
  } else {
201
201
  const validates = validateStatements.some((validateStatement) => {
202
202
  const statement = this, ///
203
- statementValidates = validateStatement(statement, stated, context);
203
+ statementValidates = validateStatement(statement, context);
204
204
 
205
205
  if (statementValidates) {
206
206
  return true;
@@ -244,36 +244,33 @@ export default define(class Statement extends Element {
244
244
  return subproofUnifies;
245
245
  }
246
246
 
247
- unifyDeduction(deduction, generalContext, specificContext) {
247
+ unifyDeduction(deduction, context) {
248
248
  let deductionUnifies = false;
249
249
 
250
250
  const statementString = this.getString(), ///
251
251
  deductionString = deduction.getString(),
252
- deductionStatement = deduction.getStatement(),
253
- deductionStatementString = deductionStatement.getString();
252
+ deductionContext = deduction.getContext(),
253
+ deductionStatement = deduction.getStatement();
254
254
 
255
- let context;
255
+ context.trace(`Unifying the '${deductionString}' deduction with the '${statementString}' statement...`);
256
256
 
257
- context = specificContext; ///
257
+ const generalContext = context, ///
258
+ specificContext = deductionContext; ///
258
259
 
259
- context.trace(`Unifying the '${deductionString}' deduction's '${deductionStatementString}' statement with the '${statementString}' statement...`);
260
+ join((specificContext) => {
261
+ reconcile((specificContext) => {
262
+ const deductionStatementUnifies = this.unifyStatement(deductionStatement, generalContext, specificContext);
260
263
 
261
- context = deduction.getContext();
264
+ if (deductionStatementUnifies) {
265
+ specificContext.commit(context);
262
266
 
263
- specificContext = context; ///
264
-
265
- reconcile((specificContext) => {
266
- const deductionStatementUnfies = this.unifyStatement(deductionStatement, generalContext, specificContext);
267
-
268
- if (deductionStatementUnfies) {
269
- specificContext.commit();
270
-
271
- deductionUnifies = true;
272
- }
273
- }, specificContext);
267
+ deductionUnifies = true;
268
+ }
269
+ }, specificContext);
270
+ }, specificContext, context);
274
271
 
275
272
  if (deductionUnifies) {
276
- context.debug(`...unified the '${deductionString}' deduction's '${deductionStatementString}' statement with the '${statementString}' statement.`);
273
+ context.debug(`...unified the '${deductionString}' deduction with the '${statementString}' statement.`);
277
274
  }
278
275
 
279
276
  return deductionUnifies;
@@ -338,41 +335,39 @@ export default define(class Statement extends Element {
338
335
  return unifiesIndependently;
339
336
  }
340
337
 
341
- unifyTopLevelMetaAssertion(topLevelMetaAssertion, generalContext, specificContext) {
342
- let topLevelMetaAssertionUnifies = false;
338
+ unifyTopLevelMetaAssertion(topLevelMetaAssertion, context) {
339
+ let topLevelAssertionUnifies = false;
343
340
 
344
- const context = specificContext, ///
345
- statementString = this.getString(), ///
341
+ const statementString = this.getString(), ///
346
342
  topLevelMetaAssertionString = topLevelMetaAssertion.getString();
347
343
 
348
344
  context.trace(`Unifying the '${topLevelMetaAssertionString}' top level meta-assertion with the '${statementString}' statement...`);
349
345
 
350
- const topLevelMetaAssertionUnconditional = topLevelMetaAssertion.isUnconditional();
346
+ const unconditional = topLevelMetaAssertion.isUnconditional();
351
347
 
352
- if (topLevelMetaAssertionUnconditional) {
348
+ if (unconditional) {
353
349
  const deduction = topLevelMetaAssertion.getDeduction(),
354
- deductionUnifies = this.unifyDeduction(deduction, generalContext, specificContext);
350
+ deductionUnifies = this.unifyDeduction(deduction, context);
355
351
 
356
352
  if (deductionUnifies) {
357
- topLevelMetaAssertionUnifies = true;
353
+ topLevelAssertionUnifies = true;
358
354
  }
359
355
  } else {
360
356
  const statementNode = this.getStatementNode(),
361
357
  subproofAssertionNode = statementNode.getSubproofAssertionNode();
362
358
 
363
359
  if (subproofAssertionNode !== null) {
364
- const context = generalContext, ///
365
- subproofAssertion = context.findAssertionByAssertionNode(subproofAssertionNode);
360
+ const subproofAssertion = context.findAssertionByAssertionNode(subproofAssertionNode);
366
361
 
367
- topLevelMetaAssertionUnifies = subproofAssertion.unifyTopLevelMetaAssertion(topLevelMetaAssertion, generalContext, specificContext);
362
+ topLevelAssertionUnifies = subproofAssertion.unifyTopLevelMetaAssertion(topLevelMetaAssertion, context);
368
363
  }
369
364
  }
370
365
 
371
- if (topLevelMetaAssertionUnifies) {
366
+ if (topLevelAssertionUnifies) {
372
367
  context.debug(`...unified the '${topLevelMetaAssertionString}' top level meta-assertion with the '${statementString}' statement.`);
373
368
  }
374
369
 
375
- return topLevelMetaAssertionUnifies;
370
+ return topLevelAssertionUnifies;
376
371
  }
377
372
 
378
373
  toJSON() {
@@ -121,7 +121,7 @@ export default define(class Subproof extends Element {
121
121
  context.trace(`Unifying the '${subproofString}' subproof with the '${satisfiesAssertionString}' satisfies assertion...`)
122
122
 
123
123
  const reference = satisfiesAssertion.getReference(),
124
- axiom = context.findAxiomByReference(reference, context);
124
+ axiom = context.findAxiomByReference(reference);
125
125
 
126
126
  if (axiom !== null) {
127
127
  const axiomSatisfiable = axiom.isSatisfiable();
@@ -4,7 +4,7 @@ import Substitution from "../substitution";
4
4
 
5
5
  import { define } from "../../elements";
6
6
  import { instantiateFrameSubstitution } from "../../process/instantiate";
7
- import { instantiate, sanitisedContextFromContext } from "../../utilities/context";
7
+ import { descend, simplify, instantiate } from "../../utilities/context";
8
8
  import { frameSubstitutionStringFromFrameAndMetavariable } from "../../utilities/string";
9
9
  import { frameSubstitutionFromStatementNode, frameSubstitutionFromFrameSubstitutionNode } from "../../utilities/element";
10
10
 
@@ -123,14 +123,15 @@ export default define(class FrameSubstitution extends Substitution {
123
123
  const targetFrameSingular = this.targetFrame.isSingular();
124
124
 
125
125
  if (targetFrameSingular) {
126
- const stated = true,
127
- tragetFrame = this.targetFrame.validate(stated, context);
126
+ descend((context) => {
127
+ const tragetFrame = this.targetFrame.validate(context);
128
128
 
129
- if (tragetFrame !== null) {
130
- this.targetFrame = tragetFrame;
129
+ if (tragetFrame !== null) {
130
+ this.targetFrame = tragetFrame;
131
131
 
132
- targetFrameValidates = true;
133
- }
132
+ targetFrameValidates = true;
133
+ }
134
+ }, context);
134
135
  } else {
135
136
  context.debug(`The '${frameSubstitutionString}' frame substitution's '${targetFrameString}' target frame is not singular.`);
136
137
  }
@@ -151,14 +152,15 @@ export default define(class FrameSubstitution extends Substitution {
151
152
 
152
153
  context.trace(`Validating the '${frameSubstitutionString}' frame substitution's '${replacementFrameString}' replacement frame...`);
153
154
 
154
- const stated = true,
155
- replacementFrame = this.replacementFrame.validate(stated, context);
155
+ descend((context) => {
156
+ const replacementFrame = this.replacementFrame.validate(context);
156
157
 
157
- if (replacementFrame !== null) {
158
- this.replacementFrame = replacementFrame;
158
+ if (replacementFrame !== null) {
159
+ this.replacementFrame = replacementFrame;
159
160
 
160
- replacementFrameValidates = true;
161
- }
161
+ replacementFrameValidates = true;
162
+ }
163
+ }, context);
162
164
 
163
165
  if (replacementFrameValidates) {
164
166
  context.debug(`...validated the '${frameSubstitutionString}' frame substitution's '${replacementFrameString}' replacement frame.`);
@@ -175,7 +177,7 @@ export default define(class FrameSubstitution extends Substitution {
175
177
  const { name } = json;
176
178
 
177
179
  if (this.name === name) {
178
- frameSubstitutionn = instantiate((context) => {
180
+ instantiate((context) => {
179
181
  const { string } = json,
180
182
  frameSubstitutionNode = instantiateFrameSubstitution(string, context),
181
183
  node = frameSubstitutionNode, ///
@@ -184,9 +186,7 @@ export default define(class FrameSubstitution extends Substitution {
184
186
 
185
187
  context = null;
186
188
 
187
- const frameSubstitutionn = new FrameSubstitution(context, string, node, targetFrame, replacementFrame);
188
-
189
- return frameSubstitutionn;
189
+ frameSubstitutionn = new FrameSubstitution(context, string, node, targetFrame, replacementFrame);
190
190
  }, context);
191
191
  }
192
192
 
@@ -201,18 +201,19 @@ export default define(class FrameSubstitution extends Substitution {
201
201
  }
202
202
 
203
203
  static fromFrameAndMetavariable(frame, metavariable, context) {
204
- const santisedContext = sanitisedContextFromContext(context);
205
-
206
- context = santisedContext; ///
204
+ let frameSubstitution
207
205
 
208
- return instantiate((context) => {
209
- const frameSubstitutionString = frameSubstitutionStringFromFrameAndMetavariable(frame, metavariable),
210
- string = frameSubstitutionString, ///
211
- frameSubstitutionNode = instantiateFrameSubstitution(string, context),
212
- frameSubstitution = frameSubstitutionFromFrameSubstitutionNode(frameSubstitutionNode, context);
206
+ simplify((context) => {
207
+ instantiate((context) => {
208
+ const frameSubstitutionString = frameSubstitutionStringFromFrameAndMetavariable(frame, metavariable),
209
+ string = frameSubstitutionString, ///
210
+ frameSubstitutionNode = instantiateFrameSubstitution(string, context);
213
211
 
214
- return frameSubstitution;
212
+ frameSubstitution = frameSubstitutionFromFrameSubstitutionNode(frameSubstitutionNode, context);
213
+ }, context);
215
214
  }, context);
215
+
216
+ return frameSubstitution;
216
217
  }
217
218
  });
218
219