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
@@ -3,7 +3,7 @@
3
3
  import Assertion from "../assertion";
4
4
 
5
5
  import { define } from "../../elements";
6
- import { instantiate } from "../../utilities/context";
6
+ import { descend, instantiate } from "../../utilities/context";
7
7
  import { instantiateContainedAssertion } from "../../process/instantiate";
8
8
  import { termFromTermAndSubstitutions, frameFromFrameAndSubstitutions, statementFromStatementAndSubstitutions } from "../../utilities/substitutions";
9
9
  import { termFromContainedAssertionNode, frameFromContainedAssertionNode, negatedFromContainedAssertionNode, statementFromContainedAssertionNode } from "../../utilities/element";
@@ -41,7 +41,7 @@ export default define(class ContainedAssertion extends Assertion {
41
41
  return containedAssertionNode;
42
42
  }
43
43
 
44
- validate(stated, context) {
44
+ validate(context) {
45
45
  let containedAssertion = null;
46
46
 
47
47
  const containedAssertionString = this.getString(); ///
@@ -57,11 +57,13 @@ export default define(class ContainedAssertion extends Assertion {
57
57
  } else {
58
58
  let validates = false;
59
59
 
60
- const termValidates = this.validateTerm(stated, context),
61
- frameValidates = this.validateFrame(stated, context),
62
- statementValidates = this.validateStatement(stated, context)
60
+ const termValidates = this.validateTerm(context),
61
+ frameValidates = this.validateFrame(context),
62
+ statementValidates = this.validateStatement(context)
63
63
 
64
64
  if (termValidates || frameValidates || statementValidates) {
65
+ const stated = context.isStated();
66
+
65
67
  let validatesWhenStated = false,
66
68
  validatesWhenDerived = false;
67
69
 
@@ -90,7 +92,7 @@ export default define(class ContainedAssertion extends Assertion {
90
92
  return containedAssertion;
91
93
  }
92
94
 
93
- validateTerm(stated, context) {
95
+ validateTerm(context) {
94
96
  let termValidates = false;
95
97
 
96
98
  if (this.term !== null) {
@@ -125,7 +127,7 @@ export default define(class ContainedAssertion extends Assertion {
125
127
  return termValidates;
126
128
  }
127
129
 
128
- validateFrame(stated, context) {
130
+ validateFrame(context) {
129
131
  let frameValidates = false;
130
132
 
131
133
  if (this.frame !== null) {
@@ -136,18 +138,18 @@ export default define(class ContainedAssertion extends Assertion {
136
138
 
137
139
  const frameSingular = this.frame.isSingular();
138
140
 
139
- if (!frameSingular) {
140
- context.debug(`The '${frameString}' frame is not singular.`);
141
- } else {
142
- stated = true; ///
143
-
144
- const frame = this.frame.validate(stated, context);
141
+ if (frameSingular) {
142
+ descend((context) => {
143
+ const frame = this.frame.validate(context);
145
144
 
146
- if (frame !== null) {
147
- this.frame = frame;
145
+ if (frame !== null) {
146
+ this.frame = frame;
148
147
 
149
- frameValidates = true;
150
- }
148
+ frameValidates = true;
149
+ }
150
+ }, context);
151
+ } else {
152
+ context.debug(`The '${frameString}' frame is not singular.`);
151
153
  }
152
154
 
153
155
  if (frameValidates) {
@@ -158,7 +160,7 @@ export default define(class ContainedAssertion extends Assertion {
158
160
  return frameValidates;
159
161
  }
160
162
 
161
- validateStatement(stated, context) {
163
+ validateStatement(context) {
162
164
  let statementValidates = false;
163
165
 
164
166
  if (this.statement !== null) {
@@ -166,13 +168,13 @@ export default define(class ContainedAssertion extends Assertion {
166
168
 
167
169
  context.trace(`Validating the '${statementString}' statement...`);
168
170
 
169
- stated = true; ///
170
-
171
- const statement = this.statement.validate(stated, context);
171
+ descend((context) => {
172
+ const statement = this.statement.validate(context);
172
173
 
173
- if (statement !== null) {
174
- statementValidates = true;
175
- }
174
+ if (statement !== null) {
175
+ statementValidates = true;
176
+ }
177
+ }, context);
176
178
 
177
179
  if (statementValidates) {
178
180
  context.debug(`...validated the '${statementString}' statement.`);
@@ -247,7 +249,7 @@ export default define(class ContainedAssertion extends Assertion {
247
249
  const { name } = json;
248
250
 
249
251
  if (this.name === name) {
250
- containedAssertion = instantiate((context) => {
252
+ instantiate((context) => {
251
253
  const { string } = json,
252
254
  containedAssertionNode = instantiateContainedAssertion(string, context),
253
255
  node = containedAssertionNode, ///
@@ -258,9 +260,7 @@ export default define(class ContainedAssertion extends Assertion {
258
260
 
259
261
  context = null;
260
262
 
261
- const containedAssertion = new ContainedAssertion(context, string, node, term, frame, negated, statement);
262
-
263
- return containedAssertion;
263
+ containedAssertion = new ContainedAssertion(context, string, node, term, frame, negated, statement);
264
264
  }, context);
265
265
  }
266
266
 
@@ -3,7 +3,7 @@
3
3
  import Assertion from "../assertion";
4
4
 
5
5
  import { define } from "../../elements";
6
- import { instantiate } from "../../utilities/context";
6
+ import { descend, instantiate } from "../../utilities/context";
7
7
  import { instantiateDefinedAssertion } from "../../process/instantiate";
8
8
  import { termFromTermAndSubstitutions, frameFromFrameAndSubstitutions } from "../../utilities/substitutions";
9
9
  import { termFromJDefinedAssertionNode, frameFromJDefinedAssertionNode, negatedFromJDefinedAssertionNode } from "../../utilities/element";
@@ -36,7 +36,7 @@ export default define(class DefinedAssertion extends Assertion {
36
36
  return definedAssertionNode;
37
37
  }
38
38
 
39
- validate(stated, context) {
39
+ validate(context) {
40
40
  let definedAssertion = null;
41
41
 
42
42
  const definedAssertionString = this.getString(); ///
@@ -52,10 +52,12 @@ export default define(class DefinedAssertion extends Assertion {
52
52
  } else {
53
53
  let validates = false;
54
54
 
55
- const termValidates = this.validateTerm(stated, context),
56
- frameValidates = this.validateFrame(stated, context);
55
+ const termValidates = this.validateTerm(context),
56
+ frameValidates = this.validateFrame(context);
57
57
 
58
58
  if (termValidates || frameValidates) {
59
+ const stated = context.isStated();
60
+
59
61
  let verifiesWhenStated = false,
60
62
  verifiesWhenDerived = false;
61
63
 
@@ -84,7 +86,7 @@ export default define(class DefinedAssertion extends Assertion {
84
86
  return definedAssertion;
85
87
  }
86
88
 
87
- validateTerm(stated, context) {
89
+ validateTerm(context) {
88
90
  let termValidates = false;
89
91
 
90
92
  if (this.term !== null) {
@@ -119,7 +121,7 @@ export default define(class DefinedAssertion extends Assertion {
119
121
  return termValidates;
120
122
  }
121
123
 
122
- validateFrame(stated, context) {
124
+ validateFrame(context) {
123
125
  let frameValidates = false;
124
126
 
125
127
  if (this.frame !== null) {
@@ -130,22 +132,22 @@ export default define(class DefinedAssertion extends Assertion {
130
132
 
131
133
  const frameSingular = this.frame.isSingular();
132
134
 
133
- if (!frameSingular) {
134
- context.debug(`The '${frameString}' frame is not singular.`);
135
- } else {
136
- stated = true; ///
137
-
138
- const frame = this.frame.validate(stated, context);
135
+ if (frameSingular) {
136
+ descend((context) => {
137
+ const frame = this.frame.validate(context);
139
138
 
140
- if (frame !== null) {
141
- this.frame = frame;
139
+ if (frame !== null) {
140
+ this.frame = frame;
142
141
 
143
- frameValidates = true;
144
- }
142
+ frameValidates = true;
143
+ }
144
+ }, context);
145
+ } else {
146
+ context.debug(`The '${frameString}' frame is not singular.`);
147
+ }
145
148
 
146
- if (frameValidates) {
147
- context.debug(`...validates the'${definedAssertionString}' defined assertion's '${frameString}' frame.`);
148
- }
149
+ if (frameValidates) {
150
+ context.debug(`...validates the'${definedAssertionString}' defined assertion's '${frameString}' frame.`);
149
151
  }
150
152
  }
151
153
 
@@ -216,7 +218,7 @@ export default define(class DefinedAssertion extends Assertion {
216
218
  const { name } = json;
217
219
 
218
220
  if (this.name === name) {
219
- definedAssertion = instantiate((context) => {
221
+ instantiate((context) => {
220
222
  const { string } = json,
221
223
  definedAssertionNode = instantiateDefinedAssertion(string, context),
222
224
  node = definedAssertionNode, ///
@@ -226,9 +228,7 @@ export default define(class DefinedAssertion extends Assertion {
226
228
 
227
229
  context = null;
228
230
 
229
- const definedAssertion = new DefinedAssertion(context, string, node, term, frame, negated);
230
-
231
- return definedAssertion;
231
+ definedAssertion = new DefinedAssertion(context, string, node, term, frame, negated);
232
232
  }, context);
233
233
  }
234
234
 
@@ -57,7 +57,7 @@ export default define(class PropertyAssertion extends Assertion {
57
57
  return comparesToTermAndPropertyRelation;
58
58
  }
59
59
 
60
- validate(stated, context) {
60
+ validate(context) {
61
61
  let propertyAssertion = null;
62
62
 
63
63
  const propertyAssertionString = this.getString(); ///
@@ -73,12 +73,14 @@ export default define(class PropertyAssertion extends Assertion {
73
73
  } else {
74
74
  let validates = false;
75
75
 
76
- const termValidates = this.validateTerm(stated, context);
76
+ const termValidates = this.validateTerm(context);
77
77
 
78
78
  if (termValidates) {
79
- const propertyRelationVerifies = this.validatePropertyRelation(stated, context);
79
+ const propertyRelationVerifies = this.validatePropertyRelation(context);
80
80
 
81
81
  if (propertyRelationVerifies) {
82
+ const stated = context.isStated();
83
+
82
84
  let validatesWhenStated = false,
83
85
  validatesWhenDerived = false;
84
86
 
@@ -99,7 +101,7 @@ export default define(class PropertyAssertion extends Assertion {
99
101
 
100
102
  propertyAssertion = assertion; ///
101
103
 
102
- this.assign(stated, context);
104
+ this.assign(context);
103
105
 
104
106
  context.addAssertion(assertion);
105
107
 
@@ -110,7 +112,7 @@ export default define(class PropertyAssertion extends Assertion {
110
112
  return propertyAssertion;
111
113
  }
112
114
 
113
- validateTerm(stated, context) {
115
+ validateTerm(context) {
114
116
  let termValidates = false;
115
117
 
116
118
  const termString = this.term.getString();
@@ -136,7 +138,7 @@ export default define(class PropertyAssertion extends Assertion {
136
138
  return termValidates;
137
139
  }
138
140
 
139
- validatePropertyRelation(stated, context) {
141
+ validatePropertyRelation(context) {
140
142
  let propertyRelationValidates = false;
141
143
 
142
144
  const propertyRelationString = this.propertyRelation.getString();
@@ -188,16 +190,17 @@ export default define(class PropertyAssertion extends Assertion {
188
190
  return validatesWhenDerived;
189
191
  }
190
192
 
191
- assign(stated, context) {
193
+ assign(context) {
194
+ const stated = context.isStated();
195
+
192
196
  if (!stated) {
193
197
  return;
194
198
  }
195
199
 
196
200
  const propertyAssertion = this, ///
197
- variableAssigment = variableAssignmentFromPrepertyAssertion(propertyAssertion, context),
198
- assignment = variableAssigment; ///
201
+ variableAssigment = variableAssignmentFromPrepertyAssertion(propertyAssertion, context);
199
202
 
200
- context.addAssignment(assignment);
203
+ context.addAssignment(variableAssigment);
201
204
  }
202
205
 
203
206
  static name = "PropertyAssertion";
@@ -208,7 +211,7 @@ export default define(class PropertyAssertion extends Assertion {
208
211
  const { name } = json;
209
212
 
210
213
  if (this.name === name) {
211
- propertyAssertion = instantiate((context) => {
214
+ instantiate((context) => {
212
215
  const { string } = json,
213
216
  propertyAssertionNode = instantiatePropertyAssertion(string, context),
214
217
  node = propertyAssertionNode, ///
@@ -217,9 +220,7 @@ export default define(class PropertyAssertion extends Assertion {
217
220
 
218
221
  context = null;
219
222
 
220
- const propertyAssertion = new PropertyAssertion(context, string, node, term, propertyRelation);
221
-
222
- return propertyAssertion;
223
+ propertyAssertion = new PropertyAssertion(context, string, node, term, propertyRelation);
223
224
  }, context);
224
225
  }
225
226
 
@@ -34,7 +34,7 @@ export default define(class SatisfiesAssertion extends Assertion {
34
34
 
35
35
  correlateSubstitutions(substitutions, context) { return this.signature.correlateSubstitutions(substitutions, context); }
36
36
 
37
- validate(stated, context) {
37
+ validate(context) {
38
38
  let satisfiesAssertion = null;
39
39
 
40
40
  const satisfiesAssertionString = this.getString(); ///
@@ -50,10 +50,10 @@ export default define(class SatisfiesAssertion extends Assertion {
50
50
  } else {
51
51
  let validates = true;
52
52
 
53
- const signatureVerifies = this.validateSignature(stated, context);
53
+ const signatureVerifies = this.validateSignature(context);
54
54
 
55
55
  if (signatureVerifies) {
56
- const referenceVerifies = this.validateReference(stated, context);
56
+ const referenceVerifies = this.validateReference(context);
57
57
 
58
58
  if (referenceVerifies) {
59
59
  validates = true;
@@ -76,7 +76,7 @@ export default define(class SatisfiesAssertion extends Assertion {
76
76
  return satisfiesAssertion;
77
77
  }
78
78
 
79
- validateSignature(stated, context) {
79
+ validateSignature(context) {
80
80
  let signatureValidates = false;
81
81
 
82
82
  const signature = this.signature.validate(context);
@@ -88,7 +88,7 @@ export default define(class SatisfiesAssertion extends Assertion {
88
88
  return signatureValidates;
89
89
  }
90
90
 
91
- validateReference(stated, context) {
91
+ validateReference(context) {
92
92
  let referenceVerifies = false;
93
93
 
94
94
  const referenceString = this.reference.getString(),
@@ -96,7 +96,7 @@ export default define(class SatisfiesAssertion extends Assertion {
96
96
 
97
97
  context.trace(`Validating the '${satisfiesAssertionString}' satisfies assertino's '${referenceString}' reference...`);
98
98
 
99
- const axiom = context.findAxiomByReference(this.reference, context);
99
+ const axiom = context.findAxiomByReference(this.reference);
100
100
 
101
101
  if (axiom !== null) {
102
102
  const axiomSatisfiable = axiom.isSatisfiable();
@@ -165,7 +165,7 @@ export default define(class SatisfiesAssertion extends Assertion {
165
165
  const { name } = json;
166
166
 
167
167
  if (this.name === name) {
168
- satisfiesAssertion = instantiate((context) => {const { string } = json,
168
+ instantiate((context) => {const { string } = json,
169
169
  definedAssertionNode = instantiateSatisfiesAssertion(string, context),
170
170
  node = definedAssertionNode, ///
171
171
  signature = signatureFromJSatisfiesAssertionNode(definedAssertionNode, context),
@@ -173,9 +173,7 @@ export default define(class SatisfiesAssertion extends Assertion {
173
173
 
174
174
  context = null;
175
175
 
176
- const satisfiesAssertion = new SatisfiesAssertion(context, string, node, signature, reference);
177
-
178
- return satisfiesAssertion;
176
+ satisfiesAssertion = new SatisfiesAssertion(context, string, node, signature, reference);
179
177
  }, context);
180
178
  }
181
179
 
@@ -6,7 +6,7 @@ import Assertion from "../assertion";
6
6
 
7
7
  import { define } from "../../elements";
8
8
  import { reconcile } from "../../utilities/context";
9
- import { join, instantiate } from "../../utilities/context";
9
+ import { join, descend, instantiate } from "../../utilities/context";
10
10
  import { instantiateSubproofAssertion } from "../../process/instantiate";
11
11
 
12
12
  const { last, front, backwardsEvery } = arrayUtilities;
@@ -49,7 +49,7 @@ export default define(class SubproofAssertion extends Assertion {
49
49
  return subproofAssertionNode;
50
50
  }
51
51
 
52
- validate(stated, context) {
52
+ validate(context) {
53
53
  let subproofAssertion = null;
54
54
 
55
55
  const subproofAssertionString = this.getString(); ///
@@ -65,7 +65,7 @@ export default define(class SubproofAssertion extends Assertion {
65
65
  } else {
66
66
  let validates = false;
67
67
 
68
- const statementsValidate = this.validateStatements(stated, context);
68
+ const statementsValidate = this.validateStatements(context);
69
69
 
70
70
  if (statementsValidate) {
71
71
  validates = true;
@@ -85,17 +85,17 @@ export default define(class SubproofAssertion extends Assertion {
85
85
  return subproofAssertion;
86
86
  }
87
87
 
88
- validateStatements(stated, context) {
89
- stated = true; ///
90
-
91
- const statementsValidate = this.statements.map((statement) => {
88
+ validateStatements(context) {
89
+ const statementsValidate = this.statements.every((statement) => {
92
90
  let statementValidates = false;
93
91
 
94
- statement = statement.validate(stated, context); ///
92
+ descend((context) => {
93
+ statement = statement.validate(context); ///
95
94
 
96
- if (statement !== null) {
97
- statementValidates = true;
98
- }
95
+ if (statement !== null) {
96
+ statementValidates = true;
97
+ }
98
+ }, context);
99
99
 
100
100
  if (statementValidates) {
101
101
  return true;
@@ -239,7 +239,7 @@ export default define(class SubproofAssertion extends Assertion {
239
239
  return suppositionUnifies;
240
240
  }
241
241
 
242
- unifySuppositions(suppositions, generalContext, specificContext) {
242
+ unifySuppositions(suppositions, generalContxt, spsecificContext) {
243
243
  let suppositionsUnify = false;
244
244
 
245
245
  const supposedStatements = this.getSupposedStatements(),
@@ -248,7 +248,7 @@ export default define(class SubproofAssertion extends Assertion {
248
248
 
249
249
  if (suppositionsLength === supposedStatementsLength) {
250
250
  suppositionsUnify = backwardsEvery(suppositions, (supposition, index) => {
251
- const suppositionUnifies = this.unifySupposition(supposition, index, generalContext, specificContext);
251
+ const suppositionUnifies = this.unifySupposition(supposition, index, generalContxt, spsecificContext);
252
252
 
253
253
  if (suppositionUnifies) {
254
254
  return true;
@@ -259,30 +259,27 @@ export default define(class SubproofAssertion extends Assertion {
259
259
  return suppositionsUnify;
260
260
  }
261
261
 
262
- unifyTopLevelMetaAssertion(topLevelMetaAssertion, generalContext, specificContext) {
262
+ unifyTopLevelMetaAssertion(topLevelMetaAssertion, context) {
263
263
  let topLevelMetaAssertionUnifies = false;
264
264
 
265
- const context = specificContext, ///
265
+ const generalContext = context, ///
266
+ specificContext = context, ///
266
267
  subproofAssertionString = this.getString(), ///
267
268
  topLevelMetaAssertionString = topLevelMetaAssertion.getString();
268
269
 
269
270
  context.trace(`Unifying the '${topLevelMetaAssertionString}' top level meta-assertion with the '${subproofAssertionString}' subproof assertion...`);
270
271
 
271
- reconcile((specificContext) => {
272
- const deduction = topLevelMetaAssertion.getDeduction(),
273
- deductionUnifies = this.unifyDeduction(deduction, generalContext, specificContext);
274
-
275
- if (deductionUnifies) {
276
- const suppositions = topLevelMetaAssertion.getSuppositions(),
277
- suppositionsUnify = this.unifySuppositions(suppositions, generalContext, specificContext);
272
+ const deduction = topLevelMetaAssertion.getDeduction(),
273
+ deductionUnifies = this.unifyDeduction(deduction, generalContext, specificContext);
278
274
 
279
- if (suppositionsUnify) {
280
- specificContext.commit();
275
+ if (deductionUnifies) {
276
+ const suppositions = topLevelMetaAssertion.getSuppositions(),
277
+ suppositionsUnify = this.unifySuppositions(suppositions, generalContext, specificContext);
281
278
 
282
- topLevelMetaAssertionUnifies = true;
283
- }
279
+ if (suppositionsUnify) {
280
+ topLevelMetaAssertionUnifies = true;
284
281
  }
285
- }, specificContext);
282
+ }
286
283
 
287
284
  if (topLevelMetaAssertionUnifies) {
288
285
  context.debug(`...unified the '${topLevelMetaAssertionString}' top level meta-assertion with the '${subproofAssertionString}' subproof assertion.`);
@@ -299,7 +296,7 @@ export default define(class SubproofAssertion extends Assertion {
299
296
  const { name } = json;
300
297
 
301
298
  if (this.name === name) {
302
- subproorAssertion = instantiate((context) => {
299
+ instantiate((context) => {
303
300
  const { string } = json,
304
301
  subproofAssertionNode = instantiateSubproofAssertion(string, context),
305
302
  statements = statementsFromSubproofAssertionNode(subproofAssertionNode, context),
@@ -307,9 +304,7 @@ export default define(class SubproofAssertion extends Assertion {
307
304
 
308
305
  context = null;
309
306
 
310
- const subproorAssertion = new SubproofAssertion(context, string, node, statements);
311
-
312
- return subproorAssertion;
307
+ subproorAssertion = new SubproofAssertion(context, string, node, statements);
313
308
  }, context);
314
309
  }
315
310
 
@@ -32,7 +32,7 @@ export default define(class TypeAssertion extends Assertion {
32
32
  return typeAssertionNode;
33
33
  }
34
34
 
35
- validate(stated, context) {
35
+ validate(context) {
36
36
  let typeAssertion = null;
37
37
 
38
38
  const typeAssertionString = this.getString(); ///
@@ -51,6 +51,8 @@ export default define(class TypeAssertion extends Assertion {
51
51
  const typeValidates = this.validateType(context);
52
52
 
53
53
  if (typeValidates) {
54
+ const stated = context.isStated();
55
+
54
56
  let validatesWhenStated = false,
55
57
  validatesWhenDerived = false;
56
58
 
@@ -70,7 +72,7 @@ export default define(class TypeAssertion extends Assertion {
70
72
 
71
73
  typeAssertion = assertion; ///
72
74
 
73
- this.assign(stated, context);
75
+ this.assign(context);
74
76
 
75
77
  context.addAssertion(assertion);
76
78
 
@@ -177,7 +179,9 @@ export default define(class TypeAssertion extends Assertion {
177
179
  return validatesWhenDerived;
178
180
  }
179
181
 
180
- assign(stated, context) {
182
+ assign(context) {
183
+ const stated = context.isStated();
184
+
181
185
  if (!stated) {
182
186
  return;
183
187
  }
@@ -185,11 +189,7 @@ export default define(class TypeAssertion extends Assertion {
185
189
  const typeAssertion = this, ///
186
190
  variableAssigment = variableAssignmentFromTypeAssertion(typeAssertion, context);
187
191
 
188
- if (variableAssigment !== null) {
189
- const assignment = variableAssigment; ///
190
-
191
- context.addAssignment(assignment);
192
- }
192
+ context.addAssignment(variableAssigment);
193
193
  }
194
194
 
195
195
  toJSON() {
@@ -214,7 +214,7 @@ export default define(class TypeAssertion extends Assertion {
214
214
  const { name } = json;
215
215
 
216
216
  if (this.name === name) {
217
- typeAssertion = instantiate((context) => {
217
+ instantiate((context) => {
218
218
  const { string } = json,
219
219
  typeAssertionNode = instantiateTypeAssertion(string, context),
220
220
  term = termFromTypeAssertionNode(typeAssertionNode, context),
@@ -223,9 +223,7 @@ export default define(class TypeAssertion extends Assertion {
223
223
 
224
224
  context = null;
225
225
 
226
- const typeAssertion = new TypeAssertion(context, string, node, term, type);
227
-
228
- return typeAssertion;
226
+ typeAssertion = new TypeAssertion(context, string, node, term, type);
229
227
  }, context);
230
228
  }
231
229