occam-verify-cli 1.0.608 → 1.0.611
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.
- package/lib/context/ephemeral.js +2 -2
- package/lib/context/file/nominal.js +17 -47
- package/lib/context/liminal.js +17 -20
- package/lib/context/scoped.js +8 -8
- package/lib/context.js +13 -13
- package/lib/element/assertion/defined.js +4 -4
- package/lib/element/frame.js +28 -23
- package/lib/element/judgement.js +4 -4
- package/lib/element/metavariable.js +18 -4
- package/lib/element/reference.js +13 -1
- package/lib/element/statement.js +16 -1
- package/lib/element/substitution/frame.js +10 -10
- package/lib/element/substitution/reference.js +10 -10
- package/lib/element/substitution/statement.js +13 -1
- package/lib/element/substitution/term.js +4 -10
- package/lib/element/substitution.js +15 -8
- package/lib/element/variable.js +6 -5
- package/lib/process/unify.js +2 -2
- package/lib/utilities/substitutions.js +6 -6
- package/package.json +2 -2
- package/src/context/ephemeral.js +1 -1
- package/src/context/file/nominal.js +15 -25
- package/src/context/liminal.js +12 -16
- package/src/context/scoped.js +6 -5
- package/src/context.js +8 -8
- package/src/element/assertion/defined.js +6 -3
- package/src/element/frame.js +28 -26
- package/src/element/judgement.js +1 -1
- package/src/element/metavariable.js +19 -4
- package/src/element/reference.js +14 -0
- package/src/element/statement.js +18 -0
- package/src/element/substitution/frame.js +2 -13
- package/src/element/substitution/reference.js +2 -13
- package/src/element/substitution/statement.js +4 -0
- package/src/element/substitution/term.js +1 -13
- package/src/element/substitution.js +12 -6
- package/src/element/variable.js +4 -2
- package/src/process/unify.js +1 -1
- package/src/utilities/substitutions.js +7 -6
package/src/context/liminal.js
CHANGED
|
@@ -185,14 +185,14 @@ export default class LiminalContext extends Context {
|
|
|
185
185
|
return substitutions;
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
|
|
188
|
+
findSubstitutionByVariableIdentifier(variable) {
|
|
189
189
|
const substitution = this.findSubstitution((substitution) => {
|
|
190
190
|
const substitutionVariable = substitution.getVariable();
|
|
191
191
|
|
|
192
192
|
if (substitutionVariable !== null) {
|
|
193
|
-
const
|
|
193
|
+
const substitutionVariableMatchesVariableIdentifier = substitutionVariable.matchVariableIdentifier(variableIdentifier);
|
|
194
194
|
|
|
195
|
-
if (
|
|
195
|
+
if (substitutionVariableMatchesVariableIdentifier) {
|
|
196
196
|
return true;
|
|
197
197
|
}
|
|
198
198
|
}
|
|
@@ -201,16 +201,12 @@ export default class LiminalContext extends Context {
|
|
|
201
201
|
return substitution;
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
-
|
|
204
|
+
findSubstitutionByMetavariableName(metavariableName) {
|
|
205
205
|
const substitution = this.findSubstitution((substitution) => { ///
|
|
206
|
-
const
|
|
206
|
+
const substitutionMatchesMetavariableName = substitution.matchMetavariableName(metavariableName);
|
|
207
207
|
|
|
208
|
-
if (
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
if (substitutionMetavvariableComparesToMetavariable) {
|
|
212
|
-
return true;
|
|
213
|
-
}
|
|
208
|
+
if (substitutionMatchesMetavariableName) {
|
|
209
|
+
return true;
|
|
214
210
|
}
|
|
215
211
|
}) || null;
|
|
216
212
|
|
|
@@ -251,13 +247,13 @@ export default class LiminalContext extends Context {
|
|
|
251
247
|
return complexSubstitutions;
|
|
252
248
|
}
|
|
253
249
|
|
|
254
|
-
|
|
250
|
+
findSubstitutionByMetavariableNameAndSubstitution(metavariableName, substitution) {
|
|
255
251
|
const substitutionA = substitution; ///
|
|
256
252
|
|
|
257
253
|
substitution = this.findSubstitution((substitution) => { ///
|
|
258
|
-
const
|
|
254
|
+
const substitutionMatchesMetavariableName = substitution.matchMetavariableName(metavariableName);
|
|
259
255
|
|
|
260
|
-
if (
|
|
256
|
+
if (substitutionMatchesMetavariableName) {
|
|
261
257
|
const substitutionB = substitution, ///
|
|
262
258
|
substitutionBSubstitutionComparesToSubstitutionA = substitutionB.compare(substitutionA);
|
|
263
259
|
|
|
@@ -277,8 +273,8 @@ export default class LiminalContext extends Context {
|
|
|
277
273
|
return simpleSubstitutionPresent;
|
|
278
274
|
}
|
|
279
275
|
|
|
280
|
-
|
|
281
|
-
substitution = this.
|
|
276
|
+
isSubstitutionPresentByMetavariableNameAndSubstitution(metavariableName, substitution) {
|
|
277
|
+
substitution = this.findSubstitutionByMetavariableNameAndSubstitution(metavariableName, substitution); ///
|
|
282
278
|
|
|
283
279
|
const substitutionPresent = (substitution !== null);
|
|
284
280
|
|
package/src/context/scoped.js
CHANGED
|
@@ -159,7 +159,8 @@ class ScopedContext extends Context {
|
|
|
159
159
|
let judgementAdded = false;
|
|
160
160
|
|
|
161
161
|
const metavariable = judgement.getMetavariable(),
|
|
162
|
-
|
|
162
|
+
metavariableName = metavariable.getMetavariableName(),
|
|
163
|
+
judgementPresent = this.isJudgementPresentByMetavariableName(metavariableName);
|
|
163
164
|
|
|
164
165
|
if (!judgementPresent) {
|
|
165
166
|
this.judgements.push(judgement);
|
|
@@ -183,10 +184,10 @@ class ScopedContext extends Context {
|
|
|
183
184
|
|
|
184
185
|
findEquivalenceByTerm(term) { return this.equivalences.findEquivalenceByTerm(term); }
|
|
185
186
|
|
|
186
|
-
|
|
187
|
+
findJudgementByMetavariableName(metavariableName) {
|
|
187
188
|
const judgements = this.getJudgements(),
|
|
188
189
|
judgement = judgements.find((judgement) => {
|
|
189
|
-
const judgementMetavariableComparesToMetavariable = judgement.
|
|
190
|
+
const judgementMetavariableComparesToMetavariable = judgement.matchMetavariableName(metavariableName);
|
|
190
191
|
|
|
191
192
|
if (judgementMetavariableComparesToMetavariable) {
|
|
192
193
|
return true;
|
|
@@ -230,8 +231,8 @@ class ScopedContext extends Context {
|
|
|
230
231
|
return termGrounded;
|
|
231
232
|
}
|
|
232
233
|
|
|
233
|
-
|
|
234
|
-
const judgement = this.
|
|
234
|
+
isJudgementPresentByMetavariableName(metavariableName) {
|
|
235
|
+
const judgement = this.findJudgementByMetavariableName(metavariableName),
|
|
235
236
|
judgementPresent = (judgement !== null);
|
|
236
237
|
|
|
237
238
|
return judgementPresent;
|
package/src/context.js
CHANGED
|
@@ -123,16 +123,16 @@ export default class Context extends ContextBase {
|
|
|
123
123
|
return topLevelAssertion;
|
|
124
124
|
}
|
|
125
125
|
|
|
126
|
-
|
|
126
|
+
findSubstitutionByVariableIdentifier(variableIdentifier) {
|
|
127
127
|
const context = this.getContext(),
|
|
128
|
-
substitution = context.
|
|
128
|
+
substitution = context.findSubstitutionByVariableIdentifier(variableIdentifier);
|
|
129
129
|
|
|
130
130
|
return substitution;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
|
|
133
|
+
findSubstitutionByMetavariableName(metavariableName) {
|
|
134
134
|
const context = this.getContext(),
|
|
135
|
-
substitution = context.
|
|
135
|
+
substitution = context.findSubstitutionByMetavariableName(metavariableName);
|
|
136
136
|
|
|
137
137
|
return substitution;
|
|
138
138
|
}
|
|
@@ -158,10 +158,10 @@ export default class Context extends ContextBase {
|
|
|
158
158
|
return simpleSubstitution;
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
-
|
|
161
|
+
findSubstitutionByMetavariableNameAndSubstitution(metavariableName, substitution) {
|
|
162
162
|
const context = this.getContext();
|
|
163
163
|
|
|
164
|
-
substitution = context.
|
|
164
|
+
substitution = context.findSubstitutionByMetavariableNameAndSubstitution(metavariableName, substitution); ///
|
|
165
165
|
|
|
166
166
|
return substitution;
|
|
167
167
|
}
|
|
@@ -180,9 +180,9 @@ export default class Context extends ContextBase {
|
|
|
180
180
|
return framePresent;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
-
|
|
183
|
+
isJudgementPresentByMetavariableName(metavariableName) {
|
|
184
184
|
const context = this.getContext(),
|
|
185
|
-
judgementPresent = context.
|
|
185
|
+
judgementPresent = context.isJudgementPresentByMetavariableName(metavariableName);
|
|
186
186
|
|
|
187
187
|
return judgementPresent;
|
|
188
188
|
}
|
|
@@ -189,7 +189,8 @@ function validateWhenDerived(term, frame, negated, generalContext, specificConte
|
|
|
189
189
|
const context = specificContext; ///
|
|
190
190
|
|
|
191
191
|
if (term !== null) {
|
|
192
|
-
const
|
|
192
|
+
const variableIdentifier = term.getVariableIdentifier(),
|
|
193
|
+
variable = context.findVariableByVariableIdentifier(variableIdentifier),
|
|
193
194
|
variableDefined = isVariableDefined(variable, context);
|
|
194
195
|
|
|
195
196
|
if (!negated && variableDefined) {
|
|
@@ -202,7 +203,8 @@ function validateWhenDerived(term, frame, negated, generalContext, specificConte
|
|
|
202
203
|
}
|
|
203
204
|
|
|
204
205
|
if (frame!== null) {
|
|
205
|
-
const
|
|
206
|
+
const metavariableName = frame.getMetavariableName(),
|
|
207
|
+
metavariable = context.findMetavariableByMetavariableName(metavariableName),
|
|
206
208
|
metavariableDefined = isMetavariableDefined(metavariable, context);
|
|
207
209
|
|
|
208
210
|
if (!negated && metavariableDefined) {
|
|
@@ -237,7 +239,8 @@ function isVariableDefined(variable, context) {
|
|
|
237
239
|
}
|
|
238
240
|
|
|
239
241
|
function isMetavariableDefined(metavariable, context) {
|
|
240
|
-
const
|
|
242
|
+
const metavariableName = metavariable.getNode(),
|
|
243
|
+
judgementPresent = context.isJudgementPresentByMetavariableName(metavariableName),
|
|
241
244
|
metavariableDefined = judgementPresent; ///
|
|
242
245
|
|
|
243
246
|
return metavariableDefined
|
package/src/element/frame.js
CHANGED
|
@@ -23,13 +23,6 @@ export default define(class Frame extends Element {
|
|
|
23
23
|
return this.metavariable;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
getMetavariableName() {
|
|
27
|
-
const node = this.getNode(),
|
|
28
|
-
metavariableName = node.getMetavariableName();
|
|
29
|
-
|
|
30
|
-
return metavariableName;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
26
|
getFrameNode() {
|
|
34
27
|
const node = this.getNode(),
|
|
35
28
|
frameNode = node; ///
|
|
@@ -37,26 +30,18 @@ export default define(class Frame extends Element {
|
|
|
37
30
|
return frameNode;
|
|
38
31
|
}
|
|
39
32
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const singular = this.isSingular();
|
|
44
|
-
|
|
45
|
-
if (singular) {
|
|
46
|
-
let metavariableName;
|
|
47
|
-
|
|
48
|
-
metavariableName = this.metavariable.getName();
|
|
49
|
-
|
|
50
|
-
const metavariableNameA = metavariableName ///
|
|
51
|
-
|
|
52
|
-
metavariableName = metavariable.getName();
|
|
33
|
+
getMetavariableName() {
|
|
34
|
+
const frameNode = this.getFrameNode(),
|
|
35
|
+
metavariableName = frameNode.getMetavariableName();
|
|
53
36
|
|
|
54
|
-
|
|
37
|
+
return metavariableName;
|
|
38
|
+
}
|
|
55
39
|
|
|
56
|
-
|
|
57
|
-
|
|
40
|
+
getMetavariableNode() {
|
|
41
|
+
const frameNode = this.getFrameNode(),
|
|
42
|
+
metavariableNode = frameNode.getMetavariableNode();
|
|
58
43
|
|
|
59
|
-
return
|
|
44
|
+
return metavariableNode;
|
|
60
45
|
}
|
|
61
46
|
|
|
62
47
|
matchFrameNode(frameNode) {
|
|
@@ -88,13 +73,30 @@ export default define(class Frame extends Element {
|
|
|
88
73
|
}
|
|
89
74
|
|
|
90
75
|
isSingular() {
|
|
91
|
-
const
|
|
92
|
-
frameNode = node, ///
|
|
76
|
+
const frameNode = this.getFrameNode(),
|
|
93
77
|
singular = frameNode.isSingular();
|
|
94
78
|
|
|
95
79
|
return singular;
|
|
96
80
|
}
|
|
97
81
|
|
|
82
|
+
matchMetavariableName(metavariableName) {
|
|
83
|
+
let metavariableNameMatches = false;
|
|
84
|
+
|
|
85
|
+
const singular = this.isSingular();
|
|
86
|
+
|
|
87
|
+
if (singular) {
|
|
88
|
+
const metavariableNameA = metavariableName ///
|
|
89
|
+
|
|
90
|
+
metavariableName = this.getMetavariableName();
|
|
91
|
+
|
|
92
|
+
const metavariableNameB = metavariableName; ///
|
|
93
|
+
|
|
94
|
+
metavariableNameMatches = (metavariableNameA === metavariableNameB);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return metavariableNameMatches;
|
|
98
|
+
}
|
|
99
|
+
|
|
98
100
|
compareParameter(parameter) {
|
|
99
101
|
let comparesToParamter = false;
|
|
100
102
|
|
package/src/element/judgement.js
CHANGED
|
@@ -31,7 +31,7 @@ export default define(class Judgement extends Element {
|
|
|
31
31
|
|
|
32
32
|
getMetavariable() { return this.frame.getMetavariable(); }
|
|
33
33
|
|
|
34
|
-
|
|
34
|
+
matchMetavariableName(metavariableName) { return this.frame.matchMetavariableName(metavariableName); }
|
|
35
35
|
|
|
36
36
|
validate(assignments, stated, context) {
|
|
37
37
|
let validates = false;
|
|
@@ -39,6 +39,20 @@ export default define(class Metavariable extends Element {
|
|
|
39
39
|
this.metaType = metaType;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
+
getMetavariableNode() {
|
|
43
|
+
const node = this.getNode(),
|
|
44
|
+
metavarialbeNode = node; ///
|
|
45
|
+
|
|
46
|
+
return metavarialbeNode;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
getMetavariableName() {
|
|
50
|
+
const metavarialbeNode = this.getMetavariableNode(),
|
|
51
|
+
metavariableName = metavarialbeNode.getMetavariableName();
|
|
52
|
+
|
|
53
|
+
return metavariableName;
|
|
54
|
+
}
|
|
55
|
+
|
|
42
56
|
compare(metavariable) {
|
|
43
57
|
const name = metavariable.getName(),
|
|
44
58
|
comparesToMetavariable = (this.name === name);
|
|
@@ -169,10 +183,11 @@ export default define(class Metavariable extends Element {
|
|
|
169
183
|
if (statementMetavariableUnifies) {
|
|
170
184
|
statementUnifies = true;
|
|
171
185
|
} else {
|
|
172
|
-
const
|
|
186
|
+
const metavariableName = metavariable.getName(),
|
|
187
|
+
substitutionPresent = context.isSubstitutionPresentByMetavariableNameAndSubstitution(metavariableName, substitution);
|
|
173
188
|
|
|
174
189
|
if (substitutionPresent) {
|
|
175
|
-
substitution = context.
|
|
190
|
+
substitution = context.findSubstitutionByMetavariableNameAndSubstitution(metavariableName, substitution); ///
|
|
176
191
|
|
|
177
192
|
const substitutionComparesToStatement = substitution.compareStatement(statement, context);
|
|
178
193
|
|
|
@@ -295,8 +310,8 @@ export default define(class Metavariable extends Element {
|
|
|
295
310
|
specificContextFilePath = specificContext.getFilePath();
|
|
296
311
|
|
|
297
312
|
if (generalContextFilePath === specificContextFilePath) {
|
|
298
|
-
const
|
|
299
|
-
frameMetavariableComparesToMetvariable = frame.
|
|
313
|
+
const metavariableName = this.getMetavariableName(), ///
|
|
314
|
+
frameMetavariableComparesToMetvariable = frame.matchMetavariableName(metavariableName);
|
|
300
315
|
|
|
301
316
|
if (frameMetavariableComparesToMetvariable) {
|
|
302
317
|
frameMetavariableUnifies = true;
|
package/src/element/reference.js
CHANGED
|
@@ -53,6 +53,20 @@ export default define(class Reference extends Element {
|
|
|
53
53
|
return equalTo;
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
+
matchMetavariableName(metavariableName) {
|
|
57
|
+
let metavariableNameMatches = false;
|
|
58
|
+
|
|
59
|
+
const metavariableNameA = metavariableName ///
|
|
60
|
+
|
|
61
|
+
metavariableName = this.getMetavariableName();
|
|
62
|
+
|
|
63
|
+
const metavariableNameB = metavariableName; ///
|
|
64
|
+
|
|
65
|
+
metavariableNameMatches = (metavariableNameA === metavariableNameB);
|
|
66
|
+
|
|
67
|
+
return metavariableNameMatches;
|
|
68
|
+
}
|
|
69
|
+
|
|
56
70
|
isValid(context) {
|
|
57
71
|
const assertionNode = this.getReferenceNode(),
|
|
58
72
|
assertionPresent = context.isReferencePresentByReferenceNode(assertionNode),
|
package/src/element/statement.js
CHANGED
|
@@ -49,6 +49,24 @@ export default define(class Statement extends Element {
|
|
|
49
49
|
return equalTo;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
+
matchMetavariableName(metavariableName) {
|
|
53
|
+
let metavariableNameMatches = false;
|
|
54
|
+
|
|
55
|
+
const singular = this.isSingular();
|
|
56
|
+
|
|
57
|
+
if (singular) {
|
|
58
|
+
const metavariableNameA = metavariableName ///
|
|
59
|
+
|
|
60
|
+
metavariableName = this.getMetavariableName();
|
|
61
|
+
|
|
62
|
+
const metavariableNameB = metavariableName; ///
|
|
63
|
+
|
|
64
|
+
metavariableNameMatches = (metavariableNameA === metavariableNameB);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
return metavariableNameMatches;
|
|
68
|
+
}
|
|
69
|
+
|
|
52
70
|
isValid(context) {
|
|
53
71
|
const statementNode = this.getStatementNode(),
|
|
54
72
|
statementPresent = context.isStatementPresentByStatementNode(statementNode),
|
|
@@ -38,20 +38,9 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
38
38
|
return replacementNode;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
let metavariable = null;
|
|
41
|
+
matchMetavariableName(metavariableName) { return this.targetFrame.matchMetavariableName(metavariableName); }
|
|
43
42
|
|
|
44
|
-
|
|
45
|
-
metavariableName = targetFrameNode.getMetavariableName();
|
|
46
|
-
|
|
47
|
-
if (metavariableName !== null) {
|
|
48
|
-
const context = generalContext; ///
|
|
49
|
-
|
|
50
|
-
metavariable = context.findMetavariableByMetavariableName(metavariableName);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return metavariable;
|
|
54
|
-
}
|
|
43
|
+
getMetavariableName() { return this.targetFrame.getMetavariableName(); }
|
|
55
44
|
|
|
56
45
|
isTrivial() {
|
|
57
46
|
const targetFrameEqualToReplacementFrame = this.targetFrame.isEqualTo(this.replacementFrame),
|
|
@@ -38,20 +38,9 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
38
38
|
return replacementNode;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
|
|
42
|
-
let metavariable = null;
|
|
41
|
+
getMetavariableName() { return this.targetReference.getMetavariableName(); }
|
|
43
42
|
|
|
44
|
-
|
|
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
|
-
}
|
|
43
|
+
matchMetavariableName(metavariableName) { return this.targetReference.matchMetavariableName(metavariableName); }
|
|
55
44
|
|
|
56
45
|
isTrivial() {
|
|
57
46
|
const targetReferenceEqualToReplacementReference = this.targetReference.isEqualTo(this.replacementReference),
|
|
@@ -72,6 +72,10 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
72
72
|
return simple;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
+
getMetavariableName() { return this.targetStatement.getMetavariableName(); }
|
|
76
|
+
|
|
77
|
+
matchMetavariableName(metavariableName) { return this.targetStatement.matchMetavariableName(metavariableName); }
|
|
78
|
+
|
|
75
79
|
compareStatement(statement, context) {
|
|
76
80
|
statement = stripBracketsFromStatement(statement, context); ///
|
|
77
81
|
|
|
@@ -39,19 +39,7 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
39
39
|
return replacementNode;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
|
|
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
|
-
}
|
|
42
|
+
getVariableIdentifier() { return this.targetTerm.getVariableIdentifier(); }
|
|
55
43
|
|
|
56
44
|
isTrivial() {
|
|
57
45
|
const targetTermEqualToReplacementTerm = this.targetTerm.isEqualTo(this.replacementTerm),
|
|
@@ -25,12 +25,6 @@ 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
28
|
getSubstitutionNode() {
|
|
35
29
|
const node = this.getNode(),
|
|
36
30
|
substitutionNode = node; ///
|
|
@@ -38,6 +32,18 @@ export default class Substitution extends Element {
|
|
|
38
32
|
return substitutionNode;
|
|
39
33
|
}
|
|
40
34
|
|
|
35
|
+
getNetavariableName() {
|
|
36
|
+
const metavariableName = null;
|
|
37
|
+
|
|
38
|
+
return metavariableName;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
getVariableIdentifier() {
|
|
42
|
+
const variableIdentifier = null;
|
|
43
|
+
|
|
44
|
+
return variableIdentifier;
|
|
45
|
+
}
|
|
46
|
+
|
|
41
47
|
matchSubstitutionNode(substitutionNode) {
|
|
42
48
|
const substitutionNodeA = substitutionNode; ///
|
|
43
49
|
|
package/src/element/variable.js
CHANGED
|
@@ -113,7 +113,7 @@ export default define(class Variable extends Element {
|
|
|
113
113
|
return typeValidates;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
unifyTerm(term,
|
|
116
|
+
unifyTerm(term, generalContext, specificContext) {
|
|
117
117
|
let termUnifies = false;
|
|
118
118
|
|
|
119
119
|
const context = specificContext, ///
|
|
@@ -127,7 +127,9 @@ export default define(class Variable extends Element {
|
|
|
127
127
|
|
|
128
128
|
variable = this; ///
|
|
129
129
|
|
|
130
|
-
|
|
130
|
+
const variableIdentifier = variable.getIdentifier();
|
|
131
|
+
|
|
132
|
+
substitution = context.findSubstitutionByVariableIdentifier(variableIdentifier);
|
|
131
133
|
|
|
132
134
|
if (substitution !== null) {
|
|
133
135
|
const substitutionComparesToTerm = substitution.compareTerm(term, context);
|
package/src/process/unify.js
CHANGED
|
@@ -69,7 +69,7 @@ class MetaLevelPass extends ZipPass {
|
|
|
69
69
|
|
|
70
70
|
const substitutionNode = statementNode.getSubstitutionNode(),
|
|
71
71
|
substitution = (substitutionNode !== null) ?
|
|
72
|
-
context.findSubstitutionBySubstitutionNode(substitutionNode
|
|
72
|
+
context.findSubstitutionBySubstitutionNode(substitutionNode) :
|
|
73
73
|
null;
|
|
74
74
|
|
|
75
75
|
context = specificContext; ///
|
|
@@ -16,7 +16,7 @@ export function termFromTermAndSubstitutions(term, generalContext, specificConte
|
|
|
16
16
|
variable = generalContext.findVariableByVariableIdentifier(variableIdentifier);
|
|
17
17
|
|
|
18
18
|
if (variable !== null) {
|
|
19
|
-
const substitution = specificContext.
|
|
19
|
+
const substitution = specificContext.findSubstitutionByVariableIdentifier(variableIdentifier);
|
|
20
20
|
|
|
21
21
|
if (substitution !== null) {
|
|
22
22
|
const termSubstitution = substitution, ///
|
|
@@ -43,7 +43,7 @@ export function frameFromFrameAndSubstitutions(frame, generalContext, specificCo
|
|
|
43
43
|
metavariable = generalContext.findMetavariableByMetavariableName(metavariableName);
|
|
44
44
|
|
|
45
45
|
if (metavariable !== null) {
|
|
46
|
-
const substitution = specificContext.
|
|
46
|
+
const substitution = specificContext.findSubstitutionByMetavariableName(metavariableName);
|
|
47
47
|
|
|
48
48
|
if (substitution !== null) {
|
|
49
49
|
const frameSubstitution = substitution, ///
|
|
@@ -77,7 +77,7 @@ export function statementFromStatementAndSubstitutions(statement, generalContext
|
|
|
77
77
|
|
|
78
78
|
specificContext = context; ///
|
|
79
79
|
|
|
80
|
-
substitution = specificContext.findSubstitutionBySubstitutionNode(substitutionNode
|
|
80
|
+
substitution = specificContext.findSubstitutionBySubstitutionNode(substitutionNode);
|
|
81
81
|
|
|
82
82
|
context = generalContext; ///
|
|
83
83
|
|
|
@@ -91,8 +91,8 @@ export function statementFromStatementAndSubstitutions(statement, generalContext
|
|
|
91
91
|
|
|
92
92
|
if (metavariable !== null) {
|
|
93
93
|
substitution = (substitution !== null) ?
|
|
94
|
-
specificContext.
|
|
95
|
-
specificContext.
|
|
94
|
+
specificContext.findSubstitutionByMetavariableNameAndSubstitution(metavariableName, substitution) :
|
|
95
|
+
specificContext.findSubstitutionByMetavariableName(metavariableName);
|
|
96
96
|
|
|
97
97
|
if (substitution !== null) {
|
|
98
98
|
const statementSubstitution = substitution, ///
|
|
@@ -112,7 +112,8 @@ export function metavariablesFromSubstitutions(substitutions, generalContext, sp
|
|
|
112
112
|
|
|
113
113
|
substitutions.forEach((substitution) => {
|
|
114
114
|
const context = generalContext, ///
|
|
115
|
-
|
|
115
|
+
metavariableName = substitution.getMetavariableName(),
|
|
116
|
+
metavariable = context.findMetavariableByMetavariableName(metavariableName);
|
|
116
117
|
|
|
117
118
|
if (metavariable !== null) {
|
|
118
119
|
metavariables.push(metavariable);
|