occam-verify-cli 1.0.956 → 1.0.973

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 (81) hide show
  1. package/lib/context/bounded.js +11 -7
  2. package/lib/context.js +17 -5
  3. package/lib/element/assertion/signature.js +17 -19
  4. package/lib/element/assertion/subproof.js +36 -39
  5. package/lib/element/assertion/type.js +20 -1
  6. package/lib/element/assumption/metaLevel.js +18 -17
  7. package/lib/element/assumption.js +52 -3
  8. package/lib/element/combinator.js +10 -12
  9. package/lib/element/conclusion.js +33 -33
  10. package/lib/element/constructor.js +7 -11
  11. package/lib/element/deduction.js +33 -33
  12. package/lib/element/equivalence.js +11 -7
  13. package/lib/element/hypothesis.js +45 -19
  14. package/lib/element/judgement.js +1 -1
  15. package/lib/element/label.js +9 -11
  16. package/lib/element/proofAssertion/premise.js +98 -87
  17. package/lib/element/proofAssertion/step.js +27 -27
  18. package/lib/element/proofAssertion/supposition.js +99 -88
  19. package/lib/element/proofAssertion.js +3 -3
  20. package/lib/element/reference.js +30 -38
  21. package/lib/element/signature.js +38 -47
  22. package/lib/element/statement.js +18 -58
  23. package/lib/element/substitution/frame.js +34 -42
  24. package/lib/element/substitution/reference.js +12 -13
  25. package/lib/element/substitution/statement.js +26 -31
  26. package/lib/element/substitution/term.js +32 -37
  27. package/lib/element/term.js +2 -2
  28. package/lib/element/topLevelAssertion/axiom.js +33 -34
  29. package/lib/element/topLevelAssertion.js +30 -7
  30. package/lib/element/topLevelMetaAssertion.js +2 -2
  31. package/lib/process/discharge.js +38 -0
  32. package/lib/process/unification.js +228 -0
  33. package/lib/process/unify.js +9 -5
  34. package/lib/process/validation.js +291 -0
  35. package/lib/utilities/context.js +69 -105
  36. package/lib/utilities/element.js +2 -4
  37. package/lib/utilities/string.js +4 -4
  38. package/package.json +1 -1
  39. package/src/context/bounded.js +19 -7
  40. package/src/context.js +26 -6
  41. package/src/element/assertion/signature.js +21 -26
  42. package/src/element/assertion/subproof.js +43 -45
  43. package/src/element/assertion/type.js +30 -1
  44. package/src/element/assumption/metaLevel.js +26 -22
  45. package/src/element/assumption.js +80 -2
  46. package/src/element/combinator.js +11 -14
  47. package/src/element/conclusion.js +38 -37
  48. package/src/element/constructor.js +8 -13
  49. package/src/element/deduction.js +38 -37
  50. package/src/element/equivalence.js +17 -13
  51. package/src/element/hypothesis.js +59 -19
  52. package/src/element/judgement.js +1 -1
  53. package/src/element/label.js +10 -12
  54. package/src/element/proofAssertion/premise.js +123 -107
  55. package/src/element/proofAssertion/step.js +29 -29
  56. package/src/element/proofAssertion/supposition.js +124 -108
  57. package/src/element/proofAssertion.js +2 -2
  58. package/src/element/reference.js +36 -47
  59. package/src/element/signature.js +42 -53
  60. package/src/element/statement.js +18 -89
  61. package/src/element/substitution/frame.js +45 -58
  62. package/src/element/substitution/reference.js +13 -16
  63. package/src/element/substitution/statement.js +27 -34
  64. package/src/element/substitution/term.js +37 -46
  65. package/src/element/term.js +1 -1
  66. package/src/element/topLevelAssertion/axiom.js +43 -45
  67. package/src/element/topLevelAssertion.js +42 -6
  68. package/src/element/topLevelMetaAssertion.js +2 -2
  69. package/src/process/discharge.js +33 -0
  70. package/src/{utilities → process}/unification.js +21 -27
  71. package/src/process/unify.js +9 -5
  72. package/src/{utilities → process}/validation.js +2 -2
  73. package/src/utilities/context.js +77 -128
  74. package/src/utilities/element.js +2 -5
  75. package/src/utilities/string.js +6 -6
  76. package/lib/context/ephemeral.js +0 -28
  77. package/lib/context/synoptic.js +0 -255
  78. package/lib/utilities/unification.js +0 -233
  79. package/lib/utilities/validation.js +0 -291
  80. package/src/context/ephemeral.js +0 -17
  81. package/src/context/synoptic.js +0 -361
