occam-verify-cli 1.0.800 → 1.0.806
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/branching.js +2 -2
- package/lib/context/ephemeral.js +186 -69
- package/lib/context/file/nominal.js +87 -52
- package/lib/context/liminal.js +2 -2
- package/lib/context/proof.js +55 -55
- package/lib/context/synthetic.js +151 -74
- package/lib/context.js +57 -17
- package/lib/element/assertion/defined.js +3 -3
- package/lib/element/assumption/metaLevel.js +6 -4
- package/lib/element/combinator.js +4 -2
- package/lib/element/conclusion.js +4 -2
- package/lib/element/constructor.js +4 -2
- package/lib/element/declaration/metavariable.js +10 -9
- package/lib/element/declaration/variable.js +7 -7
- package/lib/element/deduction.js +4 -2
- package/lib/element/label.js +9 -5
- package/lib/element/metavariable.js +34 -34
- package/lib/element/proofAssertion/premise.js +4 -3
- package/lib/element/proofAssertion/step.js +4 -2
- package/lib/element/reference.js +6 -4
- package/lib/element/statement.js +9 -1
- package/lib/element/substitution/frame.js +43 -29
- package/lib/element/substitution/reference.js +38 -28
- package/lib/element/substitution/statement.js +46 -38
- package/lib/element/substitution/term.js +49 -35
- package/lib/element/variable.js +6 -7
- package/lib/preamble.js +1 -2
- package/lib/process/assign.js +11 -10
- package/lib/process/equate.js +3 -2
- package/lib/process/unify.js +7 -7
- package/lib/utilities/context.js +13 -5
- package/lib/utilities/element.js +1 -1
- package/lib/utilities/equivalences.js +131 -0
- package/lib/utilities/json.js +59 -1
- package/lib/utilities/validation.js +4 -3
- package/package.json +2 -2
- package/src/context/branching.js +2 -2
- package/src/context/ephemeral.js +421 -237
- package/src/context/file/nominal.js +127 -77
- package/src/context/liminal.js +2 -2
- package/src/context/proof.js +81 -82
- package/src/context/synthetic.js +198 -88
- package/src/context.js +81 -20
- package/src/element/assertion/defined.js +4 -4
- package/src/element/assumption/metaLevel.js +8 -6
- package/src/element/combinator.js +4 -2
- package/src/element/conclusion.js +4 -2
- package/src/element/constructor.js +4 -2
- package/src/element/declaration/metavariable.js +10 -8
- package/src/element/declaration/variable.js +8 -7
- package/src/element/deduction.js +4 -2
- package/src/element/label.js +11 -7
- package/src/element/metavariable.js +11 -11
- package/src/element/proofAssertion/premise.js +4 -4
- package/src/element/proofAssertion/step.js +4 -2
- package/src/element/reference.js +7 -5
- package/src/element/statement.js +14 -0
- package/src/element/substitution/frame.js +47 -32
- package/src/element/substitution/reference.js +44 -34
- package/src/element/substitution/statement.js +63 -54
- package/src/element/substitution/term.js +53 -38
- package/src/element/variable.js +6 -7
- package/src/preamble.js +0 -1
- package/src/process/assign.js +17 -14
- package/src/process/equate.js +3 -1
- package/src/process/unify.js +10 -13
- package/src/utilities/context.js +13 -6
- package/src/utilities/element.js +1 -0
- package/src/utilities/equivalences.js +158 -0
- package/src/utilities/json.js +66 -0
- package/src/utilities/validation.js +6 -5
- package/lib/element/equivalences.js +0 -173
- package/src/element/equivalences.js +0 -237
package/src/context/proof.js
CHANGED
|
@@ -3,52 +3,23 @@
|
|
|
3
3
|
import { arrayUtilities } from "necessary";
|
|
4
4
|
|
|
5
5
|
import Context from "../context";
|
|
6
|
-
|
|
6
|
+
|
|
7
|
+
import { mergeEquivalences, findEquivalenceByTerm, equivalencesFromEquality, separateGroundedTermsAndDefinedVariables } from "../utilities/equivalences";
|
|
7
8
|
|
|
8
9
|
const { last, filter } = arrayUtilities;
|
|
9
10
|
|
|
10
11
|
class ProofContext extends Context {
|
|
11
|
-
constructor(context,
|
|
12
|
+
constructor(context, assignments, equivalences, declaredVariables, declaredJudgements, metaLevelAssumptions, subproofOrProofAssertions) {
|
|
12
13
|
super(context);
|
|
13
14
|
|
|
14
|
-
this.variables = variables;
|
|
15
|
-
this.judgements = judgements;
|
|
16
15
|
this.assignments = assignments;
|
|
17
16
|
this.equivalences = equivalences;
|
|
17
|
+
this.declaredVariables = declaredVariables;
|
|
18
|
+
this.declaredJudgements = declaredJudgements;
|
|
18
19
|
this.metaLevelAssumptions = metaLevelAssumptions;
|
|
19
20
|
this.subproofOrProofAssertions = subproofOrProofAssertions;
|
|
20
21
|
}
|
|
21
22
|
|
|
22
|
-
getVariables() {
|
|
23
|
-
let variables;
|
|
24
|
-
|
|
25
|
-
const context = this.getContext();
|
|
26
|
-
|
|
27
|
-
variables = context.getVariables();
|
|
28
|
-
|
|
29
|
-
variables = [
|
|
30
|
-
...this.variables,
|
|
31
|
-
...variables
|
|
32
|
-
];
|
|
33
|
-
|
|
34
|
-
return variables;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
getJudgements() {
|
|
38
|
-
let judgements;
|
|
39
|
-
|
|
40
|
-
const context = this.getContext();
|
|
41
|
-
|
|
42
|
-
judgements = context.getJudgements();
|
|
43
|
-
|
|
44
|
-
judgements = [ ///
|
|
45
|
-
...this.judgements,
|
|
46
|
-
...judgements
|
|
47
|
-
]
|
|
48
|
-
|
|
49
|
-
return judgements;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
23
|
getAssignments() {
|
|
53
24
|
return this.assignments;
|
|
54
25
|
}
|
|
@@ -64,11 +35,41 @@ class ProofContext extends Context {
|
|
|
64
35
|
|
|
65
36
|
context = this; ///
|
|
66
37
|
|
|
67
|
-
equivalences = this.equivalences
|
|
38
|
+
equivalences = mergeEquivalences(this.equivalences, equivalences, context); ///
|
|
68
39
|
|
|
69
40
|
return equivalences;
|
|
70
41
|
}
|
|
71
42
|
|
|
43
|
+
getDeclaredVariables() {
|
|
44
|
+
let declaredVariables;
|
|
45
|
+
|
|
46
|
+
const context = this.getContext();
|
|
47
|
+
|
|
48
|
+
declaredVariables = context.getDeclaredVariables();
|
|
49
|
+
|
|
50
|
+
declaredVariables = [
|
|
51
|
+
...this.declaredVariables,
|
|
52
|
+
...declaredVariables
|
|
53
|
+
];
|
|
54
|
+
|
|
55
|
+
return declaredVariables;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
getDeclaredJudgements() {
|
|
59
|
+
let declaredJudgements;
|
|
60
|
+
|
|
61
|
+
const context = this.getContext();
|
|
62
|
+
|
|
63
|
+
declaredJudgements = context.getDeclaredJudgements();
|
|
64
|
+
|
|
65
|
+
declaredJudgements = [ ///
|
|
66
|
+
...this.declaredJudgements,
|
|
67
|
+
...declaredJudgements
|
|
68
|
+
]
|
|
69
|
+
|
|
70
|
+
return declaredJudgements;
|
|
71
|
+
}
|
|
72
|
+
|
|
72
73
|
getMetaLevelAssumptions() {
|
|
73
74
|
return this.metaLevelAssumptions;
|
|
74
75
|
}
|
|
@@ -139,10 +140,9 @@ class ProofContext extends Context {
|
|
|
139
140
|
const equalityRelfexive = equality.isReflexive();
|
|
140
141
|
|
|
141
142
|
if (!equalityRelfexive) {
|
|
142
|
-
const
|
|
143
|
-
equivalence = Equivalence.fromEquality(equality, context);
|
|
143
|
+
const equivalence = equivalencesFromEquality(equality, context);
|
|
144
144
|
|
|
145
|
-
this.equivalences = this.equivalences
|
|
145
|
+
this.equivalences = mergeEquivalences(this.equivalences, equivalence, context);
|
|
146
146
|
|
|
147
147
|
context.debug(`...added the '${equalityString}' equality to the proof context.`);
|
|
148
148
|
} else {
|
|
@@ -150,38 +150,38 @@ class ProofContext extends Context {
|
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
context.trace(`Adding the '${variableString}' variable to the proof context...`);
|
|
153
|
+
addAssignment(assignment) {
|
|
154
|
+
this.assignments.push(assignment);
|
|
155
|
+
}
|
|
158
156
|
|
|
159
|
-
|
|
157
|
+
assignAssignments() {
|
|
158
|
+
const context = this; ///
|
|
160
159
|
|
|
161
|
-
|
|
160
|
+
this.assignments.forEach((assignment) => {
|
|
161
|
+
assignment(context);
|
|
162
|
+
});
|
|
162
163
|
}
|
|
163
164
|
|
|
164
|
-
|
|
165
|
+
addDEclaredVariable(declaredVariable) {
|
|
165
166
|
const context = this, ///
|
|
166
|
-
|
|
167
|
+
declaredVariableString = declaredVariable.getString();
|
|
167
168
|
|
|
168
|
-
context.trace(`Adding the '${
|
|
169
|
+
context.trace(`Adding the '${declaredVariableString}' declared variable to the proof context...`);
|
|
169
170
|
|
|
170
|
-
this.
|
|
171
|
+
this.declaredVariables.push(declaredVariable);
|
|
171
172
|
|
|
172
|
-
context.debug(`...added the '${
|
|
173
|
+
context.debug(`...added the '${declaredVariableString}' declared variable to the proof context.`);
|
|
173
174
|
}
|
|
174
175
|
|
|
175
|
-
|
|
176
|
-
this
|
|
177
|
-
|
|
176
|
+
addDeclaredJudgement(declaredJudgement) {
|
|
177
|
+
const context = this, ///
|
|
178
|
+
declaredJudgementString = declaredJudgement.getString();
|
|
178
179
|
|
|
179
|
-
|
|
180
|
-
const context = this; ///
|
|
180
|
+
context.trace(`Adding the '${declaredJudgementString}' declared judgement to the proof context...`);
|
|
181
181
|
|
|
182
|
-
this.
|
|
183
|
-
|
|
184
|
-
});
|
|
182
|
+
this.declaredJudgements.push(declaredJudgement);
|
|
183
|
+
|
|
184
|
+
context.debug(`...added the '${declaredJudgementString}' declared judgement to the proof context.`);
|
|
185
185
|
}
|
|
186
186
|
|
|
187
187
|
addMetaLevelAssumption(metaLevelAssumption) {
|
|
@@ -210,9 +210,9 @@ class ProofContext extends Context {
|
|
|
210
210
|
context.debug(`The '${metaLevelAssumptionString}' metaLevelAssumption has already been added to the proof context.`);
|
|
211
211
|
} else {
|
|
212
212
|
this.metaLevelAssumptions.push(metaLevelAssumption);
|
|
213
|
-
|
|
214
|
-
context.debug(`...added the '${metaLevelAssumptionString}' meta-level assumption to the proof context.`);
|
|
215
213
|
}
|
|
214
|
+
|
|
215
|
+
context.debug(`...added the '${metaLevelAssumptionString}' meta-level assumption to the proof context.`);
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
addSubproofOrProofAssertion(subproofOrProofAssertion) {
|
|
@@ -240,11 +240,11 @@ class ProofContext extends Context {
|
|
|
240
240
|
return comparesToTermAndPropertyRelation;
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
-
findEquivalenceByTerm(term) { return this.equivalences
|
|
243
|
+
findEquivalenceByTerm(term) { return findEquivalenceByTerm(this.equivalences, term); }
|
|
244
244
|
|
|
245
245
|
findJudgementByMetavariableName(metavariableName) {
|
|
246
|
-
const
|
|
247
|
-
judgement =
|
|
246
|
+
const declaredJudgements = this.getJudgements(),
|
|
247
|
+
judgement = declaredJudgements.find((judgement) => {
|
|
248
248
|
const judgementMetavariableComparesToMetavariable = judgement.compareMetavariableName(metavariableName);
|
|
249
249
|
|
|
250
250
|
if (judgementMetavariableComparesToMetavariable) {
|
|
@@ -255,23 +255,23 @@ class ProofContext extends Context {
|
|
|
255
255
|
return judgement;
|
|
256
256
|
}
|
|
257
257
|
|
|
258
|
-
|
|
259
|
-
const
|
|
260
|
-
|
|
261
|
-
const variableComparesToVariableIdentifier =
|
|
258
|
+
findDeclaredVariableByVariableIdentifier(variableIdentifier) {
|
|
259
|
+
const declaredVariables = this.getDeclaredVariables(),
|
|
260
|
+
declaredVariable = declaredVariables.find((declaredVariable) => {
|
|
261
|
+
const variableComparesToVariableIdentifier = declaredVariable.compareVariableIdentifier(variableIdentifier);
|
|
262
262
|
|
|
263
263
|
if (variableComparesToVariableIdentifier) {
|
|
264
264
|
return true;
|
|
265
265
|
}
|
|
266
266
|
}) || null;
|
|
267
267
|
|
|
268
|
-
return
|
|
268
|
+
return declaredVariable;
|
|
269
269
|
}
|
|
270
270
|
|
|
271
271
|
findJudgementsByMetavariableNode(metavariableNode) {
|
|
272
|
-
const
|
|
272
|
+
const declaredJudgements = this.getJudgements();
|
|
273
273
|
|
|
274
|
-
filter(
|
|
274
|
+
filter(declaredJudgements, (judgement) => {
|
|
275
275
|
const metavariableNodeMatches = judgement.matchMetavariableNode(metavariableNode);
|
|
276
276
|
|
|
277
277
|
if (metavariableNodeMatches) {
|
|
@@ -279,7 +279,7 @@ class ProofContext extends Context {
|
|
|
279
279
|
}
|
|
280
280
|
});
|
|
281
281
|
|
|
282
|
-
return
|
|
282
|
+
return declaredJudgements;
|
|
283
283
|
}
|
|
284
284
|
|
|
285
285
|
findMetaLevelAssumptionByMetaLevelAssumptionNode(metaLevelAssumptionNode) {
|
|
@@ -307,11 +307,11 @@ class ProofContext extends Context {
|
|
|
307
307
|
return judgementPresent;
|
|
308
308
|
}
|
|
309
309
|
|
|
310
|
-
|
|
311
|
-
const
|
|
312
|
-
|
|
310
|
+
isDeclaredVariablePresentByVariableIdentifier(variableIdentifier) {
|
|
311
|
+
const declaredVariable = this.findDeclaredVariableByVariableIdentifier(variableIdentifier),
|
|
312
|
+
declaredVariablePresent = (declaredVariable !== null);
|
|
313
313
|
|
|
314
|
-
return
|
|
314
|
+
return declaredVariablePresent;
|
|
315
315
|
}
|
|
316
316
|
|
|
317
317
|
isTermGrounded(term) {
|
|
@@ -320,7 +320,7 @@ class ProofContext extends Context {
|
|
|
320
320
|
groundedTerms = [],
|
|
321
321
|
definedVariables = [];
|
|
322
322
|
|
|
323
|
-
|
|
323
|
+
separateGroundedTermsAndDefinedVariables(equivalences, groundedTerms, definedVariables, context);
|
|
324
324
|
|
|
325
325
|
const termMatchesGroundedTerm = groundedTerms.some((groundedTerm) => {
|
|
326
326
|
const groundedTermNode = groundedTerm.getNode(),
|
|
@@ -336,13 +336,12 @@ class ProofContext extends Context {
|
|
|
336
336
|
}
|
|
337
337
|
|
|
338
338
|
static fromMetaLevelAssumptions(metaLevelAssumptions, context) {
|
|
339
|
-
const
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
equivalences = Equivalences.fromNothing(context),
|
|
339
|
+
const assignments = [],
|
|
340
|
+
equivalences = [],
|
|
341
|
+
declaredVariables = [],
|
|
342
|
+
declaredJudgements = [],
|
|
344
343
|
subproofOrProofAssertions = [],
|
|
345
|
-
proofContext = new ProofContext(context,
|
|
344
|
+
proofContext = new ProofContext(context, assignments, equivalences, declaredVariables, declaredJudgements, metaLevelAssumptions, subproofOrProofAssertions);
|
|
346
345
|
|
|
347
346
|
return proofContext;
|
|
348
347
|
}
|
package/src/context/synthetic.js
CHANGED
|
@@ -4,7 +4,7 @@ import { arrayUtilities } from "necessary";
|
|
|
4
4
|
|
|
5
5
|
import Context from "../context";
|
|
6
6
|
|
|
7
|
-
const { last } = arrayUtilities;
|
|
7
|
+
const { push, last } = arrayUtilities;
|
|
8
8
|
|
|
9
9
|
export default class SyntheticContext extends Context {
|
|
10
10
|
constructor(context, contexts) {
|
|
@@ -17,157 +17,267 @@ export default class SyntheticContext extends Context {
|
|
|
17
17
|
return this.contexts;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
const
|
|
20
|
+
getTerms() {
|
|
21
|
+
const terms = [];
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
this.contexts.forEach((context) => {
|
|
24
|
+
const contextTerms = context.getTerms();
|
|
25
|
+
|
|
26
|
+
push(terms, contextTerms);
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
return terms;
|
|
24
30
|
}
|
|
25
31
|
|
|
26
|
-
|
|
27
|
-
|
|
32
|
+
getFrames() {
|
|
33
|
+
const frames = [];
|
|
28
34
|
|
|
29
|
-
this.contexts.
|
|
30
|
-
|
|
35
|
+
this.contexts.forEach((context) => {
|
|
36
|
+
const contextFrames = context.getFrames();
|
|
31
37
|
|
|
32
|
-
|
|
33
|
-
return true;
|
|
34
|
-
}
|
|
38
|
+
push(frames, contextFrames);
|
|
35
39
|
});
|
|
36
40
|
|
|
37
|
-
return
|
|
41
|
+
return frames;
|
|
38
42
|
}
|
|
39
43
|
|
|
40
|
-
|
|
41
|
-
|
|
44
|
+
getEqualities() {
|
|
45
|
+
const equalities = [];
|
|
42
46
|
|
|
43
|
-
this.contexts.
|
|
44
|
-
|
|
47
|
+
this.contexts.forEach((context) => {
|
|
48
|
+
const contextEqualities = context.getEqualities();
|
|
45
49
|
|
|
46
|
-
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
50
|
+
push(equalities, contextEqualities);
|
|
49
51
|
});
|
|
50
52
|
|
|
51
|
-
return
|
|
53
|
+
return equalities;
|
|
52
54
|
}
|
|
53
55
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
+
getJudgements() {
|
|
57
|
+
const judgements = [];
|
|
56
58
|
|
|
57
|
-
this.contexts.
|
|
58
|
-
|
|
59
|
+
this.contexts.forEach((context) => {
|
|
60
|
+
const contextJudgements = context.getJudgements();
|
|
59
61
|
|
|
60
|
-
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
62
|
+
push(judgements, contextJudgements);
|
|
63
63
|
});
|
|
64
64
|
|
|
65
|
-
return
|
|
65
|
+
return judgements;
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
getStatements() {
|
|
69
|
+
const statements = [];
|
|
70
70
|
|
|
71
|
-
this.contexts.
|
|
72
|
-
|
|
71
|
+
this.contexts.forEach((context) => {
|
|
72
|
+
const contextStatements = context.getStatements();
|
|
73
73
|
|
|
74
|
-
|
|
75
|
-
return true;
|
|
76
|
-
}
|
|
74
|
+
push(statements, contextStatements);
|
|
77
75
|
});
|
|
78
76
|
|
|
79
|
-
return
|
|
77
|
+
return statements;
|
|
80
78
|
}
|
|
81
79
|
|
|
82
|
-
|
|
83
|
-
|
|
80
|
+
getAssertions() {
|
|
81
|
+
const assertions = [];
|
|
84
82
|
|
|
85
|
-
this.contexts.
|
|
86
|
-
|
|
83
|
+
this.contexts.forEach((context) => {
|
|
84
|
+
const contextAssertions = context.getAssertions();
|
|
87
85
|
|
|
88
|
-
|
|
89
|
-
return true;
|
|
90
|
-
}
|
|
86
|
+
push(assertions, contextAssertions);
|
|
91
87
|
});
|
|
92
88
|
|
|
93
|
-
return
|
|
89
|
+
return assertions;
|
|
94
90
|
}
|
|
95
91
|
|
|
96
|
-
|
|
97
|
-
|
|
92
|
+
getReferences() {
|
|
93
|
+
const references = [];
|
|
98
94
|
|
|
99
|
-
this.contexts.
|
|
100
|
-
|
|
95
|
+
this.contexts.forEach((context) => {
|
|
96
|
+
const contextReferences = context.getReferences();
|
|
101
97
|
|
|
102
|
-
|
|
103
|
-
return true;
|
|
104
|
-
}
|
|
98
|
+
push(references, contextReferences);
|
|
105
99
|
});
|
|
106
100
|
|
|
107
|
-
return
|
|
101
|
+
return references;
|
|
108
102
|
}
|
|
109
103
|
|
|
110
|
-
|
|
111
|
-
|
|
104
|
+
getAssumptions() {
|
|
105
|
+
const assumptions = [];
|
|
112
106
|
|
|
113
|
-
this.contexts.
|
|
114
|
-
|
|
107
|
+
this.contexts.forEach((context) => {
|
|
108
|
+
const contextAssumptions = context.getAssumptions();
|
|
115
109
|
|
|
116
|
-
|
|
117
|
-
return true;
|
|
118
|
-
}
|
|
110
|
+
push(assumptions, contextAssumptions);
|
|
119
111
|
});
|
|
120
112
|
|
|
121
|
-
return
|
|
113
|
+
return assumptions;
|
|
122
114
|
}
|
|
123
115
|
|
|
124
|
-
|
|
125
|
-
const
|
|
126
|
-
termPresent = (term !== null);
|
|
116
|
+
getMetavariables() {
|
|
117
|
+
const metavariables = [];
|
|
127
118
|
|
|
128
|
-
|
|
119
|
+
this.contexts.forEach((context) => {
|
|
120
|
+
const contextMetavariables = context.getMetavariables();
|
|
121
|
+
|
|
122
|
+
push(metavariables, contextMetavariables);
|
|
123
|
+
});
|
|
124
|
+
|
|
125
|
+
return metavariables;
|
|
129
126
|
}
|
|
130
127
|
|
|
131
|
-
|
|
132
|
-
const
|
|
133
|
-
|
|
128
|
+
getSubstitutions() {
|
|
129
|
+
const substitutions = [];
|
|
130
|
+
|
|
131
|
+
this.contexts.forEach((context) => {
|
|
132
|
+
const contextSubstitutions = context.getSubstitutions();
|
|
133
|
+
|
|
134
|
+
push(substitutions, contextSubstitutions);
|
|
135
|
+
});
|
|
134
136
|
|
|
135
|
-
return
|
|
137
|
+
return substitutions;
|
|
136
138
|
}
|
|
137
139
|
|
|
138
|
-
|
|
139
|
-
const
|
|
140
|
-
|
|
140
|
+
findTermByTermNode(termNode) {
|
|
141
|
+
const terms = this.getTerms(),
|
|
142
|
+
term = terms.find((term) => {
|
|
143
|
+
const termNodeMatches = term.matchTermNode(termNode);
|
|
144
|
+
|
|
145
|
+
if (termNodeMatches) {
|
|
146
|
+
return true;
|
|
147
|
+
}
|
|
148
|
+
}) || null;
|
|
141
149
|
|
|
142
|
-
return
|
|
150
|
+
return term;
|
|
143
151
|
}
|
|
144
152
|
|
|
145
|
-
|
|
146
|
-
const
|
|
147
|
-
|
|
153
|
+
findFrameByFrameNode(frameNode) {
|
|
154
|
+
const frames = this.getFrames(),
|
|
155
|
+
frame = frames.find((frame) => {
|
|
156
|
+
const frameNodeMatches = frame.matchFrameNode(frameNode);
|
|
148
157
|
|
|
149
|
-
|
|
158
|
+
if (frameNodeMatches) {
|
|
159
|
+
return true;
|
|
160
|
+
}
|
|
161
|
+
}) || null;
|
|
162
|
+
|
|
163
|
+
return frame;
|
|
150
164
|
}
|
|
151
165
|
|
|
152
|
-
|
|
153
|
-
const
|
|
154
|
-
|
|
166
|
+
findEqualityByEqualityNode(equalityNode) {
|
|
167
|
+
const equalities = this.getEqualities(),
|
|
168
|
+
equality = equalities.find((equality) => {
|
|
169
|
+
const equalityNodeMatches = equality.matchEqualityNode(equalityNode);
|
|
155
170
|
|
|
156
|
-
|
|
171
|
+
if (equalityNodeMatches) {
|
|
172
|
+
return true;
|
|
173
|
+
}
|
|
174
|
+
}) || null;
|
|
175
|
+
|
|
176
|
+
return equality;
|
|
157
177
|
}
|
|
158
178
|
|
|
159
|
-
|
|
160
|
-
const
|
|
161
|
-
|
|
179
|
+
findJudgementByJudgementNode(judgementNode) {
|
|
180
|
+
const judgements = this.getJudgements(),
|
|
181
|
+
judgement = judgements.find((judgement) => {
|
|
182
|
+
const judgementNodeMatches = judgement.matchJudgementNode(judgementNode);
|
|
183
|
+
|
|
184
|
+
if (judgementNodeMatches) {
|
|
185
|
+
return true;
|
|
186
|
+
}
|
|
187
|
+
}) || null;
|
|
162
188
|
|
|
163
|
-
return
|
|
189
|
+
return judgement;
|
|
164
190
|
}
|
|
165
191
|
|
|
166
|
-
|
|
167
|
-
const
|
|
168
|
-
|
|
192
|
+
findStatementByStatementNode(statementNode) {
|
|
193
|
+
const statements = this.getStatements(),
|
|
194
|
+
statement = statements.find((statement) => {
|
|
195
|
+
const statementNodeMatches = statement.matchStatementNode(statementNode);
|
|
196
|
+
|
|
197
|
+
if (statementNodeMatches) {
|
|
198
|
+
return true;
|
|
199
|
+
}
|
|
200
|
+
}) || null;
|
|
169
201
|
|
|
170
|
-
return
|
|
202
|
+
return statement;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
findReferenceByReferenceNode(referenceNode) {
|
|
206
|
+
const references = this.getReferences(),
|
|
207
|
+
reference = references.find((reference) => {
|
|
208
|
+
const referenceMatcheReferenceNode = reference.matchReferenceNode(referenceNode);
|
|
209
|
+
|
|
210
|
+
if (referenceMatcheReferenceNode) {
|
|
211
|
+
return true;
|
|
212
|
+
}
|
|
213
|
+
}) || null;
|
|
214
|
+
|
|
215
|
+
return reference;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
findAssertionByAssertionNode(assertionNode) {
|
|
219
|
+
const assertions = this.getAssertions(),
|
|
220
|
+
assertion = assertions.find((assertion) => {
|
|
221
|
+
const assertionNodeMatches = assertion.matchAssertionNode(assertionNode);
|
|
222
|
+
|
|
223
|
+
if (assertionNodeMatches) {
|
|
224
|
+
return true;
|
|
225
|
+
}
|
|
226
|
+
}) || null;
|
|
227
|
+
|
|
228
|
+
return assertion;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
findAssumptionByAssumptionNode(assumptionNode) {
|
|
232
|
+
const assumptions = this.getAssumptions(),
|
|
233
|
+
assumption = assumptions.find((assumption) => {
|
|
234
|
+
const assumptionNodeMatches = assumption.matchAssumptionNode(assumptionNode);
|
|
235
|
+
|
|
236
|
+
if (assumptionNodeMatches) {
|
|
237
|
+
return true;
|
|
238
|
+
}
|
|
239
|
+
}) || null;
|
|
240
|
+
|
|
241
|
+
return assumption;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
findReferenceByMetavariableNode(metavariableNode) {
|
|
245
|
+
const references = this.getReferences(),
|
|
246
|
+
reference = references.find((reference) => {
|
|
247
|
+
const referenceMatcheMetavariableNode = reference.matchMetavariableNode(metavariableNode);
|
|
248
|
+
|
|
249
|
+
if (referenceMatcheMetavariableNode) {
|
|
250
|
+
return true;
|
|
251
|
+
}
|
|
252
|
+
}) || null;
|
|
253
|
+
|
|
254
|
+
return reference;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
findMetavariableByMetavariableNode(metavariableNode) {
|
|
258
|
+
const metavariables = this.getMetavariables(),
|
|
259
|
+
metavariable = metavariables.find((metavariable) => {
|
|
260
|
+
const metavariableNodeMatches = metavariable.matchMetavariableNode(metavariableNode);
|
|
261
|
+
|
|
262
|
+
if (metavariableNodeMatches) {
|
|
263
|
+
return true;
|
|
264
|
+
}
|
|
265
|
+
}) || null;
|
|
266
|
+
|
|
267
|
+
return metavariable;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
findSubstitutionBySubstitutionNode(substitutionNode) {
|
|
271
|
+
const substitutions = this.getSubstitutions(),
|
|
272
|
+
substitution = substitutions.find((substitution) => {
|
|
273
|
+
const substitutionNodeMatches = substitution.matchSubstitutionNode(substitutionNode);
|
|
274
|
+
|
|
275
|
+
if (substitutionNodeMatches) {
|
|
276
|
+
return true;
|
|
277
|
+
}
|
|
278
|
+
}) || null;
|
|
279
|
+
|
|
280
|
+
return substitution;
|
|
171
281
|
}
|
|
172
282
|
|
|
173
283
|
static fromContexts(...contexts) {
|