occam-verify-cli 1.0.587 → 1.0.602

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 (105) hide show
  1. package/lib/context/ephemeral.js +74 -2
  2. package/lib/context/file/nominal.js +11 -9
  3. package/lib/context/liminal.js +161 -24
  4. package/lib/context/literal.js +8 -2
  5. package/lib/context/scoped.js +4 -28
  6. package/lib/context/synthetic.js +146 -0
  7. package/lib/context.js +170 -1
  8. package/lib/element/assertion/contained.js +21 -15
  9. package/lib/element/assertion/defined.js +45 -65
  10. package/lib/element/assertion/property.js +25 -19
  11. package/lib/element/assertion/satisfies.js +14 -8
  12. package/lib/element/assertion/subproof.js +12 -6
  13. package/lib/element/assertion.js +47 -1
  14. package/lib/element/assumption.js +12 -12
  15. package/lib/element/conclusion.js +2 -2
  16. package/lib/element/deduction.js +2 -2
  17. package/lib/element/frame.js +61 -29
  18. package/lib/element/judgement.js +7 -1
  19. package/lib/element/label.js +8 -8
  20. package/lib/element/metavariable.js +71 -59
  21. package/lib/element/procedureCall.js +24 -8
  22. package/lib/element/proof.js +43 -35
  23. package/lib/element/proofAssertion/premise.js +122 -97
  24. package/lib/element/proofAssertion/step.js +161 -115
  25. package/lib/element/proofAssertion/supposition.js +157 -118
  26. package/lib/element/proofAssertion.js +3 -3
  27. package/lib/element/reference.js +40 -7
  28. package/lib/element/rule.js +227 -95
  29. package/lib/element/signature.js +2 -1
  30. package/lib/element/statement.js +67 -34
  31. package/lib/element/substitution/frame.js +36 -16
  32. package/lib/element/substitution/reference.js +36 -16
  33. package/lib/element/substitution/statement.js +94 -55
  34. package/lib/element/substitution/term.js +36 -16
  35. package/lib/element/substitution.js +54 -17
  36. package/lib/element/substitutions.js +4 -276
  37. package/lib/element/term.js +60 -31
  38. package/lib/element/topLevelAssertion/axiom.js +13 -4
  39. package/lib/element/topLevelAssertion/conjecture.js +7 -2
  40. package/lib/element/topLevelAssertion/theorem.js +7 -2
  41. package/lib/element/topLevelAssertion.js +201 -134
  42. package/lib/element/topLevelMetaAssertion.js +310 -51
  43. package/lib/element/variable.js +15 -6
  44. package/lib/node/substitution/statement.js +33 -1
  45. package/lib/process/unify.js +6 -6
  46. package/lib/utilities/context.js +10 -25
  47. package/lib/utilities/element.js +34 -9
  48. package/lib/utilities/statement.js +1 -8
  49. package/lib/utilities/string.js +12 -1
  50. package/lib/utilities/substitutions.js +42 -16
  51. package/lib/utilities/unification.js +3 -1
  52. package/lib/utilities/validation.js +2 -2
  53. package/package.json +4 -4
  54. package/src/context/ephemeral.js +73 -1
  55. package/src/context/file/nominal.js +14 -11
  56. package/src/context/liminal.js +180 -25
  57. package/src/context/literal.js +3 -1
  58. package/src/context/scoped.js +3 -35
  59. package/src/context/synthetic.js +49 -0
  60. package/src/context.js +163 -1
  61. package/src/element/assertion/contained.js +28 -20
  62. package/src/element/assertion/defined.js +62 -34
  63. package/src/element/assertion/property.js +27 -19
  64. package/src/element/assertion/satisfies.js +15 -7
  65. package/src/element/assertion/subproof.js +13 -5
  66. package/src/element/assertion.js +35 -0
  67. package/src/element/assumption.js +5 -5
  68. package/src/element/conclusion.js +2 -4
  69. package/src/element/deduction.js +2 -4
  70. package/src/element/frame.js +71 -39
  71. package/src/element/judgement.js +2 -0
  72. package/src/element/label.js +4 -4
  73. package/src/element/metavariable.js +94 -75
  74. package/src/element/procedureCall.js +6 -6
  75. package/src/element/proof.js +6 -6
  76. package/src/element/proofAssertion/premise.js +101 -69
  77. package/src/element/proofAssertion/step.js +78 -39
  78. package/src/element/proofAssertion/supposition.js +141 -115
  79. package/src/element/proofAssertion.js +3 -2
  80. package/src/element/reference.js +52 -10
  81. package/src/element/rule.js +138 -76
  82. package/src/element/signature.js +2 -0
  83. package/src/element/statement.js +76 -45
  84. package/src/element/substitution/frame.js +44 -15
  85. package/src/element/substitution/reference.js +44 -15
  86. package/src/element/substitution/statement.js +124 -72
  87. package/src/element/substitution/term.js +43 -15
  88. package/src/element/substitution.js +55 -18
  89. package/src/element/substitutions.js +1 -258
  90. package/src/element/term.js +65 -34
  91. package/src/element/topLevelAssertion/axiom.js +1 -1
  92. package/src/element/topLevelAssertion/conjecture.js +1 -1
  93. package/src/element/topLevelAssertion/theorem.js +1 -1
  94. package/src/element/topLevelAssertion.js +128 -48
  95. package/src/element/topLevelMetaAssertion.js +86 -32
  96. package/src/element/variable.js +15 -5
  97. package/src/node/substitution/statement.js +33 -0
  98. package/src/process/unify.js +6 -8
  99. package/src/utilities/context.js +9 -8
  100. package/src/utilities/element.js +37 -10
  101. package/src/utilities/statement.js +0 -7
  102. package/src/utilities/string.js +14 -0
  103. package/src/utilities/substitutions.js +59 -17
  104. package/src/utilities/unification.js +4 -0
  105. package/src/utilities/validation.js +3 -1
