occam-verify-cli 1.0.764 → 1.0.776
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 +16 -47
- package/lib/context/illative.js +28 -0
- package/lib/context/nested.js +27 -0
- package/lib/context/nominal.js +2 -4
- package/lib/context/proof.js +232 -0
- package/lib/context/thetic.js +28 -0
- package/lib/context.js +37 -12
- package/lib/element/assertion/contained.js +24 -22
- package/lib/element/assertion/defined.js +20 -19
- package/lib/element/assertion/property.js +14 -13
- package/lib/element/assertion/satisfies.js +9 -10
- package/lib/element/assertion/subproof.js +23 -26
- package/lib/element/assertion/type.js +9 -11
- package/lib/element/assumption.js +46 -55
- 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 +58 -49
- package/lib/element/frame.js +41 -34
- package/lib/element/hypothesis.js +7 -5
- package/lib/element/judgement.js +33 -73
- package/lib/element/label.js +22 -22
- package/lib/element/metavariable.js +23 -7
- package/lib/element/proofAssertion/premise.js +48 -35
- package/lib/element/proofAssertion/step.js +35 -20
- package/lib/element/proofAssertion/supposition.js +48 -34
- package/lib/element/proofAssertion.js +1 -14
- package/lib/element/reference.js +79 -52
- package/lib/element/signature.js +44 -3
- package/lib/element/statement.js +28 -28
- package/lib/element/substitution/frame.js +28 -23
- package/lib/element/substitution/metaLevel.js +34 -30
- package/lib/element/substitution/reference.js +12 -11
- package/lib/element/substitution/statement.js +44 -39
- package/lib/element/substitution/term.js +12 -11
- 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 -25
- package/lib/utilities/element.js +55 -27
- package/lib/utilities/json.js +8 -8
- package/lib/utilities/statement.js +1 -8
- package/lib/utilities/string.js +12 -1
- package/lib/utilities/unification.js +6 -4
- package/lib/utilities/validation.js +39 -31
- package/package.json +1 -1
- package/src/context/file/nominal.js +26 -74
- package/src/context/illative.js +17 -0
- package/src/context/nested.js +15 -0
- package/src/context/nominal.js +1 -5
- package/src/context/{scoped.js → proof.js} +73 -73
- package/src/context/thetic.js +17 -0
- package/src/context.js +58 -17
- package/src/element/assertion/contained.js +28 -28
- package/src/element/assertion/defined.js +23 -23
- package/src/element/assertion/property.js +15 -14
- package/src/element/assertion/satisfies.js +8 -10
- package/src/element/assertion/subproof.js +26 -31
- package/src/element/assertion/type.js +10 -12
- package/src/element/assumption.js +51 -74
- 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 +77 -64
- package/src/element/frame.js +43 -35
- package/src/element/hypothesis.js +7 -6
- package/src/element/judgement.js +37 -43
- package/src/element/label.js +25 -31
- package/src/element/metavariable.js +32 -12
- package/src/element/proofAssertion/premise.js +63 -49
- package/src/element/proofAssertion/step.js +43 -23
- package/src/element/proofAssertion/supposition.js +64 -50
- package/src/element/proofAssertion.js +0 -22
- package/src/element/reference.js +118 -79
- package/src/element/signature.js +5 -2
- package/src/element/statement.js +30 -33
- package/src/element/substitution/frame.js +32 -30
- package/src/element/substitution/metaLevel.js +43 -46
- package/src/element/substitution/reference.js +17 -17
- package/src/element/substitution/statement.js +58 -56
- package/src/element/substitution/term.js +17 -17
- 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 +79 -36
- package/src/utilities/element.js +68 -31
- package/src/utilities/json.js +13 -13
- package/src/utilities/statement.js +1 -9
- package/src/utilities/string.js +16 -2
- package/src/utilities/unification.js +7 -6
- package/src/utilities/validation.js +50 -38
- package/lib/context/scoped.js +0 -232
- package/lib/utilities/term.js +0 -17
- package/src/utilities/term.js +0 -10
|
@@ -378,8 +378,6 @@ export default class NominalFileContext extends FileContext {
|
|
|
378
378
|
return metavariable;
|
|
379
379
|
}
|
|
380
380
|
|
|
381
|
-
findMetaTypeByMetaTypeName(metaTypeName) { return findMetaTypeByMetaTypeName(metaTypeName); }
|
|
382
|
-
|
|
383
381
|
findRuleByReference(reference) {
|
|
384
382
|
const rules = this.getRules(),
|
|
385
383
|
metavariableName = reference.getMetavariableName(),
|
|
@@ -436,19 +434,6 @@ export default class NominalFileContext extends FileContext {
|
|
|
436
434
|
return theorem;
|
|
437
435
|
}
|
|
438
436
|
|
|
439
|
-
findMetaLemmaByReference(reference) {
|
|
440
|
-
const metaLemmas = this.getMetaLemmas(),
|
|
441
|
-
metaLemma = metaLemmas.find((metaLemma) => {
|
|
442
|
-
const metaLemmaComparesToReference = metaLemma.compareReference(reference);
|
|
443
|
-
|
|
444
|
-
if (metaLemmaComparesToReference) {
|
|
445
|
-
return true;
|
|
446
|
-
}
|
|
447
|
-
}) || null;
|
|
448
|
-
|
|
449
|
-
return metaLemma;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
437
|
findConjectureByReference(reference) {
|
|
453
438
|
const conjectures = this.getConjectures(),
|
|
454
439
|
metavariableName = reference.getMetavariableName(),
|
|
@@ -467,9 +452,8 @@ export default class NominalFileContext extends FileContext {
|
|
|
467
452
|
const metaLemmas = this.getMetaLemmas();
|
|
468
453
|
|
|
469
454
|
filter(metaLemmas, (metaLemma) => {
|
|
470
|
-
const
|
|
471
|
-
|
|
472
|
-
topLevelMetaAssertionCompares = reference.compareTopLevelMetaAssertion(topLevelMetaAssertion, context);
|
|
455
|
+
const topLevelMetaAssertion = metaLemma, ///
|
|
456
|
+
topLevelMetaAssertionCompares = reference.compareTopLevelMetaAssertion(topLevelMetaAssertion);
|
|
473
457
|
|
|
474
458
|
if (topLevelMetaAssertionCompares) {
|
|
475
459
|
return true;
|
|
@@ -479,26 +463,12 @@ export default class NominalFileContext extends FileContext {
|
|
|
479
463
|
return metaLemmas;
|
|
480
464
|
}
|
|
481
465
|
|
|
482
|
-
findMetatheoremByReference(reference) {
|
|
483
|
-
const metatheorems = this.getMetatheorems(),
|
|
484
|
-
metatheorem = metatheorems.find((metatheorem) => {
|
|
485
|
-
const metatheoremComparesToReference = metatheorem.compareReference(reference);
|
|
486
|
-
|
|
487
|
-
if (metatheoremComparesToReference) {
|
|
488
|
-
return true;
|
|
489
|
-
}
|
|
490
|
-
}) || null;
|
|
491
|
-
|
|
492
|
-
return metatheorem;
|
|
493
|
-
}
|
|
494
|
-
|
|
495
466
|
findMetatheoremsByReference(reference) {
|
|
496
467
|
const metatheorems = this.getMetatheorems();
|
|
497
468
|
|
|
498
469
|
filter(metatheorems, (metatheorem) => {
|
|
499
|
-
const
|
|
500
|
-
|
|
501
|
-
topLevelMetaAssertionCompares = reference.compareTopLevelMetaAssertion(topLevelMetaAssertion, context);
|
|
470
|
+
const topLevelMetaAssertion = metatheorem, ///
|
|
471
|
+
topLevelMetaAssertionCompares = reference.compareTopLevelMetaAssertion(topLevelMetaAssertion);
|
|
502
472
|
|
|
503
473
|
if (topLevelMetaAssertionCompares) {
|
|
504
474
|
return true;
|
|
@@ -613,19 +583,6 @@ export default class NominalFileContext extends FileContext {
|
|
|
613
583
|
return typePrefix;
|
|
614
584
|
}
|
|
615
585
|
|
|
616
|
-
findJudgementByMetavariableName(metavariableName) {
|
|
617
|
-
const judgements = this.getJudgements(),
|
|
618
|
-
judgement = judgements.find((judgement) => {
|
|
619
|
-
const judgementMetavariableComparesToMetavariable = judgement.compareMetavariableName(metavariableName);
|
|
620
|
-
|
|
621
|
-
if (judgementMetavariableComparesToMetavariable) {
|
|
622
|
-
return true;
|
|
623
|
-
}
|
|
624
|
-
}) || null;
|
|
625
|
-
|
|
626
|
-
return judgement;
|
|
627
|
-
}
|
|
628
|
-
|
|
629
586
|
findVariableByVariableIdentifier(variableIdentifier) {
|
|
630
587
|
const variables = this.getVariables(),
|
|
631
588
|
variable = variables.find((variable) => {
|
|
@@ -665,26 +622,22 @@ export default class NominalFileContext extends FileContext {
|
|
|
665
622
|
return procedure;
|
|
666
623
|
}
|
|
667
624
|
|
|
668
|
-
|
|
669
|
-
const labels = this.getLabels(),
|
|
670
|
-
labelPresent = labels.some((label) => {
|
|
671
|
-
const context = this, ///
|
|
672
|
-
labelUnifies = reference.unifyLabel(label, context);
|
|
625
|
+
findMetaTypeByMetaTypeName(metaTypeName) { return findMetaTypeByMetaTypeName(metaTypeName); }
|
|
673
626
|
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
}
|
|
677
|
-
});
|
|
627
|
+
isMetavariablePresent(metavariable, context) {
|
|
628
|
+
metavariable = this.findMetavariable(metavariable, context); ///
|
|
678
629
|
|
|
679
|
-
|
|
630
|
+
const metavariablePresent = (metavariable !== null);
|
|
631
|
+
|
|
632
|
+
return metavariablePresent;
|
|
680
633
|
}
|
|
681
634
|
|
|
682
|
-
|
|
635
|
+
isLabelPresentByReference(reference) {
|
|
683
636
|
const labels = this.getLabels(),
|
|
684
637
|
labelPresent = labels.some((label) => {
|
|
685
|
-
const
|
|
638
|
+
const labelUnifies = reference.unifyLabel(label);
|
|
686
639
|
|
|
687
|
-
if (
|
|
640
|
+
if (labelUnifies) {
|
|
688
641
|
return true;
|
|
689
642
|
}
|
|
690
643
|
});
|
|
@@ -692,20 +645,6 @@ export default class NominalFileContext extends FileContext {
|
|
|
692
645
|
return labelPresent;
|
|
693
646
|
}
|
|
694
647
|
|
|
695
|
-
isMetavariablePresentByReference(reference) {
|
|
696
|
-
const metavariables = this.getMetavariables(),
|
|
697
|
-
metavariablePresent = metavariables.some((metavariable) => {
|
|
698
|
-
const context = this, ///
|
|
699
|
-
metavariableUnifies = reference.unifyMetavariable(metavariable, context);
|
|
700
|
-
|
|
701
|
-
if (metavariableUnifies) {
|
|
702
|
-
return true;
|
|
703
|
-
}
|
|
704
|
-
});
|
|
705
|
-
|
|
706
|
-
return metavariablePresent;
|
|
707
|
-
}
|
|
708
|
-
|
|
709
648
|
isTopLevelMetaAssertionPresentByReference(reference) {
|
|
710
649
|
const topLevelMetaAssertion = this.findTopLevelMetaAssertionByReference(reference),
|
|
711
650
|
topLevelMetaAssertionPresent = (topLevelMetaAssertion !== null);
|
|
@@ -713,6 +652,19 @@ export default class NominalFileContext extends FileContext {
|
|
|
713
652
|
return topLevelMetaAssertionPresent;
|
|
714
653
|
}
|
|
715
654
|
|
|
655
|
+
isLabelPresentByLabelNode(labelNode) {
|
|
656
|
+
const labels = this.getLabels(),
|
|
657
|
+
labelPresent = labels.some((label) => {
|
|
658
|
+
const labelNodeMatches = label.matchLabelNode(labelNode);
|
|
659
|
+
|
|
660
|
+
if (labelNodeMatches) {
|
|
661
|
+
return true;
|
|
662
|
+
}
|
|
663
|
+
});
|
|
664
|
+
|
|
665
|
+
return labelPresent;
|
|
666
|
+
}
|
|
667
|
+
|
|
716
668
|
isTypePresentByTypeName(typeName, includeRelease = true) {
|
|
717
669
|
const type = this.findTypeByTypeName(typeName, includeRelease),
|
|
718
670
|
typePresent = (type !== null);
|
|
@@ -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,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import Context from "../context";
|
|
4
|
+
|
|
5
|
+
export default class NestedContext extends Context {
|
|
6
|
+
addAssignment(assignment) {
|
|
7
|
+
///
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
static fromNothing(context) {
|
|
11
|
+
const nestedContext = new NestedContext(context);
|
|
12
|
+
|
|
13
|
+
return nestedContext;
|
|
14
|
+
}
|
|
15
|
+
}
|
package/src/context/nominal.js
CHANGED
|
@@ -14,7 +14,7 @@ const { nominalLexerFromNothing } = lexersUtilities,
|
|
|
14
14
|
const nominalLexer = nominalLexerFromNothing(NominalLexer),
|
|
15
15
|
nominalParser = nominalParserFromNothing(NominalParser); ///
|
|
16
16
|
|
|
17
|
-
class NominalContext extends Context {
|
|
17
|
+
export default class NominalContext extends Context {
|
|
18
18
|
constructor(context, lexer, parser) {
|
|
19
19
|
super(context);
|
|
20
20
|
|
|
@@ -41,7 +41,3 @@ class NominalContext extends Context {
|
|
|
41
41
|
return nominalContext;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
const nominalContext = NominalContext.fromNothing();
|
|
46
|
-
|
|
47
|
-
export default nominalContext;
|
|
@@ -7,7 +7,7 @@ import elements from "../elements";
|
|
|
7
7
|
|
|
8
8
|
const { last } = 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,66 +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
|
|
223
|
-
|
|
224
|
-
this.assignments.forEach((assignment) => {
|
|
225
|
-
assignment(context);
|
|
226
|
-
});
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
findEquivalenceByTerm(term) { return this.equivalences.findEquivalenceByTerm(term); }
|
|
218
|
+
addSubproofOrProofAssertion(subproofOrProofAssertion) {
|
|
219
|
+
const context = this, ///
|
|
220
|
+
subproofOrProofAssertionString = subproofOrProofAssertion.getString();
|
|
230
221
|
|
|
231
|
-
|
|
232
|
-
const judgements = this.getJudgements(),
|
|
233
|
-
judgement = judgements.find((judgement) => {
|
|
234
|
-
const judgementMetavariableComparesToMetavariable = judgement.compareMetavariableName(metavariableName);
|
|
222
|
+
context.trace(`Adding the '${subproofOrProofAssertionString}' subproof or proof assertion to the proof context...`);
|
|
235
223
|
|
|
236
|
-
|
|
237
|
-
return true;
|
|
238
|
-
}
|
|
239
|
-
}) || null;
|
|
224
|
+
this.subproofOrProofAssertions.push(subproofOrProofAssertion);
|
|
240
225
|
|
|
241
|
-
|
|
226
|
+
context.debug(`...added the '${subproofOrProofAssertionString}' subproof or proof assertion to the proof context.`);
|
|
242
227
|
}
|
|
243
228
|
|
|
244
|
-
|
|
245
|
-
const
|
|
246
|
-
|
|
247
|
-
|
|
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);
|
|
248
234
|
|
|
249
|
-
if (
|
|
235
|
+
if (comparesToTermAndPropertyRelation) {
|
|
250
236
|
return true;
|
|
251
237
|
}
|
|
252
|
-
})
|
|
253
|
-
|
|
254
|
-
return variable;
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
findMetaLevelSubstitutionByMetaLevelSubstitutionNode(metaLevelSubstitutionNode) {
|
|
258
|
-
let metaLevelSubstitution;
|
|
259
|
-
|
|
260
|
-
if (this.metaLevelSubstitutions === null) {
|
|
261
|
-
metaLevelSubstitution = super.findMetaLevelSubstitutionByMetaLevelSubstitutionNode(metaLevelSubstitutionNode);
|
|
262
|
-
} else {
|
|
263
|
-
metaLevelSubstitution = this.metaLevelSubstitutions.find((metaLevelSubstitution) => {
|
|
264
|
-
const metaLevelSubstitutionNodeMatches = metaLevelSubstitution.matchMetaLevelSubstitutionNode(metaLevelSubstitutionNode);
|
|
265
|
-
|
|
266
|
-
if (metaLevelSubstitutionNodeMatches) {
|
|
267
|
-
return true;
|
|
268
|
-
}
|
|
269
|
-
}) || null;
|
|
270
|
-
}
|
|
238
|
+
});
|
|
271
239
|
|
|
272
|
-
return
|
|
240
|
+
return comparesToTermAndPropertyRelation;
|
|
273
241
|
}
|
|
274
242
|
|
|
275
243
|
isTermGrounded(term) {
|
|
@@ -307,18 +275,50 @@ class ScopedContext extends Context {
|
|
|
307
275
|
return variablePresent;
|
|
308
276
|
}
|
|
309
277
|
|
|
310
|
-
|
|
311
|
-
const context = this, ///
|
|
312
|
-
proofAssertions = this.getProofAssertions(),
|
|
313
|
-
comparesToTermAndPropertyRelation = proofAssertions.some((proofAssertion) => {
|
|
314
|
-
const comparesToTermAndPropertyRelation = proofAssertion.compareTermAndPropertyRelation(term, propertyRelation, context);
|
|
278
|
+
findEquivalenceByTerm(term) { return this.equivalences.findEquivalenceByTerm(term); }
|
|
315
279
|
|
|
316
|
-
|
|
280
|
+
findJudgementByMetavariableName(metavariableName) {
|
|
281
|
+
const judgements = this.getJudgements(),
|
|
282
|
+
judgement = judgements.find((judgement) => {
|
|
283
|
+
const judgementMetavariableComparesToMetavariable = judgement.compareMetavariableName(metavariableName);
|
|
284
|
+
|
|
285
|
+
if (judgementMetavariableComparesToMetavariable) {
|
|
317
286
|
return true;
|
|
318
287
|
}
|
|
319
|
-
});
|
|
288
|
+
}) || null;
|
|
320
289
|
|
|
321
|
-
return
|
|
290
|
+
return judgement;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
findVariableByVariableIdentifier(variableIdentifier) {
|
|
294
|
+
const variables = this.getVariables(),
|
|
295
|
+
variable = variables.find((variable) => {
|
|
296
|
+
const variableComparesToVariableIdentifier = variable.compareVariableIdentifier(variableIdentifier);
|
|
297
|
+
|
|
298
|
+
if (variableComparesToVariableIdentifier) {
|
|
299
|
+
return true;
|
|
300
|
+
}
|
|
301
|
+
}) || null;
|
|
302
|
+
|
|
303
|
+
return variable;
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
findMetaLevelSubstitutionByMetaLevelSubstitutionNode(metaLevelSubstitutionNode) {
|
|
307
|
+
let metaLevelSubstitution;
|
|
308
|
+
|
|
309
|
+
if (this.metaLevelSubstitutions === null) {
|
|
310
|
+
metaLevelSubstitution = super.findMetaLevelSubstitutionByMetaLevelSubstitutionNode(metaLevelSubstitutionNode);
|
|
311
|
+
} else {
|
|
312
|
+
metaLevelSubstitution = this.metaLevelSubstitutions.find((metaLevelSubstitution) => {
|
|
313
|
+
const metaLevelSubstitutionNodeMatches = metaLevelSubstitution.matchMetaLevelSubstitutionNode(metaLevelSubstitutionNode);
|
|
314
|
+
|
|
315
|
+
if (metaLevelSubstitutionNodeMatches) {
|
|
316
|
+
return true;
|
|
317
|
+
}
|
|
318
|
+
}) || null;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
return metaLevelSubstitution;
|
|
322
322
|
}
|
|
323
323
|
|
|
324
324
|
static fromMetaLevelSubstitutions(metaLevelSubstitutions, context) {
|
|
@@ -328,10 +328,10 @@ class ScopedContext extends Context {
|
|
|
328
328
|
assignments = [],
|
|
329
329
|
equivalences = Equivalences.fromNothing(context),
|
|
330
330
|
subproofOrProofAssertions = [],
|
|
331
|
-
|
|
331
|
+
proofContext = new ProofContext(context, variables, judgements, assignments, equivalences, subproofOrProofAssertions, metaLevelSubstitutions);
|
|
332
332
|
|
|
333
|
-
return
|
|
333
|
+
return proofContext;
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
336
|
|
|
337
|
-
export default
|
|
337
|
+
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
|
@@ -136,6 +136,18 @@ export default class Context extends ContextBase {
|
|
|
136
136
|
return ephemeralContext;
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
+
findMetavariable(metavariable, context) {
|
|
140
|
+
const childContext = context; ///
|
|
141
|
+
|
|
142
|
+
context = this.getContext();
|
|
143
|
+
|
|
144
|
+
const parentContext = context; ///
|
|
145
|
+
|
|
146
|
+
metavariable = parentContext.findMetavariable(metavariable, childContext); ///
|
|
147
|
+
|
|
148
|
+
return metavariable;
|
|
149
|
+
}
|
|
150
|
+
|
|
139
151
|
findRuleByReference(reference) {
|
|
140
152
|
const context = this.getContext(),
|
|
141
153
|
rule = context.findRuleByReference(reference);
|
|
@@ -171,18 +183,6 @@ export default class Context extends ContextBase {
|
|
|
171
183
|
return metaType;
|
|
172
184
|
}
|
|
173
185
|
|
|
174
|
-
findMetavariable(metavariable, context) {
|
|
175
|
-
const childContext = context; ///
|
|
176
|
-
|
|
177
|
-
context = this.getContext();
|
|
178
|
-
|
|
179
|
-
const parentContext = context; ///
|
|
180
|
-
|
|
181
|
-
metavariable = parentContext.findMetavariable(metavariable, childContext); ///
|
|
182
|
-
|
|
183
|
-
return metavariable;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
186
|
findTermByTermNode(termNode) {
|
|
187
187
|
const context = this.getContext(),
|
|
188
188
|
term = context.findTermByTermNode(termNode);
|
|
@@ -192,7 +192,7 @@ export default class Context extends ContextBase {
|
|
|
192
192
|
|
|
193
193
|
findFrameByFrameNode(frameNode) {
|
|
194
194
|
const context = this.getContext(),
|
|
195
|
-
|
|
195
|
+
frame = context.findFrameByFrameNode(frameNode);
|
|
196
196
|
|
|
197
197
|
return frame;
|
|
198
198
|
}
|
|
@@ -325,9 +325,12 @@ export default class Context extends ContextBase {
|
|
|
325
325
|
}
|
|
326
326
|
|
|
327
327
|
isMetavariablePresent(metavariable, context) {
|
|
328
|
-
|
|
328
|
+
const childContext = context; ///
|
|
329
329
|
|
|
330
|
-
|
|
330
|
+
context = this.getContext();
|
|
331
|
+
|
|
332
|
+
const parentContext = context, ///
|
|
333
|
+
metavariablePresent = parentContext.isMetavariablePresent(metavariable, childContext);
|
|
331
334
|
|
|
332
335
|
return metavariablePresent;
|
|
333
336
|
}
|
|
@@ -339,6 +342,13 @@ export default class Context extends ContextBase {
|
|
|
339
342
|
return labelPresent;
|
|
340
343
|
}
|
|
341
344
|
|
|
345
|
+
isTopLevelMetaAssertionPresentByReference(reference) {
|
|
346
|
+
const context = this.getContext(),
|
|
347
|
+
topLevelMetaAssertionPresent = context.isTopLevelMetaAssertionPresentByReference(reference);
|
|
348
|
+
|
|
349
|
+
return topLevelMetaAssertionPresent;
|
|
350
|
+
}
|
|
351
|
+
|
|
342
352
|
isTermPresentByTermNode(termNode) {
|
|
343
353
|
const context = this.getContext(),
|
|
344
354
|
termPresent = context.isTermPresentByTermNode(termNode);
|
|
@@ -437,6 +447,19 @@ export default class Context extends ContextBase {
|
|
|
437
447
|
return metaLevelSubstitutions;
|
|
438
448
|
}
|
|
439
449
|
|
|
450
|
+
isStated() {
|
|
451
|
+
const context = this.getContext(),
|
|
452
|
+
stated = context.isStated();
|
|
453
|
+
|
|
454
|
+
return stated;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
addTerms(terms) {
|
|
458
|
+
const context = this.getContext();
|
|
459
|
+
|
|
460
|
+
context.addTerms(terms);
|
|
461
|
+
}
|
|
462
|
+
|
|
440
463
|
addTerm(term) {
|
|
441
464
|
const context = this.getContext();
|
|
442
465
|
|
|
@@ -449,22 +472,40 @@ export default class Context extends ContextBase {
|
|
|
449
472
|
context.addFrame(frame);
|
|
450
473
|
}
|
|
451
474
|
|
|
475
|
+
addEquality(equality) {
|
|
476
|
+
const context = this.getContext();
|
|
477
|
+
|
|
478
|
+
context.addEquality(equality);
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
addJudgement(judgement) {
|
|
482
|
+
const context = this.getContext();
|
|
483
|
+
|
|
484
|
+
context.addJudgement(judgement);
|
|
485
|
+
}
|
|
486
|
+
|
|
452
487
|
addStatement(statement) {
|
|
453
488
|
const context = this.getContext();
|
|
454
489
|
|
|
455
490
|
context.addStatement(statement);
|
|
456
491
|
}
|
|
457
492
|
|
|
493
|
+
addAssertion(assertion) {
|
|
494
|
+
const context = this.getContext();
|
|
495
|
+
|
|
496
|
+
context.addAssertion(assertion);
|
|
497
|
+
}
|
|
498
|
+
|
|
458
499
|
addReference(reference) {
|
|
459
500
|
const context = this.getContext();
|
|
460
501
|
|
|
461
502
|
context.addReference(reference);
|
|
462
503
|
}
|
|
463
504
|
|
|
464
|
-
|
|
505
|
+
addAssumption(assumption) {
|
|
465
506
|
const context = this.getContext();
|
|
466
507
|
|
|
467
|
-
context.
|
|
508
|
+
context.addAssumption(assumption);
|
|
468
509
|
}
|
|
469
510
|
|
|
470
511
|
addAssignment(assignment) {
|