occam-verify-cli 1.0.768 → 1.0.781
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 +11 -11
- package/lib/context/illative.js +28 -0
- package/lib/context/nested.js +31 -0
- package/lib/context/proof.js +242 -0
- package/lib/context/thetic.js +28 -0
- package/lib/context.js +19 -21
- package/lib/element/assertion/contained.js +32 -24
- package/lib/element/assertion/defined.js +47 -40
- package/lib/element/assertion/property.js +18 -13
- package/lib/element/assertion/satisfies.js +12 -9
- package/lib/element/assertion/subproof.js +28 -26
- package/lib/element/assertion/type.js +14 -12
- package/lib/element/assumption.js +40 -50
- package/lib/element/combinator/bracketed.js +3 -3
- package/lib/element/combinator.js +20 -20
- package/lib/element/conclusion.js +33 -29
- package/lib/element/constructor.js +19 -18
- package/lib/element/deduction.js +33 -29
- package/lib/element/equality.js +13 -15
- package/lib/element/equivalence.js +59 -52
- package/lib/element/equivalences.js +4 -2
- package/lib/element/frame.js +74 -53
- package/lib/element/hypothesis.js +7 -5
- package/lib/element/judgement.js +41 -74
- package/lib/element/label.js +22 -22
- package/lib/element/metavariable.js +31 -11
- package/lib/element/proofAssertion/premise.js +48 -35
- package/lib/element/proofAssertion/step.js +77 -22
- package/lib/element/proofAssertion/supposition.js +48 -34
- package/lib/element/proofAssertion.js +1 -14
- package/lib/element/reference.js +80 -53
- package/lib/element/signature.js +44 -3
- package/lib/element/statement.js +28 -29
- package/lib/element/subproof.js +2 -2
- package/lib/element/substitution/frame.js +24 -19
- package/lib/element/substitution/metaLevel.js +31 -27
- package/lib/element/substitution/reference.js +11 -10
- package/lib/element/substitution/statement.js +30 -23
- package/lib/element/substitution/term.js +11 -10
- package/lib/element/term.js +24 -20
- package/lib/element/topLevelMetaAssertion.js +2 -2
- package/lib/element/variable.js +6 -2
- package/lib/process/assign.js +10 -4
- package/lib/process/unify.js +8 -8
- package/lib/process/validate.js +10 -8
- package/lib/utilities/context.js +68 -23
- package/lib/utilities/element.js +55 -27
- package/lib/utilities/json.js +8 -8
- package/lib/utilities/string.js +12 -1
- package/lib/utilities/unification.js +14 -12
- package/lib/utilities/validation.js +55 -40
- package/package.json +4 -4
- package/src/context/file/nominal.js +14 -16
- package/src/context/illative.js +17 -0
- package/src/context/nested.js +21 -0
- package/src/context/{scoped.js → proof.js} +65 -51
- package/src/context/thetic.js +17 -0
- package/src/context.js +30 -36
- package/src/element/assertion/contained.js +44 -31
- package/src/element/assertion/defined.js +55 -46
- package/src/element/assertion/property.js +23 -15
- package/src/element/assertion/satisfies.js +15 -10
- package/src/element/assertion/subproof.js +34 -31
- package/src/element/assertion/type.js +18 -13
- package/src/element/assumption.js +40 -69
- package/src/element/combinator/bracketed.js +2 -2
- package/src/element/combinator.js +23 -29
- package/src/element/conclusion.js +37 -40
- package/src/element/constructor.js +29 -34
- package/src/element/deduction.js +36 -39
- package/src/element/equality.js +16 -18
- package/src/element/equivalence.js +76 -67
- package/src/element/equivalences.js +5 -2
- package/src/element/frame.js +96 -65
- package/src/element/hypothesis.js +7 -6
- package/src/element/judgement.js +45 -45
- package/src/element/label.js +25 -31
- package/src/element/metavariable.js +48 -21
- package/src/element/proofAssertion/premise.js +63 -49
- package/src/element/proofAssertion/step.js +47 -26
- package/src/element/proofAssertion/supposition.js +64 -50
- package/src/element/proofAssertion.js +0 -22
- package/src/element/reference.js +119 -80
- package/src/element/signature.js +5 -2
- package/src/element/statement.js +30 -35
- package/src/element/subproof.js +1 -1
- package/src/element/substitution/frame.js +27 -26
- package/src/element/substitution/metaLevel.js +38 -42
- package/src/element/substitution/reference.js +13 -14
- package/src/element/substitution/statement.js +35 -33
- package/src/element/substitution/term.js +13 -14
- package/src/element/term.js +42 -34
- package/src/element/topLevelMetaAssertion.js +1 -1
- package/src/element/variable.js +8 -1
- package/src/process/assign.js +9 -3
- package/src/process/unify.js +7 -7
- package/src/process/validate.js +9 -8
- package/src/utilities/context.js +82 -31
- package/src/utilities/element.js +68 -31
- package/src/utilities/json.js +13 -13
- package/src/utilities/string.js +16 -2
- package/src/utilities/unification.js +18 -16
- package/src/utilities/validation.js +73 -53
- package/lib/context/scoped.js +0 -232
- package/lib/utilities/statement.js +0 -78
- package/lib/utilities/term.js +0 -17
- package/src/utilities/statement.js +0 -74
- package/src/utilities/term.js +0 -10
|
@@ -452,9 +452,8 @@ export default class NominalFileContext extends FileContext {
|
|
|
452
452
|
const metaLemmas = this.getMetaLemmas();
|
|
453
453
|
|
|
454
454
|
filter(metaLemmas, (metaLemma) => {
|
|
455
|
-
const
|
|
456
|
-
|
|
457
|
-
topLevelMetaAssertionCompares = reference.compareTopLevelMetaAssertion(topLevelMetaAssertion, context);
|
|
455
|
+
const topLevelMetaAssertion = metaLemma, ///
|
|
456
|
+
topLevelMetaAssertionCompares = reference.compareTopLevelMetaAssertion(topLevelMetaAssertion);
|
|
458
457
|
|
|
459
458
|
if (topLevelMetaAssertionCompares) {
|
|
460
459
|
return true;
|
|
@@ -468,9 +467,8 @@ export default class NominalFileContext extends FileContext {
|
|
|
468
467
|
const metatheorems = this.getMetatheorems();
|
|
469
468
|
|
|
470
469
|
filter(metatheorems, (metatheorem) => {
|
|
471
|
-
const
|
|
472
|
-
|
|
473
|
-
topLevelMetaAssertionCompares = reference.compareTopLevelMetaAssertion(topLevelMetaAssertion, context);
|
|
470
|
+
const topLevelMetaAssertion = metatheorem, ///
|
|
471
|
+
topLevelMetaAssertionCompares = reference.compareTopLevelMetaAssertion(topLevelMetaAssertion);
|
|
474
472
|
|
|
475
473
|
if (topLevelMetaAssertionCompares) {
|
|
476
474
|
return true;
|
|
@@ -490,17 +488,17 @@ export default class NominalFileContext extends FileContext {
|
|
|
490
488
|
return topLevelAssertion;
|
|
491
489
|
}
|
|
492
490
|
|
|
493
|
-
findTopLevelMetaAssertionByReference(reference
|
|
494
|
-
const metaLemma = this.findMetaLemmaByReference(reference
|
|
495
|
-
metatheorem = this.findMetatheoremByReference(reference
|
|
491
|
+
findTopLevelMetaAssertionByReference(reference) {
|
|
492
|
+
const metaLemma = this.findMetaLemmaByReference(reference),
|
|
493
|
+
metatheorem = this.findMetatheoremByReference(reference),
|
|
496
494
|
topLevelMetaAssertion = (metaLemma || metatheorem); ///
|
|
497
495
|
|
|
498
496
|
return topLevelMetaAssertion;
|
|
499
497
|
}
|
|
500
498
|
|
|
501
|
-
findTopLevelMetaAssertionsByReference(reference
|
|
502
|
-
const metaLemmas = this.findMetaLemmasByReference(reference
|
|
503
|
-
metatheorems = this.findMetatheoremsByReference(reference
|
|
499
|
+
findTopLevelMetaAssertionsByReference(reference) {
|
|
500
|
+
const metaLemmas = this.findMetaLemmasByReference(reference),
|
|
501
|
+
metatheorems = this.findMetatheoremsByReference(reference),
|
|
504
502
|
topLevelMetaAssertions = [
|
|
505
503
|
...metaLemmas,
|
|
506
504
|
...metatheorems
|
|
@@ -634,10 +632,10 @@ export default class NominalFileContext extends FileContext {
|
|
|
634
632
|
return metavariablePresent;
|
|
635
633
|
}
|
|
636
634
|
|
|
637
|
-
isLabelPresentByReference(reference
|
|
635
|
+
isLabelPresentByReference(reference) {
|
|
638
636
|
const labels = this.getLabels(),
|
|
639
637
|
labelPresent = labels.some((label) => {
|
|
640
|
-
const labelUnifies = reference.unifyLabel(label
|
|
638
|
+
const labelUnifies = reference.unifyLabel(label);
|
|
641
639
|
|
|
642
640
|
if (labelUnifies) {
|
|
643
641
|
return true;
|
|
@@ -647,8 +645,8 @@ export default class NominalFileContext extends FileContext {
|
|
|
647
645
|
return labelPresent;
|
|
648
646
|
}
|
|
649
647
|
|
|
650
|
-
isTopLevelMetaAssertionPresentByReference(reference
|
|
651
|
-
const topLevelMetaAssertion = this.findTopLevelMetaAssertionByReference(reference
|
|
648
|
+
isTopLevelMetaAssertionPresentByReference(reference) {
|
|
649
|
+
const topLevelMetaAssertion = this.findTopLevelMetaAssertionByReference(reference),
|
|
652
650
|
topLevelMetaAssertionPresent = (topLevelMetaAssertion !== null);
|
|
653
651
|
|
|
654
652
|
return topLevelMetaAssertionPresent;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import Context from "../context";
|
|
4
|
+
|
|
5
|
+
export default class IllativeContext extends Context {
|
|
6
|
+
isStated() {
|
|
7
|
+
const stated = false;
|
|
8
|
+
|
|
9
|
+
return stated;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
static fromNothing(context) {
|
|
13
|
+
const illativeContext = new IllativeContext(context);
|
|
14
|
+
|
|
15
|
+
return illativeContext;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import Context from "../context";
|
|
4
|
+
|
|
5
|
+
export default class NestedContext extends Context {
|
|
6
|
+
addAssignment(assignment) {
|
|
7
|
+
///
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
isStated() {
|
|
11
|
+
const stated = true;
|
|
12
|
+
|
|
13
|
+
return stated;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
static fromNothing(context) {
|
|
17
|
+
const nestedContext = new NestedContext(context);
|
|
18
|
+
|
|
19
|
+
return nestedContext;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -5,9 +5,9 @@ import { arrayUtilities } from "necessary";
|
|
|
5
5
|
import Context from "../context";
|
|
6
6
|
import elements from "../elements";
|
|
7
7
|
|
|
8
|
-
const { last } = arrayUtilities;
|
|
8
|
+
const { last, filter } = arrayUtilities;
|
|
9
9
|
|
|
10
|
-
class
|
|
10
|
+
class ProofContext extends Context {
|
|
11
11
|
constructor(context, variables, judgements, assignments, equivalences, subproofOrProofAssertions, metaLevelSubstitutions) {
|
|
12
12
|
super(context);
|
|
13
13
|
|
|
@@ -134,7 +134,7 @@ class ScopedContext extends Context {
|
|
|
134
134
|
const context = this, ///
|
|
135
135
|
equalityString = equality.getString();
|
|
136
136
|
|
|
137
|
-
context.trace(`Adding the '${equalityString}' equality to the
|
|
137
|
+
context.trace(`Adding the '${equalityString}' equality to the proof context...`);
|
|
138
138
|
|
|
139
139
|
const equalityRelfexive = equality.isReflexive();
|
|
140
140
|
|
|
@@ -144,9 +144,9 @@ class ScopedContext extends Context {
|
|
|
144
144
|
|
|
145
145
|
this.equivalences = this.equivalences.mergedWithEquivalence(equivalence, context);
|
|
146
146
|
|
|
147
|
-
context.debug(`...added the '${equalityString}' equality to the
|
|
147
|
+
context.debug(`...added the '${equalityString}' equality to the proof context.`);
|
|
148
148
|
} else {
|
|
149
|
-
context.debug(`The '${equalityString}' equality
|
|
149
|
+
context.debug(`The reflexive '${equalityString}' equality has not been added to the proof context.`);
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
|
|
@@ -154,37 +154,34 @@ class ScopedContext extends Context {
|
|
|
154
154
|
const context = this, ///
|
|
155
155
|
variableString = variable.getString();
|
|
156
156
|
|
|
157
|
-
context.trace(`Adding the '${variableString}' variable to the
|
|
157
|
+
context.trace(`Adding the '${variableString}' variable to the proof context...`);
|
|
158
158
|
|
|
159
159
|
this.variables.push(variable);
|
|
160
160
|
|
|
161
|
-
context.debug(`...added the '${variableString}' variable to the
|
|
161
|
+
context.debug(`...added the '${variableString}' variable to the proof context.`);
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
addJudgement(judgement) {
|
|
165
165
|
const context = this, ///
|
|
166
166
|
judgementString = judgement.getString();
|
|
167
167
|
|
|
168
|
-
context.trace(`Adding the '${judgementString}' judgement to the
|
|
168
|
+
context.trace(`Adding the '${judgementString}' judgement to the proof context...`);
|
|
169
169
|
|
|
170
170
|
this.judgements.push(judgement);
|
|
171
171
|
|
|
172
|
-
context.debug(`...added the '${judgementString}' judgement to the
|
|
172
|
+
context.debug(`...added the '${judgementString}' judgement to the proof context.`);
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
addAssignment(assignment) {
|
|
176
176
|
this.assignments.push(assignment);
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
-
|
|
180
|
-
const context = this
|
|
181
|
-
subproofOrProofAssertionString = subproofOrProofAssertion.getString();
|
|
182
|
-
|
|
183
|
-
context.trace(`Adding the '${subproofOrProofAssertionString}' subproof or proof assertion to the scoped context...`);
|
|
184
|
-
|
|
185
|
-
this.subproofOrProofAssertions.push(subproofOrProofAssertion);
|
|
179
|
+
assignAssignments() {
|
|
180
|
+
const context = this; ///
|
|
186
181
|
|
|
187
|
-
|
|
182
|
+
this.assignments.forEach((assignment) => {
|
|
183
|
+
assignment(context);
|
|
184
|
+
});
|
|
188
185
|
}
|
|
189
186
|
|
|
190
187
|
addMetaLevelSubstitution(metaLevelSubstitution) {
|
|
@@ -198,7 +195,7 @@ class ScopedContext extends Context {
|
|
|
198
195
|
metaLevelSubstitutionA = metaLevelSubstitution, ///
|
|
199
196
|
metaLevelSubstitutionString = metaLevelSubstitution.getString();
|
|
200
197
|
|
|
201
|
-
context.trace(`Adding the '${metaLevelSubstitutionString}' meta-level substitution to the
|
|
198
|
+
context.trace(`Adding the '${metaLevelSubstitutionString}' meta-level substitution to the proof context...`);
|
|
202
199
|
|
|
203
200
|
const metaLevelSubstitutionB = this.metaLevelSubstitutions.find((metaLevelSubstitution) => {
|
|
204
201
|
const metaLevelSubstitutionB = metaLevelSubstitution, ///
|
|
@@ -210,20 +207,37 @@ class ScopedContext extends Context {
|
|
|
210
207
|
}) || null;
|
|
211
208
|
|
|
212
209
|
if (metaLevelSubstitutionB !== null) {
|
|
213
|
-
context.debug(`The '${metaLevelSubstitutionString}' meta-level substitution has already been added to the
|
|
210
|
+
context.debug(`The '${metaLevelSubstitutionString}' meta-level substitution has already been added to the proof context.`);
|
|
214
211
|
} else {
|
|
215
212
|
this.metaLevelSubstitutions.push(metaLevelSubstitution);
|
|
216
213
|
|
|
217
|
-
context.debug(`...added the '${metaLevelSubstitutionString}' substitution to the
|
|
214
|
+
context.debug(`...added the '${metaLevelSubstitutionString}' substitution to the proof context.`);
|
|
218
215
|
}
|
|
219
216
|
}
|
|
220
217
|
|
|
221
|
-
|
|
222
|
-
const context = this
|
|
218
|
+
addSubproofOrProofAssertion(subproofOrProofAssertion) {
|
|
219
|
+
const context = this, ///
|
|
220
|
+
subproofOrProofAssertionString = subproofOrProofAssertion.getString();
|
|
223
221
|
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
222
|
+
context.trace(`Adding the '${subproofOrProofAssertionString}' subproof or proof assertion to the proof context...`);
|
|
223
|
+
|
|
224
|
+
this.subproofOrProofAssertions.push(subproofOrProofAssertion);
|
|
225
|
+
|
|
226
|
+
context.debug(`...added the '${subproofOrProofAssertionString}' subproof or proof assertion to the proof context.`);
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
compareTermAndPropertyRelation(term, propertyRelation) {
|
|
230
|
+
const context = this, ///
|
|
231
|
+
proofAssertions = this.getProofAssertions(),
|
|
232
|
+
comparesToTermAndPropertyRelation = proofAssertions.some((proofAssertion) => {
|
|
233
|
+
const comparesToTermAndPropertyRelation = proofAssertion.compareTermAndPropertyRelation(term, propertyRelation, context);
|
|
234
|
+
|
|
235
|
+
if (comparesToTermAndPropertyRelation) {
|
|
236
|
+
return true;
|
|
237
|
+
}
|
|
238
|
+
});
|
|
239
|
+
|
|
240
|
+
return comparesToTermAndPropertyRelation;
|
|
227
241
|
}
|
|
228
242
|
|
|
229
243
|
findEquivalenceByTerm(term) { return this.equivalences.findEquivalenceByTerm(term); }
|
|
@@ -272,25 +286,18 @@ class ScopedContext extends Context {
|
|
|
272
286
|
return metaLevelSubstitution;
|
|
273
287
|
}
|
|
274
288
|
|
|
275
|
-
|
|
276
|
-
const
|
|
277
|
-
equivalences = this.getEquivalences(),
|
|
278
|
-
groundedTerms = [],
|
|
279
|
-
definedVariables = [];
|
|
289
|
+
findJudgementsByMetavariableNode(metavariableNode) {
|
|
290
|
+
const judgements = this.getJudgements();
|
|
280
291
|
|
|
281
|
-
|
|
292
|
+
filter(judgements, (judgement) => {
|
|
293
|
+
const metavariableNodeMatches = judgement.matchMetavariableNode(metavariableNode);
|
|
282
294
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
if (groundedTermNodeMatches) {
|
|
288
|
-
return true;
|
|
289
|
-
}
|
|
290
|
-
}),
|
|
291
|
-
termGrounded = termMatchesGroundedTerm; ///
|
|
295
|
+
if (metavariableNodeMatches) {
|
|
296
|
+
return true;
|
|
297
|
+
}
|
|
298
|
+
});
|
|
292
299
|
|
|
293
|
-
return
|
|
300
|
+
return judgements;
|
|
294
301
|
}
|
|
295
302
|
|
|
296
303
|
isJudgementPresentByMetavariableName(metavariableName) {
|
|
@@ -307,18 +314,25 @@ class ScopedContext extends Context {
|
|
|
307
314
|
return variablePresent;
|
|
308
315
|
}
|
|
309
316
|
|
|
310
|
-
|
|
317
|
+
isTermGrounded(term) {
|
|
311
318
|
const context = this, ///
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
319
|
+
equivalences = this.getEquivalences(),
|
|
320
|
+
groundedTerms = [],
|
|
321
|
+
definedVariables = [];
|
|
315
322
|
|
|
316
|
-
|
|
323
|
+
equivalences.separateGroundedTermsAndDefinedVariables(groundedTerms, definedVariables, context);
|
|
324
|
+
|
|
325
|
+
const termMatchesGroundedTerm = groundedTerms.some((groundedTerm) => {
|
|
326
|
+
const groundedTermNode = groundedTerm.getNode(),
|
|
327
|
+
groundedTermNodeMatches = term.matchTermNode(groundedTermNode);
|
|
328
|
+
|
|
329
|
+
if (groundedTermNodeMatches) {
|
|
317
330
|
return true;
|
|
318
331
|
}
|
|
319
|
-
})
|
|
332
|
+
}),
|
|
333
|
+
termGrounded = termMatchesGroundedTerm; ///
|
|
320
334
|
|
|
321
|
-
return
|
|
335
|
+
return termGrounded;
|
|
322
336
|
}
|
|
323
337
|
|
|
324
338
|
static fromMetaLevelSubstitutions(metaLevelSubstitutions, context) {
|
|
@@ -328,10 +342,10 @@ class ScopedContext extends Context {
|
|
|
328
342
|
assignments = [],
|
|
329
343
|
equivalences = Equivalences.fromNothing(context),
|
|
330
344
|
subproofOrProofAssertions = [],
|
|
331
|
-
|
|
345
|
+
proofContext = new ProofContext(context, variables, judgements, assignments, equivalences, subproofOrProofAssertions, metaLevelSubstitutions);
|
|
332
346
|
|
|
333
|
-
return
|
|
347
|
+
return proofContext;
|
|
334
348
|
}
|
|
335
349
|
}
|
|
336
350
|
|
|
337
|
-
export default
|
|
351
|
+
export default ProofContext;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import Context from "../context";
|
|
4
|
+
|
|
5
|
+
export default class TheticContext extends Context {
|
|
6
|
+
isStated() {
|
|
7
|
+
const stated = true;
|
|
8
|
+
|
|
9
|
+
return stated;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
static fromNothing(context) {
|
|
13
|
+
const theticContext = new TheticContext(context);
|
|
14
|
+
|
|
15
|
+
return theticContext;
|
|
16
|
+
}
|
|
17
|
+
}
|
package/src/context.js
CHANGED
|
@@ -148,35 +148,23 @@ export default class Context extends ContextBase {
|
|
|
148
148
|
return metavariable;
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
-
findRuleByReference(reference
|
|
152
|
-
const
|
|
153
|
-
|
|
154
|
-
context = this.getContext();
|
|
155
|
-
|
|
156
|
-
const parentContext = context, ///
|
|
157
|
-
rule = parentContext.findRuleByReference(reference, childContext);
|
|
151
|
+
findRuleByReference(reference) {
|
|
152
|
+
const context = this.getContext(),
|
|
153
|
+
rule = context.findRuleByReference(reference);
|
|
158
154
|
|
|
159
155
|
return rule;
|
|
160
156
|
}
|
|
161
157
|
|
|
162
|
-
findTopLevelAssertionByReference(reference
|
|
163
|
-
const
|
|
164
|
-
|
|
165
|
-
context = this.getContext();
|
|
166
|
-
|
|
167
|
-
const parentContext = context, ///
|
|
168
|
-
topLevelAssertion = parentContext.findTopLevelAssertionByReference(reference, childContext);
|
|
158
|
+
findTopLevelAssertionByReference(reference) {
|
|
159
|
+
const context = this.getContext(),
|
|
160
|
+
topLevelAssertion = context.findTopLevelAssertionByReference(reference);
|
|
169
161
|
|
|
170
162
|
return topLevelAssertion;
|
|
171
163
|
}
|
|
172
164
|
|
|
173
|
-
findTopLevelMetaAssertionsByReference(reference
|
|
174
|
-
const
|
|
175
|
-
|
|
176
|
-
context = this.getContext();
|
|
177
|
-
|
|
178
|
-
const parentContext = context, ///
|
|
179
|
-
topLevelMetaAssertion = parentContext.findTopLevelMetaAssertionsByReference(reference, childContext);
|
|
165
|
+
findTopLevelMetaAssertionsByReference(reference) {
|
|
166
|
+
const context = this.getContext(),
|
|
167
|
+
topLevelMetaAssertion = context.findTopLevelMetaAssertionsByReference(reference);
|
|
180
168
|
|
|
181
169
|
return topLevelMetaAssertion;
|
|
182
170
|
}
|
|
@@ -204,7 +192,7 @@ export default class Context extends ContextBase {
|
|
|
204
192
|
|
|
205
193
|
findFrameByFrameNode(frameNode) {
|
|
206
194
|
const context = this.getContext(),
|
|
207
|
-
|
|
195
|
+
frame = context.findFrameByFrameNode(frameNode);
|
|
208
196
|
|
|
209
197
|
return frame;
|
|
210
198
|
}
|
|
@@ -258,6 +246,13 @@ export default class Context extends ContextBase {
|
|
|
258
246
|
return reference;
|
|
259
247
|
}
|
|
260
248
|
|
|
249
|
+
findJudgementsByMetavariableNode(metavariableNode) {
|
|
250
|
+
const context = this.getContext(),
|
|
251
|
+
judgement = context.findJudgementsByMetavariableNode(metavariableNode);
|
|
252
|
+
|
|
253
|
+
return judgement;
|
|
254
|
+
}
|
|
255
|
+
|
|
261
256
|
findSubstitutionBySubstitutionNode(substitutionNode) {
|
|
262
257
|
const context = this.getContext(),
|
|
263
258
|
substitution = context.findSubstitutionBySubstitutionNode(substitutionNode);
|
|
@@ -347,24 +342,16 @@ export default class Context extends ContextBase {
|
|
|
347
342
|
return metavariablePresent;
|
|
348
343
|
}
|
|
349
344
|
|
|
350
|
-
isLabelPresentByReference(reference
|
|
351
|
-
const
|
|
352
|
-
|
|
353
|
-
context = this.getContext();
|
|
354
|
-
|
|
355
|
-
const parentContext = context, ///
|
|
356
|
-
labelPresent = parentContext.isLabelPresentByReference(reference, childContext);
|
|
345
|
+
isLabelPresentByReference(reference) {
|
|
346
|
+
const context = this.getContext(),
|
|
347
|
+
labelPresent = context.isLabelPresentByReference(reference);
|
|
357
348
|
|
|
358
349
|
return labelPresent;
|
|
359
350
|
}
|
|
360
351
|
|
|
361
|
-
isTopLevelMetaAssertionPresentByReference(reference
|
|
362
|
-
const
|
|
363
|
-
|
|
364
|
-
context = this.getContext();
|
|
365
|
-
|
|
366
|
-
const parentContext = context, ///
|
|
367
|
-
topLevelMetaAssertionPresent = parentContext.isTopLevelMetaAssertionPresentByReference(reference, childContext);
|
|
352
|
+
isTopLevelMetaAssertionPresentByReference(reference) {
|
|
353
|
+
const context = this.getContext(),
|
|
354
|
+
topLevelMetaAssertionPresent = context.isTopLevelMetaAssertionPresentByReference(reference);
|
|
368
355
|
|
|
369
356
|
return topLevelMetaAssertionPresent;
|
|
370
357
|
}
|
|
@@ -467,6 +454,13 @@ export default class Context extends ContextBase {
|
|
|
467
454
|
return metaLevelSubstitutions;
|
|
468
455
|
}
|
|
469
456
|
|
|
457
|
+
isStated() {
|
|
458
|
+
const context = this.getContext(),
|
|
459
|
+
stated = context.isStated();
|
|
460
|
+
|
|
461
|
+
return stated;
|
|
462
|
+
}
|
|
463
|
+
|
|
470
464
|
addTerms(terms) {
|
|
471
465
|
const context = this.getContext();
|
|
472
466
|
|
|
@@ -3,10 +3,14 @@
|
|
|
3
3
|
import Assertion from "../assertion";
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
|
-
import { instantiate } from "../../utilities/context";
|
|
6
|
+
import { descend, instantiate } from "../../utilities/context";
|
|
7
7
|
import { instantiateContainedAssertion } from "../../process/instantiate";
|
|
8
8
|
import { termFromTermAndSubstitutions, frameFromFrameAndSubstitutions, statementFromStatementAndSubstitutions } from "../../utilities/substitutions";
|
|
9
|
-
import { termFromContainedAssertionNode,
|
|
9
|
+
import { termFromContainedAssertionNode,
|
|
10
|
+
frameFromContainedAssertionNode,
|
|
11
|
+
negatedFromContainedAssertionNode,
|
|
12
|
+
statementFromContainedAssertionNode,
|
|
13
|
+
containedAssertionFromStatementNode } from "../../utilities/element";
|
|
10
14
|
|
|
11
15
|
export default define(class ContainedAssertion extends Assertion {
|
|
12
16
|
constructor(context, string, node, term, frame, negated, statement) {
|
|
@@ -41,7 +45,7 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
41
45
|
return containedAssertionNode;
|
|
42
46
|
}
|
|
43
47
|
|
|
44
|
-
validate(
|
|
48
|
+
validate(context) {
|
|
45
49
|
let containedAssertion = null;
|
|
46
50
|
|
|
47
51
|
const containedAssertionString = this.getString(); ///
|
|
@@ -57,11 +61,13 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
57
61
|
} else {
|
|
58
62
|
let validates = false;
|
|
59
63
|
|
|
60
|
-
const termValidates = this.validateTerm(
|
|
61
|
-
frameValidates = this.validateFrame(
|
|
62
|
-
statementValidates = this.validateStatement(
|
|
64
|
+
const termValidates = this.validateTerm(context),
|
|
65
|
+
frameValidates = this.validateFrame(context),
|
|
66
|
+
statementValidates = this.validateStatement(context)
|
|
63
67
|
|
|
64
68
|
if (termValidates || frameValidates || statementValidates) {
|
|
69
|
+
const stated = context.isStated();
|
|
70
|
+
|
|
65
71
|
let validatesWhenStated = false,
|
|
66
72
|
validatesWhenDerived = false;
|
|
67
73
|
|
|
@@ -90,7 +96,7 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
90
96
|
return containedAssertion;
|
|
91
97
|
}
|
|
92
98
|
|
|
93
|
-
validateTerm(
|
|
99
|
+
validateTerm(context) {
|
|
94
100
|
let termValidates = false;
|
|
95
101
|
|
|
96
102
|
if (this.term !== null) {
|
|
@@ -125,7 +131,7 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
125
131
|
return termValidates;
|
|
126
132
|
}
|
|
127
133
|
|
|
128
|
-
validateFrame(
|
|
134
|
+
validateFrame(context) {
|
|
129
135
|
let frameValidates = false;
|
|
130
136
|
|
|
131
137
|
if (this.frame !== null) {
|
|
@@ -136,18 +142,18 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
136
142
|
|
|
137
143
|
const frameSingular = this.frame.isSingular();
|
|
138
144
|
|
|
139
|
-
if (
|
|
140
|
-
context
|
|
141
|
-
|
|
142
|
-
stated = true; ///
|
|
145
|
+
if (frameSingular) {
|
|
146
|
+
descend((context) => {
|
|
147
|
+
const frame = this.frame.validate(context);
|
|
143
148
|
|
|
144
|
-
|
|
149
|
+
if (frame !== null) {
|
|
150
|
+
this.frame = frame;
|
|
145
151
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
152
|
+
frameValidates = true;
|
|
153
|
+
}
|
|
154
|
+
}, context);
|
|
155
|
+
} else {
|
|
156
|
+
context.debug(`The '${frameString}' frame is not singular.`);
|
|
151
157
|
}
|
|
152
158
|
|
|
153
159
|
if (frameValidates) {
|
|
@@ -158,7 +164,7 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
158
164
|
return frameValidates;
|
|
159
165
|
}
|
|
160
166
|
|
|
161
|
-
validateStatement(
|
|
167
|
+
validateStatement(context) {
|
|
162
168
|
let statementValidates = false;
|
|
163
169
|
|
|
164
170
|
if (this.statement !== null) {
|
|
@@ -166,13 +172,13 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
166
172
|
|
|
167
173
|
context.trace(`Validating the '${statementString}' statement...`);
|
|
168
174
|
|
|
169
|
-
|
|
175
|
+
descend((context) => {
|
|
176
|
+
const statement = this.statement.validate(context);
|
|
170
177
|
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}
|
|
178
|
+
if (statement !== null) {
|
|
179
|
+
statementValidates = true;
|
|
180
|
+
}
|
|
181
|
+
}, context);
|
|
176
182
|
|
|
177
183
|
if (statementValidates) {
|
|
178
184
|
context.debug(`...validated the '${statementString}' statement.`);
|
|
@@ -218,7 +224,7 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
218
224
|
}
|
|
219
225
|
|
|
220
226
|
unifyIndependently(generalContext, specificContext) {
|
|
221
|
-
let unifiesIndependently;
|
|
227
|
+
let unifiesIndependently = false;
|
|
222
228
|
|
|
223
229
|
const context = specificContext, ///
|
|
224
230
|
containedAssertionString = this.getString(); ///
|
|
@@ -230,7 +236,9 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
230
236
|
statement = statementFromStatementAndSubstitutions(this.statement, generalContext, specificContext),
|
|
231
237
|
validatesWhenDerived = validateWhenDerived(term, frame, statement, this.negated, generalContext, specificContext);
|
|
232
238
|
|
|
233
|
-
|
|
239
|
+
if (validatesWhenDerived) {
|
|
240
|
+
unifiesIndependently = true;
|
|
241
|
+
}
|
|
234
242
|
|
|
235
243
|
if (unifiesIndependently) {
|
|
236
244
|
context.debug(`...unified the '${containedAssertionString}' contained assertion independently.`);
|
|
@@ -247,7 +255,7 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
247
255
|
const { name } = json;
|
|
248
256
|
|
|
249
257
|
if (this.name === name) {
|
|
250
|
-
|
|
258
|
+
instantiate((context) => {
|
|
251
259
|
const { string } = json,
|
|
252
260
|
containedAssertionNode = instantiateContainedAssertion(string, context),
|
|
253
261
|
node = containedAssertionNode, ///
|
|
@@ -258,14 +266,19 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
258
266
|
|
|
259
267
|
context = null;
|
|
260
268
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
return containedAssertion;
|
|
269
|
+
containedAssertion = new ContainedAssertion(context, string, node, term, frame, negated, statement);
|
|
264
270
|
}, context);
|
|
265
271
|
}
|
|
266
272
|
|
|
267
273
|
return containedAssertion;
|
|
268
274
|
}
|
|
275
|
+
|
|
276
|
+
static fromStatement(statement, context) {
|
|
277
|
+
const statementNode = statement.getNode(),
|
|
278
|
+
containedAssertion = containedAssertionFromStatementNode(statementNode, context);
|
|
279
|
+
|
|
280
|
+
return containedAssertion;
|
|
281
|
+
}
|
|
269
282
|
});
|
|
270
283
|
|
|
271
284
|
function validateWhenDerived(term, frame, statement, negated, generalContext, specificContext) {
|