occam-verify-cli 0.0.1002 → 0.0.1005
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/README.md +0 -2
- package/bin/abbreviations.js +1 -3
- package/bin/action/help.js +0 -2
- package/bin/action/verify.js +4 -24
- package/bin/defaults.js +0 -2
- package/bin/main.js +3 -4
- package/bin/options.js +0 -2
- package/lib/assertion/subproof.js +106 -0
- package/lib/assignment/metavariable.js +2 -2
- package/lib/combinator.js +50 -16
- package/lib/conclusion.js +73 -14
- package/lib/context/file.js +191 -31
- package/lib/context/local.js +37 -49
- package/lib/context/release.js +42 -35
- package/lib/context/release.other.js +605 -0
- package/lib/declaration/combinator.js +83 -0
- package/lib/derivation.js +86 -0
- package/lib/equality.js +3 -11
- package/lib/index.js +1 -1
- package/lib/judgement.js +3 -10
- package/lib/label.js +58 -16
- package/lib/log.js +3 -11
- package/lib/metaType.js +31 -19
- package/lib/metavariable.js +39 -12
- package/lib/mixins/statement/qualified/unify.js +118 -0
- package/lib/mixins/statement/unify.js +57 -0
- package/lib/mixins/statement/verify.js +184 -0
- package/lib/node/statement/combinator/bracketed.js +15 -11
- package/lib/ocmbinator/bracketed.js +52 -8
- package/lib/premise.js +109 -56
- package/lib/proof.js +91 -0
- package/lib/proofStep.js +78 -25
- package/lib/reference.js +62 -16
- package/lib/rule.js +146 -26
- package/lib/ruleNames.js +5 -5
- package/lib/statement/qualified.js +127 -0
- package/lib/statement/unqualified.js +89 -0
- package/lib/statement.js +176 -0
- package/lib/subDerivation.js +86 -0
- package/lib/subproof.js +155 -0
- package/lib/substitution/frameForMetavariable.js +14 -15
- package/lib/substitution/statementForMetavariable.js +23 -24
- package/lib/substitution/termForVariable.js +11 -12
- package/lib/substitution.js +9 -2
- package/lib/substitutions.js +14 -14
- package/lib/supposition.js +92 -60
- package/lib/unifier/statementWithCombinator.js +3 -3
- package/lib/unify/metavariableWithFrame.js +2 -2
- package/lib/unify/metavariableWithStatement.js +2 -2
- package/lib/unify/metavariableWithStatementGivenSubstitution.js +2 -2
- package/lib/unify/variableWithTerm.js +2 -2
- package/lib/utilities/node.js +13 -11
- package/lib/utilities/releaseContext.js +3 -3
- package/lib/utilities/string.js +8 -2
- package/lib/utilities/subproof.js +5 -5
- package/lib/utilities/tokens.js +10 -10
- package/lib/variable.js +1 -10
- package/lib/verifier/metaLevel.js +2 -2
- package/lib/verifier/topLevel.js +5 -5
- package/lib/verify/axiom.js +3 -5
- package/lib/verify/conjecture.js +4 -7
- package/lib/verify/consequent.js +2 -3
- package/lib/verify/declaration/combinator.js +2 -14
- package/lib/verify/declaration/metavariable.js +9 -10
- package/lib/verify/files.js +4 -4
- package/lib/verify/frame.js +12 -12
- package/lib/verify/lemma.js +4 -7
- package/lib/verify/metaLemma.js +4 -7
- package/lib/verify/metatheorem.js +4 -7
- package/lib/verify/proofStep.js +2 -31
- package/lib/verify/theorem.js +4 -7
- package/package.json +4 -4
- package/src/assertion/subproof.js +84 -0
- package/src/assignment/metavariable.js +2 -2
- package/src/combinator.js +45 -15
- package/src/conclusion.js +83 -13
- package/src/context/file.js +223 -11
- package/src/context/local.js +12 -16
- package/src/context/release.js +57 -39
- package/src/context/release.other.js +547 -0
- package/src/declaration/combinator.js +44 -0
- package/src/derivation.js +50 -0
- package/src/equality.js +2 -9
- package/src/index.js +0 -1
- package/src/judgement.js +2 -8
- package/src/label.js +56 -13
- package/src/log.js +2 -9
- package/src/metaType.js +26 -14
- package/src/metavariable.js +57 -9
- package/src/mixins/statement/qualified/unify.js +186 -0
- package/src/mixins/statement/unify.js +70 -0
- package/src/mixins/statement/verify.js +274 -0
- package/src/node/statement/combinator/bracketed.js +4 -3
- package/src/ocmbinator/bracketed.js +15 -12
- package/src/premise.js +136 -44
- package/src/proof.js +58 -0
- package/src/proofStep.js +92 -22
- package/src/reference.js +58 -12
- package/src/rule.js +199 -30
- package/src/ruleNames.js +1 -1
- package/src/statement/qualified.js +104 -0
- package/src/statement/unqualified.js +60 -0
- package/src/statement.js +179 -0
- package/src/subDerivation.js +52 -0
- package/src/subproof.js +99 -0
- package/src/substitution/frameForMetavariable.js +20 -17
- package/src/substitution/statementForMetavariable.js +31 -29
- package/src/substitution/termForVariable.js +15 -14
- package/src/substitution.js +8 -0
- package/src/substitutions.js +12 -13
- package/src/supposition.js +94 -44
- package/src/unifier/statementWithCombinator.js +6 -3
- package/src/unify/metavariableWithFrame.js +1 -1
- package/src/unify/metavariableWithStatement.js +1 -1
- package/src/unify/metavariableWithStatementGivenSubstitution.js +1 -1
- package/src/unify/variableWithTerm.js +1 -1
- package/src/utilities/node.js +18 -12
- package/src/utilities/releaseContext.js +2 -2
- package/src/utilities/string.js +6 -2
- package/src/utilities/subproof.js +2 -2
- package/src/utilities/tokens.js +7 -7
- package/src/variable.js +0 -10
- package/src/verifier/metaLevel.js +3 -2
- package/src/verifier/topLevel.js +6 -4
- package/src/verify/axiom.js +1 -2
- package/src/verify/conjecture.js +2 -3
- package/src/verify/consequent.js +1 -1
- package/src/verify/declaration/combinator.js +0 -20
- package/src/verify/declaration/metavariable.js +8 -12
- package/src/verify/files.js +3 -3
- package/src/verify/frame.js +11 -11
- package/src/verify/lemma.js +2 -3
- package/src/verify/metaLemma.js +2 -3
- package/src/verify/metatheorem.js +2 -3
- package/src/verify/proofStep.js +0 -41
- package/src/verify/theorem.js +2 -3
- package/lib/tokens/combinatorStatement/bracketed.js +0 -17
- package/lib/unify/premiseWithProofStep.js +0 -41
- package/lib/unify/premisesWithProofSteps.js +0 -31
- package/lib/unify/qualifiedStatement.js +0 -136
- package/lib/unify/statementWithBracketedCombinator.js +0 -30
- package/lib/unify/statementWithCombinator.js +0 -29
- package/lib/unify/statementWithCombinators.js +0 -31
- package/lib/unify/statementWithMetaType.js +0 -24
- package/lib/verify/conclusion.js +0 -39
- package/lib/verify/derivation.js +0 -31
- package/lib/verify/label.js +0 -37
- package/lib/verify/labels.js +0 -28
- package/lib/verify/premise.js +0 -45
- package/lib/verify/premises.js +0 -28
- package/lib/verify/proof.js +0 -34
- package/lib/verify/rule.js +0 -56
- package/lib/verify/statement/qualified.js +0 -41
- package/lib/verify/statement/unqualified.js +0 -45
- package/lib/verify/statement.js +0 -219
- package/lib/verify/statementAsCombinator.js +0 -33
- package/lib/verify/statementGivenMetaType.js +0 -52
- package/lib/verify/subproof.js +0 -34
- package/lib/verify/supposition.js +0 -45
- package/lib/verify/suppositions.js +0 -28
- package/src/tokens/combinatorStatement/bracketed.js +0 -10
- package/src/unify/premiseWithProofStep.js +0 -54
- package/src/unify/premisesWithProofSteps.js +0 -23
- package/src/unify/qualifiedStatement.js +0 -208
- package/src/unify/statementWithBracketedCombinator.js +0 -22
- package/src/unify/statementWithCombinator.js +0 -22
- package/src/unify/statementWithCombinators.js +0 -23
- package/src/unify/statementWithMetaType.js +0 -14
- package/src/verify/conclusion.js +0 -40
- package/src/verify/derivation.js +0 -23
- package/src/verify/label.js +0 -34
- package/src/verify/labels.js +0 -17
- package/src/verify/premise.js +0 -49
- package/src/verify/premises.js +0 -17
- package/src/verify/proof.js +0 -31
- package/src/verify/rule.js +0 -71
- package/src/verify/statement/qualified.js +0 -40
- package/src/verify/statement/unqualified.js +0 -49
- package/src/verify/statement.js +0 -312
- package/src/verify/statementAsCombinator.js +0 -27
- package/src/verify/statementGivenMetaType.js +0 -52
- package/src/verify/subproof.js +0 -32
- package/src/verify/supposition.js +0 -49
- package/src/verify/suppositions.js +0 -17
package/src/context/file.js
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import Type from "../type";
|
|
4
|
+
import Rule from "../rule";
|
|
5
|
+
import Axiom from "../axiom";
|
|
6
|
+
import Lemma from "../lemma";
|
|
7
|
+
import Theorem from "../theorem";
|
|
8
|
+
import Variable from "../variable";
|
|
3
9
|
import metaTypes from "../metaTypes";
|
|
10
|
+
import MetaLemma from "../metaLemma";
|
|
11
|
+
import Conjecture from "../conjecture";
|
|
12
|
+
import Combinator from "../combinator";
|
|
13
|
+
import Constructor from "../constructor";
|
|
14
|
+
import Metatheorem from "../metatheorem";
|
|
15
|
+
import Metavariable from "../metavariable";
|
|
4
16
|
import topLevelVerifier from "../verifier/topLevel";
|
|
5
17
|
|
|
6
18
|
import { push } from "../utilities/array";
|
|
@@ -348,8 +360,9 @@ export default class FileContext {
|
|
|
348
360
|
return label;
|
|
349
361
|
}
|
|
350
362
|
|
|
351
|
-
|
|
363
|
+
findRuleByReference(reference) {
|
|
352
364
|
const rules = this.getRules(),
|
|
365
|
+
metavariableNode = reference.getMetavariableNode(),
|
|
353
366
|
rule = rules.find((rule) => {
|
|
354
367
|
const metavariableNodeMatches = rule.matchMetavariableNode(metavariableNode);
|
|
355
368
|
|
|
@@ -361,8 +374,9 @@ export default class FileContext {
|
|
|
361
374
|
return rule;
|
|
362
375
|
}
|
|
363
376
|
|
|
364
|
-
|
|
377
|
+
findAxiomByReference(reference) {
|
|
365
378
|
const axioms = this.getAxioms(),
|
|
379
|
+
metavariableNode = reference.getMetavariableNode(),
|
|
366
380
|
axiom = axioms.find((axiom) => {
|
|
367
381
|
const metavariableNodeMatches = axiom.matchMetavariableNode(metavariableNode);
|
|
368
382
|
|
|
@@ -374,8 +388,9 @@ export default class FileContext {
|
|
|
374
388
|
return axiom;
|
|
375
389
|
}
|
|
376
390
|
|
|
377
|
-
|
|
391
|
+
findLemmaByReference(reference) {
|
|
378
392
|
const lemmas = this.getLemmas(),
|
|
393
|
+
metavariableNode = reference.getMetavariableNode(),
|
|
379
394
|
lemma = lemmas.find((lemma) => {
|
|
380
395
|
const metavariableNodeMatches = lemma.matchMetavariableNode(metavariableNode);
|
|
381
396
|
|
|
@@ -387,8 +402,9 @@ export default class FileContext {
|
|
|
387
402
|
return lemma;
|
|
388
403
|
}
|
|
389
404
|
|
|
390
|
-
|
|
405
|
+
findTheoremByReference(reference) {
|
|
391
406
|
const theorems = this.getTheorems(),
|
|
407
|
+
metavariableNode = reference.getMetavariableNode(),
|
|
392
408
|
theorem = theorems.find((theorem) => {
|
|
393
409
|
const metavariableNodeMatches = theorem.matchMetavariableNode(metavariableNode);
|
|
394
410
|
|
|
@@ -400,8 +416,9 @@ export default class FileContext {
|
|
|
400
416
|
return theorem;
|
|
401
417
|
}
|
|
402
418
|
|
|
403
|
-
|
|
419
|
+
findMetaLemmaByReference(reference) {
|
|
404
420
|
const metaLemmas = this.getMetaLemmas(),
|
|
421
|
+
metavariableNode = reference.getMetavariableNode(),
|
|
405
422
|
metaLemma = metaLemmas.find((metaLemma) => {
|
|
406
423
|
const metavariableNodeMatches = metaLemma.matchMetavariableNode(metavariableNode);
|
|
407
424
|
|
|
@@ -413,8 +430,9 @@ export default class FileContext {
|
|
|
413
430
|
return metaLemma;
|
|
414
431
|
}
|
|
415
432
|
|
|
416
|
-
|
|
433
|
+
findConjectureByReference(reference) {
|
|
417
434
|
const conjectures = this.getConjectures(),
|
|
435
|
+
metavariableNode = reference.getMetavariableNode(),
|
|
418
436
|
conjecture = conjectures.find((conjecture) => {
|
|
419
437
|
const metavariableNodeMatches = conjecture.matchMetavariableNode(metavariableNode);
|
|
420
438
|
|
|
@@ -426,8 +444,9 @@ export default class FileContext {
|
|
|
426
444
|
return conjecture;
|
|
427
445
|
}
|
|
428
446
|
|
|
429
|
-
|
|
447
|
+
findMetatheoremByReference(reference) {
|
|
430
448
|
const metatheorems = this.getMetatheorems(),
|
|
449
|
+
metavariableNode = reference.getMetavariableNode(),
|
|
431
450
|
metatheorem = metatheorems.find((metatheorem) => {
|
|
432
451
|
const metavariableNodeMatches = metatheorem.matchMetavariableNode(metavariableNode);
|
|
433
452
|
|
|
@@ -606,8 +625,6 @@ export default class FileContext {
|
|
|
606
625
|
|
|
607
626
|
error(message, node) { this.releaseContext.error(message, node, this.tokens, this.filePath); }
|
|
608
627
|
|
|
609
|
-
fatal(message, node) { this.releaseContext.fatal(message, node, this.tokens, this.filePath); }
|
|
610
|
-
|
|
611
628
|
reset() {
|
|
612
629
|
this.types = [];
|
|
613
630
|
this.rules = [];
|
|
@@ -649,15 +666,210 @@ export default class FileContext {
|
|
|
649
666
|
|
|
650
667
|
toJSON() {
|
|
651
668
|
const filePath = this.filePath,
|
|
652
|
-
|
|
669
|
+
types = this.types.map((type) => {
|
|
670
|
+
const typeJSON = type.toJSON();
|
|
671
|
+
|
|
672
|
+
type = typeJSON; ///
|
|
673
|
+
|
|
674
|
+
return type;
|
|
675
|
+
}),
|
|
676
|
+
rules = this.rules.map((rule) => {
|
|
677
|
+
const ruleJSON = rule.toJSON();
|
|
678
|
+
|
|
679
|
+
rule = ruleJSON; ///
|
|
680
|
+
|
|
681
|
+
return rule;
|
|
682
|
+
}),
|
|
683
|
+
axioms = this.axioms.map((axiom) => {
|
|
684
|
+
const axiomJSON = axiom.toJSON();
|
|
685
|
+
|
|
686
|
+
axiom = axiomJSON; ///
|
|
687
|
+
|
|
688
|
+
return axiom;
|
|
689
|
+
}),
|
|
690
|
+
lemmas = this.lemmas.map((lemma) => {
|
|
691
|
+
const lemmaJSON = lemma.toJSON();
|
|
692
|
+
|
|
693
|
+
lemma = lemmaJSON; ///
|
|
694
|
+
|
|
695
|
+
return lemma;
|
|
696
|
+
}),
|
|
697
|
+
theorems = this.theorems.map((theorem) => {
|
|
698
|
+
const theoremJSON = theorem.toJSON();
|
|
699
|
+
|
|
700
|
+
theorem = theoremJSON; ///
|
|
701
|
+
|
|
702
|
+
return theorem;
|
|
703
|
+
}),
|
|
704
|
+
variables = this.variables.map((variable) => {
|
|
705
|
+
const variableJSON = variable.toJSON();
|
|
706
|
+
|
|
707
|
+
variable = variableJSON; ///
|
|
708
|
+
|
|
709
|
+
return variable;
|
|
710
|
+
}),
|
|
711
|
+
metaLemmas = this.metaLemmas.map((metaLemma) => {
|
|
712
|
+
const metaLemmaJSON = metaLemma.toJSON();
|
|
713
|
+
|
|
714
|
+
metaLemma = metaLemmaJSON; ///
|
|
715
|
+
|
|
716
|
+
return metaLemma;
|
|
717
|
+
}),
|
|
718
|
+
conjectures = this.conjectures.map((conjecture) => {
|
|
719
|
+
const conjectureJSON = conjecture.toJSON();
|
|
720
|
+
|
|
721
|
+
conjecture = conjectureJSON; ///
|
|
722
|
+
|
|
723
|
+
return conjecture;
|
|
724
|
+
}),
|
|
725
|
+
combinators = this.combinators.map((combinator) => {
|
|
726
|
+
const combinatorJSON = combinator.toJSON();
|
|
727
|
+
|
|
728
|
+
combinator = combinatorJSON; ///
|
|
729
|
+
|
|
730
|
+
return combinator;
|
|
731
|
+
}),
|
|
732
|
+
constructors = this.constructors.map((constructor) => {
|
|
733
|
+
const constructorJSON = constructor.toJSON();
|
|
734
|
+
|
|
735
|
+
constructor = constructorJSON; ///
|
|
736
|
+
|
|
737
|
+
return constructor;
|
|
738
|
+
}),
|
|
739
|
+
metatheorems = this.metatheorems.map((metatheorem) => {
|
|
740
|
+
const metatheoremJSON = metatheorem.toJSON();
|
|
741
|
+
|
|
742
|
+
metatheorem = metatheoremJSON; ///
|
|
743
|
+
|
|
744
|
+
return metatheorem;
|
|
745
|
+
}),
|
|
746
|
+
metavariables = this.metavariables.map((metavariable) => {
|
|
747
|
+
const metavariableJSON = metavariable.toJSON();
|
|
748
|
+
|
|
749
|
+
metavariable = metavariableJSON; ///
|
|
750
|
+
|
|
751
|
+
return metavariable;
|
|
752
|
+
}),
|
|
653
753
|
json = {
|
|
654
754
|
filePath,
|
|
655
|
-
|
|
755
|
+
types,
|
|
756
|
+
rules,
|
|
757
|
+
axioms,
|
|
758
|
+
lemmas,
|
|
759
|
+
theorems,
|
|
760
|
+
variables,
|
|
761
|
+
metaLemmas,
|
|
762
|
+
conjectures,
|
|
763
|
+
combinators,
|
|
764
|
+
constructors,
|
|
765
|
+
metatheorems,
|
|
766
|
+
metavariables
|
|
656
767
|
};
|
|
657
768
|
|
|
658
769
|
return json;
|
|
659
770
|
}
|
|
660
771
|
|
|
772
|
+
static fromJSON(json) {
|
|
773
|
+
const { types, rules, axioms, lemmas, theorems, metaLemmas, variables, conjectures, combinators, constructors, metatheorems, metavariables } = json,
|
|
774
|
+
fileContext = this, ///
|
|
775
|
+
typesJSON = types, ///
|
|
776
|
+
rulesJSON = rules, ///
|
|
777
|
+
axiomsJSON = axioms, ///
|
|
778
|
+
lemmasJSON = lemmas, ///
|
|
779
|
+
theoremsJSON = theorems, ///
|
|
780
|
+
variablesJSON = variables, ///
|
|
781
|
+
metaLemmasJSON = metaLemmas, ///
|
|
782
|
+
conjecturesJSON = conjectures, ///
|
|
783
|
+
combinatorsJSON = combinators, ///
|
|
784
|
+
constructorsJSON = constructors, ///
|
|
785
|
+
metatheoremsJSON = metatheorems, ///
|
|
786
|
+
metavariablesJSON = metavariables; ///
|
|
787
|
+
|
|
788
|
+
typesJSON.forEach((typeJSON) => {
|
|
789
|
+
const json = typeJSON, ///
|
|
790
|
+
type = Type.fromJSON(json, fileContext);
|
|
791
|
+
|
|
792
|
+
this.types.push(type);
|
|
793
|
+
});
|
|
794
|
+
|
|
795
|
+
rulesJSON.forEach((ruleJSON) => {
|
|
796
|
+
const json = ruleJSON, ///
|
|
797
|
+
rule = Rule.fromJSON(json, fileContext);
|
|
798
|
+
|
|
799
|
+
this.rules.push(rule);
|
|
800
|
+
});
|
|
801
|
+
|
|
802
|
+
axiomsJSON.forEach((axiomJSON) => {
|
|
803
|
+
const json = axiomJSON, ///
|
|
804
|
+
axiom = Axiom.fromJSON(json, fileContext);
|
|
805
|
+
|
|
806
|
+
this.axioms.push(axiom);
|
|
807
|
+
});
|
|
808
|
+
|
|
809
|
+
lemmasJSON.forEach((lemmaJSON) => {
|
|
810
|
+
const json = lemmaJSON, ///
|
|
811
|
+
lemma = Lemma.fromJSON(json, fileContext);
|
|
812
|
+
|
|
813
|
+
this.lemmas.push(lemma);
|
|
814
|
+
});
|
|
815
|
+
|
|
816
|
+
theoremsJSON.forEach((theoremJSON) => {
|
|
817
|
+
const json = theoremJSON, ///
|
|
818
|
+
theorem = Theorem.fromJSON(json, fileContext);
|
|
819
|
+
|
|
820
|
+
this.theorems.push(theorem);
|
|
821
|
+
});
|
|
822
|
+
|
|
823
|
+
variablesJSON.forEach((variableJSON) => {
|
|
824
|
+
const json = variableJSON, ///
|
|
825
|
+
variable = Variable.fromJSON(json, fileContext);
|
|
826
|
+
|
|
827
|
+
this.variables.push(variable);
|
|
828
|
+
});
|
|
829
|
+
|
|
830
|
+
metaLemmasJSON.forEach((metaLemmaJSON) => {
|
|
831
|
+
const json = metaLemmaJSON, ///
|
|
832
|
+
metaLemma = MetaLemma.fromJSON(json, fileContext);
|
|
833
|
+
|
|
834
|
+
this.metaLemmas.push(metaLemma);
|
|
835
|
+
});
|
|
836
|
+
|
|
837
|
+
conjecturesJSON.forEach((conjectureJSON) => {
|
|
838
|
+
const json = conjectureJSON, ///
|
|
839
|
+
conjecture = Conjecture.fromJSON(json, fileContext);
|
|
840
|
+
|
|
841
|
+
this.conjectures.push(conjecture);
|
|
842
|
+
});
|
|
843
|
+
|
|
844
|
+
combinatorsJSON.forEach((combinatorJSON) => {
|
|
845
|
+
const json = combinatorJSON, ///
|
|
846
|
+
combinator = Combinator.fromJSON(json, fileContext);
|
|
847
|
+
|
|
848
|
+
this.combinators.push(combinator);
|
|
849
|
+
});
|
|
850
|
+
|
|
851
|
+
constructorsJSON.forEach((constructorJSON) => {
|
|
852
|
+
const json = constructorJSON, ///
|
|
853
|
+
constructor = Constructor.fromJSON(json, fileContext);
|
|
854
|
+
|
|
855
|
+
this.constructors.push(constructor);
|
|
856
|
+
});
|
|
857
|
+
|
|
858
|
+
metatheoremsJSON.forEach((metatheoremJSON) => {
|
|
859
|
+
const json = metatheoremJSON, ///
|
|
860
|
+
metatheorem = Metatheorem.fromJSON(json, fileContext);
|
|
861
|
+
|
|
862
|
+
this.metatheorems.push(metatheorem);
|
|
863
|
+
});
|
|
864
|
+
|
|
865
|
+
metavariablesJSON.forEach((metavariableJSON) => {
|
|
866
|
+
const json = metavariableJSON, ///
|
|
867
|
+
metavariable = Metavariable.fromJSON(json, fileContext);
|
|
868
|
+
|
|
869
|
+
this.metavariables.push(metavariable);
|
|
870
|
+
});
|
|
871
|
+
}
|
|
872
|
+
|
|
661
873
|
static fromFileAndReleaseContext(file, releaseContext) {
|
|
662
874
|
const fileContent = file.getContent(),
|
|
663
875
|
filePath = file.getPath(),
|
package/src/context/local.js
CHANGED
|
@@ -88,8 +88,6 @@ class LocalContext {
|
|
|
88
88
|
return lastProofStep;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
-
getTokens() { return this.context.getTokens(); }
|
|
92
|
-
|
|
93
91
|
getAxioms() { return this.context.getAxioms(); }
|
|
94
92
|
|
|
95
93
|
getLemmas() { return this.context.getLemmas(); }
|
|
@@ -377,29 +375,29 @@ class LocalContext {
|
|
|
377
375
|
return metavariable;
|
|
378
376
|
}
|
|
379
377
|
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
findTypeByTypeNode(typeNode) { return this.context.findTypeByTypeNode(typeNode); }
|
|
378
|
+
findMetaTypeByMetaTypeNode(metaTypeNode) { return this.context.findMetaTypeByMetaTypeNode(metaTypeNode); }
|
|
383
379
|
|
|
384
380
|
findLabelByMetavariableNode(metavariableNode) { return this.context.findLabelByMetavariableNode(metavariableNode); }
|
|
385
381
|
|
|
386
|
-
|
|
382
|
+
findMetavariableByMetavariableName(metavariableName) { return this.context.findMetavariableByMetavariableName(metavariableName); }
|
|
383
|
+
|
|
384
|
+
findTypeByTypeName(typeName) { return this.context.findTypeByTypeName(typeName); }
|
|
387
385
|
|
|
388
|
-
|
|
386
|
+
findTypeByTypeNode(typeNode) { return this.context.findTypeByTypeNode(typeNode); }
|
|
389
387
|
|
|
390
|
-
|
|
388
|
+
findRuleByReference(reference) { return this.context.findRuleByReference(reference); }
|
|
391
389
|
|
|
392
|
-
|
|
390
|
+
findAxiomByReference(reference) { return this.context.findAxiomByReference(reference); }
|
|
393
391
|
|
|
394
|
-
|
|
392
|
+
findLemmaByReference(reference) { return this.context.findLemmaByReference(reference); }
|
|
395
393
|
|
|
396
|
-
|
|
394
|
+
findTheoremByReference(reference) { return this.context.findTheoremByReference(reference); }
|
|
397
395
|
|
|
398
|
-
|
|
396
|
+
findMetaLemmaByReference(reference) { return this.context.findMetaLemmaByReference(reference); }
|
|
399
397
|
|
|
400
|
-
|
|
398
|
+
findConjectureByReference(reference) { return this.context.findConjectureByReference(reference); }
|
|
401
399
|
|
|
402
|
-
|
|
400
|
+
findMetatheoremByReference(reference) { return this.context.findMetatheoremByReference(reference); }
|
|
403
401
|
|
|
404
402
|
nodeAsString(node) { return this.context.nodeAsString(node); }
|
|
405
403
|
|
|
@@ -415,8 +413,6 @@ class LocalContext {
|
|
|
415
413
|
|
|
416
414
|
error(message, node) { this.context.error(message, node); }
|
|
417
415
|
|
|
418
|
-
fatal(message, node) { this.context.fatal(node, message); }
|
|
419
|
-
|
|
420
416
|
static fromFileContext(fileContext) {
|
|
421
417
|
const context = fileContext, ///
|
|
422
418
|
variables = [],
|
package/src/context/release.js
CHANGED
|
@@ -10,8 +10,8 @@ import { tail, push, leftDifference } from "../utilities/array";
|
|
|
10
10
|
import { customGrammarFromNameAndEntries, combinedCustomGrammarFromReleaseContexts } from "../utilities/customGrammar";
|
|
11
11
|
|
|
12
12
|
const { isFilePathFlorenceFilePath } = filePathUtilities,
|
|
13
|
-
{
|
|
14
|
-
{
|
|
13
|
+
{ nominalLexerFromCombinedCustomGrammar } = lexersUtilities,
|
|
14
|
+
{ nominalParserFromCombinedCustomGrammar } = parsersUtilities;
|
|
15
15
|
|
|
16
16
|
export default class ReleaseContext {
|
|
17
17
|
constructor(log, name, entries, released, lexer, parser, verified, initialised, fileContexts, customGrammar, loggingDisabled, dependencyReleaseContexts) {
|
|
@@ -456,61 +456,44 @@ export default class ReleaseContext {
|
|
|
456
456
|
this.log.error(message, node, tokens, filePath);
|
|
457
457
|
}
|
|
458
458
|
|
|
459
|
-
|
|
460
|
-
if (this.loggingDisabled) {
|
|
461
|
-
return;
|
|
462
|
-
}
|
|
463
|
-
|
|
464
|
-
this.log.fatal(message, node, tokens, filePath);
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
initialise(releaseContexts, verbose) {
|
|
468
|
-
let initialised;
|
|
469
|
-
|
|
459
|
+
initialise(releaseContexts) {
|
|
470
460
|
const combinedCustomGrammar = combinedCustomGrammarFromReleaseContexts(releaseContexts),
|
|
471
|
-
|
|
472
|
-
|
|
461
|
+
nominalParser = nominalParserFromCombinedCustomGrammar(combinedCustomGrammar),
|
|
462
|
+
nominalLexer = nominalLexerFromCombinedCustomGrammar(combinedCustomGrammar);
|
|
473
463
|
|
|
474
|
-
this.lexer =
|
|
464
|
+
this.lexer = nominalLexer; ///
|
|
475
465
|
|
|
476
|
-
this.parser =
|
|
466
|
+
this.parser = nominalParser; ///
|
|
477
467
|
|
|
478
468
|
this.dependencyReleaseContexts = tail(releaseContexts);
|
|
479
469
|
|
|
480
470
|
if (this.released) {
|
|
481
|
-
const
|
|
471
|
+
const releaseContext = this, ///
|
|
472
|
+
fileContexts = fileContextsFromEntries(this.entries, releaseContext);
|
|
482
473
|
|
|
483
|
-
|
|
484
|
-
} else {
|
|
485
|
-
initialised = true;
|
|
486
|
-
}
|
|
474
|
+
initialiseFileContexts(fileContexts, releaseContext);
|
|
487
475
|
|
|
488
|
-
|
|
476
|
+
this.fileContexts = fileContexts;
|
|
477
|
+
}
|
|
489
478
|
|
|
490
|
-
|
|
479
|
+
this.initialised = true;
|
|
491
480
|
}
|
|
492
481
|
|
|
493
|
-
verify(
|
|
494
|
-
let verified;
|
|
482
|
+
verify() {
|
|
483
|
+
let verified = false;
|
|
495
484
|
|
|
496
|
-
const releaseContext = this
|
|
485
|
+
const releaseContext = this, ///
|
|
486
|
+
fileContexts = fileContextsFromEntries(this.entries, releaseContext),
|
|
487
|
+
fileContextsVerified = verifyFileContexts(fileContexts, releaseContext);
|
|
497
488
|
|
|
498
|
-
if (
|
|
499
|
-
|
|
500
|
-
}
|
|
501
|
-
|
|
502
|
-
this.fileContexts = fileContextsFromEntries(this.entries, releaseContext);
|
|
503
|
-
|
|
504
|
-
const fileContextsVerified = verifyFileContexts(this.fileContexts, releaseContext);
|
|
489
|
+
if (fileContextsVerified) {
|
|
490
|
+
this.fileContexts = fileContexts;
|
|
505
491
|
|
|
506
|
-
|
|
492
|
+
this.verified = true;
|
|
507
493
|
|
|
508
|
-
|
|
509
|
-
releaseContext.enableLogging();
|
|
494
|
+
verified = true;
|
|
510
495
|
}
|
|
511
496
|
|
|
512
|
-
this.verified = verified;
|
|
513
|
-
|
|
514
497
|
return verified;
|
|
515
498
|
}
|
|
516
499
|
|
|
@@ -583,6 +566,41 @@ function verifyFileContexts(fileContexts, releaseContext) {
|
|
|
583
566
|
return fileContextsVerified;
|
|
584
567
|
}
|
|
585
568
|
|
|
569
|
+
function initialiseFileContexts(fileContexts, releaseContext) {
|
|
570
|
+
fileContexts = [ ///
|
|
571
|
+
...fileContexts
|
|
572
|
+
];
|
|
573
|
+
|
|
574
|
+
for (;;) {
|
|
575
|
+
const fileContextsLength = fileContexts.length;
|
|
576
|
+
|
|
577
|
+
if (fileContextsLength === 0) {
|
|
578
|
+
break;
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
const initialisedFileContexts = [];
|
|
582
|
+
|
|
583
|
+
fileContexts.forEach((fileContext) => {
|
|
584
|
+
const initialised = fileContext.initialise(releaseContext);
|
|
585
|
+
|
|
586
|
+
if (initialised) {
|
|
587
|
+
const initialisedFileContext = fileContext; ///
|
|
588
|
+
|
|
589
|
+
initialisedFileContexts.push(initialisedFileContext);
|
|
590
|
+
}
|
|
591
|
+
});
|
|
592
|
+
|
|
593
|
+
const initialisedFileContextsLength = initialisedFileContexts.length,
|
|
594
|
+
fileInitialised = (initialisedFileContextsLength > 0);
|
|
595
|
+
|
|
596
|
+
if (!fileInitialised) {
|
|
597
|
+
break;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
leftDifference(fileContexts, initialisedFileContexts);
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
|
|
586
604
|
function fileContextsFromEntries(entries, releaseContext) {
|
|
587
605
|
const fileContexts = [];
|
|
588
606
|
|