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,11 +3,10 @@
3
3
  import Substitution from "../substitution";
4
4
 
5
5
  import { define } from "../../elements";
6
- import { instantiate } from "../../utilities/context";
7
6
  import { instantiateMetaLevelSubstitution } from "../../process/instantiate";
8
7
  import { metaLevelSubstitutionFromMetaLevelSubstitutionNode } from "../../utilities/element";
9
8
  import { metaLevelSubstitutionStringFromStatementAndReference } from "../../utilities/string";
10
- import { ephemeralContextFromJSON, ephemeralContextToEphemeralContextJSON } from "../../utilities/json";
9
+ import { descend, simplify, serialise, unserialise, instantiate } from "../../utilities/context";
11
10
 
12
11
  export default define(class MetaLevelSubstitution extends Substitution {
13
12
  constructor(context, string, node, targetReference, replacementStatement) {
@@ -65,11 +64,8 @@ export default define(class MetaLevelSubstitution extends Substitution {
65
64
  validate(generalContext, specificContext) {
66
65
  let metaLevelSubstitution = null;
67
66
 
68
- const context = this.getContext();
69
-
70
- specificContext = context; ///
71
-
72
- const metaLevelSubstitutionString = this.getString(); ///
67
+ const context = specificContext, ///
68
+ metaLevelSubstitutionString = this.getString(); ///
73
69
 
74
70
  context.trace(`Validating the '${metaLevelSubstitutionString}' meta-level substitution...`);
75
71
 
@@ -127,20 +123,21 @@ export default define(class MetaLevelSubstitution extends Substitution {
127
123
  }
128
124
 
129
125
  validateReplacementStatement(generalContext, specificContext) {
130
- let replacementStatementValidates;
126
+ let replacementStatementValidates = false;
131
127
 
132
- const context = specificContext, ///
128
+ const context = this.getContext(),
133
129
  replacementStatementString = this.replacementStatement.getString(),
134
130
  metaLevelSubstitutionString = this.getString(); ///
135
131
 
136
132
  context.trace(`Validating the '${metaLevelSubstitutionString}' meta-level substitution's '${replacementStatementString}' replacement statement...`);
137
133
 
138
- const stated = true,
139
- replacementStatement = this.replacementStatement.validate(stated, context);
134
+ descend((context) => {
135
+ const replacementStatement = this.replacementStatement.validate(context);
140
136
 
141
- if (replacementStatement !== null) {
142
- replacementStatementValidates = true;
143
- }
137
+ if (replacementStatement !== null) {
138
+ replacementStatementValidates = true;
139
+ }
140
+ }, context);
144
141
 
145
142
  if (replacementStatementValidates) {
146
143
  context.debug(`...validated the '${metaLevelSubstitutionString}' meta-level substitution's '${replacementStatementString}' replacement statement.`);
@@ -150,53 +147,53 @@ export default define(class MetaLevelSubstitution extends Substitution {
150
147
  }
151
148
 
152
149
  toJSON() {
153
- let context;
154
-
155
- context = this.getContext();
156
-
157
- const ephemeralContext = context, ///
158
- ephemeralContextJSON = ephemeralContextToEphemeralContextJSON(ephemeralContext),
159
- contextJSON = ephemeralContextJSON; ///
160
-
161
- context = contextJSON; ///
150
+ const context = this.getContext();
162
151
 
163
- const string = this.getString(),
164
- json = {
165
- context,
166
- string
167
- };
152
+ return serialise((context) => {
153
+ const string = this.getString(),
154
+ json = {
155
+ context,
156
+ string
157
+ };
168
158
 
169
- return json;
159
+ return json;
160
+ }, context);
170
161
  }
171
162
 
172
163
  static name = "MetaLevelSubstitution";
173
164
 
174
165
  static fromJSON(json, context) {
175
- const ephemeralContext = ephemeralContextFromJSON(json, context);
166
+ let metaLevelSubstitution;
176
167
 
177
- context = ephemeralContext; ///
168
+ unserialise((json, context) => {
169
+ instantiate((context) => {
170
+ const { string } = json,
171
+ metaLevelSubstitutionNode = instantiateMetaLevelSubstitution(string, context),
172
+ node = metaLevelSubstitutionNode, ///
173
+ targetReference = targetReferenceFromMetaLevelSubstitutionNode(metaLevelSubstitutionNode, context),
174
+ replacementStatement = replacementStatementFromMetaLevelSubstitutionNode(metaLevelSubstitutionNode, context);
178
175
 
179
- return instantiate((context) => {
180
- const { string } = json,
181
- metaLevelSubstitutionNode = instantiateMetaLevelSubstitution(string, context),
182
- node = metaLevelSubstitutionNode, ///
183
- targetReference = targetReferenceFromMetaLevelSubstitutionNode(metaLevelSubstitutionNode, context),
184
- replacementStatement = replacementStatementFromMetaLevelSubstitutionNode(metaLevelSubstitutionNode, context),
185
- metaLevelSubstitution = new MetaLevelSubstitution(context, string, node, targetReference, replacementStatement);
176
+ metaLevelSubstitution = new MetaLevelSubstitution(context, string, node, targetReference, replacementStatement);
177
+ }, context);
178
+ }, json, context);
186
179
 
187
- return metaLevelSubstitution;
188
- }, context);
180
+ return metaLevelSubstitution;
189
181
  }
190
182
 
191
183
  static fromStatementAndReference(statement, reference, context) {
192
- return instantiate((context) => {
193
- const metaLevelSubstitutionString = metaLevelSubstitutionStringFromStatementAndReference(statement, reference),
194
- string = metaLevelSubstitutionString, ///
195
- metaLevelSubstitutionNode = instantiateMetaLevelSubstitution(string, context),
196
- metaLevelSubstitution = metaLevelSubstitutionFromMetaLevelSubstitutionNode(metaLevelSubstitutionNode, context);
184
+ let metaLevelSubstitution;
185
+
186
+ simplify((context) => {
187
+ instantiate((context) => {
188
+ const metaLevelSubstitutionString = metaLevelSubstitutionStringFromStatementAndReference(statement, reference),
189
+ string = metaLevelSubstitutionString, ///
190
+ metaLevelSubstitutionNode = instantiateMetaLevelSubstitution(string, context);
197
191
 
198
- return metaLevelSubstitution;
192
+ metaLevelSubstitution = metaLevelSubstitutionFromMetaLevelSubstitutionNode(metaLevelSubstitutionNode, context);
193
+ }, context);
199
194
  }, context);
195
+
196
+ return metaLevelSubstitution;
200
197
  }
201
198
  });
202
199
 
@@ -3,7 +3,7 @@
3
3
  import Substitution from "../substitution";
4
4
 
5
5
  import { define } from "../../elements";
6
- import { instantiate } from "../../utilities/context";
6
+ import { simplify, instantiate } from "../../utilities/context";
7
7
  import { instantiateReferenceSubstitution } from "../../process/instantiate";
8
8
  import { referenceSubstitutionFromReferenceSubstitutionNode } from "../../utilities/element";
9
9
  import { referenceSubstitutionStringFromReferenceAndMetavariable } from "../../utilities/string";
@@ -73,11 +73,8 @@ export default define(class ReferenceSubstitution extends Substitution {
73
73
  validate(generalContext, specificContext) {
74
74
  let referenceSubstitution = null;
75
75
 
76
- const context = this.getContext();
77
-
78
- specificContext = context; ///
79
-
80
- const referenceSubstitutionString = this.getString(); ///
76
+ const context = specificContext, ///
77
+ referenceSubstitutionString = this.getString(); ///
81
78
 
82
79
  context.trace(`Validating the '${referenceSubstitutionString}' reference substitution...`);
83
80
 
@@ -139,7 +136,7 @@ export default define(class ReferenceSubstitution extends Substitution {
139
136
  validateReplacementReference(generalContext, specificContext) {
140
137
  let replacementReferenceValidates = false;
141
138
 
142
- const context = specificContext, ///
139
+ const context = this.getContext(),
143
140
  replacementReferenceString = this.replacementReference.getString(),
144
141
  referenceSubstitutionString = this.getString(); ///
145
142
 
@@ -166,7 +163,7 @@ export default define(class ReferenceSubstitution extends Substitution {
166
163
  const { name } = json;
167
164
 
168
165
  if (this.name === name) {
169
- referenceSubstitutionn = instantiate((context) => {
166
+ instantiate((context) => {
170
167
  const { string } = json,
171
168
  referenceSubstitutionNode = instantiateReferenceSubstitution(string, context),
172
169
  node = referenceSubstitutionNode, ///
@@ -175,9 +172,7 @@ export default define(class ReferenceSubstitution extends Substitution {
175
172
 
176
173
  context = null;
177
174
 
178
- const referenceSubstitutionn = new ReferenceSubstitution(context, string, node, targetReference, replacementReference);
179
-
180
- return referenceSubstitutionn;
175
+ referenceSubstitutionn = new ReferenceSubstitution(context, string, node, targetReference, replacementReference);
181
176
  }, context);
182
177
  }
183
178
 
@@ -185,14 +180,19 @@ export default define(class ReferenceSubstitution extends Substitution {
185
180
  }
186
181
 
187
182
  static fromReferenceAndMetavariable(reference, metavariable, context) {
188
- return instantiate((context) => {
189
- const referenceSubstitutionString = referenceSubstitutionStringFromReferenceAndMetavariable(reference, metavariable),
190
- string = referenceSubstitutionString, ///
191
- referenceSubstitutionNode = instantiateReferenceSubstitution(string, context),
192
- referenceSubstitution = referenceSubstitutionFromReferenceSubstitutionNode(referenceSubstitutionNode, context);
183
+ let referenceSubstitution;
184
+
185
+ simplify((context) => {
186
+ instantiate((context) => {
187
+ const referenceSubstitutionString = referenceSubstitutionStringFromReferenceAndMetavariable(reference, metavariable),
188
+ string = referenceSubstitutionString, ///
189
+ referenceSubstitutionNode = instantiateReferenceSubstitution(string, context);
193
190
 
194
- return referenceSubstitution;
191
+ referenceSubstitution = referenceSubstitutionFromReferenceSubstitutionNode(referenceSubstitutionNode, context);
192
+ }, context);
195
193
  }, context);
194
+
195
+ return referenceSubstitution;
196
196
  }
197
197
  });
198
198
 
@@ -4,9 +4,9 @@ import Substitution from "../substitution";
4
4
 
5
5
  import { define } from "../../elements";
6
6
  import { unifySubstitution } from "../../process/unify";
7
- import { join, reconcile, instantiate } from "../../utilities/context";
8
7
  import { stripBracketsFromStatement } from "../../utilities/brackets";
9
8
  import { instantiateStatementSubstitution } from "../../process/instantiate";
9
+ import { join, simplify, descend, reconcile, instantiate } from "../../utilities/context";
10
10
  import { statementSubstitutionFromStatementSubstitutionNode } from "../../utilities/element";
11
11
  import { statementSubstitutionStringFromStatementAndMetavariable, statementSubstitutionStringFromStatementMetavariableAndSubstitution } from "../../utilities/string";
12
12
 
@@ -108,11 +108,8 @@ export default define(class StatementSubstitution extends Substitution {
108
108
  validate(generalContext, specificContext) {
109
109
  let statementSubstitution = null;
110
110
 
111
- const context = this.getContext();
112
-
113
- specificContext = context; ///
114
-
115
- const statementSubstitutionString = this.getString(); ///
111
+ const context = specificContext, ///
112
+ statementSubstitutionString = this.getString(); ///
116
113
 
117
114
  context.trace(`Validating the '${statementSubstitutionString}' statement substitution...`);
118
115
 
@@ -161,12 +158,13 @@ export default define(class StatementSubstitution extends Substitution {
161
158
  const targetStatementSingular = this.targetStatement.isSingular();
162
159
 
163
160
  if (targetStatementSingular) {
164
- const stated = true,
165
- targetStatement = this.targetStatement.validate(stated, context);
161
+ descend((context) => {
162
+ const targetStatement = this.targetStatement.validate(context);
166
163
 
167
- if (targetStatement !== null) {
168
- targetStatementValidates = true;
169
- }
164
+ if (targetStatement !== null) {
165
+ targetStatementValidates = true;
166
+ }
167
+ }, context);
170
168
  } else {
171
169
  context.debug(`The '${statementSubstitutionString}' statement substitution's '${targetStatementString}' target statement is not singular.`);
172
170
  }
@@ -179,20 +177,21 @@ export default define(class StatementSubstitution extends Substitution {
179
177
  }
180
178
 
181
179
  validateReplacementStatement(generalContext, specificContext) {
182
- let replacementStatementValidates;
180
+ let replacementStatementValidates = false;
183
181
 
184
- const context = specificContext, ///
182
+ const context = this.getContext(),
185
183
  replacementStatementString = this.replacementStatement.getString(),
186
184
  statementSubstitutionString = this.getString(); ///
187
185
 
188
186
  context.trace(`Validating the '${statementSubstitutionString}' statement substitution's '${replacementStatementString}' replacement statement...`);
189
187
 
190
- const stated = true,
191
- replacementStatement = this.replacementStatement.validate(stated, context);
188
+ descend((context) => {
189
+ const replacementStatement = this.replacementStatement.validate(context);
192
190
 
193
- if (replacementStatement !== null) {
194
- replacementStatementValidates = true;
195
- }
191
+ if (replacementStatement !== null) {
192
+ replacementStatementValidates = true;
193
+ }
194
+ }, context);
196
195
 
197
196
  if (replacementStatementValidates) {
198
197
  context.debug(`...validated the '${statementSubstitutionString}' statement substitution's '${replacementStatementString}' replacement statement.`);
@@ -227,7 +226,7 @@ export default define(class StatementSubstitution extends Substitution {
227
226
  return substitutionUnifies;
228
227
  }
229
228
 
230
- uniffyComplexSubstitution(complexSubstitution, generalContext, specificContext) {
229
+ unifyComplexSubstitution(complexSubstitution, generalContext, specificContext) {
231
230
  let substitution = null;
232
231
 
233
232
  const context = specificContext, ///
@@ -287,19 +286,15 @@ export default define(class StatementSubstitution extends Substitution {
287
286
  unifyWithSimpleSubstitution(simpleSubstitution, generalContext, specificContext) {
288
287
  let substitution;
289
288
 
290
- const complexSubstitution = this; ///
291
-
292
- let context;
293
-
294
- context = this.getContext();
295
-
296
- specificContext = context; ///
289
+ const complexSubstitution = this, ///
290
+ simpleSubstitutionContext = simpleSubstitution.getContext(),
291
+ complexSubstitutionContext = complexSubstitution.getContext();
297
292
 
298
- context = simpleSubstitution.getContext();
293
+ generalContext = simpleSubstitutionContext; ///
299
294
 
300
- generalContext = context; ///
295
+ specificContext = complexSubstitutionContext; ///
301
296
 
302
- substitution = simpleSubstitution.uniffyComplexSubstitution(complexSubstitution, generalContext, specificContext);
297
+ substitution = simpleSubstitution.unifyComplexSubstitution(complexSubstitution, generalContext, specificContext);
303
298
 
304
299
  return substitution;
305
300
  }
@@ -320,20 +315,19 @@ export default define(class StatementSubstitution extends Substitution {
320
315
 
321
316
  if (substitution !== null) {
322
317
  const complexSubstitution = this, ///
323
- simpleSubstitutionComplex = simpleSubstitution.getContext(),
318
+ simpleSubstitutionContext = simpleSubstitution.getContext(),
324
319
  complexSubstitutionContext = complexSubstitution.getContext();
325
320
 
326
321
  join((context) => {
327
- const specificContext = context; ///
328
-
329
- context = this.substitution.getContext();
330
-
331
- const generalContext = context; ///
332
-
333
- this.unifySubstitution(substitution, generalContext, specificContext);
334
- }, complexSubstitutionContext, simpleSubstitutionComplex, context);
335
-
336
- resolved = true;
322
+ const substitutionContext = this.substitution.getContext(),
323
+ generalContext = substitutionContext, ///
324
+ specificContext = context, ///
325
+ substitutionUnifies = this.unifySubstitution(substitution, generalContext, specificContext);
326
+
327
+ if (substitutionUnifies) {
328
+ resolved = true;
329
+ }
330
+ }, complexSubstitutionContext, simpleSubstitutionContext, context);
337
331
  }
338
332
  }
339
333
 
@@ -352,7 +346,7 @@ export default define(class StatementSubstitution extends Substitution {
352
346
  const { name } = json;
353
347
 
354
348
  if (this.name === name) {
355
- statementSubstitutionn = instantiate((context) => {
349
+ instantiate((context) => {
356
350
  const { string } = json,
357
351
  statementSubstitutionNode = instantiateStatementSubstitution(string, context),
358
352
  node = statementSubstitutionNode, ///
@@ -361,9 +355,7 @@ export default define(class StatementSubstitution extends Substitution {
361
355
 
362
356
  context = null;
363
357
 
364
- const statementSubstitutionn = new StatementSubstitution(context, string, node, targetStatement, replacementStatement);
365
-
366
- return statementSubstitutionn;
358
+ statementSubstitutionn = new StatementSubstitution(context, string, node, targetStatement, replacementStatement);
367
359
  }, context);
368
360
  }
369
361
 
@@ -373,27 +365,37 @@ export default define(class StatementSubstitution extends Substitution {
373
365
  static fromStatementAndMetavariable(statement, metavariable, context) {
374
366
  statement = stripBracketsFromStatement(statement, context); ///
375
367
 
376
- return instantiate((context) => {
377
- const statementSubstitutionString = statementSubstitutionStringFromStatementAndMetavariable(statement, metavariable, context),
378
- string = statementSubstitutionString, ///
379
- statementSubstitutionNode = instantiateStatementSubstitution(string, context),
380
- statementSubstitution = statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, context);
368
+ let statementSubstitution;
369
+
370
+ simplify((context) => {
371
+ instantiate((context) => {
372
+ const statementSubstitutionString = statementSubstitutionStringFromStatementAndMetavariable(statement, metavariable, context),
373
+ string = statementSubstitutionString, ///
374
+ statementSubstitutionNode = instantiateStatementSubstitution(string, context);
381
375
 
382
- return statementSubstitution;
376
+ statementSubstitution = statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, context);
377
+ }, context);
383
378
  }, context);
379
+
380
+ return statementSubstitution;
384
381
  }
385
382
 
386
383
  static fromStatementMetavariableAndSubstitution(statement, metavariable, substitution, context) {
387
384
  statement = stripBracketsFromStatement(statement, context); ///
388
385
 
389
- return instantiate((context) => {
390
- const statementSubstitutionString = statementSubstitutionStringFromStatementMetavariableAndSubstitution(statement, metavariable, substitution),
391
- string = statementSubstitutionString, ///
392
- statementSubstitutionNode = instantiateStatementSubstitution(string, context),
393
- statementSubstitution = statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, context);
386
+ let statementSubstitution;
387
+
388
+ simplify((context) => {
389
+ instantiate((context) => {
390
+ const statementSubstitutionString = statementSubstitutionStringFromStatementMetavariableAndSubstitution(statement, metavariable, substitution),
391
+ string = statementSubstitutionString, ///
392
+ statementSubstitutionNode = instantiateStatementSubstitution(string, context);
394
393
 
395
- return statementSubstitution;
394
+ statementSubstitution = statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, context);
395
+ }, context);
396
396
  }, context);
397
+
398
+ return statementSubstitution;
397
399
  }
398
400
  });
399
401
 
@@ -3,7 +3,7 @@
3
3
  import Substitution from "../substitution";
4
4
 
5
5
  import { define } from "../../elements";
6
- import { instantiate } from "../../utilities/context";
6
+ import { simplify, instantiate } from "../../utilities/context";
7
7
  import { stripBracketsFromTerm } from "../../utilities/brackets";
8
8
  import { instantiateTermSubstitution } from "../../process/instantiate";
9
9
  import { termSubstitutionStringFromTermAndVariable } from "../../utilities/string";
@@ -76,11 +76,8 @@ export default define(class TermSubstitution extends Substitution {
76
76
  validate(generalContext, specificContext) {
77
77
  let termSubstitution = null;
78
78
 
79
- const context = this.getContext();
80
-
81
- specificContext = context; ///
82
-
83
- const termSubstitutionString = this.getString(); ///
79
+ const context = specificContext, ///
80
+ termSubstitutionString = this.getString(); ///
84
81
 
85
82
  context.trace(`Validating the '${termSubstitutionString}' term substitution...`);
86
83
 
@@ -154,7 +151,7 @@ export default define(class TermSubstitution extends Substitution {
154
151
  validateReplacementTerm(generalContext, specificContext) {
155
152
  let replacementTermValidates = false;
156
153
 
157
- const context = specificContext, ///
154
+ const context = this.getContext(),
158
155
  replacementTermString = this.replacementTerm.getString(),
159
156
  termSubstitutionString = this.getString(); ///
160
157
 
@@ -187,7 +184,7 @@ export default define(class TermSubstitution extends Substitution {
187
184
  const { name } = json;
188
185
 
189
186
  if (this.name === name) {
190
- termSubstitutionn = instantiate((context) => {
187
+ instantiate((context) => {
191
188
  const { string } = json,
192
189
  termSubstitutionNode = instantiateTermSubstitution(string, context),
193
190
  node = termSubstitutionNode, ///
@@ -196,9 +193,7 @@ export default define(class TermSubstitution extends Substitution {
196
193
 
197
194
  context = null;
198
195
 
199
- const termSubstitutionn = new TermSubstitution(context, string, node, targetTerm, replacementTerm);
200
-
201
- return termSubstitutionn;
196
+ termSubstitutionn = new TermSubstitution(context, string, node, targetTerm, replacementTerm);
202
197
  }, context);
203
198
  }
204
199
 
@@ -215,14 +210,19 @@ export default define(class TermSubstitution extends Substitution {
215
210
  static fromTermAndVariable(term, variable, context) {
216
211
  term = stripBracketsFromTerm(term, context); ///
217
212
 
218
- return instantiate((context) => {
219
- const termSubstitutionString = termSubstitutionStringFromTermAndVariable(term, variable),
220
- string = termSubstitutionString, ///
221
- termSubstitutionNode = instantiateTermSubstitution(string, context),
222
- termSubstitution = termSubstitutionFromTermSubstitutionNode(termSubstitutionNode, context);
213
+ let termSubstitution;
214
+
215
+ simplify((context) => {
216
+ instantiate((context) => {
217
+ const termSubstitutionString = termSubstitutionStringFromTermAndVariable(term, variable),
218
+ string = termSubstitutionString, ///
219
+ termSubstitutionNode = instantiateTermSubstitution(string, context);
223
220
 
224
- return termSubstitution;
221
+ termSubstitution = termSubstitutionFromTermSubstitutionNode(termSubstitutionNode, context);
222
+ }, context);
225
223
  }, context);
224
+
225
+ return termSubstitution;
226
226
  }
227
227
  });
228
228
 
@@ -41,40 +41,6 @@ export default define(class Term extends Element {
41
41
  return variableIdentifier;
42
42
  }
43
43
 
44
- matchTermNode(termNode) {
45
- const node = termNode, ///
46
- nodeMatches = this.matchNode(node),
47
- termNodeMatches = nodeMatches; ///
48
-
49
- return termNodeMatches;
50
- }
51
-
52
- compareVariableIdentifier(variableIdentifier) {
53
- let comparesToVariableIdentifier = false;
54
-
55
- const singular = this.isSingular();
56
-
57
- if (singular) {
58
- const variableIdentifierA = variableIdentifier; ///
59
-
60
- variableIdentifier = this.getVariableIdentifier();
61
-
62
- const variableIdentifierB = variableIdentifier;
63
-
64
- comparesToVariableIdentifier = (variableIdentifierA === variableIdentifierB);
65
- }
66
-
67
- return comparesToVariableIdentifier;
68
- }
69
-
70
- findValidTerm(context) {
71
- const termNode = this.getTermNode(),
72
- term = context.findTermByTermNode(termNode),
73
- validTerm = term; ///
74
-
75
- return validTerm;
76
- }
77
-
78
44
  isEqualTo(term) {
79
45
  const termNode = term.getNode(),
80
46
  termNodeMatches = this.matchTermNode(termNode),
@@ -127,6 +93,22 @@ export default define(class Term extends Element {
127
93
  return implicitlyGrounded;
128
94
  }
129
95
 
96
+ matchTermNode(termNode) {
97
+ const node = termNode, ///
98
+ nodeMatches = this.matchNode(node),
99
+ termNodeMatches = nodeMatches; ///
100
+
101
+ return termNodeMatches;
102
+ }
103
+
104
+ compareTerm(term) {
105
+ const termNode = term.getNode(),
106
+ termNodeMatches = this.matchNode(termNode),
107
+ comparesTo = termNodeMatches; ///
108
+
109
+ return comparesTo;
110
+ }
111
+
130
112
  compareParameter(parameter) {
131
113
  let comparesToParamter = false;
132
114
 
@@ -147,6 +129,32 @@ export default define(class Term extends Element {
147
129
  return comparesToParamter;
148
130
  }
149
131
 
132
+ compareVariableIdentifier(variableIdentifier) {
133
+ let comparesToVariableIdentifier = false;
134
+
135
+ const singular = this.isSingular();
136
+
137
+ if (singular) {
138
+ const variableIdentifierA = variableIdentifier; ///
139
+
140
+ variableIdentifier = this.getVariableIdentifier();
141
+
142
+ const variableIdentifierB = variableIdentifier;
143
+
144
+ comparesToVariableIdentifier = (variableIdentifierA === variableIdentifierB);
145
+ }
146
+
147
+ return comparesToVariableIdentifier;
148
+ }
149
+
150
+ findValidTerm(context) {
151
+ const termNode = this.getTermNode(),
152
+ term = context.findTermByTermNode(termNode),
153
+ validTerm = term; ///
154
+
155
+ return validTerm;
156
+ }
157
+
150
158
  validate(context, validateForwards) {
151
159
  let term = null;
152
160
 
@@ -42,7 +42,7 @@ export default class TopLevelMetaAssertion extends Element {
42
42
  return this.proof;
43
43
  }
44
44
 
45
- getSubstitutions() {
45
+ getMetaLevelSubstitutions() {
46
46
  return this.metaLevelSubstitutions;
47
47
  }
48
48
 
@@ -7,8 +7,8 @@ import elements from "../elements";
7
7
  import { define } from "../elements";
8
8
  import { instantiate } from "../utilities/context";
9
9
  import { instantiateVariable } from "../process/instantiate";
10
- import {identifierFromVarialbeNode, variableFromVariableNode} from "../utilities/element";
11
10
  import { typeFromJSON, typeToTypeJSON } from "../utilities/json";
11
+ import { variableFromTermNode, identifierFromVarialbeNode } from "../utilities/element";
12
12
 
13
13
  export default define(class Variable extends Element {
14
14
  constructor(context, string, node, type, identifier) {
@@ -198,4 +198,11 @@ export default define(class Variable extends Element {
198
198
  return variable;
199
199
  }, context);
200
200
  }
201
+
202
+ static fromTerm(term, context) {
203
+ const termNode = term.getNode(),
204
+ variable = variableFromTermNode(termNode, context);
205
+
206
+ return variable;
207
+ }
201
208
  });
@@ -23,7 +23,9 @@ export function judgementAssignmentFromJudgement(judgement, context) {
23
23
  }
24
24
 
25
25
  export function leftVariableAssignmentFromEquality(equality, context) {
26
- let leftVariableAssignment = null;
26
+ let leftVariableAssignment = (contxt) => {
27
+ ///
28
+ };
27
29
 
28
30
  const leftTermNode = equality.getLeftTermNode(),
29
31
  singularVariableNode = leftTermNode.getSingularVariableNode();
@@ -39,7 +41,9 @@ export function leftVariableAssignmentFromEquality(equality, context) {
39
41
  }
40
42
 
41
43
  export function rightVariableAssignmentFromEquality(equality, context) {
42
- let rightVariableAssignment = null;
44
+ let rightVariableAssignment = (context) => {
45
+ ///
46
+ };
43
47
 
44
48
  const rightTermNode = equality.getRightTermNode(),
45
49
  singularVariableNode = rightTermNode.getSingularVariableNode();
@@ -55,7 +59,9 @@ export function rightVariableAssignmentFromEquality(equality, context) {
55
59
  }
56
60
 
57
61
  export function variableAssignmentFromTypeAssertion(typeAssertion, context) {
58
- let variableAssignment = null;
62
+ let variableAssignment = (context) => {
63
+ ///
64
+ };
59
65
 
60
66
  const term = typeAssertion.getTerm(),
61
67
  termSingular = term.isSingular();