occam-verify-cli 1.0.852 → 1.0.857
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/file/nominal.js +18 -3
- package/lib/context/liminal.js +101 -102
- package/lib/context/mnemic.js +511 -0
- package/lib/context.js +23 -11
- package/lib/element/assertion/contained.js +8 -8
- package/lib/element/assertion/defined.js +6 -6
- package/lib/element/assertion/satisfies.js +4 -4
- package/lib/element/assertion/type.js +5 -4
- package/lib/element/assumption/metaLevel.js +7 -7
- package/lib/element/assumption.js +23 -15
- package/lib/element/combinator.js +4 -4
- package/lib/element/conclusion.js +4 -4
- package/lib/element/constructor.js +4 -4
- package/lib/element/declaration/combinator.js +4 -4
- package/lib/element/declaration/complexType.js +3 -3
- package/lib/element/declaration/constructor.js +6 -4
- package/lib/element/declaration/metavariable.js +7 -7
- package/lib/element/declaration/variable.js +6 -4
- package/lib/element/deduction.js +4 -4
- package/lib/element/frame.js +60 -48
- package/lib/element/judgement.js +16 -29
- package/lib/element/label.js +4 -4
- package/lib/element/metavariable.js +59 -58
- package/lib/element/proofAssertion/premise.js +4 -4
- package/lib/element/reference.js +20 -20
- package/lib/element/rule.js +4 -4
- package/lib/element/substitution/frame.js +9 -8
- package/lib/element/substitution/reference.js +7 -7
- package/lib/element/substitution/statement.js +12 -11
- package/lib/element/substitution/term.js +9 -8
- package/lib/element/topLevelAssertion.js +4 -4
- package/lib/element/topLevelMetaAssertion.js +2 -2
- package/lib/element/variable.js +8 -8
- package/lib/utilities/context.js +6 -6
- package/lib/utilities/element.js +3 -3
- package/lib/utilities/json.js +16 -16
- package/lib/utilities/string.js +7 -29
- package/lib/utilities/substitutions.js +6 -6
- package/package.json +1 -1
- package/src/context/file/nominal.js +24 -2
- package/src/context/liminal.js +116 -117
- package/src/context/{ephemeral.js → mnemic.js} +38 -40
- package/src/context.js +32 -12
- package/src/element/assertion/contained.js +7 -7
- package/src/element/assertion/defined.js +5 -5
- package/src/element/assertion/satisfies.js +3 -4
- package/src/element/assertion/type.js +5 -4
- package/src/element/assumption/metaLevel.js +6 -8
- package/src/element/assumption.js +28 -17
- package/src/element/combinator.js +3 -4
- package/src/element/conclusion.js +3 -4
- package/src/element/constructor.js +3 -4
- package/src/element/declaration/combinator.js +3 -4
- package/src/element/declaration/complexType.js +2 -2
- package/src/element/declaration/constructor.js +7 -4
- package/src/element/declaration/metavariable.js +6 -8
- package/src/element/declaration/variable.js +7 -4
- package/src/element/deduction.js +3 -4
- package/src/element/frame.js +81 -64
- package/src/element/judgement.js +21 -43
- package/src/element/label.js +3 -4
- package/src/element/metavariable.js +66 -73
- package/src/element/proofAssertion/premise.js +3 -4
- package/src/element/reference.js +21 -25
- package/src/element/rule.js +3 -3
- package/src/element/substitution/frame.js +7 -7
- package/src/element/substitution/reference.js +4 -6
- package/src/element/substitution/statement.js +9 -10
- package/src/element/substitution/term.js +7 -7
- package/src/element/topLevelAssertion.js +3 -3
- package/src/element/topLevelMetaAssertion.js +2 -2
- package/src/element/variable.js +7 -8
- package/src/utilities/context.js +9 -9
- package/src/utilities/element.js +3 -3
- package/src/utilities/json.js +9 -9
- package/src/utilities/string.js +11 -40
- package/src/utilities/substitutions.js +3 -3
- package/lib/context/ephemeral.js +0 -513
|
@@ -12,8 +12,8 @@ _export(exports, {
|
|
|
12
12
|
get frameFromFrameAndSubstitutions () {
|
|
13
13
|
return frameFromFrameAndSubstitutions;
|
|
14
14
|
},
|
|
15
|
-
get
|
|
16
|
-
return
|
|
15
|
+
get metavariableNodesFromDerivedSubstitutions () {
|
|
16
|
+
return metavariableNodesFromDerivedSubstitutions;
|
|
17
17
|
},
|
|
18
18
|
get statementFromStatementAndSubstitutions () {
|
|
19
19
|
return statementFromStatementAndSubstitutions;
|
|
@@ -78,10 +78,10 @@ function statementFromStatementAndSubstitutions(statement, generalContext, speci
|
|
|
78
78
|
}
|
|
79
79
|
return statement;
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function metavariableNodesFromDerivedSubstitutions(derivedSubstitutions) {
|
|
82
82
|
const metavariableNodes = [];
|
|
83
|
-
|
|
84
|
-
const metavariableNode =
|
|
83
|
+
derivedSubstitutions.forEach((derivedSubstitution)=>{
|
|
84
|
+
const metavariableNode = derivedSubstitution.getMetavariableNode();
|
|
85
85
|
if (metavariableNode !== null) {
|
|
86
86
|
metavariableNodes.push(metavariableNode);
|
|
87
87
|
}
|
|
@@ -95,4 +95,4 @@ function metavariableNodesFromSubstitutions(substitutions) {
|
|
|
95
95
|
return metavariableNodes;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
//# sourceMappingURL=data:application/json;base64,
|
|
98
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy91dGlsaXRpZXMvc3Vic3RpdHV0aW9ucy5qcyJdLCJzb3VyY2VzQ29udGVudCI6WyJcInVzZSBzdHJpY3RcIjtcblxuaW1wb3J0IHsgYXJyYXlVdGlsaXRpZXMgfSBmcm9tIFwibmVjZXNzYXJ5XCI7XG5cbmNvbnN0IHsgY29tcHJlc3MgfSA9IGFycmF5VXRpbGl0aWVzO1xuXG5leHBvcnQgZnVuY3Rpb24gdGVybUZyb21UZXJtQW5kU3Vic3RpdHV0aW9ucyh0ZXJtLCBnZW5lcmFsQ29udGV4dCwgc3BlY2lmaWNDb250ZXh0KSB7XG4gIGlmICh0ZXJtICE9PSBudWxsKSB7XG4gICAgY29uc3QgdGVybU5vZGUgPSB0ZXJtLmdldE5vZGUoKSxcbiAgICAgICAgICB0ZXJtU2luZ3VsYXIgPSB0ZXJtLmlzU2luZ3VsYXIoKTtcblxuICAgIHRlcm0gPSBudWxsOyAgLy8vXG5cbiAgICBpZiAodGVybVNpbmd1bGFyKSB7XG4gICAgICBjb25zdCB2YXJpYWJsZU5vZGUgPSB0ZXJtTm9kZS5nZXRWYXJpYWJsZU5vZGUoKSxcbiAgICAgICAgICAgIHN1YnN0aXR1dGl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QUUxRVYsWUFBWVMsc0JBQXNCLEdBQUc7WUFDdkM7UUFDRjtJQUNGO0lBRUEsT0FBT1Q7QUFDVDtBQUVPLFNBQVM1QiwwQ0FBMEN1QyxvQkFBb0I7SUFDNUUsTUFBTUMsb0JBQW9CLEVBQUU7SUFFNUJELHFCQUFxQkUsT0FBTyxDQUFDLENBQUNDO1FBQzVCLE1BQU1wQixtQkFBbUJvQixvQkFBb0JuQixtQkFBbUI7UUFFaEUsSUFBSUQscUJBQXFCLE1BQU07WUFDN0JrQixrQkFBa0JHLElBQUksQ0FBQ3JCO1FBQ3pCO0lBQ0Y7SUFFQW5CLFNBQVNxQyxtQkFBbUIsQ0FBQ0ksbUJBQW1CQztRQUM5QyxNQUFNQywyQ0FBMkNGLGtCQUFrQkcsS0FBSyxDQUFDRjtRQUV6RSxJQUFJLENBQUNDLDBDQUEwQztZQUM3QyxPQUFPO1FBQ1Q7SUFDRjtJQUVBLE9BQU9OO0FBQ1QifQ==
|
package/package.json
CHANGED
|
@@ -280,6 +280,10 @@ export default class NominalFileContext extends FileContext {
|
|
|
280
280
|
return substitutions;
|
|
281
281
|
}
|
|
282
282
|
|
|
283
|
+
getDerivedSubstitutions(derivedSubstitutions = []) {
|
|
284
|
+
return derivedSubstitutions;
|
|
285
|
+
}
|
|
286
|
+
|
|
283
287
|
addType(type) {
|
|
284
288
|
this.types.push(type);
|
|
285
289
|
|
|
@@ -642,6 +646,24 @@ export default class NominalFileContext extends FileContext {
|
|
|
642
646
|
return declaredMetavariable;
|
|
643
647
|
}
|
|
644
648
|
|
|
649
|
+
findSubstitutionByVariableNode(variableNode) {
|
|
650
|
+
const substitution = null;
|
|
651
|
+
|
|
652
|
+
return substitution;
|
|
653
|
+
}
|
|
654
|
+
|
|
655
|
+
findSubstitutionByMetavariableNode(metavariableNode) {
|
|
656
|
+
const substitution = null;
|
|
657
|
+
|
|
658
|
+
return substitution;
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
findSubstitutionBySubstitutionNode(substitutionNode) {
|
|
662
|
+
const substitution = null;
|
|
663
|
+
|
|
664
|
+
return substitution;
|
|
665
|
+
}
|
|
666
|
+
|
|
645
667
|
findMetaLevelAssumptionByMetaLevelAssumptionNode(metaLevelAssumptionNode) {
|
|
646
668
|
const metaLevelAssumption = null;
|
|
647
669
|
|
|
@@ -671,10 +693,10 @@ export default class NominalFileContext extends FileContext {
|
|
|
671
693
|
return metavariablePresent;
|
|
672
694
|
}
|
|
673
695
|
|
|
674
|
-
isLabelPresentByReference(reference) {
|
|
696
|
+
isLabelPresentByReference(reference, context = null) {
|
|
675
697
|
const labels = this.getLabels(),
|
|
676
698
|
labelPresent = labels.some((label) => {
|
|
677
|
-
const labelUnifies = reference.unifyLabel(label);
|
|
699
|
+
const labelUnifies = reference.unifyLabel(label, context);
|
|
678
700
|
|
|
679
701
|
if (labelUnifies) {
|
|
680
702
|
return true;
|
package/src/context/liminal.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { arrayUtilities } from "necessary";
|
|
4
|
-
import {
|
|
4
|
+
import { metavariableNodesFromDerivedSubstitutions } from "../utilities/substitutions";
|
|
5
5
|
|
|
6
6
|
import Context from "../context";
|
|
7
7
|
import elements from "../elements";
|
|
@@ -9,126 +9,126 @@ import elements from "../elements";
|
|
|
9
9
|
const { find, first } = arrayUtilities;
|
|
10
10
|
|
|
11
11
|
export default class LiminalContext extends Context {
|
|
12
|
-
constructor(context,
|
|
12
|
+
constructor(context, derivedSubstitutions) {
|
|
13
13
|
super(context);
|
|
14
14
|
|
|
15
|
-
this.
|
|
15
|
+
this.derivedSubstitutions = derivedSubstitutions;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
let
|
|
18
|
+
getDerivedSubstitutions(nested = true) {
|
|
19
|
+
let derivedSubstitutions;
|
|
20
20
|
|
|
21
21
|
if (nested) {
|
|
22
22
|
const context = this.getContext();
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
derivedSubstitutions = context.getDerivedSubstitutions();
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
...this.
|
|
28
|
-
...
|
|
26
|
+
derivedSubstitutions = [ ///
|
|
27
|
+
...this.derivedSubstitutions,
|
|
28
|
+
...derivedSubstitutions
|
|
29
29
|
]
|
|
30
30
|
} else {
|
|
31
|
-
|
|
31
|
+
derivedSubstitutions = this.derivedSubstitutions;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
return
|
|
34
|
+
return derivedSubstitutions;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
|
|
38
|
-
let
|
|
37
|
+
getSoleDerivedSubstitution(nested = true) {
|
|
38
|
+
let soleDerivedSubstitution = null;
|
|
39
39
|
|
|
40
|
-
const
|
|
41
|
-
|
|
40
|
+
const derivedSubstitutions = this.getDerivedSubstitutions(nested),
|
|
41
|
+
derivedSubstitutionsLength = derivedSubstitutions.length;
|
|
42
42
|
|
|
43
|
-
if (
|
|
44
|
-
const
|
|
43
|
+
if (derivedSubstitutionsLength === 1) {
|
|
44
|
+
const firstDerivedSubstitution = first(derivedSubstitutions);
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
soleDerivedSubstitution = firstDerivedSubstitution; ///
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
return
|
|
49
|
+
return soleDerivedSubstitution;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
|
|
53
|
-
let
|
|
52
|
+
getSoleNonTrivialDerivedSubstitution(nested = true) {
|
|
53
|
+
let soleNonTrivialDerivedSubstitution = null;
|
|
54
54
|
|
|
55
|
-
const
|
|
55
|
+
const soleDerivedSubstitution = this.getSoleDerivedSubstitution(nested);
|
|
56
56
|
|
|
57
|
-
if (
|
|
58
|
-
const
|
|
57
|
+
if (soleDerivedSubstitution !== null) {
|
|
58
|
+
const soleDerivedSubstitutionNonTrivial = soleDerivedSubstitution.isNonTrivial();
|
|
59
59
|
|
|
60
|
-
if (
|
|
61
|
-
|
|
60
|
+
if (soleDerivedSubstitutionNonTrivial) {
|
|
61
|
+
soleNonTrivialDerivedSubstitution = soleDerivedSubstitution; ///
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
return
|
|
65
|
+
return soleNonTrivialDerivedSubstitution;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
addDerivedSubstitution(derivedSubstitution) {
|
|
69
69
|
const context = this, ///
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
derivedSubstitutionA = derivedSubstitution, ///
|
|
71
|
+
derivedSubstitutionString = derivedSubstitution.getString();
|
|
72
72
|
|
|
73
|
-
context.trace(`Adding the '${
|
|
73
|
+
context.trace(`Adding the '${derivedSubstitutionString}' derivedSubstitution to the liminal context...`);
|
|
74
74
|
|
|
75
|
-
const
|
|
76
|
-
const
|
|
77
|
-
|
|
75
|
+
const derivedSubstitutionB = this.derivedSubstitutions.find((derivedSubstitution) => {
|
|
76
|
+
const derivedSubstitutionB = derivedSubstitution, ///
|
|
77
|
+
derivedSubstitutionAEqualToDerivedSubstitutionB = derivedSubstitutionA.isEqualTo(derivedSubstitutionB);
|
|
78
78
|
|
|
79
|
-
if (
|
|
79
|
+
if (derivedSubstitutionAEqualToDerivedSubstitutionB) {
|
|
80
80
|
return true;
|
|
81
81
|
}
|
|
82
82
|
}) || null;
|
|
83
83
|
|
|
84
|
-
if (
|
|
85
|
-
context.debug(`The '${
|
|
84
|
+
if (derivedSubstitutionB !== null) {
|
|
85
|
+
context.debug(`The '${derivedSubstitutionString}' derivedSubstitution has already been added to the liminal context.`);
|
|
86
86
|
} else {
|
|
87
|
-
this.
|
|
87
|
+
this.derivedSubstitutions.push(derivedSubstitution);
|
|
88
88
|
}
|
|
89
89
|
|
|
90
|
-
context.debug(`...added the '${
|
|
90
|
+
context.debug(`...added the '${derivedSubstitutionString}' derivedSubstitution to the liminal context.`);
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
this.
|
|
93
|
+
addDerivedSubstitutions(derivedSubstitutions) {
|
|
94
|
+
derivedSubstitutions.forEach((derivedSubstitution) => {
|
|
95
|
+
this.addDerivedSubstitution(derivedSubstitution);
|
|
96
96
|
});
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
resolveDerivedSubstitutions() {
|
|
100
100
|
const context = this, ///
|
|
101
|
-
|
|
102
|
-
metavariableNodes =
|
|
101
|
+
derivedSubstitutions = this.getDerivedSubstitutions(),
|
|
102
|
+
metavariableNodes = metavariableNodesFromDerivedSubstitutions(derivedSubstitutions);
|
|
103
103
|
|
|
104
104
|
metavariableNodes.forEach((metavariableNode) => {
|
|
105
|
-
const
|
|
105
|
+
const complexDerivedSubstitutions = this.findComplexDerivedSubstitutionsByMetavariableNode(metavariableNode);
|
|
106
106
|
|
|
107
|
-
|
|
108
|
-
const
|
|
109
|
-
resolved =
|
|
107
|
+
complexDerivedSubstitutions.forEach((complexDerivedSubstitution) => {
|
|
108
|
+
const derivedSubstitution = complexDerivedSubstitution, ///
|
|
109
|
+
resolved = derivedSubstitution.isResolved();
|
|
110
110
|
|
|
111
111
|
if (!resolved) {
|
|
112
|
-
|
|
112
|
+
derivedSubstitution.resolve(context);
|
|
113
113
|
}
|
|
114
114
|
});
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
|
|
119
|
-
const
|
|
120
|
-
metavariableNodes =
|
|
118
|
+
areDerivedSubstitutionsResolved() {
|
|
119
|
+
const derivedSubstitutions = this.getDerivedSubstitutions(),
|
|
120
|
+
metavariableNodes = metavariableNodesFromDerivedSubstitutions(derivedSubstitutions),
|
|
121
121
|
resolved = metavariableNodes.every((metavariableNode) => {
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
const
|
|
122
|
+
const complexDerivedSubstitutions = this.findComplexDerivedSubstitutionsByMetavariableNode(metavariableNode),
|
|
123
|
+
complexDerivedSubstitutionsResolved = complexDerivedSubstitutions.every((complexDerivedSubstitution) => {
|
|
124
|
+
const complexDerivedSubstitutionResolved = complexDerivedSubstitution.isResolved();
|
|
125
125
|
|
|
126
|
-
if (
|
|
126
|
+
if (complexDerivedSubstitutionResolved) {
|
|
127
127
|
return true;
|
|
128
128
|
}
|
|
129
129
|
});
|
|
130
130
|
|
|
131
|
-
if (
|
|
131
|
+
if (complexDerivedSubstitutionsResolved) {
|
|
132
132
|
return true;
|
|
133
133
|
}
|
|
134
134
|
});
|
|
@@ -137,8 +137,8 @@ export default class LiminalContext extends Context {
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
isEmpty() {
|
|
140
|
-
const
|
|
141
|
-
empty = (
|
|
140
|
+
const derivedSubstitutionsLength = this.derivedSubstitutions.length,
|
|
141
|
+
empty = (derivedSubstitutionsLength === 0);
|
|
142
142
|
|
|
143
143
|
return empty;
|
|
144
144
|
}
|
|
@@ -152,15 +152,15 @@ export default class LiminalContext extends Context {
|
|
|
152
152
|
qualifies = true;
|
|
153
153
|
} else {
|
|
154
154
|
const nested = false,
|
|
155
|
-
|
|
155
|
+
soleDerivedSubstitution = this.getSoleDerivedSubstitution(nested);
|
|
156
156
|
|
|
157
|
-
if (
|
|
158
|
-
const {
|
|
157
|
+
if (soleDerivedSubstitution !== null) {
|
|
158
|
+
const { ReferenceDerivedSubstitution } = elements,
|
|
159
159
|
context = this,
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
referenceDerivedSubstitution = ReferenceDerivedSubstitution.fromAssumptionAndMetaLevelAssumption(assumption, metaLevelAssumption, context),
|
|
161
|
+
soleDerivedSubstitutionCompares = referenceDerivedSubstitution.compareDerivedSubstitution(soleDerivedSubstitution);
|
|
162
162
|
|
|
163
|
-
if (
|
|
163
|
+
if (soleDerivedSubstitutionCompares) {
|
|
164
164
|
qualifies = true;
|
|
165
165
|
}
|
|
166
166
|
}
|
|
@@ -176,52 +176,52 @@ export default class LiminalContext extends Context {
|
|
|
176
176
|
|
|
177
177
|
context.debug(`Committing the limiinal context`);
|
|
178
178
|
|
|
179
|
-
context.
|
|
179
|
+
context.addDerivedSubstitutions(this.derivedSubstitutions);
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
|
|
183
|
-
const
|
|
184
|
-
|
|
182
|
+
findDerivedSubstitution(callback) {
|
|
183
|
+
const derivedSubstitutions = this.getDerivedSubstitutions(),
|
|
184
|
+
derivedSubstitution = derivedSubstitutions.find(callback);
|
|
185
185
|
|
|
186
|
-
return
|
|
186
|
+
return derivedSubstitution;
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
|
|
190
|
-
let
|
|
189
|
+
findDerivedSubstitutions(callback, nested = true) {
|
|
190
|
+
let derivedSubstitutions;
|
|
191
191
|
|
|
192
|
-
|
|
192
|
+
derivedSubstitutions = this.getDerivedSubstitutions(nested);
|
|
193
193
|
|
|
194
|
-
|
|
194
|
+
derivedSubstitutions = find(derivedSubstitutions, callback); ///
|
|
195
195
|
|
|
196
|
-
return
|
|
196
|
+
return derivedSubstitutions;
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
-
|
|
200
|
-
const
|
|
201
|
-
const variableNodeMatches =
|
|
199
|
+
findDerivedSubstitutionByVariableNode(variableNode) {
|
|
200
|
+
const derivedSubstitution = this.findDerivedSubstitution((derivedSubstitution) => {
|
|
201
|
+
const variableNodeMatches = derivedSubstitution.matchVariableNode(variableNode);
|
|
202
202
|
|
|
203
203
|
if (variableNodeMatches) {
|
|
204
204
|
return true;
|
|
205
205
|
}
|
|
206
206
|
}) || null;
|
|
207
207
|
|
|
208
|
-
return
|
|
208
|
+
return derivedSubstitution;
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
-
|
|
212
|
-
const
|
|
213
|
-
|
|
211
|
+
findDerivedSubstitutionByMetavariableNode(metavariableNode) {
|
|
212
|
+
const simpleDerivedSubstitution = this.findSimpleDerivedSubstitutionByMetavariableNode(metavariableNode),
|
|
213
|
+
derivedSubstitution = simpleDerivedSubstitution; ///
|
|
214
214
|
|
|
215
|
-
return
|
|
215
|
+
return derivedSubstitution;
|
|
216
216
|
}
|
|
217
217
|
|
|
218
|
-
|
|
219
|
-
const
|
|
220
|
-
const
|
|
218
|
+
findSimpleDerivedSubstitutionByMetavariableNode(metavariableNode) {
|
|
219
|
+
const simpleDerivedSubstitution = this.findDerivedSubstitution((derivedSubstitution) => {
|
|
220
|
+
const derivedSubstitutionSimple = derivedSubstitution.isSimple();
|
|
221
221
|
|
|
222
|
-
if (
|
|
223
|
-
const
|
|
224
|
-
metavariableNodeMatches =
|
|
222
|
+
if (derivedSubstitutionSimple) {
|
|
223
|
+
const simpleDerivedSubstitution = derivedSubstitution, ///
|
|
224
|
+
metavariableNodeMatches = simpleDerivedSubstitution.matchMetavariableNode(metavariableNode);
|
|
225
225
|
|
|
226
226
|
if (metavariableNodeMatches) {
|
|
227
227
|
return true;
|
|
@@ -229,16 +229,16 @@ export default class LiminalContext extends Context {
|
|
|
229
229
|
}
|
|
230
230
|
}) || null;
|
|
231
231
|
|
|
232
|
-
return
|
|
232
|
+
return simpleDerivedSubstitution;
|
|
233
233
|
}
|
|
234
234
|
|
|
235
|
-
|
|
236
|
-
const
|
|
237
|
-
const
|
|
235
|
+
findComplexDerivedSubstitutionsByMetavariableNode(metavariableNode) {
|
|
236
|
+
const complexDerivedSubstitution = this.findDerivedSubstitutions((derivedSubstitution) => {
|
|
237
|
+
const derivedSubstitutionComplex = derivedSubstitution.isComplex();
|
|
238
238
|
|
|
239
|
-
if (
|
|
240
|
-
const
|
|
241
|
-
metavariableNodeMatches =
|
|
239
|
+
if (derivedSubstitutionComplex) {
|
|
240
|
+
const complexDerivedSubstitution = derivedSubstitution, ///
|
|
241
|
+
metavariableNodeMatches = complexDerivedSubstitution.matchMetavariableNode(metavariableNode);
|
|
242
242
|
|
|
243
243
|
if (metavariableNodeMatches) {
|
|
244
244
|
return true;
|
|
@@ -246,46 +246,45 @@ export default class LiminalContext extends Context {
|
|
|
246
246
|
}
|
|
247
247
|
}) || null;
|
|
248
248
|
|
|
249
|
-
return
|
|
249
|
+
return complexDerivedSubstitution;
|
|
250
250
|
}
|
|
251
251
|
|
|
252
|
-
|
|
253
|
-
const
|
|
252
|
+
findDerivedSubstitutionByMetavariableNodeAndSubstitution(metavariableNode, derivedSubstitution) {
|
|
253
|
+
const derivedSubstitutionA = derivedSubstitution; ///
|
|
254
254
|
|
|
255
|
-
|
|
256
|
-
const metavariableNodeMatches =
|
|
255
|
+
derivedSubstitution = this.findDerivedSubstitution((derivedSubstitution) => { ///
|
|
256
|
+
const metavariableNodeMatches = derivedSubstitution.matchMetavariableNode(metavariableNode);
|
|
257
257
|
|
|
258
258
|
if (metavariableNodeMatches) {
|
|
259
|
-
const
|
|
260
|
-
|
|
259
|
+
const derivedSubstitutionB = derivedSubstitution, ///
|
|
260
|
+
derivedSubstitutionBEqualToDerivedSubstitutionA = derivedSubstitutionB.isEqualTo(derivedSubstitutionA);
|
|
261
261
|
|
|
262
|
-
if (
|
|
262
|
+
if (derivedSubstitutionBEqualToDerivedSubstitutionA) {
|
|
263
263
|
return true;
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
266
|
}) || null;
|
|
267
267
|
|
|
268
|
-
return
|
|
268
|
+
return derivedSubstitution;
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
-
|
|
272
|
-
const
|
|
273
|
-
|
|
271
|
+
isDerivedSubstitutionPresentByMetavariableNode(metavariableNode) {
|
|
272
|
+
const derivedSubstitution = this.findDerivedSubstitutionByMetavariableNode(metavariableNode),
|
|
273
|
+
derivedSubstitutionPresent = (derivedSubstitution !== null);
|
|
274
274
|
|
|
275
|
-
return
|
|
275
|
+
return derivedSubstitutionPresent;
|
|
276
276
|
}
|
|
277
277
|
|
|
278
|
-
|
|
279
|
-
|
|
278
|
+
isDerivedSubstitutionPresentByMetavariableNodeAndSubstitution(metavariableNode, substitution) {
|
|
279
|
+
const derivedSubstitution = this.findDerivedSubstitutionByMetavariableNodeAndSubstitution(metavariableNode, substitution),
|
|
280
|
+
derivedSubstitutionPresent = (derivedSubstitution !== null);
|
|
280
281
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
return substitutionPresent;
|
|
282
|
+
return derivedSubstitutionPresent;
|
|
284
283
|
}
|
|
285
284
|
|
|
286
285
|
static fromNothing(context) {
|
|
287
|
-
const
|
|
288
|
-
liminalContext = new LiminalContext(context,
|
|
286
|
+
const derivedSubstitutions = [],
|
|
287
|
+
liminalContext = new LiminalContext(context, derivedSubstitutions);
|
|
289
288
|
|
|
290
289
|
return liminalContext;
|
|
291
290
|
}
|