occam-verify-cli 1.0.753 → 1.0.758

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 (51) hide show
  1. package/lib/context/file/nominal.js +5 -5
  2. package/lib/context/scoped.js +6 -5
  3. package/lib/context/synthetic.js +5 -1
  4. package/lib/element/assertion/contained.js +1 -1
  5. package/lib/element/assertion/subproof.js +110 -13
  6. package/lib/element/assumption.js +20 -32
  7. package/lib/element/conclusion.js +1 -5
  8. package/lib/element/deduction.js +16 -19
  9. package/lib/element/derivation.js +4 -4
  10. package/lib/element/metavariable.js +7 -1
  11. package/lib/element/proof.js +6 -6
  12. package/lib/element/proofAssertion/premise.js +9 -15
  13. package/lib/element/proofAssertion/supposition.js +10 -16
  14. package/lib/element/reference.js +10 -8
  15. package/lib/element/statement.js +99 -58
  16. package/lib/element/subDerivation.js +4 -4
  17. package/lib/element/subproof.js +6 -6
  18. package/lib/element/substitution/statement.js +63 -46
  19. package/lib/element/topLevelAssertion/axiom.js +15 -13
  20. package/lib/element/topLevelAssertion.js +1 -4
  21. package/lib/element/topLevelMetaAssertion.js +26 -2
  22. package/lib/element/variable.js +3 -1
  23. package/lib/process/unify.js +41 -3
  24. package/lib/utilities/releaseContext.js +3 -3
  25. package/lib/utilities/string.js +2 -2
  26. package/package.json +3 -3
  27. package/src/context/file/nominal.js +4 -4
  28. package/src/context/scoped.js +6 -4
  29. package/src/context/synthetic.js +6 -0
  30. package/src/element/assertion/contained.js +1 -1
  31. package/src/element/assertion/subproof.js +189 -16
  32. package/src/element/assumption.js +20 -51
  33. package/src/element/conclusion.js +0 -7
  34. package/src/element/deduction.js +15 -21
  35. package/src/element/derivation.js +4 -3
  36. package/src/element/metavariable.js +15 -2
  37. package/src/element/proof.js +6 -6
  38. package/src/element/proofAssertion/premise.js +18 -28
  39. package/src/element/proofAssertion/supposition.js +23 -32
  40. package/src/element/reference.js +9 -7
  41. package/src/element/statement.js +153 -87
  42. package/src/element/subDerivation.js +4 -3
  43. package/src/element/subproof.js +4 -4
  44. package/src/element/substitution/statement.js +94 -64
  45. package/src/element/topLevelAssertion/axiom.js +20 -16
  46. package/src/element/topLevelAssertion.js +0 -2
  47. package/src/element/topLevelMetaAssertion.js +40 -1
  48. package/src/element/variable.js +5 -0
  49. package/src/process/unify.js +63 -1
  50. package/src/utilities/releaseContext.js +1 -1
  51. package/src/utilities/string.js +3 -3
