occam-verify-cli 1.0.809 → 1.0.814

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 (91) hide show
  1. package/lib/context/bounded.js +6 -6
  2. package/lib/context/branching.js +3 -3
  3. package/lib/context/ephemeral.js +3 -3
  4. package/lib/context/file/nominal.js +16 -16
  5. package/lib/context/liminal.js +26 -30
  6. package/lib/context/synoptic.js +62 -2
  7. package/lib/context.js +66 -54
  8. package/lib/element/assertion/defined.js +8 -8
  9. package/lib/element/assertion/satisfies.js +15 -11
  10. package/lib/element/assertion.js +5 -5
  11. package/lib/element/assumption/metaLevel.js +3 -3
  12. package/lib/element/conclusion.js +11 -8
  13. package/lib/element/deduction.js +11 -8
  14. package/lib/element/frame.js +6 -14
  15. package/lib/element/label.js +5 -8
  16. package/lib/element/metavariable.js +17 -17
  17. package/lib/element/procedureCall.js +10 -6
  18. package/lib/element/proofAssertion/premise.js +27 -27
  19. package/lib/element/proofAssertion/step.js +25 -5
  20. package/lib/element/proofAssertion/supposition.js +27 -27
  21. package/lib/element/proofAssertion.js +10 -10
  22. package/lib/element/reference.js +9 -13
  23. package/lib/element/rule.js +41 -43
  24. package/lib/element/signature.js +4 -4
  25. package/lib/element/statement.js +35 -45
  26. package/lib/element/subproof.js +4 -4
  27. package/lib/element/substitution/frame.js +16 -11
  28. package/lib/element/substitution/reference.js +15 -10
  29. package/lib/element/substitution/statement.js +55 -51
  30. package/lib/element/substitution/term.js +15 -10
  31. package/lib/element/substitution.js +29 -31
  32. package/lib/element/term.js +1 -16
  33. package/lib/element/topLevelAssertion/axiom.js +5 -3
  34. package/lib/element/topLevelAssertion.js +36 -38
  35. package/lib/element/variable.js +6 -6
  36. package/lib/node/frame.js +1 -9
  37. package/lib/node/statement.js +1 -9
  38. package/lib/node/term.js +1 -19
  39. package/lib/process/assign.js +23 -31
  40. package/lib/utilities/element.js +33 -5
  41. package/lib/utilities/equivalence.js +4 -4
  42. package/lib/utilities/equivalences.js +28 -13
  43. package/lib/utilities/string.js +2 -2
  44. package/lib/utilities/substitutions.js +16 -15
  45. package/lib/utilities/unification.js +133 -124
  46. package/package.json +1 -1
  47. package/src/context/bounded.js +5 -5
  48. package/src/context/branching.js +2 -2
  49. package/src/context/ephemeral.js +2 -2
  50. package/src/context/file/nominal.js +15 -15
  51. package/src/context/liminal.js +29 -35
  52. package/src/context/synoptic.js +81 -1
  53. package/src/context.js +88 -69
  54. package/src/element/assertion/defined.js +8 -8
  55. package/src/element/assertion/satisfies.js +17 -10
  56. package/src/element/assertion.js +8 -8
  57. package/src/element/assumption/metaLevel.js +4 -2
  58. package/src/element/conclusion.js +12 -7
  59. package/src/element/deduction.js +12 -7
  60. package/src/element/frame.js +7 -20
  61. package/src/element/label.js +3 -5
  62. package/src/element/metavariable.js +27 -27
  63. package/src/element/procedureCall.js +14 -9
  64. package/src/element/proofAssertion/premise.js +41 -41
  65. package/src/element/proofAssertion/step.js +37 -7
  66. package/src/element/proofAssertion/supposition.js +41 -41
  67. package/src/element/proofAssertion.js +10 -9
  68. package/src/element/reference.js +9 -13
  69. package/src/element/rule.js +57 -61
  70. package/src/element/signature.js +3 -3
  71. package/src/element/statement.js +54 -68
  72. package/src/element/subproof.js +3 -3
  73. package/src/element/substitution/frame.js +18 -8
  74. package/src/element/substitution/reference.js +16 -7
  75. package/src/element/substitution/statement.js +78 -67
  76. package/src/element/substitution/term.js +15 -6
  77. package/src/element/substitution.js +38 -41
  78. package/src/element/term.js +0 -26
  79. package/src/element/topLevelAssertion/axiom.js +5 -2
  80. package/src/element/topLevelAssertion.js +49 -53
  81. package/src/element/variable.js +5 -5
  82. package/src/node/frame.js +0 -12
  83. package/src/node/statement.js +0 -12
  84. package/src/node/term.js +0 -28
  85. package/src/process/assign.js +35 -46
  86. package/src/utilities/element.js +32 -4
  87. package/src/utilities/equivalence.js +3 -4
  88. package/src/utilities/equivalences.js +29 -17
  89. package/src/utilities/string.js +2 -2
  90. package/src/utilities/substitutions.js +17 -15
  91. package/src/utilities/unification.js +145 -119