@@ -7,7 +7,7 @@ import { breakPointFromJSON } from "../../utilities/breakPoint";
7
7
  import { stripBracketsFromStatement } from "../../utilities/brackets";
8
8
  import { instantiateStatementSubstitution } from "../../process/instantiate";
9
9
  import { statementSubstitutionFromStatementSubstitutionNode } from "../../utilities/element";
10
- import { join, ablates, manifest, attempts, sequester, reconcile, instantiate, unserialises } from "../../utilities/context";
10
+ import { elide, ablates, manifest, attempts, reconcile, instantiate, unserialises } from "../../utilities/context";
11
11
  import { statementSubstitutionStringFromStatementAndMetavariable, statementSubstitutionStringFromStatementMetavariableAndSubstitution } from "../../utilities/string";
12
12
 
13
13
  export default define(class StatementSubstitution extends Substitution {
@@ -173,7 +173,7 @@ export default define(class StatementSubstitution extends Substitution {
173
173
 
174
174
  if (targetStatementSingular) {
175
175
  manifest((context) => {
176
- sequester((context) => {
176
+ elide((context) => {
177
177
  const targetStatement = this.targetStatement.validate(context);
178
178
 
179
179
  if (targetStatement !== null) {
@@ -202,7 +202,7 @@ export default define(class StatementSubstitution extends Substitution {
202
202
 
203
203
  context.trace(`Validating the '${statementSubstitutionString}' statement substitution's replacement statement...`);
204
204
 
205
- sequester((context) => {
205
+ elide((context) => {
206
206
  const replacementStatement = this.replacementStatement.validate(context);
207
207
 
208
208
  if (replacementStatement !== null) {
@@ -236,17 +236,15 @@ export default define(class StatementSubstitution extends Substitution {
236
236
  generalStatement = generalSubstitutionTargetStatement, ///
237
237
  specificStatement = specificSubstitutionTargetStatement; ///
238
238
 
239
- join((specificContext) => {
240
- reconcile((specificContext) => {
241
- const statementUnifies = generalStatement.unifyStatement(specificStatement, generalContext, specificContext);
239
+ reconcile((specificContext) => {
240
+ const statementUnifies = generalStatement.unifyStatement(specificStatement, generalContext, specificContext);
242
241
 
243
- if (statementUnifies) {
244
- specificContext.commit(context);
242
+ if (statementUnifies) {
243
+ specificContext.commit(context);
245
244
 
246
- targetStatemnentUnifies = true;
247
- }
248
- }, specificContext);
249
- }, specificContext, context);
245
+ targetStatemnentUnifies = true;
246
+ }
247
+ }, specificContext);
250
248
 
251
249
  if (targetStatemnentUnifies) {
252
250
  context.trace(`...unified the '${specificSubstitutionString}' substitution's target statement with the '${generalSubstitutionString}' substitution's target statement.`);
@@ -274,17 +272,15 @@ export default define(class StatementSubstitution extends Substitution {
274
272
  generalStatement = generalSubstitutionReplacementStatement, ///
275
273
  specificStatement = specificSubstitutionReplacementStatement; ///
276
274
 
277
- join((specificContext) => {
278
- reconcile((specificContext) => {
279
- const statementUnifies = generalStatement.unifyStatement(specificStatement, generalContext, specificContext);
275
+ reconcile((specificContext) => {
276
+ const statementUnifies = generalStatement.unifyStatement(specificStatement, generalContext, specificContext);
280
277
 
281
- if (statementUnifies) {
282
- specificContext.commit(context);
278
+ if (statementUnifies) {
279
+ specificContext.commit(context);
283
280
 
284
- replacementStatemnentUnifies = true;
285
- }
286
- }, specificContext);
287
- }, specificContext, context);
281
+ replacementStatemnentUnifies = true;
282
+ }
283
+ }, specificContext);
288
284
 
289
285
  if (replacementStatemnentUnifies) {
290
286
  context.trace(`...unified the '${specificSubstitutionString}' substitution's replacement statement with the '${generalSubstitutionString}' substitution's replacement statement.`);
@@ -358,27 +354,24 @@ export default define(class StatementSubstitution extends Substitution {
358
354
  const { name } = json;
359
355
 
360
356
  if (this.name === name) {
361
- unserialises((json, generalContext, specificContext) => {
362
- const context = specificContext; ///
363
-
364
- instantiate((context) => {
357
+ instantiate((context) => {
358
+ unserialises((json, generalContext, specificContext) => {
365
359
  const { string } = json,
366
360
  statementSubstitutionNode = instantiateStatementSubstitution(string, context),
367
361
  node = statementSubstitutionNode, ///
368
362
  breakPoint = breakPointFromJSON(json),
369
363
  resolved = resolvedFromStatementSubstitutionNode(statementSubstitutionNode, context),
370
364
  substitution = substitutionFromStatementSubstitutionNode(statementSubstitutionNode, generalContext, specificContext),
371
- targetStatement = targetStatementFromStatementSubstitutionNode(statementSubstitutionNode, context),
372
- replacementStatement = replacementStatementFromStatementSubstitutionNode(statementSubstitutionNode, context),
373
- specificContext = context, ///
365
+ targetStatement = targetStatementFromStatementSubstitutionNode(statementSubstitutionNode, generalContext),
366
+ replacementStatement = replacementStatementFromStatementSubstitutionNode(statementSubstitutionNode, specificContext),
374
367
  contexts = [
375
368
  generalContext,
376
369
  specificContext
377
370
  ];
378
371
 
379
372
  statementSubstitutionn = new StatementSubstitution(contexts, string, node, breakPoint, resolved, substitution, targetStatement, replacementStatement);
380
- }, context);
381
- }, json, context);
373
+ }, json, context);
374
+ }, context);
382
375
  }
383
376
 
384
377
  return statementSubstitutionn;
@@ -444,16 +437,16 @@ function substitutionFromStatementSubstitutionNode(statementSubstitutionNode, co
444
437
  return substitution;
445
438
  }
446
439
 
447
- function targetStatementFromStatementSubstitutionNode(statementSubstitutionNode, context) {
440
+ function targetStatementFromStatementSubstitutionNode(statementSubstitutionNode, generalContext) {
448
441
  const targetStatementNode = statementSubstitutionNode.getTargetStatementNode(),
449
- targetStatement = context.findStatementByStatementNode(targetStatementNode);
442
+ targetStatement = generalContext.findStatementByStatementNode(targetStatementNode);
450
443
 
451
444
  return targetStatement;
452
445
  }
453
446
 
454
- function replacementStatementFromStatementSubstitutionNode(statementSubstitutionNode, context) {
447
+ function replacementStatementFromStatementSubstitutionNode(statementSubstitutionNode, specificContext) {
455
448
  const replacementStatementNode = statementSubstitutionNode.getReplacementStatementNode(),
456
- replacementStatement = context.findStatementByStatementNode(replacementStatementNode);
449
+ replacementStatement = specificContext.findStatementByStatementNode(replacementStatementNode);
457
450
 
458
451
  return replacementStatement;
459
452
  }
@@ -8,7 +8,7 @@ import { stripBracketsFromTerm } from "../../utilities/brackets";
8
8
  import { instantiateTermSubstitution } from "../../process/instantiate";
9
9
  import { termSubstitutionFromTermSubstitutionNode } from "../../utilities/element";
10
10
  import { termSubstitutionStringFromTermAndVariable } from "../../utilities/string";
11
- import { join, ablate, ablates, manifest, attempts, reconcile, sequester, instantiate, unserialises } from "../../utilities/context";
11
+ import { elide, ablate, manifest, attempts, reconcile, ablates, instantiate, unserialises } from "../../utilities/context";
12
12
 
13
13
  export default define(class TermSubstitution extends Substitution {
14
14
  constructor(context, string, node, breakPoint, targetTerm, replacementTerm) {
@@ -139,7 +139,7 @@ export default define(class TermSubstitution extends Substitution {
139
139
 
140
140
  if (targetTermSingular) {
141
141
  manifest((context) => {
142
- sequester((context) => {
142
+ elide((context) => {
143
143
  const targetTerm = this.targetTerm.validate(context, (targetTerm, context) => {
144
144
  const validatesForwards = true;
145
145
 
@@ -174,7 +174,7 @@ export default define(class TermSubstitution extends Substitution {
174
174
 
175
175
  context.trace(`Validating the '${termSubstitutionString}' term substitution's replacement term...`);
176
176
 
177
- sequester((context) => {
177
+ elide((context) => {
178
178
  const replacementTerm = this.replacementTerm.validate(context, (replacementTerm, context) => {
179
179
  const validatesForwards = true;
180
180
 
@@ -245,24 +245,21 @@ export default define(class TermSubstitution extends Substitution {
245
245
  generalTerm = generalSubstitutionTargetTerm, ///
246
246
  specificTerm = specificSubstitutionTargetTerm; ///
247
247
 
248
- join((specificContext) => {
249
- reconcile((specificContext) => {
250
- const generalTermNode = generalTerm.getNode(),
251
- generalVariable = variableFromTermNode(generalTermNode, generalContext);
248
+ reconcile((specificContext) => {
249
+ const termNode = generalTerm.getNode(),
250
+ variable = variableFromTermNode(termNode, generalContext);
252
251
 
253
- if (generalVariable !== null) {
254
- const term = specificTerm, ///
255
- variable = generalVariable, ///
256
- termUnifies = variable.unifyTerm(term, generalContext, specificContext);
252
+ if (variable !== null) {
253
+ const term = specificTerm, ///
254
+ termUnifies = variable.unifyTerm(term, generalContext, specificContext);
257
255
 
258
- if (termUnifies) {
259
- specificContext.commit(context);
256
+ if (termUnifies) {
257
+ specificContext.commit(context);
260
258
 
261
- targetTermUnifies = true;
262
- }
259
+ targetTermUnifies = true;
263
260
  }
264
- }, specificContext);
265
- }, specificContext, context);
261
+ }
262
+ }, specificContext);
266
263
 
267
264
  if (targetTermUnifies) {
268
265
  context.trace(`...unified the '${specificSubstitutionString}' substitution's target term with the '${generalSubstitutionString}' substitution's target term.`);
@@ -290,24 +287,21 @@ export default define(class TermSubstitution extends Substitution {
290
287
  generalTerm = generalSubstitutionReplacementTerm, ///
291
288
  specificTerm = specificSubstitutionReplacementTerm; ///
292
289
 
293
- join((specificContext) => {
294
- reconcile((specificContext) => {
295
- const generalTermNode = generalTerm.getNode(),
296
- generalVariable = variableFromTermNode(generalTermNode, generalContext);
290
+ reconcile((specificContext) => {
291
+ const termNode = generalTerm.getNode(),
292
+ variable = variableFromTermNode(termNode, generalContext);
297
293
 
298
- if (generalVariable !== null) {
299
- const term = specificTerm, ///
300
- variable = generalVariable, ///
301
- termUnifies = variable.unifyTerm(term, generalContext, specificContext);
294
+ if (variable !== null) {
295
+ const term = specificTerm, ///
296
+ termUnifies = variable.unifyTerm(term, generalContext, specificContext);
302
297
 
303
- if (termUnifies) {
304
- specificContext.commit(context);
298
+ if (termUnifies) {
299
+ specificContext.commit(context);
305
300
 
306
- replacementTermUnifies = true;
307
- }
301
+ replacementTermUnifies = true;
308
302
  }
309
- }, specificContext);
310
- }, specificContext, context);
303
+ }
304
+ }, specificContext);
311
305
 
312
306
  if (replacementTermUnifies) {
313
307
  context.trace(`...unified the '${specificSubstitutionString}' substitution's replacement term with the '${generalSubstitutionString}' substitution's replacement term.`);
@@ -324,25 +318,22 @@ export default define(class TermSubstitution extends Substitution {
324
318
  const { name } = json;
325
319
 
326
320
  if (this.name === name) {
327
- unserialises((json, generalContext, specificContext) => {
328
- const context = specificContext; ///
329
-
330
- instantiate((context) => {
321
+ instantiate((context) => {
322
+ unserialises((json, generalContext, specificContext) => {
331
323
  const { string } = json,
332
324
  termSubstitutionNode = instantiateTermSubstitution(string, context),
333
325
  node = termSubstitutionNode, ///
334
326
  breakPoint = breakPointFromJSON(json),
335
- targetTerm = targetTermFromTermSubstitutionNode(termSubstitutionNode, context),
336
- replacementTerm = replacementTermFromTermSubstitutionNode(termSubstitutionNode, context),
337
- specificContext = context, ///
327
+ targetTerm = targetTermFromTermSubstitutionNode(termSubstitutionNode, generalContext),
328
+ replacementTerm = replacementTermFromTermSubstitutionNode(termSubstitutionNode, specificContext),
338
329
  contexts = [
339
330
  generalContext,
340
331
  specificContext
341
332
  ];
342
333
 
343
334
  termSubstitutionn = new TermSubstitution(contexts, string, node, breakPoint, targetTerm, replacementTerm);
344
- }, context);
345
- }, json, context);
335
+ }, json, context);
336
+ }, context);
346
337
  }
347
338
 
348
339
  return termSubstitutionn;
@@ -389,28 +380,28 @@ export default define(class TermSubstitution extends Substitution {
389
380
  }
390
381
  });
391
382
 
392
- function variableFromTermNode(termNode, context) {
383
+ function variableFromTermNode(termNode, generalContext) {
393
384
  let variable = null;
394
385
 
395
386
  const variableNode = termNode.getVariableNode();
396
387
 
397
388
  if (variableNode !== null) {
398
- variable = context.findVariableByVariableNode(variableNode);
389
+ variable = generalContext.findVariableByVariableNode(variableNode);
399
390
  }
400
391
 
401
392
  return variable;
402
393
  }
403
394
 
404
- function targetTermFromTermSubstitutionNode(termSubstitutionNode, context) {
395
+ function targetTermFromTermSubstitutionNode(termSubstitutionNode, generalContext) {
405
396
  const targetTermNode = termSubstitutionNode.getTargetTermNode(),
406
- targetTerm = context.findTermByTermNode(targetTermNode);
397
+ targetTerm = generalContext.findTermByTermNode(targetTermNode);
407
398
 
408
399
  return targetTerm;
409
400
  }
410
401
 
411
- function replacementTermFromTermSubstitutionNode(termSubstitutionNode, context) {
402
+ function replacementTermFromTermSubstitutionNode(termSubstitutionNode, specificContext) {
412
403
  const replacementTermNode = termSubstitutionNode.getReplacementTermNode(),
413
- replacementTerm = context.findTermByTermNode(replacementTermNode);
404
+ replacementTerm = specificContext.findTermByTermNode(replacementTermNode);
414
405
 
415
406
  return replacementTerm;
416
407
  }
@@ -5,7 +5,7 @@ import { arrayUtilities } from "necessary";
5
5
 
6
6
  import { define } from "../elements";
7
7
  import { instantiate } from "../utilities/context";
8
- import { validateTerms } from "../utilities/validation";
8
+ import { validateTerms } from "../process/validation";
9
9
  import { instantiateTerm } from "../process/instantiate";
10
10
  import { variablesFromTerm } from "../utilities/equivalence";
11
11
  import { unifyTermIntrinsically } from "../process/unify";
@@ -5,7 +5,7 @@ import { asynchronousUtilities } from "occam-languages";
5
5
  import TopLevelAssertion from "../topLevelAssertion";
6
6
 
7
7
  import { define } from "../../elements";
8
- import { join, reconcile } from "../../utilities/context";
8
+ import { reconcile } from "../../utilities/context";
9
9
 
10
10
  const { asyncMatch } = asynchronousUtilities;
11
11
 
@@ -86,11 +86,9 @@ export default define(class Axiom extends TopLevelAssertion {
86
86
 
87
87
  signature = this.getSignature();
88
88
 
89
- const generalSignature = signature, ///
90
- specificContext = context, ///
91
- generalContext = null;
89
+ const generalSignature = signature; ///
92
90
 
93
- signatureUnifies = generalSignature.unifySignature(specificSignature, generalContext, specificContext);
91
+ signatureUnifies = generalSignature.unifySignature(specificSignature, context);
94
92
 
95
93
  if (signatureUnifies) {
96
94
  context.debug(`...unified the '${signatureString}' signature with the '${axiomString}' axiom.`);
@@ -112,31 +110,29 @@ export default define(class Axiom extends TopLevelAssertion {
112
110
 
113
111
  context.trace(`Unifying the '${specificDeductionString}' deduction with the '${axiomString}' axiom's '${generalDeductionString}' deduction...`);
114
112
 
115
- const specificDeductionContext = specificDeduction.getContext(),
116
- generalDeductionContext = generalDeduction.getContext(),
117
- specificContext = specificDeductionContext, ///
118
- generalContext = generalDeductionContext; ///
113
+ const generalDeductionContext = generalDeduction.getContext(),
114
+ specificDeductionContext = specificDeduction.getContext(),
115
+ generalContext = generalDeductionContext, ///
116
+ specificContext = specificDeductionContext; ///
119
117
 
120
- join((specificContext) => {
121
- reconcile((specificContext) => {
122
- let statement;
118
+ reconcile((specificContext) => {
119
+ let statement;
123
120
 
124
- statement = specificDeduction.getStatement();
121
+ statement = specificDeduction.getStatement();
125
122
 
126
- const specificStatement = statement; ///
123
+ const specificStatement = statement; ///
127
124
 
128
- statement = generalDeduction.getStatement();
125
+ statement = generalDeduction.getStatement();
129
126
 
130
- const generalStatement = statement, ///
131
- statementUnifies = generalStatement.unifyStatement(specificStatement, generalContext, specificContext);
127
+ const generalStatement = statement, ///
128
+ statementUnifies = generalStatement.unifyStatement(specificStatement, generalContext, specificContext);
132
129
 
133
- if (statementUnifies) {
134
- specificContext.commit();
130
+ if (statementUnifies) {
131
+ specificContext.commit(context);
135
132
 
136
- deductionUnifies = true;
137
- }
138
- }, specificContext);
139
- }, specificContext, context);
133
+ deductionUnifies = true;
134
+ }
135
+ }, specificContext);
140
136
 
141
137
  if (deductionUnifies) {
142
138
  context.debug(`...unified the '${specificDeductionString}' deduction with the '${axiomString}' axiom's '${generalDeductionString}' deduction.`);
@@ -159,31 +155,29 @@ export default define(class Axiom extends TopLevelAssertion {
159
155
 
160
156
  context.trace(`Unifying the '${specificSuppositionString}' supposition with the '${axiomString}' axiom's '${generalSuppositionString}' supposition...`);
161
157
 
162
- const specificSuppositionContext = specificSupposition.getContext(),
163
- generalSuppositionContext = generalSupposition.getContext(),
164
- specificContext = specificSuppositionContext, ///
165
- generalContext = generalSuppositionContext; ///
158
+ const generalSuppositionContext = generalSupposition.getContext(),
159
+ specificSuppositionContext = specificSupposition.getContext(),
160
+ generalContext = generalSuppositionContext, ///
161
+ specificContext = specificSuppositionContext; ///
166
162
 
167
- join((specificContext) => {
168
- reconcile((specificContext) => {
169
- let statement;
163
+ reconcile((specificContext) => {
164
+ let statement;
170
165
 
171
- statement = specificSupposition.getStatement();
166
+ statement = specificSupposition.getStatement();
172
167
 
173
- const specificStatement = statement; ///
168
+ const specificStatement = statement; ///
174
169
 
175
- statement = generalSupposition.getStatement();
170
+ statement = generalSupposition.getStatement();
176
171
 
177
- const generalStatement = statement, ///
178
- statementUnifies = generalStatement.unifyStatement(specificStatement, generalContext, specificContext);
172
+ const generalStatement = statement, ///
173
+ statementUnifies = generalStatement.unifyStatement(specificStatement, generalContext, specificContext);
179
174
 
180
- if (statementUnifies) {
181
- specificContext.commit();
175
+ if (statementUnifies) {
176
+ specificContext.commit(context);
182
177
 
183
- suppositionUnifies = true;
184
- }
185
- }, specificContext);
186
- }, specificContext, context);
178
+ suppositionUnifies = true;
179
+ }
180
+ }, specificContext);
187
181
 
188
182
  if (suppositionUnifies) {
189
183
  context.debug(`...unified the '${specificSuppositionString}' supposition with the '${axiomString}' axiom's '${generalSuppositionString}' supposition...`);
@@ -225,11 +219,15 @@ export default define(class Axiom extends TopLevelAssertion {
225
219
  deductionUnifies = await this.unifyDeduction(deduction, context);
226
220
 
227
221
  if (deductionUnifies) {
228
- const suppositions = topLevelAssertion.getSuppositions(),
229
- suppositionsUnify = await this.unifySuppositions(suppositions, context);
222
+ const hypothesesDischarged = await topLevelAssertion.dischargeHypotheses(context);
223
+
224
+ if (hypothesesDischarged) {
225
+ const suppositions = topLevelAssertion.getSuppositions(),
226
+ suppositionsUnify = await this.unifySuppositions(suppositions, context);
230
227
 
231
- if (suppositionsUnify) {
232
- topLevelAssertionUnifies = true;
228
+ if (suppositionsUnify) {
229
+ topLevelAssertionUnifies = true;
230
+ }
233
231
  }
234
232
  }
235
233
 
@@ -18,7 +18,7 @@ import { labelsFromJSON,
18
18
  suppositionsToSuppositionsJSON } from "../utilities/json";
19
19
 
20
20
  const { reverse } = arrayUtilities,
21
- { asyncExtract, asyncForwardsEvery, asyncBackwardsEvery } = asynchronousUtilities;
21
+ { asyncEvery, asyncExtract, asyncForwardsEvery, asyncBackwardsEvery } = asynchronousUtilities;
22
22
 
23
23
  export default class TopLevelAssertion extends Element {
24
24
  constructor(context, string, node, breakPoint, labels, suppositions, deduction, proof, signature, hypotheses) {
@@ -257,6 +257,38 @@ export default class TopLevelAssertion extends Element {
257
257
  return suppositionsVerify;
258
258
  }
259
259
 
260
+ async dischargeHypothesis(hypothesis, context) {
261
+ let hypothesisDischarged;
262
+
263
+ await this.break(context);
264
+
265
+ const hypothesisString = hypothesis.getString(),
266
+ topLevelAssertionString = this.getString(); ///
267
+
268
+ context.trace(`Discharding the '${topLevelAssertionString}' top level assertion's '${hypothesisString}' hypothesis... `);
269
+
270
+ hypothesisDischarged = hypothesis.discharge(context);
271
+
272
+ if (hypothesisDischarged) {
273
+ context.trace(`...discharged the '${topLevelAssertionString}' top level assertion's '${hypothesisString}' hypothesis. `);
274
+ }
275
+
276
+ return hypothesisDischarged;
277
+ }
278
+
279
+ async dischargeHypotheses(context) {
280
+ const hypotheses = this.getHypotheses(),
281
+ hypothesesDischarged = await asyncEvery(hypotheses, async (hypothesis) => {
282
+ const hypothesisDischarged = await this.dischargeHypothesis(hypothesis, context);
283
+
284
+ if (hypothesisDischarged) {
285
+ return true;
286
+ }
287
+ });
288
+
289
+ return hypothesesDischarged;
290
+ }
291
+
260
292
  async unifyStepWithDeduction(step, context) {
261
293
  let stepUnifiesWithDeduction = false;
262
294
 
@@ -286,13 +318,17 @@ export default class TopLevelAssertion extends Element {
286
318
  const stepUnifiesWithDeduction = await this.unifyStepWithDeduction(step, context);
287
319
 
288
320
  if (stepUnifiesWithDeduction) {
289
- const subproofOrProofAssertionsUnifiesWithSuppositions = await this.unifySubproofOrProofAssertionsWithSuppositions(subproofOrProofAssertions, context);
321
+ const hypothesesDischarged = await this.dischargeHypotheses(context);
290
322
 
291
- if (subproofOrProofAssertionsUnifiesWithSuppositions) {
292
- const derivedSubstitutionsResolved = context.areDerivedSubstitutionsResolved();
323
+ if (hypothesesDischarged) {
324
+ const subproofOrProofAssertionsUnifiesWithSuppositions = await this.unifySubproofOrProofAssertionsWithSuppositions(subproofOrProofAssertions, context);
293
325
 
294
- if (derivedSubstitutionsResolved) {
295
- stepAndSubproofOrProofAssertionsUnify = true;
326
+ if (subproofOrProofAssertionsUnifiesWithSuppositions) {
327
+ const derivedSubstitutionsResolved = context.areDerivedSubstitutionsResolved();
328
+
329
+ if (derivedSubstitutionsResolved) {
330
+ stepAndSubproofOrProofAssertionsUnify = true;
331
+ }
296
332
  }
297
333
  }
298
334
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { Element, asynchronousUtilities } from "occam-languages";
4
4
 
5
- import { enclose } from "../utilities/context";
5
+ import { encapsulate } from "../utilities/context";
6
6
  import { breakPointFromJSON, breakPointToBreakPointJSON } from "../utilities/breakPoint";
7
7
  import { topLevelMetaAssertionStringFromLabelSuppositionsAndDeduction } from "../utilities/string";
8
8
  import { labelFromJSON,
@@ -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 enclose(async (context) => {
106
+ await encapsulate(async (context) => {
107
107
  const labelVerifies = this.verifyLabel(context);
108
108
 
109
109
  if (labelVerifies) {
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+
3
+ import elements from "../elements";
4
+
5
+ function dischargeStatementAsTypeAssertion(statement, context) {
6
+ let dischargesStatementAsTypeAssertion = false;
7
+
8
+ const { TypeAssertion } = elements;
9
+
10
+ const typeAssertion = TypeAssertion.fromStatement(statement, context);
11
+
12
+ if (typeAssertion !== null) {
13
+ const statementString = statement.getString();
14
+
15
+ context.trace(`Validating the '${statementString}' statement as a type assertion...`);
16
+
17
+ const discharges = typeAssertion.discharge(context); ///
18
+
19
+ if (discharges !== null) {
20
+ dischargesStatementAsTypeAssertion = true;
21
+ }
22
+
23
+ if (dischargesStatementAsTypeAssertion) {
24
+ context.debug(`...discharged the '${statementString}' statement as a type assertion.`);
25
+ }
26
+ }
27
+
28
+ return dischargesStatementAsTypeAssertion;
29
+ }
30
+
31
+ export const dischargeStatements = [
32
+ dischargeStatementAsTypeAssertion
33
+ ];