@@ -473,9 +473,9 @@ export default class NominalFileContext extends FileContext {
473
473
  filter(metaLemmas, (metaLemma) => {
474
474
  const context = this, ///
475
475
  topLevelMetaAssertion = metaLemma, ///
476
- topLevelMetaAssertionUnifies = reference.unifyTopLevelMetaAssertion(topLevelMetaAssertion, context);
476
+ topLevelMetaAssertionCompares = reference.compareTopLevelMetaAssertion(topLevelMetaAssertion, context);
477
477
 
478
- if (topLevelMetaAssertionUnifies) {
478
+ if (topLevelMetaAssertionCompares) {
479
479
  return true;
480
480
  }
481
481
  });
@@ -502,9 +502,9 @@ export default class NominalFileContext extends FileContext {
502
502
  filter(metatheorems, (metatheorem) => {
503
503
  const context = this, ///
504
504
  topLevelMetaAssertion = metatheorem, ///
505
- topLevelMetaAssertionUnifies = reference.unifyTopLevelMetaAssertion(topLevelMetaAssertion, context);
505
+ topLevelMetaAssertionCompares = reference.compareTopLevelMetaAssertion(topLevelMetaAssertion, context);
506
506
 
507
- if (topLevelMetaAssertionUnifies) {
507
+ if (topLevelMetaAssertionCompares) {
508
508
  return true;
509
509
  }
510
510
  });
@@ -101,17 +101,19 @@ class ScopedContext extends Context {
101
101
  return proofAssertions;
102
102
  }
103
103
 
104
- getLastProofAssertion() {
105
- let lastProofAssertion = null;
104
+ getLastStep() {
105
+ let lastStep = null;
106
106
 
107
107
  const proofAssertions = this.getProofAssertions(),
108
108
  proofAssertionsLength = proofAssertions.length;
109
109
 
110
110
  if (proofAssertionsLength > 0) {
111
- lastProofAssertion = last(proofAssertions);
111
+ const lastProofAssertion = last(proofAssertions);
112
+
113
+ lastStep = lastProofAssertion; ///
112
114
  }
113
115
 
114
- return lastProofAssertion;
116
+ return lastStep;
115
117
  }
116
118
 
117
119
  hasMetaLevelSubstitutions() {
@@ -13,6 +13,12 @@ export default class SyntheticContext extends Context {
13
13
  return this.contexts;
14
14
  }
15
15
 
16
+ addSubstitutions(substitutions) {
17
+ const context = this.getContext();
18
+
19
+ context.addSubstitutions(substitutions);
20
+ }
21
+
16
22
  findTermByTermNode(termNode) {
17
23
  let term = null;
18
24
 
@@ -206,7 +206,7 @@ export default define(class ContainedAssertion extends Assertion {
206
206
  context.trace(`Validating the '${containedAssertionString}' derived contained assertion...`);
207
207
 
208
208
  const generalCotnext = null,
209
- specificContext = context; ///
209
+ specificContext = context; ///
210
210
 
211
211
  validatesWhenDerived = validateWhenDerived(this.term, this.frame, this.statement, this.negated, generalCotnext, specificContext);
212
212
 
@@ -5,11 +5,11 @@ import { arrayUtilities } from "necessary";
5
5
  import Assertion from "../assertion";
6
6
 
7
7
  import { define } from "../../elements";
8
+ import { reconcile } from "../../utilities/context";
8
9
  import { instantiate } from "../../utilities/context";
9
- import { unifyStatement } from "../../process/unify";
10
10
  import { instantiateSubproofAssertion } from "../../process/instantiate";
11
11
 
12
- const { match } = arrayUtilities;
12
+ const { last, front, backwardsEvery } = arrayUtilities;
13
13
 
14
14
  export default define(class SubproofAssertion extends Assertion {
15
15
  constructor(context, string, node, statements) {
@@ -22,6 +22,26 @@ export default define(class SubproofAssertion extends Assertion {
22
22
  return this.statements;
23
23
  }
24
24
 
25
+ getLastStatement() {
26
+ const lastStatement = last(this.statements);
27
+
28
+ return lastStatement;
29
+ }
30
+
31
+ getSupposedStatement(index) {
32
+ const statement = this.statements[index],
33
+ supposedStatement = statement; ///
34
+
35
+ return supposedStatement;
36
+ }
37
+
38
+ getSupposedStatements() {
39
+ const frontStatements = front(this.statements),
40
+ supposedStatements = frontStatements; ///
41
+
42
+ return supposedStatements;
43
+ }
44
+
25
45
  getSubproofAssertionNode() {
26
46
  const node = this.getNode(),
27
47
  subproofAssertionNode = node; ///
@@ -86,33 +106,186 @@ export default define(class SubproofAssertion extends Assertion {
86
106
  }
87
107
 
88
108
  unifySubproof(subproof, generalContext, specificContext) {
89
- let subproofUnifies;
109
+ let subproofUnifies = false;
90
110
 
91
- const subproofString = subproof.getString(),
92
- subproofAssertionString = this.getString(); ///
111
+ const context = specificContext, ///
112
+ subproofString = subproof.getString(),
113
+ subproofAssertionString = this.getString(); ///
93
114
 
94
- specificContext.trace(`Unifying the '${subproofString}' subproof with the '${subproofAssertionString}' subproof assertion...`);
115
+ context.trace(`Unifying the '${subproofString}' subproof with the '${subproofAssertionString}' subproof assertion...`);
95
116
 
96
- const subproofStatements = subproof.getStatements(),
97
- subproofAssertionStatements = this.statements; ///
117
+ const lastStep = subproof.getLastStep(),
118
+ lastStepUnifies = this.unifyLastStep(lastStep, generalContext, specificContext);
98
119
 
99
- subproofUnifies = match(subproofAssertionStatements, subproofStatements, (subproofAssertionStatement, subproofStatement) => {
100
- const generalStatement = subproofAssertionStatement, ///
101
- specificStatement = subproofStatement, ///
102
- statementUnifies = unifyStatement(generalStatement, specificStatement, generalContext, specificContext);
120
+ if (lastStepUnifies) {
121
+ const suppositions = subproof.getSuppositions(),
122
+ suppositionsUnify = this.unifySuppositions(suppositions, generalContext, specificContext);
103
123
 
104
- if (statementUnifies) {
105
- return true;
124
+ if (suppositionsUnify) {
125
+ subproofUnifies = true;
106
126
  }
107
- });
127
+ }
108
128
 
109
129
  if (subproofUnifies) {
110
- specificContext.debug(`...unified the '${subproofString}' subproof with the '${subproofAssertionString}' subproof assertion.`);
130
+ context.debug(`...unified the '${subproofString}' subproof with the '${subproofAssertionString}' subproof assertion.`);
111
131
  }
112
132
 
113
133
  return subproofUnifies;
114
134
  }
115
135
 
136
+ unifyLastStep(lastStep, generalContext, specificContext) {
137
+ let lastStepUnifies = false;
138
+
139
+ const lastStatement = this.getLastStatement(),
140
+ lastStepString = lastStep.getString(),
141
+ lastStepStatement = lastStep.getStatement(),
142
+ lastStatementString = lastStatement.getString(),
143
+ subproofAssertionString = this.getString(), ///
144
+ lastStepStatementString = lastStepStatement.getString();
145
+
146
+ let context;
147
+
148
+ context = specificContext; ///
149
+
150
+ context.trace(`Unifying the '${lastStepString}' last step's '${lastStepStatementString}' statement with the '${subproofAssertionString}' subproof assertion's '${lastStatementString}' last statement...`)
151
+
152
+ context = lastStep.getContext();
153
+
154
+ specificContext = context; ///
155
+
156
+ reconcile((specificContext) => {
157
+ const lastStepStatementUnifies = lastStatement.unifyStatement(lastStepStatement, generalContext, specificContext);
158
+
159
+ if (lastStepStatementUnifies) {
160
+ lastStepUnifies = true;
161
+ }
162
+ }, specificContext);
163
+
164
+ if (lastStepUnifies) {
165
+ context.debug(`...unified the '${lastStepString}' last step's '${lastStepStatementString}' statement with the '${subproofAssertionString}' subproof assertion's '${lastStatementString}' last statement.`)
166
+ }
167
+
168
+ return lastStepUnifies;
169
+ }
170
+
171
+ unifyDeduction(deduction, generalContext, specificContext) {
172
+ let deductionUnifies = false;
173
+
174
+ const lastStatement = this.getLastStatement(),
175
+ deductionString = deduction.getString(),
176
+ deductionStatement = deduction.getStatement(),
177
+ lastStatementString = lastStatement.getString(),
178
+ subproofAssertionString = this.getString(), ///
179
+ deductionStatementString = deductionStatement.getString();
180
+
181
+ let context;
182
+
183
+ context = specificContext; ///
184
+
185
+ context.trace(`Unifying the '${deductionString}' deduction's '${deductionStatementString}' statement with the '${subproofAssertionString}' subproof assertion's '${lastStatementString}' last statement...`)
186
+
187
+ context = deduction.getContext();
188
+
189
+ specificContext = context; ///
190
+
191
+ reconcile((specificContext) => {
192
+ const deductionStatementUnifies = lastStatement.unifyStatement(deductionStatement, generalContext, specificContext);
193
+
194
+ if (deductionStatementUnifies) {
195
+ deductionUnifies = true;
196
+ }
197
+ }, specificContext);
198
+
199
+ if (deductionUnifies) {
200
+ context.debug(`...unified the '${deductionString}' deduction's '${deductionStatementString}' statement with the '${subproofAssertionString}' subproof assertion's '${lastStatementString}' last statement.`)
201
+ }
202
+
203
+ return deductionUnifies;
204
+ }
205
+
206
+ unifySupposition(supposition, index, generalContext, specificContext) {
207
+ let suppositionUnifies = false;
208
+
209
+ const supposedStatement = this.getSupposedStatement(index),
210
+ suppositionString = supposition.getString(),
211
+ suppositionStatement = supposition.getStatement(),
212
+ subproofAssertionString = this.getString(), ///
213
+ supposedStatementString = supposedStatement.getString(),
214
+ suppositionStatementString = suppositionStatement.getString(); ///
215
+
216
+ let context;
217
+
218
+ context = specificContext; ///
219
+
220
+ context.trace(`Unifying the '${suppositionString}' supposition's '${suppositionStatementString}' statement with the '${subproofAssertionString}' subproof assertion's '${supposedStatementString}' supposed statement...`)
221
+
222
+ context = supposition.getContext();
223
+
224
+ specificContext = context; ///
225
+
226
+ reconcile((specificContext) => {
227
+ const suppositionStatementUnifies = supposedStatement.unifyStatement(suppositionStatement, generalContext, specificContext);
228
+
229
+ if (suppositionStatementUnifies) {
230
+ suppositionUnifies = true;
231
+ }
232
+ }, specificContext);
233
+
234
+ if (suppositionUnifies) {
235
+ context.debug(`...unified the '${suppositionString}' supposition's '${suppositionStatementString}' statement with the '${subproofAssertionString}' subproof assertion's '${supposedStatementString}' supposed statement.`)
236
+ }
237
+
238
+ return suppositionUnifies;
239
+ }
240
+
241
+ unifySuppositions(suppositions, generalContext, specificContext) {
242
+ let suppositionsUnify = false;
243
+
244
+ const supposedStatements = this.getSupposedStatements(),
245
+ suppositionsLength = suppositions.length,
246
+ supposedStatementsLength = supposedStatements.length;
247
+
248
+ if (suppositionsLength === supposedStatementsLength) {
249
+ suppositionsUnify = backwardsEvery(suppositions, (supposition, index) => {
250
+ const suppositionUnifies = this.unifySupposition(supposition, index, generalContext, specificContext);
251
+
252
+ if (suppositionUnifies) {
253
+ return true;
254
+ }
255
+ });
256
+ }
257
+
258
+ return suppositionsUnify;
259
+ }
260
+
261
+ unifyTopLevelMetaAssertion(topLevelMetaAssertion, generalContext, specificContext) {
262
+ let topLevelMetaAssertionUnifies = false;
263
+
264
+ const context = specificContext, ///
265
+ subproofAssertionString = this.getString(), ///
266
+ topLevelMetaAssertionString = topLevelMetaAssertion.getString();
267
+
268
+ context.trace(`Unifying the '${topLevelMetaAssertionString}' top level meta-assertion with the '${subproofAssertionString}' subproof assertion...`);
269
+
270
+ const deduction = topLevelMetaAssertion.getDeduction(),
271
+ deductionUnifies = this.unifyDeduction(deduction, generalContext, specificContext);
272
+
273
+ if (deductionUnifies) {
274
+ const suppositions = topLevelMetaAssertion.getSuppositions(),
275
+ suppositionsUnify = this.unifySuppositions(suppositions, generalContext, specificContext);
276
+
277
+ if (suppositionsUnify) {
278
+ topLevelMetaAssertionUnifies = true;
279
+ }
280
+ }
281
+
282
+ if (topLevelMetaAssertionUnifies) {
283
+ context.debug(`...unified the '${topLevelMetaAssertionString}' top level meta-assertion with the '${subproofAssertionString}' subproof assertion.`);
284
+ }
285
+
286
+ return topLevelMetaAssertionUnifies;
287
+ }
288
+
116
289
  static name = "SubproofAssertion";
117
290
 
118
291
  static fromJSON(json, context) {
@@ -3,16 +3,15 @@
3
3
  import { Element } from "occam-languages";
4
4
 
5
5
  import { define } from "../elements";
6
- import { instantiate } from "../utilities/context";
7
6
  import { instantiateAssumption } from "../process/instantiate";
8
- import { unifyStatementIntrinsically } from "../process/unify";
7
+ import { instantiate, reconcile } from "../utilities/context";
9
8
 
10
9
  export default define(class Assumption extends Element {
11
10
  constructor(context, string, node, reference, statement) {
12
11
  super(context, string, node);
13
12
 
14
- this.statement = statement;
15
13
  this.reference = reference;
14
+ this.statement = statement;
16
15
  }
17
16
 
18
17
  getReference() {
@@ -166,7 +165,7 @@ export default define(class Assumption extends Element {
166
165
  }
167
166
 
168
167
  validateWhenStated(context) {
169
- let validatesWhenStated;
168
+ let validatesWhenStated = false;
170
169
 
171
170
  const assumptionString = this.getString(); ///
172
171
 
@@ -179,15 +178,17 @@ export default define(class Assumption extends Element {
179
178
  validatesWhenStated = true;
180
179
  } else {
181
180
  const topLevelMetaAssertions = context.findTopLevelMetaAssertionsByReference(this.reference),
182
- topLevelMetaAssertionsUnify = topLevelMetaAssertions.every((topLevelMetaAssertion) => {
183
- const topLevelMetaAssertionUnifies = this.unifyTopLevelMetaAssertion(topLevelMetaAssertion, context);
181
+ topLevelMetaAssertionsCompare = topLevelMetaAssertions.some((topLevelMetaAssertion) => {
182
+ const topLevelMetaAssertionCompares = this.unifyTopLevelMetaAssertion(topLevelMetaAssertion, context);
184
183
 
185
- if (topLevelMetaAssertionUnifies) {
184
+ if (topLevelMetaAssertionCompares) {
186
185
  return true;
187
186
  }
188
187
  });
189
188
 
190
- validatesWhenStated = topLevelMetaAssertionsUnify; ///
189
+ if (topLevelMetaAssertionsCompare) {
190
+ validatesWhenStated = true;
191
+ }
191
192
  }
192
193
 
193
194
  if (validatesWhenStated) {
@@ -198,7 +199,7 @@ export default define(class Assumption extends Element {
198
199
  }
199
200
 
200
201
  validateWhenDerived(context) {
201
- let validatesWhenDerived;
202
+ let validatesWhenDerived = false;
202
203
 
203
204
  const assumptionString = this.getString(); ///
204
205
 
@@ -206,7 +207,9 @@ export default define(class Assumption extends Element {
206
207
 
207
208
  const topLevelMetaAssertionPresent = context.isTopLevelMetaAssertionPresentByReference(this.reference);
208
209
 
209
- validatesWhenDerived = topLevelMetaAssertionPresent; ///
210
+ if (topLevelMetaAssertionPresent) {
211
+ validatesWhenDerived = true;
212
+ }
210
213
 
211
214
  if (validatesWhenDerived) {
212
215
  context.debug(`...validated the '${assumptionString}' derived assumption.`);
@@ -215,28 +218,6 @@ export default define(class Assumption extends Element {
215
218
  return validatesWhenDerived;
216
219
  }
217
220
 
218
- unifyStatement(statement, substitutions, generalContext, specificContext) {
219
- let statementUnifies;
220
-
221
- const context = generalContext, ///
222
- statementString = statement.getString(),
223
- assumptionStatementString = this.statement.getString();
224
-
225
- context.trace(`Unifying the '${statementString}' statement with the '${assumptionStatementString}' statement...`);
226
-
227
- const generalStatement = this.statement,
228
- specificStatement = statement, ///
229
- statementUUnifiesIntrinsically = unifyStatementIntrinsically(generalStatement, specificStatement, substitutions, generalContext, specificContext);
230
-
231
- statementUnifies = statementUUnifiesIntrinsically; ///
232
-
233
- if (statementUnifies) {
234
- context.debug(`...unified the '${statementString}' statement with the '${assumptionStatementString}' statement.`);
235
- }
236
-
237
- return statementUnifies;
238
- }
239
-
240
221
  unifyLabel(label, generalContext, specificContext) {
241
222
  let labelUnifiesWithReference;
242
223
 
@@ -269,30 +250,18 @@ export default define(class Assumption extends Element {
269
250
 
270
251
  context = topLevelMetaAssertion.getContext(); ///
271
252
 
272
- const specificContext = context, ///
273
- labelSubstitutions = [],
274
- label = topLevelMetaAssertion.getLabel(),
275
- substitutions = labelSubstitutions, ///
276
- labelUnifies = this.unifyLabel(label, substitutions, generalContext, specificContext);
253
+ const specificContext = context; ///
277
254
 
278
- if (labelUnifies) {
279
- const statementSubstitutions = [],
280
- statement = topLevelMetaAssertion.getStatement(),
281
- substitutions = statementSubstitutions, ///
282
- statementUUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
255
+ reconcile((specificContext) => {
256
+ const label = topLevelMetaAssertion.getLabel(),
257
+ labelUnifies = this.unifyLabel(label, generalContext, specificContext);
283
258
 
284
- if (statementUUnifies) {
285
- const labelSubstitutionsCorrelateStatementSubstitutions = labelSubstitutions.correlateSubstitutions(statementSubstitutions);
286
-
287
- if (labelSubstitutionsCorrelateStatementSubstitutions) {
288
- topLevelMetaAssertionUnifies = true; ///
289
- }
259
+ if (labelUnifies) {
260
+ topLevelMetaAssertionUnifies = this.statement.unifyTopLevelMetaAssertion(topLevelMetaAssertion, generalContext, specificContext);
290
261
  }
291
- }
262
+ }, specificContext);
292
263
 
293
264
  if (topLevelMetaAssertionUnifies) {
294
- context = generalContext; ///
295
-
296
265
  context.trace(`...unified the '${topLevelMetaAssertionString}' top level meta-assertion with the '${assumptionString}' assumption...`);
297
266
  }
298
267
 
@@ -163,10 +163,3 @@ export default define(class Conclusion extends Element {
163
163
  return conclusion;
164
164
  }
165
165
  });
166
-
167
- function statementFromConclusionNode(conclusionNode, context) {
168
- const statementNode = conclusionNode.getStatementNode(),
169
- statement = context.findStatementByStatementNode(statementNode);
170
-
171
- return statement;
172
- }
@@ -5,6 +5,7 @@ import { Element } from "occam-languages";
5
5
  import { define } from "../elements";
6
6
  import { attempt, instantiate } from "../utilities/context";
7
7
  import { instantiateDeduction } from "../process/instantiate";
8
+ import { statementFromDeductionNode } from "../utilities/element";
8
9
  import { ephemeralContextFromJSON, ephemeralContextToEphemeralContextJSON } from "../utilities/json";
9
10
 
10
11
  export default define(class Deduction extends Element {
@@ -30,9 +31,9 @@ export default define(class Deduction extends Element {
30
31
 
31
32
  await this.break(context);
32
33
 
33
- const duductionString = this.getString(); ///
34
+ const deductionString = this.getString(); ///
34
35
 
35
- context.trace(`Verifying the '${duductionString}' duduction...`);
36
+ context.trace(`Verifying the '${deductionString}' deduction...`);
36
37
 
37
38
  if (this.statement !== null) {
38
39
  const validates = this.validate(context);
@@ -41,11 +42,11 @@ export default define(class Deduction extends Element {
41
42
  verifies = true;
42
43
  }
43
44
  } else {
44
- context.debug(`Unable to verify the '${duductionString}' duduction because it is nonsense.`);
45
+ context.debug(`Unable to verify the '${deductionString}' deduction because it is nonsense.`);
45
46
  }
46
47
 
47
48
  if (verifies) {
48
- context.debug(`...verified the '${duductionString}' duduction.`);
49
+ context.debug(`...verified the '${deductionString}' deduction.`);
49
50
  }
50
51
 
51
52
  return verifies;
@@ -54,9 +55,9 @@ export default define(class Deduction extends Element {
54
55
  validate(context) {
55
56
  let validates = false;
56
57
 
57
- const duductionString = this.getString(); ///
58
+ const deductionString = this.getString(); ///
58
59
 
59
- context.trace(`Validating the '${duductionString}' duduction...`);
60
+ context.trace(`Validating the '${deductionString}' deduction...`);
60
61
 
61
62
  attempt((context) => {
62
63
  const statementValidates = this.validateStatement(context);
@@ -69,7 +70,7 @@ export default define(class Deduction extends Element {
69
70
  }, context);
70
71
 
71
72
  if (validates) {
72
- context.debug(`...validated the '${duductionString}' duduction.`);
73
+ context.debug(`...validated the '${deductionString}' deduction.`);
73
74
  }
74
75
 
75
76
  return validates;
@@ -79,9 +80,9 @@ export default define(class Deduction extends Element {
79
80
  let statementValidates;
80
81
 
81
82
  const statementString = this.statement.getString(),
82
- duductionnString = this.getString(); ///
83
+ deductionnString = this.getString(); ///
83
84
 
84
- context.trace(`Validating the '${duductionnString}' duductionn's '${statementString}' statement...`);
85
+ context.trace(`Validating the '${deductionnString}' deductionn's '${statementString}' statement...`);
85
86
 
86
87
  const stated = true,
87
88
  statement = this.statement.validate(stated, context);
@@ -91,7 +92,7 @@ export default define(class Deduction extends Element {
91
92
  }
92
93
 
93
94
  if (statementValidates) {
94
- context.trace(`...validated the '${duductionnString}' duductionn's '${statementString}' statement.`);
95
+ context.trace(`...validated the '${deductionnString}' deductionn's '${statementString}' statement.`);
95
96
  }
96
97
 
97
98
  return statementValidates;
@@ -174,23 +175,16 @@ export default define(class Deduction extends Element {
174
175
 
175
176
  context = ephemeralContext; ///
176
177
 
177
- const duduction = instantiate((context) => {
178
+ const deduction = instantiate((context) => {
178
179
  const { string } = json,
179
180
  deductionNode = instantiateDeduction(string, context),
180
181
  node = deductionNode, ///
181
182
  statement = statementFromDeductionNode(deductionNode, context),
182
- duduction = new Deduction(context, string, node, statement);
183
+ deduction = new Deduction(context, string, node, statement);
183
184
 
184
- return duduction;
185
+ return deduction;
185
186
  }, context);
186
187
 
187
- return duduction;
188
+ return deduction;
188
189
  }
189
190
  });
190
-
191
- function statementFromDeductionNode(deductionNode, context) {
192
- const statementNode = deductionNode.getStatementNode(),
193
- statement = context.findStatementByStatementNode(statementNode);
194
-
195
- return statement;
196
- }
@@ -28,11 +28,12 @@ export default define(class Derivation extends Element {
28
28
  return derivationNode;
29
29
  }
30
30
 
31
- getLastProofAssertion() {
31
+ getLastStep() {
32
32
  const lastSubproofOrProofAssertion = last(this.subproofOrProofAssertions),
33
- lastProofAssertion = lastSubproofOrProofAssertion; ///
33
+ lastProofAssertion = lastSubproofOrProofAssertion, ///
34
+ lastStep = lastProofAssertion; ///
34
35
 
35
- return lastProofAssertion;
36
+ return lastStep;
36
37
  }
37
38
 
38
39
  async verify(context) {
@@ -297,6 +297,11 @@ export default define(class Metavariable extends Element {
297
297
  substitutionFrameComparesToFrame = substitution.compareFrame(frame, context);
298
298
 
299
299
  if (substitutionFrameComparesToFrame) {
300
+ const frameSubstitution = substitution, ///
301
+ frameSubstitutionString = frameSubstitution.getString();
302
+
303
+ context.trace(`The '${frameSubstitutionString}' frame substitution is already present.`);
304
+
300
305
  frameUnifies = true;
301
306
  }
302
307
  } else {
@@ -333,8 +338,6 @@ export default define(class Metavariable extends Element {
333
338
  substitution.getString() :
334
339
  EMPTY_STRING;
335
340
 
336
-
337
-
338
341
  context.trace(`Unifying the '${statementString}' statement with the '${metavariableString}${substitutionString}' metavariable...`);
339
342
 
340
343
  const metavariable = this, ///
@@ -356,6 +359,11 @@ export default define(class Metavariable extends Element {
356
359
  const substitutionComparesToStatement = substitution.compareStatement(statement, context);
357
360
 
358
361
  if (substitutionComparesToStatement) {
362
+ const statementSubstitution = substitution, //
363
+ statementSubstitutionString = statementSubstitution.getString();
364
+
365
+ context.trace(`The '${statementSubstitutionString}' statement substitution is already present.`);
366
+
359
367
  statementUnifies = true;
360
368
  }
361
369
  } else {
@@ -413,6 +421,11 @@ export default define(class Metavariable extends Element {
413
421
  substitutionReferenceComparesToReference = substitution.compareReference(reference, context);
414
422
 
415
423
  if (substitutionReferenceComparesToReference) {
424
+ const referenceSubstitution = substitution, ///
425
+ referenceSubstitutionString = referenceSubstitution.getString();
426
+
427
+ context.trace(`The '${referenceSubstitutionString}' reference substitution is already present.`);
428
+
416
429
  referenceUnifies = true;
417
430
  }
418
431
  } else {
@@ -23,12 +23,12 @@ export default define(class Proof extends Element {
23
23
  return proofNode;
24
24
  }
25
25
 
26
- getLastProofAssertion() { return this.derivation.getLastProofAssertion(); }
26
+ getLastStep() { return this.derivation.getLastStep(); }
27
27
 
28
28
  getStatement() {
29
- const lastProofAssertion = this.getLastProofAssertion(),
30
- lastProofAssertionStatement = lastProofAssertion.getStatement(),
31
- statement = lastProofAssertionStatement; ///
29
+ const lastStep = this.getLastStep(),
30
+ lastStepStatement = lastStep.getStatement(),
31
+ statement = lastStepStatement; ///
32
32
 
33
33
  return statement;
34
34
  }
@@ -40,9 +40,9 @@ export default define(class Proof extends Element {
40
40
  const derivationVerifies = await this.derivation.verify(context);
41
41
 
42
42
  if (derivationVerifies) {
43
- const lastProofAssertion = context.getLastProofAssertion();
43
+ const lastStep = context.getLastStep();
44
44
 
45
- if (lastProofAssertion !== null) {
45
+ if (lastStep !== null) {
46
46
  const proof = this, ///
47
47
  proofStatement = proof.getStatement(),
48
48
  proofStatementEqualToStatement = proofStatement.isEqualTo(statement);