@@ -158,6 +158,47 @@ export default define(class Supposition extends ProofAssertion {
158
158
  return suppositionUnifies;
159
159
  }
160
160
 
161
+ async unifyIndependently(context) {
162
+ let unifiesIndependently = false;
163
+
164
+ const suppositionString = this.getString(); ///
165
+
166
+ context.trace(`Unifying the '${suppositionString}' supposition independently...`);
167
+
168
+ const statement = this.getStatement(),
169
+ procedureCall = this.getProcedureCall();
170
+
171
+ if (statement !== null) {
172
+ const specificContext = context; ///
173
+
174
+ context = this.getContext();
175
+
176
+ const generalContext = context; ///
177
+
178
+ context = specificContext; ///
179
+
180
+ const statementUnifiesIndependently = statement.unifyIndependently(generalContext, specificContext);
181
+
182
+ if (statementUnifiesIndependently) {
183
+ unifiesIndependently = true;
184
+ }
185
+ }
186
+
187
+ if (procedureCall !== null) {
188
+ const procedureCallResolvedIndependently = await procedureCall.unifyIndependently(context);
189
+
190
+ if (procedureCallResolvedIndependently) {
191
+ unifiesIndependently = true;
192
+ }
193
+ }
194
+
195
+ if (unifiesIndependently) {
196
+ context.debug(`...unified the '${suppositionString}' supposition independenly.`);
197
+ }
198
+
199
+ return unifiesIndependently;
200
+ }
201
+
161
202
  unifySubproofOrProofAssertion(subproofOrProofAssertion, context) {
162
203
  let subproofOrProofAssertionUnifies;
163
204
 
@@ -265,47 +306,6 @@ export default define(class Supposition extends ProofAssertion {
265
306
  return subproofUnifies;
266
307
  }
267
308
 
268
- async unifyIndependently(context) {
269
- let unifiesIndependently = false;
270
-
271
- const suppositionString = this.getString(); ///
272
-
273
- context.trace(`Unifying the '${suppositionString}' supposition independently...`);
274
-
275
- const statement = this.getStatement(),
276
- procedureCall = this.getProcedureCall();
277
-
278
- if (statement !== null) {
279
- const specificContext = context; ///
280
-
281
- context = this.getContext();
282
-
283
- const generalContext = context; ///
284
-
285
- context = specificContext; ///
286
-
287
- const statementUnifiesIndependently = statement.unifyIndependently(generalContext, specificContext);
288
-
289
- if (statementUnifiesIndependently) {
290
- unifiesIndependently = true;
291
- }
292
- }
293
-
294
- if (procedureCall !== null) {
295
- const procedureCallResolvedIndependently = await procedureCall.unifyIndependently(context);
296
-
297
- if (procedureCallResolvedIndependently) {
298
- unifiesIndependently = true;
299
- }
300
- }
301
-
302
- if (unifiesIndependently) {
303
- context.debug(`...unified the '${suppositionString}' supposition independenly.`);
304
- }
305
-
306
- return unifiesIndependently;
307
- }
308
-
309
309
  toJSON() {
310
310
  const context = this.getContext();
311
311
 
@@ -28,27 +28,28 @@ export default class ProofAssertion extends Element {
28
28
  return proofAssertion;
29
29
  }
30
30
 
31
- compareStatement(statement, context) {
32
- let comparesToStatement = false;
31
+ compareStep(step, context) {
32
+ let comparesToStep = false;
33
33
 
34
- const statementString = statement.getString(),
34
+ const stepString = step.getString(),
35
35
  proofAssertionString = this.getString(); ///
36
36
 
37
- context.trace(`Comparing the '${statementString}' statement to the '${proofAssertionString}' proof assertion...`);
37
+ context.trace(`Comparing the '${stepString}' step to the '${proofAssertionString}' proof assertion...`);
38
38
 
39
- const leftStatement = statement, ///
39
+ const statement = step.getStatement(),
40
+ leftStatement = statement, ///
40
41
  rightStatement = this.statement, ///
41
42
  statementsEquate = equateStatements(leftStatement, rightStatement, context);
42
43
 
43
44
  if (statementsEquate) {
44
- comparesToStatement = true;
45
+ comparesToStep = true;
45
46
  }
46
47
 
47
- if (comparesToStatement) {
48
- context.debug(`...compared the '${statementString}' statement to the '${proofAssertionString}' proof assertion.`);
48
+ if (comparesToStep) {
49
+ context.debug(`...compared the '${stepString}' step to the '${proofAssertionString}' proof assertion.`);
49
50
  }
50
51
 
51
- return comparesToStatement;
52
+ return comparesToStep;
52
53
  }
53
54
 
54
55
  unifyStatement(statement, generalContext, specificContext) {
@@ -32,12 +32,6 @@ export default define(class Reference extends Element {
32
32
  return referenceNode;
33
33
  }
34
34
 
35
- getMetavariableName() {
36
- const metavariableName = this.metavariable.getName();
37
-
38
- return metavariableName;
39
- }
40
-
41
35
  getMetavariableNode() {
42
36
  const metavariableNode = this.metavariable.getNode();
43
37
 
@@ -65,13 +59,17 @@ export default define(class Reference extends Element {
65
59
  compareParameter(parameter) {
66
60
  let comparesToParamter = false;
67
61
 
68
- const parameterName = parameter.getName();
62
+ const singular = this.isSingular();
69
63
 
70
- if (parameterName !== null) {
71
- const metavariableName = this.getMetavariableName();
64
+ if (singular) {
65
+ const parameterName = parameter.getName();
72
66
 
73
- if (parameterName === metavariableName) {
74
- comparesToParamter = true;
67
+ if (parameterName !== null) {
68
+ const metavariableName = this.getMetavariableName();
69
+
70
+ if (parameterName === metavariableName) {
71
+ comparesToParamter = true;
72
+ }
75
73
  }
76
74
  }
77
75
 
@@ -98,8 +96,6 @@ export default define(class Reference extends Element {
98
96
  return comparesToMetavariable;
99
97
  }
100
98
 
101
- compareMetavariableName(metavariableName) { return this.metavariable.compareMetavariableName(metavariableName); }
102
-
103
99
  compareTopLevelMetaAssertion(topLevelMetaAssertion) {
104
100
  let topLevelMetaAssertionCompares = false;
105
101
 
@@ -7,8 +7,8 @@ import { define } from "../elements";
7
7
  import { enclose } from "../utilities/context";
8
8
  import { labelsFromJSON, premisesFromJSON, conclusionFromJSON, labelsToLabelsJSON, premisesToPremisesJSON, conclusionToConclusionJSON } from "../utilities/json";
9
9
 
10
- const { reverse, extract } = arrayUtilities,
11
- { asyncForwardsEvery, asyncBackwardsEvery } = asynchronousUtilities;
10
+ const { reverse } = arrayUtilities,
11
+ { asyncExtract, asyncForwardsEvery, asyncBackwardsEvery } = asynchronousUtilities;
12
12
 
13
13
  export default define(class Rule extends Element {
14
14
  constructor(context, string, node, proof, labels, premises, conclusion) {
@@ -43,38 +43,16 @@ export default define(class Rule extends Element {
43
43
  return ruleNode;
44
44
  }
45
45
 
46
- compareMetavariableName(metavariableName) {
47
- const comparesToMetavariableName = this.labels.some((label) => {
48
- const labelComparesToMetavariableName = label.compareMetavariableName(metavariableName);
46
+ matchMetavariableNode(metavariableNode) {
47
+ const metavariableNodeMatches = this.labels.some((label) => {
48
+ const metavariableNodeMatches = label.matchMetavariableNode(metavariableNode);
49
49
 
50
- if (labelComparesToMetavariableName) {
50
+ if (metavariableNodeMatches) {
51
51
  return true;
52
52
  }
53
53
  });
54
54
 
55
- return comparesToMetavariableName;
56
- }
57
-
58
- unifyStatementWithConclusion(statement, context) {
59
- let statementUnifiesWithConclusion = false;
60
-
61
- const ruleString = this.getString(),
62
- statementString = statement.getString(),
63
- conclusionString = this.conclusion.getString();
64
-
65
- context.trace(`Unifying the '${statementString}' statement with the '${ruleString}' rule's '${conclusionString}' conclusion...`);
66
-
67
- const statementUnifies = this.conclusion.unifyStatement(statement, context);
68
-
69
- if (statementUnifies) {
70
- statementUnifiesWithConclusion = true;
71
- }
72
-
73
- if (statementUnifiesWithConclusion) {
74
- context.debug(`...unified the '${statementString}' statement with the '${ruleString}' rule's '${conclusionString}' conclusion.`);
75
- }
76
-
77
- return statementUnifiesWithConclusion;
55
+ return metavariableNodeMatches;
78
56
  }
79
57
 
80
58
  async verify() {
@@ -246,59 +224,61 @@ export default define(class Rule extends Element {
246
224
  return conclusionVerifies;
247
225
  }
248
226
 
249
- async unifyStatementAndSubproofOrProofAssertions(statement, subproofOrProofAssertions, context) {
250
- let statementAndSubproofOrProofAssertionsUnify = false;
227
+ async unifyStepWithConclusion(step, context) {
228
+ let stepUnifiesWithConclusion = false;
251
229
 
252
- const statementUnifiesWithConclusion = this.unifyStatementWithConclusion(statement, context);
230
+ await this.break(context);
253
231
 
254
- if (statementUnifiesWithConclusion) {
255
- const subproofOrProofAssertionsUnifiesWithPremises = await this.unifySubproofOrProofAssertionsWithPremises(subproofOrProofAssertions, context);
232
+ const ruleString = this.getString(),
233
+ stepString = step.getString(),
234
+ conclusionString = this.conclusion.getString();
256
235
 
257
- if (subproofOrProofAssertionsUnifiesWithPremises) {
258
- const substitutionsResolved = context.areSubstitutionsResolved();
236
+ context.trace(`Unifying the '${stepString}' step with the '${ruleString}' rule's '${conclusionString}' conclusion...`);
259
237
 
260
- if (substitutionsResolved) {
261
- statementAndSubproofOrProofAssertionsUnify = true;
262
- }
263
- }
238
+ const stepUnifies = this.conclusion.unifyStep(step, context);
239
+
240
+ if (stepUnifies) {
241
+ stepUnifiesWithConclusion = true;
264
242
  }
265
243
 
266
- return statementAndSubproofOrProofAssertionsUnify;
244
+ if (stepUnifiesWithConclusion) {
245
+ context.debug(`...unified the '${stepString}' step with the '${ruleString}' rule's '${conclusionString}' conclusion.`);
246
+ }
247
+
248
+ return stepUnifiesWithConclusion;
267
249
  }
268
250
 
269
- async unifySubproofOrProofAssertionsWithPremises(subproofOrProofAssertions, context) {
270
- let subproofOrProofAssertionsUnifiesWithPremises;
251
+ async unifyStepAndSubproofOrProofAssertions(step, subproofOrProofAssertions, context) {
252
+ let stepAndSubproofOrProofAssertionsUnify = false;
271
253
 
272
- subproofOrProofAssertions = reverse(subproofOrProofAssertions); ///
254
+ const statementUnifiesWithConclusion = await this.unifyStepWithConclusion(step, context);
273
255
 
274
- subproofOrProofAssertionsUnifiesWithPremises = asyncBackwardsEvery(this.premises, async (premise) => {
275
- const stepUnifiesWithPremise = await this.unifySubproofOrProofAssertionsWithPremise(subproofOrProofAssertions, premise, context);
256
+ if (statementUnifiesWithConclusion) {
257
+ const subproofOrProofAssertionsUnifiesWithPremises = await this.unifySubproofOrProofAssertionsWithPremises(subproofOrProofAssertions, context);
276
258
 
277
- if (stepUnifiesWithPremise) {
278
- return true;
259
+ if (subproofOrProofAssertionsUnifiesWithPremises) {
260
+ const substitutionsResolved = context.areSubstitutionsResolved();
261
+
262
+ if (substitutionsResolved) {
263
+ stepAndSubproofOrProofAssertionsUnify = true;
264
+ }
279
265
  }
280
- });
266
+ }
281
267
 
282
- return subproofOrProofAssertionsUnifiesWithPremises;
268
+ return stepAndSubproofOrProofAssertionsUnify;
283
269
  }
284
270
 
285
271
  async unifySubproofOrProofAssertionsWithPremise(subproofOrProofAssertions, premise, context) {
286
272
  let subproofOrProofAssertionsUnifiesWithPremise = false;
287
273
 
274
+ await this.break(context);
275
+
288
276
  if (!subproofOrProofAssertionsUnifiesWithPremise) {
289
- const subproofOrProofAssertion = extract(subproofOrProofAssertions, (subproofOrProofAssertion) => {
290
- const subproofOrProofAssertionUnifies = premise.unifySubproofOrProofAssertion(subproofOrProofAssertion, context);
277
+ const subproofOrProofAssertion = await asyncExtract(subproofOrProofAssertions, async (subproofOrProofAssertion) => {
278
+ const subproofOrProofAssertionUnifies = await premise.unifySubproofOrProofAssertion(subproofOrProofAssertion, context);
291
279
 
292
280
  if (subproofOrProofAssertionUnifies) {
293
- const specificContext = context; ///
294
-
295
- context = this.getContext();
296
-
297
- const generalContext = context; ///
298
-
299
- context = specificContext; ///
300
-
301
- context.resolveSubstitutions(generalContext, specificContext);
281
+ context.resolveSubstitutions();
302
282
 
303
283
  return true;
304
284
  }
@@ -320,6 +300,22 @@ export default define(class Rule extends Element {
320
300
  return subproofOrProofAssertionsUnifiesWithPremise;
321
301
  }
322
302
 
303
+ async unifySubproofOrProofAssertionsWithPremises(subproofOrProofAssertions, context) {
304
+ let subproofOrProofAssertionsUnifiesWithPremises;
305
+
306
+ subproofOrProofAssertions = reverse(subproofOrProofAssertions); ///
307
+
308
+ subproofOrProofAssertionsUnifiesWithPremises = await asyncBackwardsEvery(this.premises, async (premise) => {
309
+ const stepUnifiesWithPremise = await this.unifySubproofOrProofAssertionsWithPremise(subproofOrProofAssertions, premise, context);
310
+
311
+ if (stepUnifiesWithPremise) {
312
+ return true;
313
+ }
314
+ });
315
+
316
+ return subproofOrProofAssertionsUnifiesWithPremises;
317
+ }
318
+
323
319
  toJSON() {
324
320
  const labelsJSON = labelsToLabelsJSON(this.labels),
325
321
  premisesJSON = premisesToPremisesJSON(this.premises),
@@ -122,7 +122,7 @@ export default define(class Signature extends Element {
122
122
  return termsValidate
123
123
  }
124
124
 
125
- compare(signature, substitutions, generalContext, specificContext) {
125
+ compareSignature(signature, substitutions, generalContext, specificContext) {
126
126
  const terms = signature.getTerms(),
127
127
  termsA = this.terms, ///
128
128
  termsB = terms, ///
@@ -153,9 +153,9 @@ export default define(class Signature extends Element {
153
153
  }
154
154
  }
155
155
  }),
156
- compares = matches; ///
156
+ comparesToSignature = matches; ///
157
157
 
158
- return compares;
158
+ return comparesToSignature;
159
159
  }
160
160
 
161
161
  compareSubstitutions(substitutions, context) {
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  import { Element } from "occam-languages";
4
- import { arrayUtilities } from "necessary";
5
4
 
6
5
  import { define } from "../elements";
7
6
  import { unifyStatement } from "../process/unify";
@@ -9,8 +8,6 @@ import { validateStatements } from "../utilities/validation";
9
8
  import { instantiateStatement } from "../process/instantiate";
10
9
  import { join, reconcile, instantiate } from "../utilities/context";
11
10
 
12
- const { backwardsSome } = arrayUtilities;
13
-
14
11
  export default define(class Statement extends Element {
15
12
  getStatementNode() {
16
13
  const node = this.getNode(),
@@ -19,13 +16,6 @@ export default define(class Statement extends Element {
19
16
  return statementNode;
20
17
  }
21
18
 
22
- getMetavariableName() {
23
- const sttaementNode = this.getStatementNode(),
24
- metavariableName = sttaementNode.getMetavariableName();
25
-
26
- return metavariableName;
27
- }
28
-
29
19
  getTermSubstitutionNode() {
30
20
  const statementNode = this.getNode(),
31
21
  termSubstitutionNode = statementNode.getTermSubstitutionNode();
@@ -40,11 +30,33 @@ export default define(class Statement extends Element {
40
30
  return frameSubstitutionNode;
41
31
  }
42
32
 
43
- isSingular() {
44
- const statementNode = this.getStatementNode(),
45
- singular = statementNode.isSingular();
33
+ getMetavariableNode() {
34
+ let metavariableNode = null;
46
35
 
47
- return singular;
36
+ const singular = this.isSingular();
37
+
38
+ if (singular) {
39
+ const statementNode = this.getStatementNode();
40
+
41
+ metavariableNode = statementNode.getMetavariableNode();
42
+ }
43
+
44
+ return metavariableNode;
45
+ }
46
+
47
+ getMetavariableName() {
48
+ let metavariableName = null;
49
+
50
+ const singular = this.isSingular();
51
+
52
+ if (singular) {
53
+ const statementNode = this.getStatementNode(),
54
+ metavariableNode = statementNode.getMetavariableNode();
55
+
56
+ metavariableName = metavariableNode.getMetavariableName();
57
+ }
58
+
59
+ return metavariableName;
48
60
  }
49
61
 
50
62
  isEqualTo(statement) {
@@ -55,6 +67,13 @@ export default define(class Statement extends Element {
55
67
  return equalTo;
56
68
  }
57
69
 
70
+ isSingular() {
71
+ const statementNode = this.getStatementNode(),
72
+ singular = statementNode.isSingular();
73
+
74
+ return singular;
75
+ }
76
+
58
77
  matchStatementNode(statementNode) {
59
78
  const node = statementNode, ///
60
79
  nodeMatches = this.matchNode(node),
@@ -63,79 +82,46 @@ export default define(class Statement extends Element {
63
82
  return statementNodeMatches;
64
83
  }
65
84
 
66
- compareParameter(parameter) {
67
- let comparesToParamter = false;
85
+ matchMetavariableNode(metavariableNode) {
86
+ let metavariableNodeMatches = false;
68
87
 
69
88
  const singular = this.isSingular();
70
89
 
71
90
  if (singular) {
72
- const parameterName = parameter.getName();
91
+ const metavariableNodeA = metavariableNode, ///
92
+ statementNode = this.getStatementNode();
73
93
 
74
- if (parameterName !== null) {
75
- const metavariableName = this.getMetavariableName();
76
-
77
- if (parameterName === metavariableName) {
78
- comparesToParamter = true;
79
- }
80
- }
81
- }
82
-
83
- return comparesToParamter;
84
- }
94
+ metavariableNode = statementNode.getMetavariableNode();
85
95
 
86
- compareMetavariable(metavariable) {
87
- let comparesToMetavariableName;
96
+ const metavariableNodeB = metavariableNode, ///
97
+ metavariableNodeAMatchesMetavariableNodeB = metavariableNodeA.match(metavariableNodeB);
88
98
 
89
- const singular = this.isSingular();
90
-
91
- if (singular) {
92
- let metavariableName;
93
-
94
- metavariableName = metavariable.getName();
95
-
96
- const metavariableNameA = metavariableName; ///
97
-
98
- metavariableName = this.getMetavariableName();
99
-
100
- const metavariableNameB = metavariableName; ///
101
-
102
- comparesToMetavariableName = (metavariableNameA === metavariableNameB);
99
+ if (metavariableNodeAMatchesMetavariableNodeB) {
100
+ metavariableNodeMatches = true;
101
+ }
103
102
  }
104
103
 
105
- return comparesToMetavariableName;
104
+ return metavariableNodeMatches;
106
105
  }
107
106
 
108
- compareMetavariableName(metavariableName) {
109
- let comparesToMetavariableName = false;
107
+ compareParameter(parameter) {
108
+ let comparesToParamter = false;
110
109
 
111
110
  const singular = this.isSingular();
112
111
 
113
112
  if (singular) {
114
- const metavariableNameA = metavariableName ///
115
-
116
- metavariableName = this.getMetavariableName();
117
-
118
- const metavariableNameB = metavariableName; ///
119
-
120
- comparesToMetavariableName = (metavariableNameA === metavariableNameB);
121
- }
122
-
123
- return comparesToMetavariableName;
124
- }
125
-
126
- compareSubproofOrProofAssertions(subproofOrProofAssertions, context) {
127
- let comparesToSubproofOrProofAssertions;
113
+ const parameterName = parameter.getName();
128
114
 
129
- comparesToSubproofOrProofAssertions = backwardsSome(subproofOrProofAssertions, (subproofOrProofAssertion) => {
130
- const statement = this, ///
131
- subproofOrProofAssertionComparesToStatement = subproofOrProofAssertion.compareStatement(statement, context);
115
+ if (parameterName !== null) {
116
+ const metavariableName = this.getMetavariableName();
132
117
 
133
- if (subproofOrProofAssertionComparesToStatement) {
134
- return true;
118
+ if (parameterName === metavariableName) {
119
+ comparesToParamter = true;
120
+ }
135
121
  }
136
- });
122
+ }
137
123
 
138
- return comparesToSubproofOrProofAssertions;
124
+ return comparesToParamter;
139
125
  }
140
126
 
141
127
  findValidStatment(context) {
@@ -54,10 +54,10 @@ export default define(class Subproof extends Element {
54
54
  return proofAssertion;
55
55
  }
56
56
 
57
- compareStatement(statement, context) {
58
- const statementUnifies = false;
57
+ compareStep(step, context) {
58
+ const comparesToStep = false;
59
59
 
60
- return statementUnifies;
60
+ return comparesToStep;
61
61
  }
62
62
 
63
63
  async verify(context) {
@@ -9,8 +9,8 @@ import { join, ablate, descend, attempt, instantiate } from "../../utilities/con
9
9
  import { frameSubstitutionStringFromFrameAndMetavariable } from "../../utilities/string";
10
10
 
11
11
  export default define(class FrameSubstitution extends Substitution {
12
- constructor(context, string, node, targetFrame, replacementFrame) {
13
- super(context, string, node);
12
+ constructor(context, string, node, generalContext, targetFrame, replacementFrame) {
13
+ super(context, string, node, generalContext);
14
14
 
15
15
  this.targetFrame = targetFrame;
16
16
  this.replacementFrame = replacementFrame;
@@ -31,6 +31,8 @@ export default define(class FrameSubstitution extends Substitution {
31
31
  return frameSubstitutionNode;
32
32
  }
33
33
 
34
+ getMetavariableNode() { return this.targetFrame.getMetavariableNode(); }
35
+
34
36
  getTargetNode() {
35
37
  const targetFrameNode = this.targetFrame.getNode(),
36
38
  tergetNode = targetFrameNode; ///
@@ -45,10 +47,6 @@ export default define(class FrameSubstitution extends Substitution {
45
47
  return replacementNode;
46
48
  }
47
49
 
48
- compareMetavariableName(metavariableName) { return this.targetFrame.compareMetavariableName(metavariableName); }
49
-
50
- getMetavariableName() { return this.targetFrame.getMetavariableName(); }
51
-
52
50
  isTrivial() {
53
51
  const targetFrameEqualToReplacementFrame = this.targetFrame.isEqualTo(this.replacementFrame),
54
52
  trivial = targetFrameEqualToReplacementFrame; ///
@@ -56,6 +54,8 @@ export default define(class FrameSubstitution extends Substitution {
56
54
  return trivial;
57
55
  }
58
56
 
57
+ matchMetavariableNode(metavariableNode) { return this.targetFrame.matchMetavariableNode(metavariableNode); }
58
+
59
59
  compareFrame(frame, context) {
60
60
  const frameEqualToReplacementFrame = this.replacementFrame.isEqualTo(frame),
61
61
  comparedToFrame = frameEqualToReplacementFrame; ///
@@ -116,6 +116,8 @@ export default define(class FrameSubstitution extends Substitution {
116
116
 
117
117
  context.addSubstitution(substitution);
118
118
 
119
+ this.setGeneralContext(generalContext);
120
+
119
121
  context.debug(`...validated the '${frameSubstitutionString}' frame substitution.`);
120
122
  }
121
123
 
@@ -191,11 +193,12 @@ export default define(class FrameSubstitution extends Substitution {
191
193
  instantiate((context) => {
192
194
  const { string } = json,
193
195
  frameSubstitutionNode = instantiateFrameSubstitution(string, context),
194
- node = frameSubstitutionNode, ///
196
+ node = frameSubstitutionNode, ///
197
+ generalContext = generalContextFromFrameSubstitutionNode(frameSubstitutionNode, context),
195
198
  targetFrame = targetFrameFromFrameSubstitutionNode(frameSubstitutionNode, context),
196
199
  replacementFrame = replacementFrameFromFrameSubstitutionNode(frameSubstitutionNode, context);
197
200
 
198
- frameSubstitutionn = new FrameSubstitution(context, string, node, targetFrame, replacementFrame);
201
+ frameSubstitutionn = new FrameSubstitution(context, string, node, generalContext, targetFrame, replacementFrame);
199
202
  }, context);
200
203
  }
201
204
 
@@ -246,3 +249,10 @@ function replacementFrameFromFrameSubstitutionNode(frameSubstitutionNode, contex
246
249
 
247
250
  return replacementFrame;
248
251
  }
252
+
253
+ function generalContextFromFrameSubstitutionNode(frameSubstitutionNode, context) {
254
+ const generalContext = context; ///
255
+
256
+ return generalContext;
257
+ }
258
+