@@ -38,6 +38,21 @@ export default define(class ReferenceSubstitution extends Substitution {
38
38
  return replacementNode;
39
39
  }
40
40
 
41
+ getMetavariable(generalContext, specificContext) {
42
+ let metavariable = null;
43
+
44
+ const targetReferenceNode = this.targetReference.getNode(),
45
+ metavariableName = targetReferenceNode.getMetavariableName();
46
+
47
+ if (metavariableName !== null) {
48
+ const context = generalContext; ///
49
+
50
+ metavariable = context.findMetavariableByMetavariableName(metavariableName);
51
+ }
52
+
53
+ return metavariable;
54
+ }
55
+
41
56
  isTrivial() {
42
57
  const targetReferenceEqualToReplacementReference = this.targetReference.isEqualTo(this.replacementReference),
43
58
  trivial = targetReferenceEqualToReplacementReference; ///
@@ -59,38 +74,51 @@ export default define(class ReferenceSubstitution extends Substitution {
59
74
  return comparesToParameter;
60
75
  }
61
76
 
62
- validate(context) {
77
+ validate(generalContext, specificContext) {
63
78
  let validates = false;
64
79
 
80
+ const context = this.getContext();
81
+
82
+ specificContext = context; ///
83
+
65
84
  const referenceSubstitutionString = this.getString(); ///
66
85
 
67
86
  context.trace(`Validating the '${referenceSubstitutionString}' reference substitution...`);
68
87
 
69
- const targetReferenceValidates = this.validateTargetReference(context);
88
+ const valid = this.isValid(context);
70
89
 
71
- if (targetReferenceValidates) {
72
- const replacementReferenceValidates = this.validateReplacementReference(context);
90
+ if (valid) {
91
+ validates = true;
92
+
93
+ context.debug(`...the '${referenceSubstitutionString}' reference substitution is already valid.`);
94
+ } else {
95
+ const targetReferenceValidates = this.validateTargetReference(generalContext, specificContext);
96
+
97
+ if (targetReferenceValidates) {
98
+ const replacementReferenceValidates = this.validateReplacementReference(generalContext, specificContext);
73
99
 
74
- if (replacementReferenceValidates) {
75
- validates = true;
100
+ if (replacementReferenceValidates) {
101
+ validates = true;
102
+ }
76
103
  }
77
- }
78
104
 
79
- if (validates) {
80
- const substititoin = this; ///
105
+ if (validates) {
106
+ const substititoin = this; ///
81
107
 
82
- context.addSubstitution(substititoin);
108
+ context.addSubstitution(substititoin);
83
109
 
84
- context.debug(`...validated the '${referenceSubstitutionString}' reference substitution.`);
110
+ context.debug(`...validated the '${referenceSubstitutionString}' reference substitution.`);
111
+ }
85
112
  }
86
113
 
87
114
  return validates;
88
115
  }
89
116
 
90
- validateTargetReference(context) {
117
+ validateTargetReference(generalContext, specificContext) {
91
118
  let targetReferenceValidates = false;
92
119
 
93
- const targetReferenceString = this.targetReference.getString(),
120
+ const context = generalContext, ///
121
+ targetReferenceString = this.targetReference.getString(),
94
122
  referenceSubstitutionString = this.getString(); ///
95
123
 
96
124
  context.trace(`Validating the '${referenceSubstitutionString}' reference subtitution's '${targetReferenceString}' target reference...`);
@@ -110,10 +138,11 @@ export default define(class ReferenceSubstitution extends Substitution {
110
138
  return targetReferenceValidates;
111
139
  }
112
140
 
113
- validateReplacementReference(context) {
141
+ validateReplacementReference(generalContext, specificContext) {
114
142
  let replacementReferenceValidates;
115
143
 
116
- const replacementReferenceString = this.replacementReference.getString(),
144
+ const context = specificContext, ///
145
+ replacementReferenceString = this.replacementReference.getString(),
117
146
  referenceSubstitutionString = this.getString(); ///
118
147
 
119
148
  context.trace(`Validating the '${referenceSubstitutionString}' reference subtitution's '${replacementReferenceString}' replacement reference...`);
@@ -3,10 +3,10 @@
3
3
  import Substitution from "../substitution";
4
4
 
5
5
  import { define } from "../../elements";
6
- import { literally } from "../../utilities/context";
7
6
  import { unifySubstitution } from "../../process/unify";
8
7
  import { stripBracketsFromStatement } from "../../utilities/brackets";
9
8
  import { instantiateStatementSubstitution } from "../../process/instantiate";
9
+ import { liminally, literally, synthetically } from "../../utilities/context";
10
10
  import { statementSubstitutionFromStatementSubstitutionNode } from "../../utilities/element";
11
11
  import { statementToStatementJSON, metavariableToMetavariableJSON } from "../../utilities/json";
12
12
  import { statementSubstitutionStringFromStatementAndMetavariable, statementSubstitutionStringFromStatementMetavariableAndSubstitution } from "../../utilities/string";
@@ -37,6 +37,21 @@ export default define(class StatementSubstitution extends Substitution {
37
37
  return this.replacementStatement;
38
38
  }
39
39
 
40
+ getMetavariable(generalContext, specificContext) {
41
+ let metavariable = null;
42
+
43
+ const targetStatementNode = this.targetStatement.getNode(),
44
+ metavariableName = targetStatementNode.getMetavariableName();
45
+
46
+ if (metavariableName !== null) {
47
+ const context = generalContext; ///
48
+
49
+ metavariable = context.findMetavariableByMetavariableName(metavariableName);
50
+ }
51
+
52
+ return metavariable;
53
+ }
54
+
40
55
  getTargetNode() {
41
56
  const targetStatementNode = this.targetStatement.getNode(),
42
57
  targetNode = targetStatementNode; ///
@@ -91,38 +106,53 @@ export default define(class StatementSubstitution extends Substitution {
91
106
  return comparesToSubstitution;
92
107
  }
93
108
 
94
- validate(context) {
109
+ compareMetavariable(metavariable) { return this.targetStatement.compareMetavariable(metavariable); }
110
+
111
+ validate(generalContext, specificContext) {
95
112
  let validates = false;
96
113
 
114
+ const context = this.getContext();
115
+
116
+ specificContext = context; ///
117
+
97
118
  const statementSubstitutionString = this.getString(); ///
98
119
 
99
120
  context.trace(`Validating the '${statementSubstitutionString}' statement substitution...`);
100
121
 
101
- const targetStatementValidates = this.validateTargetStatement(context);
122
+ const valid = this.isValid(context);
102
123
 
103
- if (targetStatementValidates) {
104
- const replacementStatementValidates = this.validateReplacementStatement(context);
124
+ if (valid) {
125
+ validates = true;
105
126
 
106
- if (replacementStatementValidates) {
107
- validates = true;
127
+ context.debug(`...the '${statementSubstitutionString}' statement substitution is already valid.`);
128
+ } else {
129
+ const targetStatementValidates = this.validateTargetStatement(generalContext, specificContext);
130
+
131
+ if (targetStatementValidates) {
132
+ const replacementStatementValidates = this.validateReplacementStatement(generalContext, specificContext);
133
+
134
+ if (replacementStatementValidates) {
135
+ validates = true;
136
+ }
108
137
  }
109
- }
110
138
 
111
- if (validates) {
112
- const substititoin = this; ///
139
+ if (validates) {
140
+ const substititoin = this; ///
113
141
 
114
- context.addSubstitution(substititoin);
142
+ context.addSubstitution(substititoin);
115
143
 
116
- context.debug(`...validated the '${statementSubstitutionString}' statement substitution.`);
144
+ context.debug(`...validated the '${statementSubstitutionString}' statement substitution.`);
145
+ }
117
146
  }
118
147
 
119
148
  return validates;
120
149
  }
121
150
 
122
- validateTargetStatement(context) {
151
+ validateTargetStatement(generalContext, specificContext) {
123
152
  let targetStatementValidates = false;
124
153
 
125
- const targetStatementString = this.targetStatement.getString(),
154
+ const context = generalContext, ///
155
+ targetStatementString = this.targetStatement.getString(),
126
156
  statementSubstitutionString = this.getString(); ///
127
157
 
128
158
  context.trace(`Validating the '${statementSubstitutionString}' statement subtitution's '${targetStatementString}' target statement...`);
@@ -145,10 +175,11 @@ export default define(class StatementSubstitution extends Substitution {
145
175
  return targetStatementValidates;
146
176
  }
147
177
 
148
- validateReplacementStatement(context) {
178
+ validateReplacementStatement(generalContext, specificContext) {
149
179
  let replacementStatementValidates;
150
180
 
151
- const replacementStatementString = this.replacementStatement.getString(),
181
+ const context = specificContext, ///
182
+ replacementStatementString = this.replacementStatement.getString(),
152
183
  statementSubstitutionString = this.getString(); ///
153
184
 
154
185
  context.trace(`Validating the '${statementSubstitutionString}' statement subtitution's '${replacementStatementString}' replacement statement...`);
@@ -165,65 +196,39 @@ export default define(class StatementSubstitution extends Substitution {
165
196
  return replacementStatementValidates;
166
197
  }
167
198
 
168
- unifyStatement(statement, context) {
169
- let statementUnifies = false;
170
-
171
- const statementString = statement.getString(),
172
- statementSubstitutionString = this.getString();
173
-
174
- context.trace(`Unifying the '${statementString}' statement with the '${statementSubstitutionString}' statement substiution's statement...`);
175
-
176
- const specificContext = context; ///
199
+ unifyReplacementStatement(replacementStatement, generalContext, specificContext) {
200
+ let replacementStatemnentUnifies = false;
177
201
 
178
- context = this.getContext();
179
-
180
- const generalContext = context; ///
181
-
182
- context = specificContext; ///
202
+ const context = specificContext, ///
203
+ substitutionString = this.getString(), ///
204
+ replacementStatementString = replacementStatement.getString(),
205
+ substitutionReplacementStatementString = this.replacementStatement.getString(); ///
183
206
 
184
- const substitutions = [];
207
+ context.trace(`Unifying the '${replacementStatementString}' replacement statement with the '${substitutionString}' substiution's '${substitutionReplacementStatementString}' replacement statement...`);
185
208
 
186
- statementUnifies = this.replacementStatement.unifyStatement(statement, substitutions, generalContext, specificContext);
187
-
188
- let substitution = null;
209
+ const statementUnifies = this.replacementStatement.unifyStatement(replacementStatement, generalContext, specificContext);
189
210
 
190
211
  if (statementUnifies) {
191
- const substitutionsNonTrivialLength = substitutions.getNonTrivialLength();
192
-
193
- if (substitutionsNonTrivialLength === 1) {
194
- const firstSubstitution = substitutions.getFirstSubstitution();
195
-
196
- substitution = firstSubstitution; ///
197
- } else {
198
- statementUnifies = false;
199
- }
212
+ replacementStatemnentUnifies = true;
200
213
  }
201
214
 
202
- if (statementUnifies) {
203
- context.trace(`...unified the '${statementString}' statement with the '${statementSubstitutionString}' statement substiution's statement.`);
215
+ if (replacementStatemnentUnifies) {
216
+ context.debug(`...unified the '${replacementStatementString}' replacement statement with the '${substitutionString}' substiution's '${substitutionReplacementStatementString}' replacement statement.`);
204
217
  }
205
218
 
206
- return substitution;
219
+ return replacementStatemnentUnifies;
207
220
  }
208
221
 
209
- unifySubstitution(substitution, substitutions, context) {
210
- const generalSubstitution = this.substitution, ///
222
+ unifySubstitution(substitution, generalContext, specificContext) {
223
+ const context = specificContext,
224
+ generalSubstitution = this.substitution, ///
211
225
  specificSubstitution = substitution, ///
212
226
  generalSubstitutionString = generalSubstitution.getString(),
213
227
  specificSubstitutionString = specificSubstitution.getString();
214
228
 
215
229
  context.trace(`Unifying the '${specificSubstitutionString}' substitution with the '${generalSubstitutionString}' substitution...`);
216
230
 
217
- let substitutionContext;
218
-
219
- substitutionContext = this.substitution.getContext();
220
-
221
- const generalContext = substitutionContext; ///
222
-
223
- substitutionContext = substitution.getContext();
224
-
225
- const specificContext = substitutionContext, ///
226
- substitutionUnifies = unifySubstitution(generalSubstitution, specificSubstitution, substitutions, generalContext, specificContext);
231
+ const substitutionUnifies = unifySubstitution(generalSubstitution, specificSubstitution, generalContext, specificContext);
227
232
 
228
233
  if (substitutionUnifies) {
229
234
  context.trace(`...unified the '${specificSubstitutionString}' substitution with the '${generalSubstitutionString}' substitution.`);
@@ -232,30 +237,77 @@ export default define(class StatementSubstitution extends Substitution {
232
237
  return substitutionUnifies;
233
238
  }
234
239
 
235
- resolve(substitutions, context) {
240
+ resolve(generalContext, specificContext) {
241
+ let context;
242
+
236
243
  context = this.getContext();
237
244
 
238
245
  const substitutionString = this.getString(); ///
239
246
 
240
247
  context.trace(`Resolving the ${substitutionString} substitution...`);
241
248
 
242
- substitutions.snapshot(context);
249
+ context = generalContext; ///
250
+
251
+ const metavariable = this.getMetavariable(generalContext, specificContext);
243
252
 
244
- const metavariable = this.getMetavariable(),
245
- simpleSubstitution = substitutions.findSimpleSubstitutionByMetavariable(metavariable),
246
- substitution = simpleSubstitution.unifyStatement(this.replacementStatement, context);
253
+ context = specificContext; ///
254
+
255
+ const simpleSubstitution = context.findSimpleSubstitutionByMetavariable(metavariable);
256
+
257
+ context = this.getContext();
247
258
 
248
- if (substitution !== null) {
249
- const substitutionUnifies = this.unifySubstitution(substitution, substitutions, context);
259
+ const subtitution = liminally((context) => {
260
+ let substitution = null;
250
261
 
251
- if (substitutionUnifies) {
252
- this.resolved = true;
262
+ const specificContext = context; ///
263
+
264
+ context = simpleSubstitution.getContext();
265
+
266
+ const generalContext = context; ///
267
+
268
+ context = specificContext; ///
269
+
270
+ const replacementStatementUnifies = simpleSubstitution.unifyReplacementStatement(this.replacementStatement, generalContext, specificContext);
271
+
272
+ if (replacementStatementUnifies) {
273
+ const nested = false,
274
+ soleNonTrivialSubstitution = context.getSoleNonTrivialSubstitution(nested);
275
+
276
+ substitution = soleNonTrivialSubstitution; ///
253
277
  }
254
- }
255
278
 
256
- this.resolved ?
257
- substitutions.continue(context) :
258
- substitutions.rollback(context);
279
+ return substitution;
280
+ }, context);
281
+
282
+ if (subtitution !== null) {
283
+ liminally((specificContext) => {
284
+ const contexts = [];
285
+
286
+ context = simpleSubstitution.getContext();
287
+
288
+ contexts.push(context);
289
+
290
+ context = this.getContext();
291
+
292
+ contexts.push(context);
293
+
294
+ context = specificContext; ///
295
+
296
+ synthetically((context) => {
297
+ const specificContext = context; ///
298
+
299
+ context = this.substitution.getContext();
300
+
301
+ const generalContext = context; ///
302
+
303
+ this.unifySubstitution(subtitution, generalContext, specificContext);
304
+ }, contexts, context);
305
+
306
+ specificContext.commit();
307
+ }, specificContext);
308
+
309
+ this.resolved = true;
310
+ }
259
311
 
260
312
  if (this.resolved) {
261
313
  context.debug(`...resolved the '${substitutionString}' substitution.`);
@@ -303,7 +355,7 @@ export default define(class StatementSubstitution extends Substitution {
303
355
  const statementSubstitutionString = statementSubstitutionStringFromStatementMetavariableAndSubstitution(statement, metavariable, substitution),
304
356
  string = statementSubstitutionString, ///
305
357
  statementSubstitutionNode = instantiateStatementSubstitution(string, context),
306
- statementSubstitution = statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, substitution, context);
358
+ statementSubstitution = statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, context);
307
359
 
308
360
  return statementSubstitution;
309
361
  }, context);
@@ -39,6 +39,20 @@ export default define(class TermSubstitution extends Substitution {
39
39
  return replacementNode;
40
40
  }
41
41
 
42
+ getVariable(generalContext, specificContext) {
43
+ let variable = null;
44
+
45
+ const targetTermNode = this.targetTerm.getNode(),
46
+ variableIdentifier = targetTermNode.getVariableIdentifier();
47
+
48
+ if (variableIdentifier !== null) {
49
+ const context = specificContext; ///
50
+ variable = context.findVariableByVariableIdentifier(variableIdentifier);
51
+ }
52
+
53
+ return variable;
54
+ }
55
+
42
56
  isTrivial() {
43
57
  const targetTermEqualToReplacementTerm = this.targetTerm.isEqualTo(this.replacementTerm),
44
58
  trivial = targetTermEqualToReplacementTerm; ///
@@ -62,38 +76,51 @@ export default define(class TermSubstitution extends Substitution {
62
76
  return comparesToParameter;
63
77
  }
64
78
 
65
- validate(context) {
79
+ validate(generalContext, specificContext) {
66
80
  let validates = false;
67
81
 
82
+ const context = this.getContext();
83
+
84
+ specificContext = context; ///
85
+
68
86
  const termSubstitutionString = this.getString(); ///
69
87
 
70
88
  context.trace(`Validating the '${termSubstitutionString}' term substitution...`);
71
89
 
72
- const targetTermValidates = this.validateTargetTerm(context);
90
+ const valid = this.isValid(context);
73
91
 
74
- if (targetTermValidates) {
75
- const replacementTermValidates = this.validateReplacementTerm(context);
92
+ if (valid) {
93
+ validates = true;
94
+
95
+ context.debug(`...the '${termSubstitutionString}' term substitution is alrady valid.`);
96
+ } else {
97
+ const targetTermValidates = this.validateTargetTerm(generalContext, specificContext);
76
98
 
77
- if (replacementTermValidates) {
78
- validates = true;
99
+ if (targetTermValidates) {
100
+ const replacementTermValidates = this.validateReplacementTerm(generalContext, specificContext);
101
+
102
+ if (replacementTermValidates) {
103
+ validates = true;
104
+ }
79
105
  }
80
- }
81
106
 
82
- if (validates) {
83
- const substititoin = this; ///
107
+ if (validates) {
108
+ const substititoin = this; ///
84
109
 
85
- context.addSubstitution(substititoin);
110
+ context.addSubstitution(substititoin);
86
111
 
87
- context.debug(`...validated the '${termSubstitutionString}' term substitution.`);
112
+ context.debug(`...validated the '${termSubstitutionString}' term substitution.`);
113
+ }
88
114
  }
89
115
 
90
116
  return validates;
91
117
  }
92
118
 
93
- validateTargetTerm(context) {
119
+ validateTargetTerm(generalContext, specificContext) {
94
120
  let targetTermValidates = false;
95
121
 
96
- const targetTermString = this.targetTerm.getString(),
122
+ const context = generalContext, ///
123
+ targetTermString = this.targetTerm.getString(),
97
124
  termSubstitutionString = this.getString(); ///
98
125
 
99
126
  context.trace(`Validating the '${termSubstitutionString}' term subtitution's '${targetTermString}' target term...`);
@@ -117,10 +144,11 @@ export default define(class TermSubstitution extends Substitution {
117
144
  return targetTermValidates;
118
145
  }
119
146
 
120
- validateReplacementTerm(context) {
147
+ validateReplacementTerm(generalContext, specificContext) {
121
148
  let replacementTermValidates;
122
149
 
123
- const replacementTermString = this.replacementTerm.getString(),
150
+ const context = specificContext, ///
151
+ replacementTermString = this.replacementTerm.getString(),
124
152
  termSubstitutionString = this.getString(); ///
125
153
 
126
154
  context.trace(`Validating the '${termSubstitutionString}' term subtitution's '${replacementTermString}' replacement term...`);
@@ -25,6 +25,47 @@ export default class Substitution extends Element {
25
25
  return primitive;
26
26
  }
27
27
 
28
+ getMetavariable(context) {
29
+ const metavariable = null;
30
+
31
+ return metavariable;
32
+ }
33
+
34
+ getSubstitutionNode() {
35
+ const node = this.getNode(),
36
+ substitutionNode = node; ///
37
+
38
+ return substitutionNode;
39
+ }
40
+
41
+ matchSubstitutionNode(substitutionNode) {
42
+ const substitutionNodeA = substitutionNode; ///
43
+
44
+ substitutionNode = this.getSubstitutionNode();
45
+
46
+ const substitutionNodeB = substitutionNode, ///
47
+ substitutionNodeAAMatchesSubstitutionBNodeB = substitutionNodeA.match(substitutionNodeB),
48
+ equalTo = substitutionNodeAAMatchesSubstitutionBNodeB; ///
49
+
50
+ return equalTo;
51
+ }
52
+
53
+ isValid(context) {
54
+ const substitutionNode = this.getSubstitutionNode(),
55
+ substitutionPresent = context.isSubstitutionPresentBySubstitutionNode(substitutionNode),
56
+ valid = substitutionPresent; ///
57
+
58
+ return valid;
59
+ }
60
+
61
+ isEqualTo(substitution) {
62
+ const substitutionNode = substitution.getNode(),
63
+ substitutionNodeMatches = this.matchSubstitutionNode(substitutionNode),
64
+ equalTo = substitutionNodeMatches; ///
65
+
66
+ return equalTo;
67
+ }
68
+
28
69
  isSimple() {
29
70
  const simple = true;
30
71
 
@@ -44,6 +85,13 @@ export default class Substitution extends Element {
44
85
  return trivial;
45
86
  }
46
87
 
88
+ isNonTrivial() {
89
+ const trivial = this.isTrivial(),
90
+ nonTrivlal = !trivial;
91
+
92
+ return nonTrivlal;
93
+ }
94
+
47
95
  isFrameEqualToFrame(frame) {
48
96
  const frameEqualToFrame = false;
49
97
 
@@ -56,21 +104,10 @@ export default class Substitution extends Element {
56
104
  return referenceEqualToReference;
57
105
  }
58
106
 
59
- isMetavariableEqualToMetavariable(metavariable) {
60
- const metavariableEqualToMetavariable = false;
61
-
62
- return metavariableEqualToMetavariable;
63
- }
64
-
65
- isEqualTo(substitution) {
66
- const substitutionA = this, ///
67
- substitutionB = substitution, ///
68
- substitutionANode = substitutionA.getNode(),
69
- substitutionBNode = substitutionB.getNode(),
70
- substitutionANodeMatchesSubstitutionBNode = substitutionANode.match(substitutionBNode),
71
- equalTo = substitutionANodeMatchesSubstitutionBNode; ///
107
+ compare(substitution) {
108
+ const comparesToSubstitution = false;
72
109
 
73
- return equalTo;
110
+ return comparesToSubstitution;
74
111
  }
75
112
 
76
113
  compareTerm(term, context) {
@@ -91,13 +128,13 @@ export default class Substitution extends Element {
91
128
  return comparesToParameter;
92
129
  }
93
130
 
94
- compareSubstitution(substitution) {
95
- const comparesToSubstitution = false;
131
+ compareMetavariable(metavariable) {
132
+ const compaaresToMetavariable = false;
96
133
 
97
- return comparesToSubstitution;
134
+ return compaaresToMetavariable;
98
135
  }
99
136
 
100
- resolve(substitutions, context) {
137
+ resolve(substitutions, generalContext, specificContext) {
101
138
  const resolved = true;
102
139
 
103
140
  return resolved;