occam-verify-cli 1.0.764 → 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 +16 -47
  2. package/lib/context/illative.js +28 -0
  3. package/lib/context/nested.js +27 -0
  4. package/lib/context/nominal.js +2 -4
  5. package/lib/context/proof.js +232 -0
  6. package/lib/context/thetic.js +28 -0
  7. package/lib/context.js +37 -12
  8. package/lib/element/assertion/contained.js +24 -22
  9. package/lib/element/assertion/defined.js +20 -19
  10. package/lib/element/assertion/property.js +14 -13
  11. package/lib/element/assertion/satisfies.js +9 -10
  12. package/lib/element/assertion/subproof.js +23 -26
  13. package/lib/element/assertion/type.js +9 -11
  14. package/lib/element/assumption.js +46 -55
  15. package/lib/element/combinator/bracketed.js +3 -3
  16. package/lib/element/combinator.js +20 -20
  17. package/lib/element/conclusion.js +33 -29
  18. package/lib/element/constructor.js +19 -18
  19. package/lib/element/deduction.js +33 -29
  20. package/lib/element/equality.js +13 -15
  21. package/lib/element/equivalence.js +58 -49
  22. package/lib/element/frame.js +41 -34
  23. package/lib/element/hypothesis.js +7 -5
  24. package/lib/element/judgement.js +33 -73
  25. package/lib/element/label.js +22 -22
  26. package/lib/element/metavariable.js +23 -7
  27. package/lib/element/proofAssertion/premise.js +48 -35
  28. package/lib/element/proofAssertion/step.js +35 -20
  29. package/lib/element/proofAssertion/supposition.js +48 -34
  30. package/lib/element/proofAssertion.js +1 -14
  31. package/lib/element/reference.js +79 -52
  32. package/lib/element/signature.js +44 -3
  33. package/lib/element/statement.js +28 -28
  34. package/lib/element/substitution/frame.js +28 -23
  35. package/lib/element/substitution/metaLevel.js +34 -30
  36. package/lib/element/substitution/reference.js +12 -11
  37. package/lib/element/substitution/statement.js +44 -39
  38. package/lib/element/substitution/term.js +12 -11
  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 -25
  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 +6 -4
  51. package/lib/utilities/validation.js +39 -31
  52. package/package.json +1 -1
  53. package/src/context/file/nominal.js +26 -74
  54. package/src/context/illative.js +17 -0
  55. package/src/context/nested.js +15 -0
  56. package/src/context/nominal.js +1 -5
  57. package/src/context/{scoped.js → proof.js} +73 -73
  58. package/src/context/thetic.js +17 -0
  59. package/src/context.js +58 -17
  60. package/src/element/assertion/contained.js +28 -28
  61. package/src/element/assertion/defined.js +23 -23
  62. package/src/element/assertion/property.js +15 -14
  63. package/src/element/assertion/satisfies.js +8 -10
  64. package/src/element/assertion/subproof.js +26 -31
  65. package/src/element/assertion/type.js +10 -12
  66. package/src/element/assumption.js +51 -74
  67. package/src/element/combinator/bracketed.js +2 -2
  68. package/src/element/combinator.js +23 -29
  69. package/src/element/conclusion.js +37 -40
  70. package/src/element/constructor.js +29 -34
  71. package/src/element/deduction.js +36 -39
  72. package/src/element/equality.js +16 -18
  73. package/src/element/equivalence.js +77 -64
  74. package/src/element/frame.js +43 -35
  75. package/src/element/hypothesis.js +7 -6
  76. package/src/element/judgement.js +37 -43
  77. package/src/element/label.js +25 -31
  78. package/src/element/metavariable.js +32 -12
  79. package/src/element/proofAssertion/premise.js +63 -49
  80. package/src/element/proofAssertion/step.js +43 -23
  81. package/src/element/proofAssertion/supposition.js +64 -50
  82. package/src/element/proofAssertion.js +0 -22
  83. package/src/element/reference.js +118 -79
  84. package/src/element/signature.js +5 -2
  85. package/src/element/statement.js +30 -33
  86. package/src/element/substitution/frame.js +32 -30
  87. package/src/element/substitution/metaLevel.js +43 -46
  88. package/src/element/substitution/reference.js +17 -17
  89. package/src/element/substitution/statement.js +58 -56
  90. package/src/element/substitution/term.js +17 -17
  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 +79 -36
  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 +7 -6
  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
