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.
- package/lib/context/bounded.js +6 -6
- package/lib/context/branching.js +3 -3
- package/lib/context/ephemeral.js +3 -3
- package/lib/context/file/nominal.js +16 -16
- package/lib/context/liminal.js +26 -30
- package/lib/context/synoptic.js +62 -2
- package/lib/context.js +66 -54
- package/lib/element/assertion/defined.js +8 -8
- package/lib/element/assertion/satisfies.js +15 -11
- package/lib/element/assertion.js +5 -5
- package/lib/element/assumption/metaLevel.js +3 -3
- package/lib/element/conclusion.js +11 -8
- package/lib/element/deduction.js +11 -8
- package/lib/element/frame.js +6 -14
- package/lib/element/label.js +5 -8
- package/lib/element/metavariable.js +17 -17
- package/lib/element/procedureCall.js +10 -6
- package/lib/element/proofAssertion/premise.js +27 -27
- package/lib/element/proofAssertion/step.js +25 -5
- package/lib/element/proofAssertion/supposition.js +27 -27
- package/lib/element/proofAssertion.js +10 -10
- package/lib/element/reference.js +9 -13
- package/lib/element/rule.js +41 -43
- package/lib/element/signature.js +4 -4
- package/lib/element/statement.js +35 -45
- package/lib/element/subproof.js +4 -4
- package/lib/element/substitution/frame.js +16 -11
- package/lib/element/substitution/reference.js +15 -10
- package/lib/element/substitution/statement.js +55 -51
- package/lib/element/substitution/term.js +15 -10
- package/lib/element/substitution.js +29 -31
- package/lib/element/term.js +1 -16
- package/lib/element/topLevelAssertion/axiom.js +5 -3
- package/lib/element/topLevelAssertion.js +36 -38
- package/lib/element/variable.js +6 -6
- package/lib/node/frame.js +1 -9
- package/lib/node/statement.js +1 -9
- package/lib/node/term.js +1 -19
- package/lib/process/assign.js +23 -31
- package/lib/utilities/element.js +33 -5
- package/lib/utilities/equivalence.js +4 -4
- package/lib/utilities/equivalences.js +28 -13
- package/lib/utilities/string.js +2 -2
- package/lib/utilities/substitutions.js +16 -15
- package/lib/utilities/unification.js +133 -124
- package/package.json +1 -1
- package/src/context/bounded.js +5 -5
- package/src/context/branching.js +2 -2
- package/src/context/ephemeral.js +2 -2
- package/src/context/file/nominal.js +15 -15
- package/src/context/liminal.js +29 -35
- package/src/context/synoptic.js +81 -1
- package/src/context.js +88 -69
- package/src/element/assertion/defined.js +8 -8
- package/src/element/assertion/satisfies.js +17 -10
- package/src/element/assertion.js +8 -8
- package/src/element/assumption/metaLevel.js +4 -2
- package/src/element/conclusion.js +12 -7
- package/src/element/deduction.js +12 -7
- package/src/element/frame.js +7 -20
- package/src/element/label.js +3 -5
- package/src/element/metavariable.js +27 -27
- package/src/element/procedureCall.js +14 -9
- package/src/element/proofAssertion/premise.js +41 -41
- package/src/element/proofAssertion/step.js +37 -7
- package/src/element/proofAssertion/supposition.js +41 -41
- package/src/element/proofAssertion.js +10 -9
- package/src/element/reference.js +9 -13
- package/src/element/rule.js +57 -61
- package/src/element/signature.js +3 -3
- package/src/element/statement.js +54 -68
- package/src/element/subproof.js +3 -3
- package/src/element/substitution/frame.js +18 -8
- package/src/element/substitution/reference.js +16 -7
- package/src/element/substitution/statement.js +78 -67
- package/src/element/substitution/term.js +15 -6
- package/src/element/substitution.js +38 -41
- package/src/element/term.js +0 -26
- package/src/element/topLevelAssertion/axiom.js +5 -2
- package/src/element/topLevelAssertion.js +49 -53
- package/src/element/variable.js +5 -5
- package/src/node/frame.js +0 -12
- package/src/node/statement.js +0 -12
- package/src/node/term.js +0 -28
- package/src/process/assign.js +35 -46
- package/src/utilities/element.js +32 -4
- package/src/utilities/equivalence.js +3 -4
- package/src/utilities/equivalences.js +29 -17
- package/src/utilities/string.js +2 -2
- package/src/utilities/substitutions.js +17 -15
- package/src/utilities/unification.js +145 -119
|
@@ -9,8 +9,8 @@ import { referenceSubstitutionFromReferenceSubstitutionNode } from "../../utilit
|
|
|
9
9
|
import { referenceSubstitutionStringFromReferenceAndMetavariable } from "../../utilities/string";
|
|
10
10
|
|
|
11
11
|
export default define(class ReferenceSubstitution extends Substitution {
|
|
12
|
-
constructor(context, string, node, targetReference, replacementReference) {
|
|
13
|
-
super(context, string, node);
|
|
12
|
+
constructor(context, string, node, generalContext, targetReference, replacementReference) {
|
|
13
|
+
super(context, string, node, generalContext);
|
|
14
14
|
|
|
15
15
|
this.targetReference = targetReference;
|
|
16
16
|
this.replacementReference = replacementReference;
|
|
@@ -45,9 +45,7 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
45
45
|
return replacementNode;
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
compareMetavariableName(metavariableName) { return this.targetReference.compareMetavariableName(metavariableName); }
|
|
48
|
+
getMetavariableNode() { return this.targetReference.getMetavariableNode(); }
|
|
51
49
|
|
|
52
50
|
isTrivial() {
|
|
53
51
|
const targetReferenceEqualToReplacementReference = this.targetReference.isEqualTo(this.replacementReference),
|
|
@@ -56,6 +54,8 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
56
54
|
return trivial;
|
|
57
55
|
}
|
|
58
56
|
|
|
57
|
+
matchMetavariableNode(metavariableNode) { return this.targetReference.matchMetavariableNode(metavariableNode); }
|
|
58
|
+
|
|
59
59
|
compareReference(reference, context) {
|
|
60
60
|
const referenceEqualToReplacementReference = this.replacementReference.isEqualTo(reference),
|
|
61
61
|
comparedToReference = referenceEqualToReplacementReference; ///
|
|
@@ -133,6 +133,8 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
133
133
|
|
|
134
134
|
context.addSubstitution(substitution);
|
|
135
135
|
|
|
136
|
+
this.setGeneralContext(generalContext);
|
|
137
|
+
|
|
136
138
|
context.debug(`...validated the '${referenceSubstitutionString}' reference substitution.`);
|
|
137
139
|
}
|
|
138
140
|
|
|
@@ -198,11 +200,12 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
198
200
|
instantiate((context) => {
|
|
199
201
|
const { string } = json,
|
|
200
202
|
referenceSubstitutionNode = instantiateReferenceSubstitution(string, context),
|
|
201
|
-
node = referenceSubstitutionNode,
|
|
203
|
+
node = referenceSubstitutionNode, ///
|
|
204
|
+
generalContext = generalContextFromReferenceSubstitutionNode(referenceSubstitutionNode, context),
|
|
202
205
|
targetReference = targetReferenceFromReferenceSubstitutionNode(referenceSubstitutionNode, context),
|
|
203
206
|
replacementReference = replacementReferenceFromReferenceSubstitutionNode(referenceSubstitutionNode, context);
|
|
204
207
|
|
|
205
|
-
referenceSubstitutionn = new ReferenceSubstitution(context, string, node, targetReference, replacementReference);
|
|
208
|
+
referenceSubstitutionn = new ReferenceSubstitution(context, string, node, generalContext, targetReference, replacementReference);
|
|
206
209
|
}, context);
|
|
207
210
|
}
|
|
208
211
|
|
|
@@ -257,3 +260,9 @@ function replacementReferenceFromReferenceSubstitutionNode(referenceSubstitution
|
|
|
257
260
|
|
|
258
261
|
return replacementReference;
|
|
259
262
|
}
|
|
263
|
+
|
|
264
|
+
function generalContextFromReferenceSubstitutionNode(referenceSubstitutionNode, context) {
|
|
265
|
+
const generalContext = context; ///
|
|
266
|
+
|
|
267
|
+
return generalContext;
|
|
268
|
+
}
|
|
@@ -11,8 +11,8 @@ import { join, ablate, attempt, descend, reconcile, instantiate } from "../../ut
|
|
|
11
11
|
import { statementSubstitutionStringFromStatementAndMetavariable, statementSubstitutionStringFromStatementMetavariableAndSubstitution } from "../../utilities/string";
|
|
12
12
|
|
|
13
13
|
export default define(class StatementSubstitution extends Substitution {
|
|
14
|
-
constructor(context, string, node, resolved, substitution, targetStatement, replacementStatement) {
|
|
15
|
-
super(context, string, node);
|
|
14
|
+
constructor(context, string, node, generalContext, resolved, substitution, targetStatement, replacementStatement) {
|
|
15
|
+
super(context, string, node, generalContext);
|
|
16
16
|
|
|
17
17
|
this.resolved = resolved;
|
|
18
18
|
this.substitution = substitution;
|
|
@@ -43,8 +43,6 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
43
43
|
return statementSubstitutionNode;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
getMtavariableName() { return this.targetStatement.getMtavariableName(); }
|
|
47
|
-
|
|
48
46
|
getTargetNode() {
|
|
49
47
|
const targetStatementNode = this.targetStatement.getNode(),
|
|
50
48
|
targetNode = targetStatementNode; ///
|
|
@@ -59,15 +57,15 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
59
57
|
return replacementNode;
|
|
60
58
|
}
|
|
61
59
|
|
|
60
|
+
getMetavariableNode() { return this.targetStatement.getMetavariableNode(); }
|
|
61
|
+
|
|
62
62
|
isSimple() {
|
|
63
63
|
const simple = (this.substitution === null);
|
|
64
64
|
|
|
65
65
|
return simple;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
compareMetavariableName(metavariableName) { return this.targetStatement.compareMetavariableName(metavariableName); }
|
|
68
|
+
matchMetavariableNode(metavariableNode) { return this.targetStatement.matchMetavariableNode(metavariableNode); }
|
|
71
69
|
|
|
72
70
|
compareStatement(statement, context) {
|
|
73
71
|
statement = stripBracketsFromStatement(statement, context); ///
|
|
@@ -103,8 +101,6 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
103
101
|
return comparesToSubstitution;
|
|
104
102
|
}
|
|
105
103
|
|
|
106
|
-
compareMetavariable(metavariable) { return this.targetStatement.compareMetavariable(metavariable); }
|
|
107
|
-
|
|
108
104
|
validate(generalContext, specificContext) {
|
|
109
105
|
let statementSubstitution = null;
|
|
110
106
|
|
|
@@ -155,6 +151,8 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
155
151
|
|
|
156
152
|
context.addSubstitution(substitution);
|
|
157
153
|
|
|
154
|
+
this.setGeneralContext(generalContext);
|
|
155
|
+
|
|
158
156
|
context.debug(`...validated the '${statementSubstitutionString}' statement substitution.`);
|
|
159
157
|
}
|
|
160
158
|
|
|
@@ -165,7 +163,7 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
165
163
|
let substitutionValidates = true;
|
|
166
164
|
|
|
167
165
|
if (this.substitution !== null) {
|
|
168
|
-
const context =
|
|
166
|
+
const context = generalContext, ///
|
|
169
167
|
substitutionString = this.substitution.getString(),
|
|
170
168
|
statementSubstitutionString = this.getString();
|
|
171
169
|
|
|
@@ -245,41 +243,58 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
245
243
|
return replacementStatementValidates;
|
|
246
244
|
}
|
|
247
245
|
|
|
248
|
-
|
|
249
|
-
let
|
|
246
|
+
unifySimpleSubstitution(simpleSubstitution, context) {
|
|
247
|
+
let simpleSubstitutionUnifies;
|
|
250
248
|
|
|
251
|
-
const
|
|
252
|
-
|
|
253
|
-
specificSubstitution = substitution, ///
|
|
254
|
-
generalSubstitutionString = generalSubstitution.getString(),
|
|
255
|
-
specificSubstitutionString = specificSubstitution.getString();
|
|
249
|
+
const substitutionString = this.substitution.getString(),
|
|
250
|
+
simpleSubstitutionString = simpleSubstitution.getString();
|
|
256
251
|
|
|
257
|
-
context.trace(`Unifying the '${
|
|
252
|
+
context.trace(`Unifying the '${simpleSubstitutionString}' simple substitution with the '${substitutionString}' substitution...`);
|
|
258
253
|
|
|
259
|
-
|
|
260
|
-
|
|
254
|
+
const generalSubstitution = this.substitution, ///
|
|
255
|
+
specificSubstitution = simpleSubstitution, ///
|
|
256
|
+
generalSubstitutionGeneralContext = generalSubstitution.getGeneralContext(),
|
|
257
|
+
generalSubstitutionSpecificContext = generalSubstitution.getSpecificContext(),
|
|
258
|
+
specificSubstitutionGeneralContext = specificSubstitution.getGeneralContext(),
|
|
259
|
+
specificSubstitutionSpecificContext = specificSubstitution.getSpecificContext();
|
|
261
260
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
261
|
+
join((specificContext) => {
|
|
262
|
+
join((generalContext) => {
|
|
263
|
+
reconcile((specificContext) => {
|
|
264
|
+
simpleSubstitutionUnifies = unifySubstitution(generalSubstitution, specificSubstitution, generalContext, specificContext);
|
|
266
265
|
|
|
267
|
-
|
|
268
|
-
|
|
266
|
+
if (simpleSubstitutionUnifies) {
|
|
267
|
+
specificContext.commit(context);
|
|
268
|
+
}
|
|
269
|
+
}, specificContext)
|
|
270
|
+
}, generalSubstitutionSpecificContext, generalSubstitutionGeneralContext);
|
|
271
|
+
}, specificSubstitutionSpecificContext, specificSubstitutionGeneralContext, context);
|
|
272
|
+
|
|
273
|
+
if (simpleSubstitutionUnifies) {
|
|
274
|
+
context.trace(`...unified the '${simpleSubstitutionString}' simple substitution with the '${substitutionString}' substitution.`);
|
|
269
275
|
}
|
|
270
276
|
|
|
271
|
-
return
|
|
277
|
+
return simpleSubstitutionUnifies;
|
|
272
278
|
}
|
|
273
279
|
|
|
274
|
-
unifyComplexSubstitution(complexSubstitution,
|
|
280
|
+
unifyComplexSubstitution(complexSubstitution, context) {
|
|
275
281
|
let substitution = null;
|
|
276
282
|
|
|
277
|
-
const
|
|
278
|
-
simpleSubstitutionString = this.getString(), ///
|
|
283
|
+
const simpleSubstitutionString = this.getString(), ///
|
|
279
284
|
complexSubstitutionString = complexSubstitution.getString(); ///
|
|
280
285
|
|
|
281
286
|
context.trace(`Unifying the '${complexSubstitutionString}' complex substitution with the '${simpleSubstitutionString}' simple substitution...`);
|
|
282
287
|
|
|
288
|
+
context = complexSubstitution.getContext();
|
|
289
|
+
|
|
290
|
+
const specificContext = context; ///
|
|
291
|
+
|
|
292
|
+
context = this.getContext();
|
|
293
|
+
|
|
294
|
+
const generalContext = context; ///
|
|
295
|
+
|
|
296
|
+
context = specificContext; ///
|
|
297
|
+
|
|
283
298
|
let simpleSubstitutionUnifies = false;
|
|
284
299
|
|
|
285
300
|
reconcile((specificContext) => {
|
|
@@ -296,6 +311,8 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
296
311
|
}, specificContext);
|
|
297
312
|
|
|
298
313
|
if (substitution !== null) {
|
|
314
|
+
substitution = substitution.validate(generalContext, specificContext);
|
|
315
|
+
|
|
299
316
|
simpleSubstitutionUnifies = true;
|
|
300
317
|
}
|
|
301
318
|
|
|
@@ -328,52 +345,24 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
328
345
|
return replacementStatemnentUnifies;
|
|
329
346
|
}
|
|
330
347
|
|
|
331
|
-
|
|
332
|
-
let substitution;
|
|
333
|
-
|
|
334
|
-
const complexSubstitution = this, ///
|
|
335
|
-
simpleSubstitutionContext = simpleSubstitution.getContext(),
|
|
336
|
-
complexSubstitutionContext = complexSubstitution.getContext();
|
|
337
|
-
|
|
338
|
-
generalContext = simpleSubstitutionContext; ///
|
|
339
|
-
|
|
340
|
-
specificContext = complexSubstitutionContext; ///
|
|
341
|
-
|
|
342
|
-
substitution = simpleSubstitution.unifyComplexSubstitution(complexSubstitution, generalContext, specificContext);
|
|
343
|
-
|
|
344
|
-
return substitution;
|
|
345
|
-
}
|
|
346
|
-
|
|
347
|
-
resolve(generalContext, specificContext) {
|
|
348
|
+
resolve(context) {
|
|
348
349
|
let resolved = false;
|
|
349
350
|
|
|
350
|
-
const
|
|
351
|
-
|
|
352
|
-
|
|
351
|
+
const metavariableNode = this.getMetavariableNode(),
|
|
352
|
+
simpleSubstitution = context.findSimpleSubstitutionByMetavariableNode(metavariableNode),
|
|
353
|
+
complexSubstitution = this; ///
|
|
353
354
|
|
|
354
355
|
if (simpleSubstitution !== null) {
|
|
355
356
|
const substitutionString = this.getString(); ///
|
|
356
357
|
|
|
357
358
|
context.trace(`Resolving the ${substitutionString} substitution...`);
|
|
358
359
|
|
|
359
|
-
const substitution =
|
|
360
|
+
const substitution = simpleSubstitution.unifyComplexSubstitution(complexSubstitution, context);
|
|
360
361
|
|
|
361
362
|
if (substitution !== null) {
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
context = substitution.getContext();
|
|
365
|
-
|
|
366
|
-
const specificContext = context; ///
|
|
367
|
-
|
|
368
|
-
context = this.substitution.getContext();
|
|
369
|
-
|
|
370
|
-
const generalContext = context; ///
|
|
371
|
-
|
|
372
|
-
context = specificContext; ///
|
|
363
|
+
const simpleSubstitutionUnifies = complexSubstitution.unifySimpleSubstitution(substitution, context);
|
|
373
364
|
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
if (substitutionUnifies) {
|
|
365
|
+
if (simpleSubstitutionUnifies) {
|
|
377
366
|
resolved = true;
|
|
378
367
|
}
|
|
379
368
|
|
|
@@ -397,11 +386,14 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
397
386
|
instantiate((context) => {
|
|
398
387
|
const { string } = json,
|
|
399
388
|
statementSubstitutionNode = instantiateStatementSubstitution(string, context),
|
|
400
|
-
node = statementSubstitutionNode,
|
|
389
|
+
node = statementSubstitutionNode, ///
|
|
390
|
+
generalContext = generalContextFromStatementSubstitutionNode(statementSubstitutionNode, context),
|
|
391
|
+
resolved = resolvedFromStatementSubstitutionNode(statementSubstitutionNode, context),
|
|
392
|
+
substitution = substitutionFromStatementSubstitutionNode(statementSubstitutionNode, context),
|
|
401
393
|
targetStatement = targetStatementFromStatementSubstitutionNode(statementSubstitutionNode, context),
|
|
402
394
|
replacementStatement = replacementStatementFromStatementSubstitutionNode(statementSubstitutionNode, context);
|
|
403
395
|
|
|
404
|
-
statementSubstitutionn = new StatementSubstitution(context, string, node, targetStatement, replacementStatement);
|
|
396
|
+
statementSubstitutionn = new StatementSubstitution(context, string, node, generalContext, resolved, substitution, targetStatement, replacementStatement);
|
|
405
397
|
}, context);
|
|
406
398
|
}
|
|
407
399
|
|
|
@@ -458,3 +450,22 @@ function replacementStatementFromStatementSubstitutionNode(statementSubstitution
|
|
|
458
450
|
|
|
459
451
|
return replacementStatement;
|
|
460
452
|
}
|
|
453
|
+
|
|
454
|
+
function resolvedFromStatementSubstitutionNode(statementSubstitutionNode, context) {
|
|
455
|
+
const resolved = true;
|
|
456
|
+
|
|
457
|
+
return resolved;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
function substitutionFromStatementSubstitutionNode(statementSubstitutionNode, context) {
|
|
461
|
+
const substitutionNode = statementSubstitutionNode.getSubstitutionNode(),
|
|
462
|
+
substitution = context.findStatementByStatementNode(substitutionNode);
|
|
463
|
+
|
|
464
|
+
return substitution;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
function generalContextFromStatementSubstitutionNode(statementSubstitutionNode, context) {
|
|
468
|
+
const generalContext = context; ///
|
|
469
|
+
|
|
470
|
+
return generalContext;
|
|
471
|
+
}
|
|
@@ -10,8 +10,8 @@ import { termSubstitutionStringFromTermAndVariable } from "../../utilities/strin
|
|
|
10
10
|
import { join, ablate, descend, attempt, instantiate } from "../../utilities/context";
|
|
11
11
|
|
|
12
12
|
export default define(class TermSubstitution extends Substitution {
|
|
13
|
-
constructor(context, string, node, targetTerm, replacementTerm) {
|
|
14
|
-
super(context, string, node);
|
|
13
|
+
constructor(context, string, node, generalContext, targetTerm, replacementTerm) {
|
|
14
|
+
super(context, string, node, generalContext);
|
|
15
15
|
|
|
16
16
|
this.targetTerm = targetTerm;
|
|
17
17
|
this.replacementTerm = replacementTerm;
|
|
@@ -46,9 +46,7 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
46
46
|
return replacementNode;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
compareVariableIdentifier(variableIdentifier) { return this.targetTerm.compareVariableIdentifier(variableIdentifier); }
|
|
49
|
+
getVariableNode() { return this.targetTerm.getVariableNode(); }
|
|
52
50
|
|
|
53
51
|
isTrivial() {
|
|
54
52
|
const targetTermEqualToReplacementTerm = this.targetTerm.isEqualTo(this.replacementTerm),
|
|
@@ -57,6 +55,8 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
57
55
|
return trivial;
|
|
58
56
|
}
|
|
59
57
|
|
|
58
|
+
matchVariableNode(variableNode) { return this.targetTerm.matchVariableNode(variableNode); }
|
|
59
|
+
|
|
60
60
|
compareTerm(term, context) {
|
|
61
61
|
term = stripBracketsFromTerm(term, context); ///
|
|
62
62
|
|
|
@@ -119,6 +119,8 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
119
119
|
|
|
120
120
|
context.addSubstitution(substitution);
|
|
121
121
|
|
|
122
|
+
this.setGeneralContext(generalContext);
|
|
123
|
+
|
|
122
124
|
context.debug(`...validated the '${termSubstitutionString}' term substitution.`);
|
|
123
125
|
}
|
|
124
126
|
|
|
@@ -203,10 +205,11 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
203
205
|
const { string } = json,
|
|
204
206
|
termSubstitutionNode = instantiateTermSubstitution(string, context),
|
|
205
207
|
node = termSubstitutionNode, ///
|
|
208
|
+
generalContext = generalContextFromTermSubstitutionNode(termSubstitutionNode, context),
|
|
206
209
|
targetTerm = targetTermFromTermSubstitutionNode(termSubstitutionNode, context),
|
|
207
210
|
replacementTerm = replacementTermFromTermSubstitutionNode(termSubstitutionNode, context);
|
|
208
211
|
|
|
209
|
-
termSubstitutionn = new TermSubstitution(context, string, node, targetTerm, replacementTerm);
|
|
212
|
+
termSubstitutionn = new TermSubstitution(context, string, node, generalContext, targetTerm, replacementTerm);
|
|
210
213
|
}, context);
|
|
211
214
|
}
|
|
212
215
|
|
|
@@ -259,3 +262,9 @@ function replacementTermFromTermSubstitutionNode(termSubstitutionNode, context)
|
|
|
259
262
|
|
|
260
263
|
return replacementTerm;
|
|
261
264
|
}
|
|
265
|
+
|
|
266
|
+
function generalContextFromTermSubstitutionNode(termSubstitutionNode, context) {
|
|
267
|
+
const generalContext = context; ///
|
|
268
|
+
|
|
269
|
+
return generalContext;
|
|
270
|
+
}
|
|
@@ -6,6 +6,16 @@ import { primitiveUtilities } from "occam-furtle";
|
|
|
6
6
|
const { primitiveFromNode } =primitiveUtilities;
|
|
7
7
|
|
|
8
8
|
export default class Substitution extends Element {
|
|
9
|
+
constructor(context, string, node, generalContext) {
|
|
10
|
+
super(context, string, node);
|
|
11
|
+
|
|
12
|
+
this.generalContext = generalContext;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
getGeneralContext() {
|
|
16
|
+
return this.generalContext;
|
|
17
|
+
}
|
|
18
|
+
|
|
9
19
|
getPrimitive(context) {
|
|
10
20
|
const replacementNode = this.getReplacementNode(),
|
|
11
21
|
node = replacementNode, ///
|
|
@@ -21,20 +31,15 @@ export default class Substitution extends Element {
|
|
|
21
31
|
return substitutionNode;
|
|
22
32
|
}
|
|
23
33
|
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
|
|
27
|
-
substitutionNodeMatches = nodeMatches; ///
|
|
34
|
+
getSpecificContext() {
|
|
35
|
+
const context = this.getContext(),
|
|
36
|
+
specificContext = context; ///
|
|
28
37
|
|
|
29
|
-
return
|
|
38
|
+
return specificContext;
|
|
30
39
|
}
|
|
31
40
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
substitution = context.findSubstitutionBySubstitutionNode(substitutionNode),
|
|
35
|
-
validSubstitution = substitution; ///
|
|
36
|
-
|
|
37
|
-
return validSubstitution;
|
|
41
|
+
setGeneralContext(generalContext) {
|
|
42
|
+
this.generalContext = generalContext;
|
|
38
43
|
}
|
|
39
44
|
|
|
40
45
|
isEqualTo(substitution) {
|
|
@@ -65,58 +70,50 @@ export default class Substitution extends Element {
|
|
|
65
70
|
return variable;
|
|
66
71
|
}
|
|
67
72
|
|
|
68
|
-
getSubstitution() {
|
|
69
|
-
const substitution = null;
|
|
70
|
-
|
|
71
|
-
return substitution;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
73
|
getMetavariable() {
|
|
75
74
|
const metavariable = null;
|
|
76
75
|
|
|
77
76
|
return metavariable;
|
|
78
77
|
}
|
|
79
78
|
|
|
80
|
-
|
|
81
|
-
const
|
|
79
|
+
getSubstitution() {
|
|
80
|
+
const substitution = null;
|
|
82
81
|
|
|
83
|
-
return
|
|
82
|
+
return substitution;
|
|
84
83
|
}
|
|
85
84
|
|
|
86
|
-
|
|
87
|
-
const
|
|
85
|
+
getVariableNode() {
|
|
86
|
+
const variableNode = null;
|
|
88
87
|
|
|
89
|
-
return
|
|
88
|
+
return variableNode;
|
|
90
89
|
}
|
|
91
90
|
|
|
92
|
-
|
|
93
|
-
const
|
|
91
|
+
getMetavariableNode() {
|
|
92
|
+
const metavariableNode = null;
|
|
94
93
|
|
|
95
|
-
return
|
|
94
|
+
return metavariableNode;
|
|
96
95
|
}
|
|
97
96
|
|
|
98
|
-
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
return comparesToParameter;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
compareMetavariable(metavariable) {
|
|
105
|
-
const compaaresToMetavariable = false;
|
|
97
|
+
isSimple() {
|
|
98
|
+
const simple = true;
|
|
106
99
|
|
|
107
|
-
return
|
|
100
|
+
return simple;
|
|
108
101
|
}
|
|
109
102
|
|
|
110
|
-
|
|
111
|
-
const
|
|
103
|
+
matchSubstitutionNode(substitutionNode) {
|
|
104
|
+
const node = substitutionNode, ///
|
|
105
|
+
nodeMatches = this.matchNode(node),
|
|
106
|
+
substitutionNodeMatches = nodeMatches; ///
|
|
112
107
|
|
|
113
|
-
return
|
|
108
|
+
return substitutionNodeMatches;
|
|
114
109
|
}
|
|
115
110
|
|
|
116
|
-
|
|
117
|
-
const
|
|
111
|
+
findValidSubstitution(context) {
|
|
112
|
+
const substitutionNode = this.getSubstitutionNode(),
|
|
113
|
+
substitution = context.findSubstitutionBySubstitutionNode(substitutionNode),
|
|
114
|
+
validSubstitution = substitution; ///
|
|
118
115
|
|
|
119
|
-
return
|
|
116
|
+
return validSubstitution;
|
|
120
117
|
}
|
|
121
118
|
|
|
122
119
|
resolve(substitutions, generalContext, specificContext) {
|
package/src/element/term.js
CHANGED
|
@@ -41,14 +41,6 @@ export default define(class Term extends Element {
|
|
|
41
41
|
return variableIdentifier;
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
isEqualTo(term) {
|
|
45
|
-
const termNode = term.getNode(),
|
|
46
|
-
termNodeMatches = this.matchTermNode(termNode),
|
|
47
|
-
equalTo = termNodeMatches; ///
|
|
48
|
-
|
|
49
|
-
return equalTo;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
44
|
isGrounded(definedVariables, context) {
|
|
53
45
|
const term = this, ///
|
|
54
46
|
variables = variablesFromTerm(term, context);
|
|
@@ -129,24 +121,6 @@ export default define(class Term extends Element {
|
|
|
129
121
|
return comparesToParamter;
|
|
130
122
|
}
|
|
131
123
|
|
|
132
|
-
compareVariableIdentifier(variableIdentifier) {
|
|
133
|
-
let comparesToVariableIdentifier = false;
|
|
134
|
-
|
|
135
|
-
const singular = this.isSingular();
|
|
136
|
-
|
|
137
|
-
if (singular) {
|
|
138
|
-
const variableIdentifierA = variableIdentifier; ///
|
|
139
|
-
|
|
140
|
-
variableIdentifier = this.getVariableIdentifier();
|
|
141
|
-
|
|
142
|
-
const variableIdentifierB = variableIdentifier;
|
|
143
|
-
|
|
144
|
-
comparesToVariableIdentifier = (variableIdentifierA === variableIdentifierB);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
return comparesToVariableIdentifier;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
124
|
findValidTerm(context) {
|
|
151
125
|
const termNode = this.getTermNode(),
|
|
152
126
|
term = context.findTermByTermNode(termNode),
|
|
@@ -38,9 +38,12 @@ export default define(class Axiom extends TopLevelAssertion {
|
|
|
38
38
|
|
|
39
39
|
context = this.getContext();
|
|
40
40
|
|
|
41
|
-
const generalContext = context
|
|
41
|
+
const generalContext = context, ///
|
|
42
|
+
signatureAComparesToSignatureB = signatureA.compareSignature(signatureB, generalContext, specificContext);
|
|
42
43
|
|
|
43
|
-
|
|
44
|
+
if (signatureAComparesToSignatureB) {
|
|
45
|
+
comparesToSignature = true;
|
|
46
|
+
}
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
return comparesToSignature;
|