occam-verify-cli 1.0.612 → 1.0.631
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 +210 -77
- package/lib/context/file/nominal.js +157 -135
- package/lib/context/liminal.js +34 -59
- package/lib/context/scoped.js +37 -58
- package/lib/context.js +103 -53
- package/lib/element/assertion/contained.js +3 -1
- package/lib/element/assertion/defined.js +3 -1
- package/lib/element/assertion/property.js +10 -58
- package/lib/element/assertion/satisfies.js +3 -1
- package/lib/element/assertion/subproof.js +3 -1
- package/lib/element/assertion/type.js +63 -109
- package/lib/element/assertion.js +5 -9
- package/lib/element/assumption.js +50 -19
- package/lib/element/combinator.js +8 -1
- package/lib/element/conclusion.js +8 -1
- package/lib/element/constructor.js +8 -1
- package/lib/element/declaration.js +3 -7
- package/lib/element/deduction.js +8 -1
- package/lib/element/derivation.js +15 -10
- package/lib/element/equality.js +109 -62
- package/lib/element/equivalence.js +13 -6
- package/lib/element/equivalences.js +11 -4
- package/lib/element/error.js +10 -7
- package/lib/element/frame.js +21 -21
- package/lib/element/hypothesis.js +12 -7
- package/lib/element/judgement.js +55 -26
- package/lib/element/label.js +8 -1
- package/lib/element/metaType.js +9 -2
- package/lib/element/metavariable.js +16 -10
- package/lib/element/parameter.js +8 -1
- package/lib/element/procedureCall.js +21 -29
- package/lib/element/procedureReference.js +15 -1
- package/lib/element/proof.js +8 -1
- package/lib/element/proofAssertion.js +8 -1
- package/lib/element/property.js +8 -1
- package/lib/element/propertyRelation.js +8 -1
- package/lib/element/reference.js +16 -28
- package/lib/element/rule.js +22 -21
- package/lib/element/section.js +8 -1
- package/lib/element/signature.js +8 -1
- package/lib/element/statement.js +34 -40
- package/lib/element/subDerivation.js +11 -6
- package/lib/element/subproof.js +8 -1
- package/lib/element/substitution/frame.js +6 -6
- package/lib/element/substitution/reference.js +6 -6
- package/lib/element/substitution/statement.js +6 -6
- package/lib/element/substitution/term.js +9 -3
- package/lib/element/substitution.js +73 -49
- package/lib/element/term.js +15 -1
- package/lib/element/topLevelAssertion/axiom.js +8 -1
- package/lib/element/topLevelAssertion/conjecture.js +8 -1
- package/lib/element/topLevelAssertion/lemma.js +8 -1
- package/lib/element/topLevelAssertion/theorem.js +8 -1
- package/lib/element/topLevelAssertion.js +11 -17
- package/lib/element/topLevelMetaAssertion/metaLemma.js +8 -1
- package/lib/element/topLevelMetaAssertion/metatheorem.js +8 -1
- package/lib/element/topLevelMetaAssertion.js +9 -11
- package/lib/element/type.js +8 -1
- package/lib/element/typePrefix.js +8 -1
- package/lib/element/variable.js +51 -5
- package/lib/preamble.js +1 -2
- package/lib/process/assign.js +96 -27
- package/lib/process/unify.js +3 -4
- package/lib/process/validate.js +2 -2
- package/lib/process/verify.js +2 -2
- package/lib/utilities/element.js +74 -12
- package/lib/utilities/json.js +2 -2
- package/lib/utilities/string.js +9 -24
- package/lib/utilities/substitutions.js +15 -23
- package/package.json +2 -2
- package/src/context/ephemeral.js +234 -82
- package/src/context/file/nominal.js +195 -135
- package/src/context/liminal.js +43 -80
- package/src/context/scoped.js +56 -81
- package/src/context.js +97 -46
- package/src/element/assertion/contained.js +4 -0
- package/src/element/assertion/defined.js +4 -0
- package/src/element/assertion/property.js +15 -26
- package/src/element/assertion/satisfies.js +4 -0
- package/src/element/assertion/subproof.js +4 -0
- package/src/element/assertion/type.js +67 -77
- package/src/element/assertion.js +4 -8
- package/src/element/assumption.js +57 -18
- package/src/element/combinator.js +7 -0
- package/src/element/conclusion.js +7 -0
- package/src/element/constructor.js +7 -0
- package/src/element/declaration.js +1 -3
- package/src/element/deduction.js +7 -0
- package/src/element/derivation.js +10 -5
- package/src/element/equality.js +116 -74
- package/src/element/equivalence.js +15 -7
- package/src/element/equivalences.js +14 -5
- package/src/element/error.js +5 -2
- package/src/element/frame.js +25 -25
- package/src/element/hypothesis.js +11 -6
- package/src/element/judgement.js +62 -26
- package/src/element/label.js +7 -0
- package/src/element/metaType.js +8 -1
- package/src/element/metavariable.js +20 -14
- package/src/element/parameter.js +7 -0
- package/src/element/procedureCall.js +21 -14
- package/src/element/procedureReference.js +13 -0
- package/src/element/proof.js +7 -0
- package/src/element/proofAssertion.js +7 -0
- package/src/element/property.js +7 -0
- package/src/element/propertyRelation.js +7 -0
- package/src/element/reference.js +20 -33
- package/src/element/rule.js +16 -19
- package/src/element/section.js +7 -0
- package/src/element/signature.js +7 -0
- package/src/element/statement.js +36 -44
- package/src/element/subDerivation.js +10 -5
- package/src/element/subproof.js +7 -0
- package/src/element/substitution/frame.js +3 -3
- package/src/element/substitution/reference.js +3 -3
- package/src/element/substitution/statement.js +3 -3
- package/src/element/substitution/term.js +4 -2
- package/src/element/substitution.js +60 -40
- package/src/element/term.js +20 -2
- package/src/element/topLevelAssertion/axiom.js +7 -0
- package/src/element/topLevelAssertion/conjecture.js +7 -0
- package/src/element/topLevelAssertion/lemma.js +7 -0
- package/src/element/topLevelAssertion/theorem.js +7 -0
- package/src/element/topLevelAssertion.js +5 -15
- package/src/element/topLevelMetaAssertion/metaLemma.js +7 -0
- package/src/element/topLevelMetaAssertion/metatheorem.js +7 -0
- package/src/element/topLevelMetaAssertion.js +4 -6
- package/src/element/type.js +7 -0
- package/src/element/typePrefix.js +7 -0
- package/src/element/variable.js +9 -4
- package/src/preamble.js +0 -1
- package/src/process/assign.js +113 -38
- package/src/process/unify.js +2 -3
- package/src/process/validate.js +1 -1
- package/src/process/verify.js +1 -1
- package/src/utilities/element.js +83 -26
- package/src/utilities/json.js +1 -1
- package/src/utilities/string.js +7 -29
- package/src/utilities/substitutions.js +19 -30
- package/lib/element/substitutions.js +0 -225
- package/src/element/substitutions.js +0 -84
package/src/context/ephemeral.js
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import { arrayUtilities } from "necessary";
|
|
4
|
-
|
|
5
3
|
import Context from "../context";
|
|
6
4
|
|
|
7
|
-
const { extract } = arrayUtilities;
|
|
8
|
-
|
|
9
5
|
export default class EphemeralContext extends Context {
|
|
10
|
-
constructor(context, terms, frames,
|
|
6
|
+
constructor(context, terms, frames, judgements, equalities, assertions, statements, references, assumptions, substitutions) {
|
|
11
7
|
super(context);
|
|
12
8
|
|
|
13
9
|
this.terms = terms;
|
|
14
10
|
this.frames = frames;
|
|
15
|
-
this.
|
|
11
|
+
this.judgements = judgements;
|
|
12
|
+
this.equalities = equalities;
|
|
16
13
|
this.assertions = assertions;
|
|
14
|
+
this.statements = statements;
|
|
17
15
|
this.references = references;
|
|
16
|
+
this.assumptions = assumptions;
|
|
18
17
|
this.substitutions = substitutions;
|
|
19
18
|
}
|
|
20
19
|
|
|
@@ -26,6 +25,14 @@ export default class EphemeralContext extends Context {
|
|
|
26
25
|
return this.frames;
|
|
27
26
|
}
|
|
28
27
|
|
|
28
|
+
getEqualities() {
|
|
29
|
+
return this.equalities;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
getJudgements() {
|
|
33
|
+
return this.judgements;
|
|
34
|
+
}
|
|
35
|
+
|
|
29
36
|
getStatements() {
|
|
30
37
|
return this.statements;
|
|
31
38
|
}
|
|
@@ -38,6 +45,10 @@ export default class EphemeralContext extends Context {
|
|
|
38
45
|
return this.references;
|
|
39
46
|
}
|
|
40
47
|
|
|
48
|
+
getAssumptions() {
|
|
49
|
+
return this.assumptions;
|
|
50
|
+
}
|
|
51
|
+
|
|
41
52
|
getSubstitutions() {
|
|
42
53
|
return this.substitutions;
|
|
43
54
|
}
|
|
@@ -47,18 +58,24 @@ export default class EphemeralContext extends Context {
|
|
|
47
58
|
context = this, ///
|
|
48
59
|
termString = term.getString();
|
|
49
60
|
|
|
50
|
-
|
|
61
|
+
context.trace(`Adding the '${termString}' term to the ephemeral context...`);
|
|
62
|
+
|
|
63
|
+
const termB = this.terms.find((term) => {
|
|
51
64
|
const termB = term, ///
|
|
52
65
|
termAEqualToTermB = termA.isEqualTo(termB);
|
|
53
66
|
|
|
54
67
|
if (termAEqualToTermB) {
|
|
55
68
|
return true;
|
|
56
69
|
}
|
|
57
|
-
});
|
|
70
|
+
}) || null;
|
|
58
71
|
|
|
59
|
-
|
|
72
|
+
if (termB !== null) {
|
|
73
|
+
context.trace(`The '${termString}' term has already been added to the ephemeral context.`);
|
|
74
|
+
} else {
|
|
75
|
+
this.terms.push(term);
|
|
60
76
|
|
|
61
|
-
|
|
77
|
+
context.debug(`...added the '${termString}' term to the ephemeral context.`);
|
|
78
|
+
}
|
|
62
79
|
}
|
|
63
80
|
|
|
64
81
|
addFrame(frame) {
|
|
@@ -66,18 +83,74 @@ export default class EphemeralContext extends Context {
|
|
|
66
83
|
context = this, ///
|
|
67
84
|
frameString = frame.getString();
|
|
68
85
|
|
|
69
|
-
|
|
86
|
+
context.trace(`Adding the '${frameString}' frame to the ephemeral context...`);
|
|
87
|
+
|
|
88
|
+
const frameB = this.frames.find((frame) => {
|
|
70
89
|
const frameB = frame, ///
|
|
71
90
|
frameAEqualToFrameB = frameA.isEqualTo(frameB);
|
|
72
91
|
|
|
73
92
|
if (frameAEqualToFrameB) {
|
|
74
93
|
return true;
|
|
75
94
|
}
|
|
76
|
-
});
|
|
95
|
+
}) || null;
|
|
96
|
+
|
|
97
|
+
if (frameB !== null) {
|
|
98
|
+
context.trace(`The '${frameString}' frame has already been added to the ephemeral context.`);
|
|
99
|
+
} else {
|
|
100
|
+
this.frames.push(frame);
|
|
101
|
+
|
|
102
|
+
context.debug(`...added the '${frameString}' frame to the ephemeral context.`);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
addEquality(equality) {
|
|
107
|
+
const equalityA = equality, ///
|
|
108
|
+
context = this, ///
|
|
109
|
+
equalityString = equality.getString();
|
|
110
|
+
|
|
111
|
+
context.trace(`Adding the '${equalityString}' equality to the ephemeral context...`);
|
|
112
|
+
|
|
113
|
+
const equalityB = this.equalities.find((equality) => {
|
|
114
|
+
const equalityB = equality, ///
|
|
115
|
+
equalityAEqualToEqualityB = equalityA.isEqualTo(equalityB);
|
|
116
|
+
|
|
117
|
+
if (equalityAEqualToEqualityB) {
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
}) || null;
|
|
121
|
+
|
|
122
|
+
if (equalityB !== null) {
|
|
123
|
+
context.trace(`The '${equalityString}' equality has already been added to the ephemeral context.`);
|
|
124
|
+
} else {
|
|
125
|
+
this.equalities.push(equality);
|
|
126
|
+
|
|
127
|
+
context.debug(`...added the '${equalityString}' equality to the ephemeral context.`);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
addJudgement(judgement) {
|
|
132
|
+
const judgementA = judgement, ///
|
|
133
|
+
context = this, ///
|
|
134
|
+
judgementString = judgement.getString();
|
|
135
|
+
|
|
136
|
+
context.trace(`Adding the '${judgementString}' judgement to the ephemeral context...`);
|
|
137
|
+
|
|
138
|
+
const judgementB = this.judgements.find((judgement) => {
|
|
139
|
+
const judgementB = judgement, ///
|
|
140
|
+
judgementAEqualToEqualityB = judgementA.isEqualTo(judgementB);
|
|
141
|
+
|
|
142
|
+
if (judgementAEqualToEqualityB) {
|
|
143
|
+
return true;
|
|
144
|
+
}
|
|
145
|
+
}) || null;
|
|
77
146
|
|
|
78
|
-
|
|
147
|
+
if (judgementB !== null) {
|
|
148
|
+
context.trace(`The '${judgementString}' judgement has already been added to the ephemeral context.`);
|
|
149
|
+
} else {
|
|
150
|
+
this.judgements.push(judgement);
|
|
79
151
|
|
|
80
|
-
|
|
152
|
+
context.debug(`...added the '${judgementString}' judgement to the ephemeral context.`);
|
|
153
|
+
}
|
|
81
154
|
}
|
|
82
155
|
|
|
83
156
|
addStatement(statement) {
|
|
@@ -85,18 +158,24 @@ export default class EphemeralContext extends Context {
|
|
|
85
158
|
statementA = statement, ///
|
|
86
159
|
statementString = statement.getString();
|
|
87
160
|
|
|
88
|
-
|
|
161
|
+
context.trace(`Adding the '${statementString}' statement to the ephemeral context...`);
|
|
162
|
+
|
|
163
|
+
const statementB = this.statements.find((statement) => {
|
|
89
164
|
const statementB = statement, ///
|
|
90
|
-
|
|
165
|
+
statementAEqualToStatementB = statementA.isEqualTo(statementB);
|
|
91
166
|
|
|
92
|
-
if (
|
|
167
|
+
if (statementAEqualToStatementB) {
|
|
93
168
|
return true;
|
|
94
169
|
}
|
|
95
|
-
});
|
|
170
|
+
}) || null;
|
|
96
171
|
|
|
97
|
-
|
|
172
|
+
if (statementB !== null) {
|
|
173
|
+
context.trace(`The '${statementString}' statement has already been added to the ephemeral context.`);
|
|
174
|
+
} else {
|
|
175
|
+
this.statements.push(statement);
|
|
98
176
|
|
|
99
|
-
|
|
177
|
+
context.debug(`...added the '${statementString}' statement to the ephemeral context.`);
|
|
178
|
+
}
|
|
100
179
|
}
|
|
101
180
|
|
|
102
181
|
addAssertion(assertion) {
|
|
@@ -104,18 +183,24 @@ export default class EphemeralContext extends Context {
|
|
|
104
183
|
assertionA = assertion, ///
|
|
105
184
|
assertionString = assertion.getString();
|
|
106
185
|
|
|
107
|
-
|
|
186
|
+
context.trace(`Adding the '${assertionString}' assertion to the ephemeral context...`);
|
|
187
|
+
|
|
188
|
+
const assertionB = this.assertions.find((assertion) => {
|
|
108
189
|
const assertionB = assertion, ///
|
|
109
190
|
assertionAEqualToAssertionB = assertionA.isEqualTo(assertionB);
|
|
110
191
|
|
|
111
192
|
if (assertionAEqualToAssertionB) {
|
|
112
193
|
return true;
|
|
113
194
|
}
|
|
114
|
-
});
|
|
195
|
+
}) || null;
|
|
115
196
|
|
|
116
|
-
|
|
197
|
+
if (assertionB !== null) {
|
|
198
|
+
context.trace(`The '${assertionString}' assertion has already been added to the ephemeral context.`);
|
|
199
|
+
} else {
|
|
200
|
+
this.assertions.push(assertion);
|
|
117
201
|
|
|
118
|
-
|
|
202
|
+
context.debug(`...added the '${assertionString}' assertion to the ephemeral context.`);
|
|
203
|
+
}
|
|
119
204
|
}
|
|
120
205
|
|
|
121
206
|
addReference(reference) {
|
|
@@ -123,18 +208,49 @@ export default class EphemeralContext extends Context {
|
|
|
123
208
|
referenceA = reference, ///
|
|
124
209
|
referenceString = reference.getString();
|
|
125
210
|
|
|
126
|
-
|
|
211
|
+
context.trace(`Adding the '${referenceString}' reference to the ephemeral context...`);
|
|
212
|
+
|
|
213
|
+
const referenceB = this.references.find((reference) => {
|
|
127
214
|
const referenceB = reference, ///
|
|
128
215
|
referenceAEqualToReferenceB = referenceA.isEqualTo(referenceB);
|
|
129
216
|
|
|
130
217
|
if (referenceAEqualToReferenceB) {
|
|
131
218
|
return true;
|
|
132
219
|
}
|
|
133
|
-
});
|
|
220
|
+
}) || null;
|
|
134
221
|
|
|
135
|
-
|
|
222
|
+
if (referenceB !== null) {
|
|
223
|
+
context.trace(`The '${referenceString}' reference has already been added to the ephemeral context.`);
|
|
224
|
+
} else {
|
|
225
|
+
this.references.push(reference);
|
|
136
226
|
|
|
137
|
-
|
|
227
|
+
context.debug(`...added the '${referenceString}' reference to the ephemeral context.`);
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
addAssumption(assumption) {
|
|
232
|
+
const context = this, ///
|
|
233
|
+
assumptionA = assumption, ///
|
|
234
|
+
assumptionString = assumption.getString();
|
|
235
|
+
|
|
236
|
+
context.trace(`Adding the '${assumptionString}' assumption to the ephemeral context...`);
|
|
237
|
+
|
|
238
|
+
const assumptionB = this.assumptions.find((assumption) => {
|
|
239
|
+
const assumptionB = assumption, ///
|
|
240
|
+
assumptionAEqualToAssumptionB = assumptionA.isEqualTo(assumptionB);
|
|
241
|
+
|
|
242
|
+
if (assumptionAEqualToAssumptionB) {
|
|
243
|
+
return true;
|
|
244
|
+
}
|
|
245
|
+
}) || null;
|
|
246
|
+
|
|
247
|
+
if (assumptionB !== null) {
|
|
248
|
+
context.trace(`The '${assumptionString}' assumption has already been added to the ephemeral context.`);
|
|
249
|
+
} else {
|
|
250
|
+
this.assumptions.push(assumption);
|
|
251
|
+
|
|
252
|
+
context.debug(`...added the '${assumptionString}' assumption to the ephemeral context.`);
|
|
253
|
+
}
|
|
138
254
|
}
|
|
139
255
|
|
|
140
256
|
addSubstitution(substitution) {
|
|
@@ -142,23 +258,29 @@ export default class EphemeralContext extends Context {
|
|
|
142
258
|
substitutionA = substitution, ///
|
|
143
259
|
substitutionString = substitution.getString();
|
|
144
260
|
|
|
145
|
-
|
|
261
|
+
context.trace(`Adding the '${substitutionString}' substitution to the ephemeral context...`);
|
|
262
|
+
|
|
263
|
+
const substitutionB = this.substitutions.find((substitution) => {
|
|
146
264
|
const substitutionB = substitution, ///
|
|
147
|
-
|
|
265
|
+
substitutionAEqualToSubstitutionB = substitutionA.isEqualTo(substitutionB);
|
|
148
266
|
|
|
149
|
-
if (
|
|
267
|
+
if (substitutionAEqualToSubstitutionB) {
|
|
150
268
|
return true;
|
|
151
269
|
}
|
|
152
|
-
});
|
|
270
|
+
}) || null;
|
|
153
271
|
|
|
154
|
-
|
|
272
|
+
if (substitutionB !== null) {
|
|
273
|
+
context.trace(`The '${substitutionString}' substitution has already been added to the ephemeral context.`);
|
|
274
|
+
} else {
|
|
275
|
+
this.substitutions.push(substitution);
|
|
155
276
|
|
|
156
|
-
|
|
277
|
+
context.debug(`...added the '${substitutionString}' substitution to the ephemeral context.`);
|
|
278
|
+
}
|
|
157
279
|
}
|
|
158
280
|
|
|
159
281
|
findTermByTermNode(termNode) {
|
|
160
282
|
const term = this.terms.find((term) => {
|
|
161
|
-
const termNodeMatches = term.
|
|
283
|
+
const termNodeMatches = term.matchTermNode(termNode);
|
|
162
284
|
|
|
163
285
|
if (termNodeMatches) {
|
|
164
286
|
return true;
|
|
@@ -170,7 +292,7 @@ export default class EphemeralContext extends Context {
|
|
|
170
292
|
|
|
171
293
|
findFrameByFrameNode(frameNode) {
|
|
172
294
|
const frame = this.frames.find((frame) => {
|
|
173
|
-
const frameNodeMatches = frame.
|
|
295
|
+
const frameNodeMatches = frame.matchFrameNode(frameNode);
|
|
174
296
|
|
|
175
297
|
if (frameNodeMatches) {
|
|
176
298
|
return true;
|
|
@@ -180,9 +302,33 @@ export default class EphemeralContext extends Context {
|
|
|
180
302
|
return frame;
|
|
181
303
|
}
|
|
182
304
|
|
|
305
|
+
findJudgementByJudgementNode(judgementNode) {
|
|
306
|
+
const judgement = this.judgements.find((judgement) => {
|
|
307
|
+
const judgementNodeMatches = judgement.matchJudgementNode(judgementNode);
|
|
308
|
+
|
|
309
|
+
if (judgementNodeMatches) {
|
|
310
|
+
return true;
|
|
311
|
+
}
|
|
312
|
+
}) || null;
|
|
313
|
+
|
|
314
|
+
return judgement;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
findEqualityByEqualityNode(equalityNode) {
|
|
318
|
+
const equality = this.equalities.find((equality) => {
|
|
319
|
+
const equalityNodeMatches = equality.matchEqualityNode(equalityNode);
|
|
320
|
+
|
|
321
|
+
if (equalityNodeMatches) {
|
|
322
|
+
return true;
|
|
323
|
+
}
|
|
324
|
+
}) || null;
|
|
325
|
+
|
|
326
|
+
return equality;
|
|
327
|
+
}
|
|
328
|
+
|
|
183
329
|
findStatementByStatementNode(statementNode) {
|
|
184
330
|
const statement = this.statements.find((statement) => {
|
|
185
|
-
const statementNodeMatches = statement.
|
|
331
|
+
const statementNodeMatches = statement.matchStatementNode(statementNode);
|
|
186
332
|
|
|
187
333
|
if (statementNodeMatches) {
|
|
188
334
|
return true;
|
|
@@ -194,7 +340,7 @@ export default class EphemeralContext extends Context {
|
|
|
194
340
|
|
|
195
341
|
findAssertionByAssertionNode(assertionNode) {
|
|
196
342
|
const assertion = this.assertions.find((assertion) => {
|
|
197
|
-
const assertionNodeMatches = assertion.
|
|
343
|
+
const assertionNodeMatches = assertion.matchAssertionNode(assertionNode);
|
|
198
344
|
|
|
199
345
|
if (assertionNodeMatches) {
|
|
200
346
|
return true;
|
|
@@ -204,6 +350,18 @@ export default class EphemeralContext extends Context {
|
|
|
204
350
|
return assertion;
|
|
205
351
|
}
|
|
206
352
|
|
|
353
|
+
findAssumptionByAssumptionNode(assumptionNode) {
|
|
354
|
+
const assumption = this.assumptions.find((assumption) => {
|
|
355
|
+
const assumptionNodeMatches = assumption.matchAssumptionNode(assumptionNode);
|
|
356
|
+
|
|
357
|
+
if (assumptionNodeMatches) {
|
|
358
|
+
return true;
|
|
359
|
+
}
|
|
360
|
+
}) || null;
|
|
361
|
+
|
|
362
|
+
return assumption;
|
|
363
|
+
}
|
|
364
|
+
|
|
207
365
|
findReferenceByMetavariableNode(metavariableNode) {
|
|
208
366
|
const reference = this.references.find((reference) => {
|
|
209
367
|
const referenceMatcheMetavariableNode = reference.matchMetavariableNode(metavariableNode);
|
|
@@ -218,7 +376,7 @@ export default class EphemeralContext extends Context {
|
|
|
218
376
|
|
|
219
377
|
findSubstitutionBySubstitutionNode(substitutionNode) {
|
|
220
378
|
const substitution = this.substitutions.find((substitution) => {
|
|
221
|
-
const substitutionNodeMatches = substitution.
|
|
379
|
+
const substitutionNodeMatches = substitution.matchSubstitutionNode(substitutionNode);
|
|
222
380
|
|
|
223
381
|
if (substitutionNodeMatches) {
|
|
224
382
|
return true;
|
|
@@ -229,73 +387,64 @@ export default class EphemeralContext extends Context {
|
|
|
229
387
|
}
|
|
230
388
|
|
|
231
389
|
isTermPresentByTermNode(termNode) {
|
|
232
|
-
const
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
if (termNodeMatches) {
|
|
236
|
-
return true;
|
|
237
|
-
}
|
|
238
|
-
});
|
|
390
|
+
const term = this.findTermByTermNode(termNode),
|
|
391
|
+
termPresent = (term !== null);
|
|
239
392
|
|
|
240
393
|
return termPresent;
|
|
241
394
|
}
|
|
242
395
|
|
|
243
396
|
isFramePresentByFrameNode(frameNode) {
|
|
244
|
-
const
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
if (frameNodeMatches) {
|
|
248
|
-
return true;
|
|
249
|
-
}
|
|
250
|
-
});
|
|
397
|
+
const frame = this.findFrameByFrameNode(frameNode),
|
|
398
|
+
framePresent = (frame !== null);
|
|
251
399
|
|
|
252
400
|
return framePresent;
|
|
253
401
|
}
|
|
254
402
|
|
|
255
|
-
|
|
256
|
-
const
|
|
257
|
-
|
|
403
|
+
isEqualityPresentByEqualityNode(equalityNode) {
|
|
404
|
+
const equality = this.findEqualityByEqualityNode(equalityNode),
|
|
405
|
+
equalityPresent = (equality !== null);
|
|
258
406
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
407
|
+
return equalityPresent;
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
isJudgementPresentByJudgementNode(judgementNode) {
|
|
411
|
+
const judgement = this.findJudgementByJudgementNode(judgementNode),
|
|
412
|
+
judgementPresent = (judgement !== null);
|
|
413
|
+
|
|
414
|
+
return judgementPresent;
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
isStatementPresentByStatementNode(statementNode) {
|
|
418
|
+
const statement = this.findStatementByStatementNode(statementNode),
|
|
419
|
+
statementPresent = (statement !== null);
|
|
263
420
|
|
|
264
421
|
return statementPresent;
|
|
265
422
|
}
|
|
266
423
|
|
|
267
424
|
isAssertionPresentByAssertionNode(assertionNode) {
|
|
268
|
-
const
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
if (assertionNodeMatches) {
|
|
272
|
-
return true;
|
|
273
|
-
}
|
|
274
|
-
});
|
|
425
|
+
const assertion = this.findAssertionByAssertionNode(assertionNode),
|
|
426
|
+
assertionPresent = (assertion !== null);
|
|
275
427
|
|
|
276
428
|
return assertionPresent;
|
|
277
429
|
}
|
|
278
430
|
|
|
279
|
-
|
|
280
|
-
const
|
|
281
|
-
|
|
431
|
+
isAssumptionPresentByAssumptionNode(assumptionNode) {
|
|
432
|
+
const assumption = this.findAssumptionByAssumptionNode(assumptionNode),
|
|
433
|
+
assumptionPresent = (assumption !== null);
|
|
282
434
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
435
|
+
return assumptionPresent;
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
isReferencePresentByMetavariableNode(metavariableNode) {
|
|
439
|
+
const reference = this.findReferenceByMetavariableNode(metavariableNode),
|
|
440
|
+
referencePresent = (reference !== null);
|
|
287
441
|
|
|
288
442
|
return referencePresent;
|
|
289
443
|
}
|
|
290
444
|
|
|
291
445
|
isSubstitutionPresentBySubstitutionNode(substitutionNode) {
|
|
292
|
-
const
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
if (substitutionNodeMatches) {
|
|
296
|
-
return true;
|
|
297
|
-
}
|
|
298
|
-
});
|
|
446
|
+
const substitution = this.findSubstitutionBySubstitutionNode(substitutionNode),
|
|
447
|
+
substitutionPresent = (substitution !== null);
|
|
299
448
|
|
|
300
449
|
return substitutionPresent;
|
|
301
450
|
}
|
|
@@ -303,11 +452,14 @@ export default class EphemeralContext extends Context {
|
|
|
303
452
|
static fromNothing(context) {
|
|
304
453
|
const terms = [],
|
|
305
454
|
frames = [],
|
|
455
|
+
judgements = [],
|
|
456
|
+
equalities = [],
|
|
306
457
|
statements = [],
|
|
307
458
|
assertions = [],
|
|
308
459
|
references = [],
|
|
460
|
+
assumptions = [],
|
|
309
461
|
substitutions = [],
|
|
310
|
-
emphemeralContext = new EphemeralContext(context, terms, frames,
|
|
462
|
+
emphemeralContext = new EphemeralContext(context, terms, frames, judgements, equalities, assertions, statements, references, assumptions, substitutions);
|
|
311
463
|
|
|
312
464
|
return emphemeralContext;
|
|
313
465
|
}
|