@@ -4,9 +4,8 @@ import { Element } from "occam-languages";
4
4
 
5
5
  import { define } from "../elements";
6
6
  import { instantiateLabel } from "../process/instantiate";
7
- import { attempt, instantiate } from "../utilities/context";
8
7
  import { metavariableFromLabelNode } from "../utilities/element";
9
- import { ephemeralContextFromJSON, ephemeralContextToEphemeralContextJSON } from "../utilities/json";
8
+ import { attempt, serialise, unserialise, instantiate } from "../utilities/context";
10
9
 
11
10
  export default define(class Label extends Element {
12
11
  constructor(context, string, node, metavariable) {
@@ -38,10 +37,6 @@ export default define(class Label extends Element {
38
37
  return labelNodeMatches;
39
38
  }
40
39
 
41
- compareMetavariable(metavariable) { return this.metavariable.compare(metavariable); }
42
-
43
- compareMetavariableName(metavariableName) { return this.metavariable.compareMetavariableName(metavariableName); }
44
-
45
40
  compareReference(reference) {
46
41
  const metavariable = reference.getMetavariable(),
47
42
  metavariableComparesToMetavariable = this.compareMetavariable(metavariable),
@@ -50,6 +45,10 @@ export default define(class Label extends Element {
50
45
  return comparesToReference;
51
46
  }
52
47
 
48
+ compareMetavariable(metavariable) { return this.metavariable.compare(metavariable); }
49
+
50
+ compareMetavariableName(metavariableName) { return this.metavariable.compareMetavariableName(metavariableName); }
51
+
53
52
  verify() {
54
53
  let verifies = false;
55
54
 
@@ -127,40 +126,35 @@ export default define(class Label extends Element {
127
126
  }
128
127
 
129
128
  toJSON() {
130
- let context;
131
-
132
- context = this.getContext();
133
-
134
- const ephemeralContext = context, ///
135
- ephemeralContextJSON = ephemeralContextToEphemeralContextJSON(ephemeralContext),
136
- contextJSON = ephemeralContextJSON; ///
129
+ const context = this.getContext();
137
130
 
138
- context = contextJSON; ///
131
+ return serialise((context) => {
132
+ const string = this.getString(),
133
+ json = {
134
+ context,
135
+ string
136
+ };
139
137
 
140
- const string = this.getString(),
141
- json = {
142
- context,
143
- string
144
- };
145
-
146
- return json;
138
+ return json;
139
+ }, context);
147
140
  }
148
141
 
149
142
  static name = "Label";
150
143
 
151
144
  static fromJSON(json, context) {
152
- const ephemeralContext = ephemeralContextFromJSON(json, context);
145
+ let label;
153
146
 
154
- context = ephemeralContext; ///
147
+ unserialise((json, context) => {
148
+ instantiate((context) => {
149
+ const { string } = json,
150
+ labelNode = instantiateLabel(string, context),
151
+ node = labelNode, ///
152
+ metavariable = metavariableFromLabelNode(labelNode, context);
155
153
 
156
- return instantiate((context) => {
157
- const { string } = json,
158
- labelNode = instantiateLabel(string, context),
159
- node = labelNode, ///
160
- metavariable = metavariableFromLabelNode(labelNode, context),
161
- label = new Label(context, string, node, metavariable);
154
+ label = new Label(context, string, node, metavariable);
155
+ }, context);
156
+ }, json, context);
162
157
 
163
- return label;
164
- }, context);
158
+ return label;
165
159
  }
166
160
  });
@@ -486,11 +486,11 @@ export default define(class Metavariable extends Element {
486
486
  if (frameSingular) {
487
487
  const frameMetavariableName = frame.getMetavariableName(),
488
488
  frameMetavariable = context.findMetavariableByMetavariableName(frameMetavariableName),
489
- generalMetavariable = this, ///
490
- specificMetavariable = frameMetavariable, ///
491
- metavariableUnifiesIntrinsically = unifyMetavariableIntrinsically(generalMetavariable, specificMetavariable, generalContext, specificContext);
489
+ frameMetavariableUnifiesIntrinsically = this.unifyMetavariableIntrinsically(frameMetavariable, generalContext, specificContext);
492
490
 
493
- frameMetavariableUnifies = metavariableUnifiesIntrinsically; ///
491
+ if (frameMetavariableUnifiesIntrinsically) {
492
+ frameMetavariableUnifies = true;
493
+ }
494
494
  }
495
495
  }
496
496
  }
@@ -522,11 +522,11 @@ export default define(class Metavariable extends Element {
522
522
  referenceMetavariableUnifies = true;
523
523
  } else {
524
524
  const referenceMetavariable = reference.getMetavariable(),
525
- generalMetavariable = this, ///
526
- specificMetavariable = referenceMetavariable, ///
527
- metavariableUnifiesIntrinsically = unifyMetavariableIntrinsically(generalMetavariable, specificMetavariable, generalContext, specificContext);
525
+ referenceMetavariableUnifiesIntrinsically = this.unifyMetavariableIntrinsically(referenceMetavariable, generalContext, specificContext);
528
526
 
529
- referenceMetavariableUnifies = metavariableUnifiesIntrinsically; ///
527
+ if (referenceMetavariableUnifiesIntrinsically) {
528
+ referenceMetavariableUnifies = true;
529
+ }
530
530
  }
531
531
  }
532
532
 
@@ -561,11 +561,11 @@ export default define(class Metavariable extends Element {
561
561
  if (statementSingular) {
562
562
  const statementMetavariableName = statement.getMetavariableName(),
563
563
  statementMetavariable = context.findMetavariableByMetavariableName(statementMetavariableName),
564
- generalMetavariable = this, ///
565
- specificMetavariable = statementMetavariable, ///
566
- metavariableUnifiesIntrinsically = unifyMetavariableIntrinsically(generalMetavariable, specificMetavariable, generalContext, specificContext);
564
+ statementMetavariableUnifiesIntrinsically = this.unifyMetavariableIntrinsically(statementMetavariable, generalContext, specificContext);
567
565
 
568
- statementMetavariableUnifies = metavariableUnifiesIntrinsically; ///
566
+ if (statementMetavariableUnifiesIntrinsically) {
567
+ statementMetavariableUnifies = true;
568
+ }
569
569
  }
570
570
  }
571
571
  }
@@ -577,6 +577,26 @@ export default define(class Metavariable extends Element {
577
577
  return statementMetavariableUnifies;
578
578
  }
579
579
 
580
+ unifyMetavariableIntrinsically(metavariable, generalContext, specificContext) {
581
+ let metavariableUnifiesIntrinsically;
582
+
583
+ const context = specificContext, ///
584
+ generalMetavariable = this, ///
585
+ specificMetavariable = metavariable,
586
+ generalMetavariableString = generalMetavariable.getString(), ///
587
+ specificMetavariableString = specificMetavariable.getString();
588
+
589
+ context.trace(`Unifying the '${specificMetavariableString}' metavariable with the '${generalMetavariableString}' metavariable intrinsically...`);
590
+
591
+ metavariableUnifiesIntrinsically = unifyMetavariableIntrinsically(generalMetavariable, specificMetavariable, generalContext, specificContext);
592
+
593
+ if (metavariableUnifiesIntrinsically) {
594
+ context.debug(`...unified the '${specificMetavariableString}' metavariable with the '${generalMetavariableString}' metavariable intrinsically.`);
595
+ }
596
+
597
+ return metavariableUnifiesIntrinsically;
598
+ }
599
+
580
600
  toJSON() {
581
601
  const metaTypeJSON = metaTypeToMetaTypeJSON(this.metaType),
582
602
  metaType = metaTypeJSON, ///
@@ -5,8 +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 { join, attempt, reconcile, instantiate } from "../../utilities/context";
9
- import { ephemeralContextFromJSON, ephemeralContextToEphemeralContextJSON } from "../../utilities/json";
8
+ import { join, declare, attempt, reconcile, serialise, unserialise, instantiate } from "../../utilities/context";
10
9
 
11
10
  export default define(class Premise extends ProofAssertion {
12
11
  constructor(context, string, node, statement, procedureCall) {
@@ -26,12 +25,6 @@ export default define(class Premise extends ProofAssertion {
26
25
  return premiseNode;
27
26
  }
28
27
 
29
- isStated() {
30
- const stated = true; ///
31
-
32
- return stated;
33
- }
34
-
35
28
  async verify(context) {
36
29
  let verifies = false;
37
30
 
@@ -64,29 +57,31 @@ export default define(class Premise extends ProofAssertion {
64
57
 
65
58
  context.trace(`Validatting the '${premiseString}' premise...`);
66
59
 
67
- attempt((context) => {
68
- const statement = this.getStatement(),
69
- procedureCall = this.getProcedureCall();
60
+ declare((context) => {
61
+ attempt((context) => {
62
+ const statement = this.getStatement(),
63
+ procedureCall = this.getProcedureCall();
70
64
 
71
- if (statement !== null) {
72
- const statementValidates = this.validateStatement(context);
65
+ if (statement !== null) {
66
+ const statementValidates = this.validateStatement(context);
73
67
 
74
- if (statementValidates) {
75
- context.commit(this);
68
+ if (statementValidates) {
69
+ context.commit(this);
76
70
 
77
- validates = true;
71
+ validates = true;
72
+ }
78
73
  }
79
- }
80
74
 
81
- if (procedureCall !== null) {
82
- const procedureCallValidates = this.validateProcedureCall(context);
75
+ if (procedureCall !== null) {
76
+ const procedureCallValidates = this.validateProcedureCall(context);
83
77
 
84
- if (procedureCallValidates) {
85
- context.commit(this);
78
+ if (procedureCallValidates) {
79
+ context.commit(this);
86
80
 
87
- validates = true;
81
+ validates = true;
82
+ }
88
83
  }
89
- }
84
+ }, context);
90
85
  }, context);
91
86
 
92
87
  if (validates) {
@@ -96,6 +91,30 @@ export default define(class Premise extends ProofAssertion {
96
91
  return validates;
97
92
  }
98
93
 
94
+ validateStatement(context) {
95
+ let statementValidates = false;
96
+
97
+ const premiseString = this.getString();
98
+
99
+ context.trace(`Validating the '${premiseString}' premise's statsement... `);
100
+
101
+ let statement;
102
+
103
+ statement = this.getStatement();
104
+
105
+ statement = statement.validate(context); ///
106
+
107
+ if (statement !== null) {
108
+ statementValidates = true;
109
+ }
110
+
111
+ if (statementValidates) {
112
+ context.debug(`...validated the '${premiseString}' premise's statement. `);
113
+ }
114
+
115
+ return statementValidates;
116
+ }
117
+
99
118
  validateProcedureCall(context) {
100
119
  let procedureCallValidates = false;
101
120
 
@@ -266,42 +285,37 @@ export default define(class Premise extends ProofAssertion {
266
285
  }
267
286
 
268
287
  toJSON() {
269
- let context;
270
-
271
- context = this.getContext();
272
-
273
- const ephemeralContext = context, ///
274
- ephemeralContextJSON = ephemeralContextToEphemeralContextJSON(ephemeralContext),
275
- contextJSON = ephemeralContextJSON; ///
288
+ const context = this.getContext();
276
289
 
277
- context = contextJSON; ///
290
+ return serialise((context) => {
291
+ const string = this.getString(),
292
+ json = {
293
+ context,
294
+ string
295
+ };
278
296
 
279
- const string = this.getString(),
280
- json = {
281
- context,
282
- string
283
- };
284
-
285
- return json;
297
+ return json;
298
+ }, context);
286
299
  }
287
300
 
288
301
  static name = "Premise";
289
302
 
290
303
  static fromJSON(json, context) {
291
- const ephemeralContext = ephemeralContextFromJSON(json, context);
304
+ let premise;
292
305
 
293
- context = ephemeralContext; ///
306
+ unserialise((json, context) => {
307
+ instantiate((context) => {
308
+ const { string } = json,
309
+ premiseNode = instantiatePremise(string, context),
310
+ node = premiseNode, ///
311
+ statement = statementFromPremiseNode(premiseNode, context),
312
+ procedureCall = procedureCallFromPremiseNode(premiseNode, context);
294
313
 
295
- return instantiate((context) => {
296
- const { string } = json,
297
- premiseNode = instantiatePremise(string, context),
298
- node = premiseNode, ///
299
- statement = statementFromPremiseNode(premiseNode, context),
300
- procedureCall = procedureCallFromPremiseNode(premiseNode, context),
301
- premise = new Premise(context, string, node, statement, procedureCall);
314
+ premise = new Premise(context, string, node, statement, procedureCall);
315
+ }, context);
316
+ }, json, context);
302
317
 
303
- return premise;
304
- }, context);
318
+ return premise;
305
319
  }
306
320
  });
307
321
 
@@ -6,8 +6,8 @@ import ProofAssertion from "../proofAssertion";
6
6
 
7
7
  import { define } from "../../elements";
8
8
  import { unifyStatements } from "../../utilities/unification";
9
- import { attempt, asyncReconcile } from "../../utilities/context";
10
9
  import { propertyAssertionFromStatement } from "../../utilities/statement";
10
+ import { derive, attempt, descend, asyncReconcile } from "../../utilities/context";
11
11
 
12
12
  const { asyncSome } = asynchronousUtilities;
13
13
 
@@ -46,13 +46,6 @@ export default define(class Step extends ProofAssertion {
46
46
  return qualified;
47
47
  }
48
48
 
49
- isStated() {
50
- const qualified = this.isQualified(),
51
- stated = qualified; ///
52
-
53
- return stated;
54
- }
55
-
56
49
  compareTermAndPropertyRelation(term, propertyRelation, context) {
57
50
  let comparesToTermAndPropertyRelation = false;
58
51
 
@@ -107,22 +100,24 @@ export default define(class Step extends ProofAssertion {
107
100
 
108
101
  context.trace(`Validating the '${stepString}' step...`);
109
102
 
110
- attempt((context) => {
111
- const statementValidates = this.validateStatement(context);
103
+ derive((context) => {
104
+ attempt((context) => {
105
+ const statementValidates = this.validateStatement(context);
112
106
 
113
- if (statementValidates) {
114
- const referenceValidates = this.validateReference(context);
107
+ if (statementValidates) {
108
+ const referenceValidates = this.validateReference(context);
115
109
 
116
- if (referenceValidates) {
117
- const satisfiesAssertioValidates = this.validateSatisfiesAssertion(context);
110
+ if (referenceValidates) {
111
+ const satisfiesAssertioValidates = this.validateSatisfiesAssertion(context);
118
112
 
119
- if (satisfiesAssertioValidates) {
120
- context.commit(this);
113
+ if (satisfiesAssertioValidates) {
114
+ context.commit(this);
121
115
 
122
- validates = true;
116
+ validates = true;
117
+ }
123
118
  }
124
119
  }
125
- }
120
+ }, context);
126
121
  }, context);
127
122
 
128
123
  if (validates) {
@@ -155,6 +150,30 @@ export default define(class Step extends ProofAssertion {
155
150
  return referenceValidates;
156
151
  }
157
152
 
153
+ validateStatement(context) {
154
+ let statementValidates = false;
155
+
156
+ const stepString = this.getString();
157
+
158
+ context.trace(`Validating the '${stepString}' step's statement... `);
159
+
160
+ let statement;
161
+
162
+ statement = this.getStatement();
163
+
164
+ statement = statement.validate(context); ///
165
+
166
+ if (statement !== null) {
167
+ statementValidates = true;
168
+ }
169
+
170
+ if (statementValidates) {
171
+ context.debug(`...validated the '${stepString}' step statement. `);
172
+ }
173
+
174
+ return statementValidates;
175
+ }
176
+
158
177
  validateSatisfiesAssertion(context) {
159
178
  let satisfiesAssertionValidates = true; ///
160
179
 
@@ -164,12 +183,13 @@ export default define(class Step extends ProofAssertion {
164
183
 
165
184
  context.trace(`Validating the '${stepString}' step's '${satisfiesAssertionString}' satisfies assertion... `);
166
185
 
167
- const stated = true,
168
- satisfiesAssertion = this.satisfiesAssertion.validate(stated, context);
186
+ descend((context) => {
187
+ const satisfiesAssertion = this.satisfiesAssertion.validate(context);
169
188
 
170
- if (satisfiesAssertion === null) {
171
- satisfiesAssertionValidates = false;
172
- }
189
+ if (satisfiesAssertion === null) {
190
+ satisfiesAssertionValidates = false;
191
+ }
192
+ }, context);
173
193
 
174
194
  if (satisfiesAssertionValidates) {
175
195
  context.debug(`...validating the '${stepString}' step's '${satisfiesAssertionString}' satisfies assertion. `);
@@ -5,8 +5,7 @@ import ProofAssertion from "../proofAssertion";
5
5
  import { define } from "../../elements";
6
6
  import { instantiateSupposition} from "../../process/instantiate";
7
7
  import { procedureCallFromSuppositionNode } from "../../utilities/element";
8
- import { join, attempt, reconcile, instantiate } from "../../utilities/context";
9
- import { ephemeralContextFromJSON, ephemeralContextToEphemeralContextJSON } from "../../utilities/json";
8
+ import { join, declare, attempt, reconcile, serialise, unserialise, instantiate } from "../../utilities/context";
10
9
 
11
10
  export default define(class Supposition extends ProofAssertion {
12
11
  constructor(context, string, node, statement, procedureCall) {
@@ -26,12 +25,6 @@ export default define(class Supposition extends ProofAssertion {
26
25
  return suppositionNode;
27
26
  }
28
27
 
29
- isStated() {
30
- const stated = true; ///
31
-
32
- return stated;
33
- }
34
-
35
28
  async verify(context) {
36
29
  let verifies = false;
37
30
 
@@ -64,29 +57,31 @@ export default define(class Supposition extends ProofAssertion {
64
57
 
65
58
  context.trace(`Validatting the '${suppositionString}' supposition...`);
66
59
 
67
- attempt((context) => {
68
- const statement = this.getStatement(),
69
- procedureCall = this.getProcedureCall();
70
-
71
- if (statement !== null) {
72
- const statementValidates = this.validateStatement(context);
60
+ declare((context) => {
61
+ attempt((context) => {
62
+ const statement = this.getStatement(),
63
+ procedureCall = this.getProcedureCall();
73
64
 
74
- if (statementValidates) {
75
- context.commit(this);
65
+ if (statement !== null) {
66
+ const statementValidates = this.validateStatement(context);
76
67
 
77
- validates = true;
68
+ if (statementValidates) {
69
+ validates = true;
70
+ }
78
71
  }
79
- }
80
72
 
81
- if (procedureCall !== null) {
82
- const procedureCallValidates = this.validateProcedureCall(context);
73
+ if (procedureCall !== null) {
74
+ const procedureCallValidates = this.validateProcedureCall(context);
83
75
 
84
- if (procedureCallValidates) {
85
- context.commit(this);
76
+ if (procedureCallValidates) {
77
+ validates = true;
78
+ }
79
+ }
86
80
 
87
- validates = true;
81
+ if (validates) {
82
+ context.commit(this);
88
83
  }
89
- }
84
+ }, context);
90
85
  }, context);
91
86
 
92
87
  if (validates) {
@@ -96,6 +91,30 @@ export default define(class Supposition extends ProofAssertion {
96
91
  return validates;
97
92
  }
98
93
 
94
+ validateStatement(context) {
95
+ let statementValidates = false;
96
+
97
+ const suppositionString = this.getString();
98
+
99
+ context.trace(`Validating the '${suppositionString}' supposition's statement... `);
100
+
101
+ let statement;
102
+
103
+ statement = this.getStatement();
104
+
105
+ statement = statement.validate(context); ///
106
+
107
+ if (statement !== null) {
108
+ statementValidates = true;
109
+ }
110
+
111
+ if (statementValidates) {
112
+ context.debug(`...validated the '${suppositionString}' supposition statement. `);
113
+ }
114
+
115
+ return statementValidates;
116
+ }
117
+
99
118
  validateProcedureCall(context) {
100
119
  let procedureCallValidates = false;
101
120
 
@@ -288,42 +307,37 @@ export default define(class Supposition extends ProofAssertion {
288
307
  }
289
308
 
290
309
  toJSON() {
291
- let context;
292
-
293
- context = this.getContext();
294
-
295
- const ephemeralContext = context, ///
296
- ephemeralContextJSON = ephemeralContextToEphemeralContextJSON(ephemeralContext),
297
- contextJSON = ephemeralContextJSON; ///
310
+ const context = this.getContext();
298
311
 
299
- context = contextJSON; ///
312
+ return serialise((context) => {
313
+ const string = this.getString(),
314
+ json = {
315
+ context,
316
+ string
317
+ };
300
318
 
301
- const string = this.getString(),
302
- json = {
303
- context,
304
- string
305
- };
306
-
307
- return json;
319
+ return json;
320
+ }, context);
308
321
  }
309
322
 
310
323
  static name = "Supposition";
311
324
 
312
325
  static fromJSON(json, context) {
313
- const ephemeralContext = ephemeralContextFromJSON(json, context);
326
+ let supposition;
314
327
 
315
- context = ephemeralContext; ///
328
+ unserialise((json, context) => {
329
+ instantiate((context) => {
330
+ const { string } = json,
331
+ suppositionNode = instantiateSupposition(string, context),
332
+ node = suppositionNode, ///
333
+ statement = statementFromSuppositionNode(suppositionNode, context),
334
+ procedureCall = procedureCallFromSuppositionNode(suppositionNode, context);
316
335
 
317
- return instantiate((context) => {
318
- const { string } = json,
319
- suppositionNode = instantiateSupposition(string, context),
320
- node = suppositionNode, ///
321
- statement = statementFromSuppositionNode(suppositionNode, context),
322
- procedureCall = procedureCallFromSuppositionNode(suppositionNode, context),
323
- supposition = new Supposition(context, string, node, statement, procedureCall);
336
+ supposition = new Supposition(context, string, node, statement, procedureCall);
337
+ }, context);
338
+ }, json, context);
324
339
 
325
- return supposition;
326
- }, context);
340
+ return supposition;
327
341
  }
328
342
  });
329
343
 
@@ -51,28 +51,6 @@ export default class ProofAssertion extends Element {
51
51
  return comparesToStatement;
52
52
  }
53
53
 
54
- validateStatement(context) {
55
- let statementValidates = false;
56
-
57
- const statementString = this.statement.getString(),
58
- proofAssertionString = this.getString(); ///
59
-
60
- context.trace(`Validating the '${proofAssertionString}' proof assertion's '${statementString}' statement... `);
61
-
62
- const stated = this.isStated(),
63
- statement = this.statement.validate(stated, context);
64
-
65
- if (statement !== null) {
66
- statementValidates = true;
67
- }
68
-
69
- if (statementValidates) {
70
- context.debug(`...validated the '${proofAssertionString}' proof assertion's '${statementString}' statement. `);
71
- }
72
-
73
- return statementValidates;
74
- }
75
-
76
54
  unifyStatement(statement, generalContext, specificContext) {
77
55
  let statementUnifies = false;
78
56