occam-verify-cli 1.0.444 → 1.0.457
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/constants.js +1 -5
- package/lib/context/file.js +54 -82
- package/lib/context/fragment.js +77 -0
- package/lib/context/release.js +5 -9
- package/lib/context/scoped.js +314 -0
- package/lib/context/transient.js +371 -0
- package/lib/element/assumption.js +71 -84
- package/lib/element/combinator/bracketed.js +1 -10
- package/lib/element/conclusion.js +11 -8
- package/lib/element/constructor/bracketed.js +1 -10
- package/lib/element/declaration/combinator.js +1 -2
- package/lib/element/declaration/metavariable.js +3 -3
- package/lib/element/declaration/variable.js +3 -3
- package/lib/element/deduction.js +18 -13
- package/lib/element/derivation.js +14 -14
- package/lib/element/frame.js +40 -46
- package/lib/element/hypothesis.js +14 -55
- package/lib/element/judgement.js +35 -56
- package/lib/element/metaType.js +5 -4
- package/lib/element/metavariable.js +14 -10
- package/lib/element/proof.js +10 -10
- package/lib/element/proofAssertion/premise.js +308 -0
- package/lib/element/proofAssertion/step.js +305 -0
- package/lib/element/proofAssertion/supposition.js +322 -0
- package/lib/element/proofAssertion.js +199 -0
- package/lib/element/reference.js +28 -25
- package/lib/element/rule.js +29 -29
- package/lib/element/section.js +4 -4
- package/lib/element/statement.js +9 -14
- package/lib/element/subDerivation.js +14 -14
- package/lib/element/subproof.js +14 -14
- package/lib/element/substitution/frame.js +7 -7
- package/lib/element/substitution/statement.js +15 -39
- package/lib/element/substitution.js +5 -5
- package/lib/element/term.js +12 -10
- package/lib/element/topLevelAssertion/axiom.js +329 -0
- package/lib/element/{conjecture.js → topLevelAssertion/conjecture.js} +7 -7
- package/lib/element/{lemma.js → topLevelAssertion/lemma.js} +6 -6
- package/lib/element/{theorem.js → topLevelAssertion/theorem.js} +7 -7
- package/lib/element/topLevelAssertion.js +427 -0
- package/lib/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +7 -7
- package/lib/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +7 -7
- package/lib/element/topLevelMetaAssertion.js +289 -0
- package/lib/element/type.js +4 -4
- package/lib/element/variable.js +20 -20
- package/lib/metaTypes.js +33 -19
- package/lib/node/proofAssertion/premise.js +116 -0
- package/lib/node/proofAssertion/step.js +152 -0
- package/lib/node/proofAssertion/supposition.js +116 -0
- package/lib/node/{premise.js → proofAssertion.js} +11 -18
- package/lib/node/statement.js +2 -2
- package/lib/node/subDerivation.js +1 -8
- package/lib/node/subproof.js +1 -8
- package/lib/node/substitution/statement.js +2 -2
- package/lib/node/{axiom.js → topLevelAssertion/axiom.js} +7 -7
- package/lib/node/{conjecture.js → topLevelAssertion/conjecture.js} +7 -7
- package/lib/node/{lemma.js → topLevelAssertion/lemma.js} +7 -7
- package/lib/node/{theorem.js → topLevelAssertion/theorem.js} +7 -7
- package/lib/node/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +9 -9
- package/lib/node/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +7 -7
- package/lib/node/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +7 -7
- package/lib/node/{metaLemmaMetaTheorem.js → topLevelMetaAssertion.js} +9 -9
- package/lib/nonTerminalNodeMap.js +13 -13
- package/lib/preamble.js +10 -10
- package/lib/process/instantiate.js +6 -9
- package/lib/process/unify.js +7 -6
- package/lib/types.js +3 -3
- package/lib/utilities/bnf.js +5 -5
- package/lib/utilities/brackets.js +6 -11
- package/lib/utilities/context.js +28 -0
- package/lib/utilities/element.js +101 -99
- package/lib/utilities/fragment.js +23 -0
- package/lib/utilities/instance.js +12 -21
- package/lib/utilities/json.js +3 -2
- package/lib/utilities/string.js +44 -23
- package/lib/utilities/unification.js +36 -36
- package/lib/utilities/validation.js +22 -25
- package/package.json +6 -6
- package/src/constants.js +0 -1
- package/src/context/file.js +51 -58
- package/src/context/fragment.js +38 -0
- package/src/context/release.js +6 -11
- package/src/context/{local.js → scoped.js} +35 -127
- package/src/context/{temporary.js → transient.js} +9 -131
- package/src/element/assumption.js +69 -85
- package/src/element/combinator/bracketed.js +0 -7
- package/src/element/conclusion.js +14 -10
- package/src/element/constructor/bracketed.js +0 -7
- package/src/element/declaration/combinator.js +0 -1
- package/src/element/declaration/metavariable.js +2 -2
- package/src/element/declaration/variable.js +5 -5
- package/src/element/deduction.js +22 -15
- package/src/element/derivation.js +12 -12
- package/src/element/frame.js +36 -48
- package/src/element/hypothesis.js +14 -16
- package/src/element/judgement.js +33 -58
- package/src/element/metaType.js +4 -4
- package/src/element/metavariable.js +17 -10
- package/src/element/proof.js +9 -9
- package/src/element/{premise.js → proofAssertion/premise.js} +107 -75
- package/src/element/{step.js → proofAssertion/step.js} +43 -89
- package/src/element/{supposition.js → proofAssertion/supposition.js} +89 -88
- package/src/element/proofAssertion.js +69 -0
- package/src/element/reference.js +27 -23
- package/src/element/rule.js +25 -25
- package/src/element/section.js +4 -4
- package/src/element/statement.js +8 -15
- package/src/element/subDerivation.js +12 -12
- package/src/element/subproof.js +10 -10
- package/src/element/substitution/frame.js +10 -13
- package/src/element/substitution/statement.js +20 -52
- package/src/element/substitution.js +3 -3
- package/src/element/term.js +10 -9
- package/src/element/{axiom.js → topLevelAssertion/axiom.js} +41 -41
- package/src/element/{conjecture.js → topLevelAssertion/conjecture.js} +4 -4
- package/src/element/{lemma.js → topLevelAssertion/lemma.js} +3 -3
- package/src/element/{theorem.js → topLevelAssertion/theorem.js} +4 -4
- package/src/element/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +30 -49
- package/src/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +4 -4
- package/src/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +4 -4
- package/src/element/{metaLemmaMetatheorem.js → topLevelMetaAssertion.js} +7 -72
- package/src/element/type.js +2 -4
- package/src/element/variable.js +17 -17
- package/src/metaTypes.js +42 -13
- package/src/node/proofAssertion/premise.js +16 -0
- package/src/node/{step.js → proofAssertion/step.js} +4 -18
- package/src/node/proofAssertion/supposition.js +16 -0
- package/src/node/proofAssertion.js +23 -0
- package/src/node/statement.js +1 -1
- package/src/node/subDerivation.js +0 -7
- package/src/node/subproof.js +0 -7
- package/src/node/substitution/statement.js +1 -1
- package/src/node/topLevelAssertion/axiom.js +13 -0
- package/src/node/topLevelAssertion/conjecture.js +13 -0
- package/src/node/topLevelAssertion/lemma.js +13 -0
- package/src/node/topLevelAssertion/theorem.js +13 -0
- package/src/node/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +1 -1
- package/src/node/topLevelMetaAssertion/metaLemma.js +13 -0
- package/src/node/topLevelMetaAssertion/metatheorem.js +13 -0
- package/src/node/{metaLemmaMetaTheorem.js → topLevelMetaAssertion.js} +1 -1
- package/src/nonTerminalNodeMap.js +12 -12
- package/src/preamble.js +9 -9
- package/src/process/instantiate.js +31 -32
- package/src/process/unify.js +6 -5
- package/src/types.js +4 -2
- package/src/utilities/bnf.js +3 -2
- package/src/utilities/brackets.js +5 -8
- package/src/utilities/context.js +20 -0
- package/src/utilities/element.js +169 -162
- package/src/utilities/fragment.js +11 -0
- package/src/utilities/instance.js +19 -24
- package/src/utilities/json.js +3 -1
- package/src/utilities/string.js +57 -32
- package/src/utilities/unification.js +39 -39
- package/src/utilities/validation.js +26 -35
- package/lib/context/local.js +0 -605
- package/lib/context/temporary.js +0 -752
- package/lib/element/axiom.js +0 -329
- package/lib/element/axiomLemmaTheoremConjecture.js +0 -434
- package/lib/element/metaLemmaMetatheorem.js +0 -322
- package/lib/element/premise.js +0 -380
- package/lib/element/step.js +0 -390
- package/lib/element/supposition.js +0 -410
- package/lib/node/step.js +0 -166
- package/lib/node/supposition.js +0 -130
- package/src/node/axiom.js +0 -13
- package/src/node/conjecture.js +0 -13
- package/src/node/lemma.js +0 -13
- package/src/node/metaLemma.js +0 -13
- package/src/node/metatheorem.js +0 -13
- package/src/node/premise.js +0 -30
- package/src/node/supposition.js +0 -30
- package/src/node/theorem.js +0 -13
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import TopLevelAssertionNode from "../../node/topLevelAssertion";
|
|
4
|
+
|
|
5
|
+
import { CONJECTURE_BODY_RULE_NAME, CONJECTURE_HEADER_RULE_NAME } from "../../ruleNames";
|
|
6
|
+
|
|
7
|
+
export default class ConjectureNode extends TopLevelAssertionNode {
|
|
8
|
+
static bodyRuleName = CONJECTURE_BODY_RULE_NAME;
|
|
9
|
+
|
|
10
|
+
static headerRuleName = CONJECTURE_HEADER_RULE_NAME;
|
|
11
|
+
|
|
12
|
+
static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return TopLevelAssertionNode.fromRuleNameChildNodesOpacityAndPrecedence(ConjectureNode, ruleName, childNodes, opacity, precedence); }
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import TopLevelAssertionNode from "../../node/topLevelAssertion";
|
|
4
|
+
|
|
5
|
+
import { LEMMA_BODY_RULE_NAME, LEMMA_HEADER_RULE_NAME } from "../../ruleNames";
|
|
6
|
+
|
|
7
|
+
export default class LemmaNode extends TopLevelAssertionNode {
|
|
8
|
+
static bodyRuleName = LEMMA_BODY_RULE_NAME;
|
|
9
|
+
|
|
10
|
+
static headerRuleName = LEMMA_HEADER_RULE_NAME;
|
|
11
|
+
|
|
12
|
+
static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return TopLevelAssertionNode.fromRuleNameChildNodesOpacityAndPrecedence(LemmaNode, ruleName, childNodes, opacity, precedence); }
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import TopLevelAssertionNode from "../../node/topLevelAssertion";
|
|
4
|
+
|
|
5
|
+
import { THEOREM_BODY_RULE_NAME, THEOREM_HEADER_RULE_NAME } from "../../ruleNames";
|
|
6
|
+
|
|
7
|
+
export default class TheoremNode extends TopLevelAssertionNode {
|
|
8
|
+
static bodyRuleName = THEOREM_BODY_RULE_NAME;
|
|
9
|
+
|
|
10
|
+
static headerRuleName = THEOREM_HEADER_RULE_NAME;
|
|
11
|
+
|
|
12
|
+
static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return TopLevelAssertionNode.fromRuleNameChildNodesOpacityAndPrecedence(TheoremNode, ruleName, childNodes, opacity, precedence); }
|
|
13
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import NonTerminalNode from "../nonTerminalNode";
|
|
4
4
|
|
|
5
|
-
export default class
|
|
5
|
+
export default class TopLevelAssertionNode extends NonTerminalNode {
|
|
6
6
|
getBodyNode() {
|
|
7
7
|
const { bodyRuleName } = this.constructor,
|
|
8
8
|
ruleName = bodyRuleName, ///
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import TopLevelMetaAssertionNode from "../../node/topLevelMetaAssertion";
|
|
4
|
+
|
|
5
|
+
import { META_LEMMA_BODY_RULE_NAME, META_LEMMA_HEADER_RULE_NAME } from "../../ruleNames";
|
|
6
|
+
|
|
7
|
+
export default class MetaLemmaNode extends TopLevelMetaAssertionNode {
|
|
8
|
+
static bodyRuleName = META_LEMMA_BODY_RULE_NAME;
|
|
9
|
+
|
|
10
|
+
static headerRuleName = META_LEMMA_HEADER_RULE_NAME;
|
|
11
|
+
|
|
12
|
+
static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return TopLevelMetaAssertionNode.fromRuleNameChildNodesOpacityAndPrecedence(MetaLemmaNode, ruleName, childNodes, opacity, precedence); }
|
|
13
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import TopLevelMetaAssertionNode from "../../node/topLevelMetaAssertion";
|
|
4
|
+
|
|
5
|
+
import { METATHEOREM_BODY_RULE_NAME, METATHEOREM_HEADER_RULE_NAME } from "../../ruleNames";
|
|
6
|
+
|
|
7
|
+
export default class MetatheoremNode extends TopLevelMetaAssertionNode {
|
|
8
|
+
static bodyRuleName = METATHEOREM_BODY_RULE_NAME;
|
|
9
|
+
|
|
10
|
+
static headerRuleName = METATHEOREM_HEADER_RULE_NAME;
|
|
11
|
+
|
|
12
|
+
static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return TopLevelMetaAssertionNode.fromRuleNameChildNodesOpacityAndPrecedence(MetatheoremNode, ruleName, childNodes, opacity, precedence); }
|
|
13
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import NonTerminalNode from "../nonTerminalNode";
|
|
4
4
|
|
|
5
|
-
export default class
|
|
5
|
+
export default class TopLevelMetaAssertionNode extends NonTerminalNode {
|
|
6
6
|
getBodyNode() {
|
|
7
7
|
const { bodyRuleName } = this.constructor,
|
|
8
8
|
ruleName = bodyRuleName, ///
|
|
@@ -2,32 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
import TermNode from "./node/term";
|
|
4
4
|
import RuleNode from "./node/rule";
|
|
5
|
-
import StepNode from "./node/step";
|
|
5
|
+
import StepNode from "./node/proofAssertion/step";
|
|
6
6
|
import TypeNode from "./node/type";
|
|
7
7
|
import TypesNode from "./node/types";
|
|
8
8
|
import ErrorNode from "./node/error";
|
|
9
9
|
import FrameNode from "./node/frame";
|
|
10
|
-
import AxiomNode from "./node/axiom";
|
|
11
|
-
import LemmaNode from "./node/lemma";
|
|
10
|
+
import AxiomNode from "./node/topLevelAssertion/axiom";
|
|
11
|
+
import LemmaNode from "./node/topLevelAssertion/lemma";
|
|
12
12
|
import ProofNode from "./node/proof";
|
|
13
13
|
import LabelNode from "./node/label";
|
|
14
14
|
import LabelsNode from "./node/labels";
|
|
15
15
|
import SectionNode from "./node/section";
|
|
16
|
-
import PremiseNode from "./node/premise";
|
|
17
|
-
import TheoremNode from "./node/theorem";
|
|
16
|
+
import PremiseNode from "./node/proofAssertion/premise";
|
|
17
|
+
import TheoremNode from "./node/topLevelAssertion/theorem";
|
|
18
18
|
import ArgumentNode from "./node/argument";
|
|
19
19
|
import SubproofNode from "./node/subproof";
|
|
20
20
|
import PropertyNode from "./node/property";
|
|
21
21
|
import MetaTypeNode from "./node/metaType";
|
|
22
22
|
import EqualityNode from "./node/equality";
|
|
23
23
|
import VariableNode from "./node/variable";
|
|
24
|
-
import RuleBodyNode from "./node/body/rule";
|
|
25
24
|
import DocumentNode from "./node/document";
|
|
25
|
+
import RuleBodyNode from "./node/body/rule";
|
|
26
26
|
import StatementNode from "./node/statement";
|
|
27
27
|
import ReferenceNode from "./node/reference";
|
|
28
28
|
import DeductionNode from "./node/deduction";
|
|
29
29
|
import JudgementNode from "./node/judgement";
|
|
30
|
-
import MetaLemmaNode from "./node/metaLemma";
|
|
30
|
+
import MetaLemmaNode from "./node/topLevelMetaAssertion/metaLemma";
|
|
31
31
|
import ParameterNode from "./node/parameter";
|
|
32
32
|
import SignatureNode from "./node/signature";
|
|
33
33
|
import AxiomBodyNode from "./node/body/axiom";
|
|
@@ -35,19 +35,19 @@ import LemmaBodyNode from "./node/body/lemma";
|
|
|
35
35
|
import DerivationNode from "./node/derivation";
|
|
36
36
|
import CombinatorNode from "./node/combinator";
|
|
37
37
|
import ConclusionNode from "./node/conclusion";
|
|
38
|
-
import ConjectureNode from "./node/conjecture";
|
|
38
|
+
import ConjectureNode from "./node/topLevelAssertion/conjecture";
|
|
39
39
|
import HypothesisNode from "./node/hypothesis";
|
|
40
40
|
import TypePrefixNode from "./node/typePrefix";
|
|
41
41
|
import AssumptionNode from "./node/assumption";
|
|
42
42
|
import RuleHeaderNode from "./node/header/rule";
|
|
43
|
-
import SuppositionNode from "./node/supposition";
|
|
43
|
+
import SuppositionNode from "./node/proofAssertion/supposition";
|
|
44
44
|
import PlaceholderNode from "./node/placeholder";
|
|
45
45
|
import ConstructorNode from "./node/constructor";
|
|
46
|
+
import MetatheoremNode from "./node/topLevelMetaAssertion/metatheorem";
|
|
47
|
+
import EquivalenceNode from "./node/equivalence";
|
|
46
48
|
import TheoremBodyNode from "./node/body/theorem";
|
|
47
49
|
import AxiomHeaderNode from "./node/header/axiom";
|
|
48
50
|
import LemmaHeaderNode from "./node/header/lemma";
|
|
49
|
-
import MetatheoremNode from "./node/metatheorem";
|
|
50
|
-
import EquivalenceNode from "./node/equivalence";
|
|
51
51
|
import EquivalencesNode from "./node/equivalences";
|
|
52
52
|
import MetaArgumentNode from "./node/metaArgument";
|
|
53
53
|
import MetavariableNode from "./node/metavariable";
|
|
@@ -68,8 +68,8 @@ import MetatheoremHeaderNode from "./node/header/metatheorem";
|
|
|
68
68
|
import PropertyAssertionNode from "./node/assertion/property";
|
|
69
69
|
import SubproofAssertionNode from "./node/assertion/subproof";
|
|
70
70
|
import FrameSubstitutionNode from "./node/substitution/frame";
|
|
71
|
-
import ProcedureReferenceNode from "./node/procedureReference";
|
|
72
71
|
import ParenthesisedLabelNode from "./node/parenthesisedLabel";
|
|
72
|
+
import ProcedureReferenceNode from "./node/procedureReference";
|
|
73
73
|
import ContainedAssertionNode from "./node/assertion/contained";
|
|
74
74
|
import SatisfiesAssertionNode from "./node/assertion/satisfies";
|
|
75
75
|
import ParenthesisedLabelsNode from "./node/parenthesisedLabels"
|
package/src/preamble.js
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
import Type from "./element/type";
|
|
4
4
|
import Term from "./element/term";
|
|
5
5
|
import Rule from "./element/rule";
|
|
6
|
-
import Step from "./element/step";
|
|
6
|
+
import Step from "./element/proofAssertion/step";
|
|
7
7
|
import Label from "./element/label";
|
|
8
|
-
import Axiom from "./element/axiom";
|
|
9
|
-
import Lemma from "./element/lemma";
|
|
8
|
+
import Axiom from "./element/topLevelAssertion/axiom";
|
|
9
|
+
import Lemma from "./element/topLevelAssertion/lemma";
|
|
10
10
|
import Frame from "./element/frame";
|
|
11
11
|
import Proof from "./element/proof";
|
|
12
12
|
import Error from "./element/error";
|
|
13
|
-
import Premise from "./element/premise";
|
|
14
|
-
import Theorem from "./element/theorem";
|
|
13
|
+
import Premise from "./element/proofAssertion/premise";
|
|
14
|
+
import Theorem from "./element/topLevelAssertion/theorem";
|
|
15
15
|
import Section from "./element/section";
|
|
16
16
|
import Equality from "./element/equality";
|
|
17
17
|
import MetaType from "./element/metaType";
|
|
@@ -22,19 +22,19 @@ import Parameter from "./element/parameter";
|
|
|
22
22
|
import Reference from "./element/reference";
|
|
23
23
|
import Statement from "./element/statement";
|
|
24
24
|
import Judgement from "./element/judgement";
|
|
25
|
-
import MetaLemma from "./element/metaLemma";
|
|
25
|
+
import MetaLemma from "./element/topLevelMetaAssertion/metaLemma";
|
|
26
26
|
import Deduction from "./element/deduction";
|
|
27
27
|
import Signature from "./element/signature";
|
|
28
28
|
import TypePrefix from "./element/typePrefix";
|
|
29
|
-
import Conjecture from "./element/conjecture";
|
|
29
|
+
import Conjecture from "./element/topLevelAssertion/conjecture";
|
|
30
30
|
import Conclusion from "./element/conclusion";
|
|
31
31
|
import Derivation from "./element/derivation";
|
|
32
32
|
import Hypothesis from "./element/hypothesis";
|
|
33
33
|
import Assumption from "./element/assumption";
|
|
34
34
|
import Combinator from "./element/combinator";
|
|
35
35
|
import Constructor from "./element/constructor";
|
|
36
|
-
import Supposition from "./element/supposition";
|
|
37
|
-
import Metatheorem from "./element/metatheorem";
|
|
36
|
+
import Supposition from "./element/proofAssertion/supposition";
|
|
37
|
+
import Metatheorem from "./element/topLevelMetaAssertion/metatheorem";
|
|
38
38
|
import Equivalence from "./element/equivalence";
|
|
39
39
|
import Equivalences from "./element/equivalences";
|
|
40
40
|
import Metavariable from "./element/metavariable";
|
|
@@ -1,38 +1,34 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
statementSubstitutionPlaceholderRule = ruleFromBNF(statementSubstitutionPlaceholderBNF),
|
|
30
|
-
referenceSubstitutionPlaceholderRule = ruleFromBNF(referenceSubstitutionPlaceholderBNF);
|
|
3
|
+
import { ruleFromRuleName } from "../utilities/bnf";
|
|
4
|
+
import { TERM_RULE_NAME,
|
|
5
|
+
VARIABLE_RULE_NAME,
|
|
6
|
+
REFERENCE_RULE_NAME,
|
|
7
|
+
STATEMENT_RULE_NAME,
|
|
8
|
+
COMBINATOR_RULE_NAME,
|
|
9
|
+
CONSTRUCTOR_RULE_NAME,
|
|
10
|
+
EQUIVALENCE_RULE_NAME,
|
|
11
|
+
METAVARIABLE_RULE_NAME,
|
|
12
|
+
TERM_SUBSTITUTION_RULE_NAME,
|
|
13
|
+
FRAME_SUBSTITUTION_RULE_NAME,
|
|
14
|
+
STATEMENT_SUBSTITUTION_RULE_NAME,
|
|
15
|
+
REFERENCE_SUBSTITUTION_RULE_NAME } from "../ruleNames";
|
|
16
|
+
|
|
17
|
+
const termPlaceholderRule = ruleFromRuleName(TERM_RULE_NAME),
|
|
18
|
+
variablePlaceholderRule = ruleFromRuleName(VARIABLE_RULE_NAME),
|
|
19
|
+
referencePlaceholderRule = ruleFromRuleName(REFERENCE_RULE_NAME),
|
|
20
|
+
statementPlaceholderRule = ruleFromRuleName(STATEMENT_RULE_NAME),
|
|
21
|
+
combinatorPlaceholderRule = ruleFromRuleName(COMBINATOR_RULE_NAME),
|
|
22
|
+
constructorPlaceholderRule = ruleFromRuleName(CONSTRUCTOR_RULE_NAME),
|
|
23
|
+
equivalencePlaceholderRule = ruleFromRuleName(EQUIVALENCE_RULE_NAME),
|
|
24
|
+
metavariablePlaceholderRule = ruleFromRuleName(METAVARIABLE_RULE_NAME),
|
|
25
|
+
termSubstitutionPlaceholderRule = ruleFromRuleName(TERM_SUBSTITUTION_RULE_NAME),
|
|
26
|
+
frameSubstitutionPlaceholderRule = ruleFromRuleName(FRAME_SUBSTITUTION_RULE_NAME),
|
|
27
|
+
statementSubstitutionPlaceholderRule = ruleFromRuleName(STATEMENT_SUBSTITUTION_RULE_NAME),
|
|
28
|
+
referenceSubstitutionPlaceholderRule = ruleFromRuleName(REFERENCE_SUBSTITUTION_RULE_NAME);
|
|
31
29
|
|
|
32
30
|
export function instantiateTerm(string, context) { return instantiate(termPlaceholderRule, string, context); }
|
|
33
31
|
|
|
34
|
-
export function instantiateStep(string, context) { return instantiate(stepPlaceholderRule, string, context); }
|
|
35
|
-
|
|
36
32
|
export function instantiateVariable(string, context) { return instantiate(variablePlaceholderRule, string, context); }
|
|
37
33
|
|
|
38
34
|
export function instantiateReference(string, context) { return instantiate(referencePlaceholderRule, string, context); }
|
|
@@ -62,8 +58,11 @@ function instantiate(placeholderRule, string, context) {
|
|
|
62
58
|
parser = context.getParser(),
|
|
63
59
|
content = `${string}
|
|
64
60
|
`,
|
|
65
|
-
tokens = lexer.tokenise(content)
|
|
66
|
-
|
|
61
|
+
tokens = lexer.tokenise(content);
|
|
62
|
+
|
|
63
|
+
context.setTokens(tokens);
|
|
64
|
+
|
|
65
|
+
const startRule = placeholderRule; ///
|
|
67
66
|
|
|
68
67
|
node = parser.parse(tokens, startRule);
|
|
69
68
|
|
package/src/process/unify.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { nodeQuery } from "../utilities/query";
|
|
4
|
+
import { findMetaTypeByMetaTypeName } from "../metaTypes";
|
|
4
5
|
import { termFromTermNode, frameFromFrameNode, statementFromStatementNode } from "../utilities/element";
|
|
5
6
|
import { terminalNodeMapFromNodes, areTerminalNodeMapsEqual, isLastRemainingArgumentFunction } from "../utilities/pass";
|
|
6
7
|
|
|
@@ -344,7 +345,7 @@ class CombinatorPass extends Pass {
|
|
|
344
345
|
context = generalContext; ///
|
|
345
346
|
|
|
346
347
|
const metaTypeName = metaTypeNode.getMetaTypeName(),
|
|
347
|
-
metaType =
|
|
348
|
+
metaType = findMetaTypeByMetaTypeName(metaTypeName);
|
|
348
349
|
|
|
349
350
|
context = specificContext; ///
|
|
350
351
|
|
|
@@ -372,7 +373,7 @@ class CombinatorPass extends Pass {
|
|
|
372
373
|
context = generalContext; ///
|
|
373
374
|
|
|
374
375
|
const metaTypeName = metaTypeNode.getMetaTypeName(),
|
|
375
|
-
metaType =
|
|
376
|
+
metaType = findMetaTypeByMetaTypeName(metaTypeName);
|
|
376
377
|
|
|
377
378
|
context = specificContext; ///
|
|
378
379
|
|
|
@@ -406,7 +407,7 @@ class CombinatorPass extends Pass {
|
|
|
406
407
|
context = specificContext; ///
|
|
407
408
|
|
|
408
409
|
const term = termFromTermNode(termNode, context),
|
|
409
|
-
termValidatesGivenType = term.validateGivenType(type,
|
|
410
|
+
termValidatesGivenType = term.validateGivenType(type, context);
|
|
410
411
|
|
|
411
412
|
if (termValidatesGivenType) {
|
|
412
413
|
success = true;
|
|
@@ -441,7 +442,7 @@ class ConstructorPass extends Pass {
|
|
|
441
442
|
context = specificContext; ///
|
|
442
443
|
|
|
443
444
|
const term = termFromTermNode(termNode, context),
|
|
444
|
-
termValidatesGivenType = term.validateGivenType(type,
|
|
445
|
+
termValidatesGivenType = term.validateGivenType(type, context);
|
|
445
446
|
|
|
446
447
|
if (termValidatesGivenType) {
|
|
447
448
|
success = true;
|
|
@@ -468,7 +469,7 @@ class MetavariablePass extends Pass {
|
|
|
468
469
|
type = generalContext.findTypeByNominalTypeName(nominalTypeName),
|
|
469
470
|
context = specificContext, ///
|
|
470
471
|
term = context.findTermByTermNode(termNode),
|
|
471
|
-
termValidatesGivenType = term.validateGivenType(type,
|
|
472
|
+
termValidatesGivenType = term.validateGivenType(type, context);
|
|
472
473
|
|
|
473
474
|
if (termValidatesGivenType) {
|
|
474
475
|
success = true;
|
package/src/types.js
CHANGED
|
@@ -9,9 +9,11 @@ let baseType = null;
|
|
|
9
9
|
export function baseTypeFromNothing() {
|
|
10
10
|
if (baseType === null) {
|
|
11
11
|
const { Type } = elements,
|
|
12
|
-
name = BASE_TYPE_SYMBOL
|
|
12
|
+
name = BASE_TYPE_SYMBOL, ///
|
|
13
|
+
context = null,
|
|
14
|
+
provisional = false;
|
|
13
15
|
|
|
14
|
-
baseType = Type.
|
|
16
|
+
baseType = Type.fromNameAndProvisional(name, provisional, context);
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
return baseType;
|
package/src/utilities/bnf.js
CHANGED
|
@@ -9,8 +9,9 @@ const { first } = arrayUtilities;
|
|
|
9
9
|
const bnfLexer = BNFLexer.fromNothing(),
|
|
10
10
|
bnfParser = BNFParser.fromNothing();
|
|
11
11
|
|
|
12
|
-
export function
|
|
13
|
-
const
|
|
12
|
+
export function ruleFromRuleName(ruleName) {
|
|
13
|
+
const bnf = ` _ ::= ${ruleName}... <END_OF_LINE> ; `,
|
|
14
|
+
tokens = bnfLexer.tokensFromBNF(bnf),
|
|
14
15
|
rules = bnfParser.rulesFromTokens(tokens),
|
|
15
16
|
firstRule = first(rules),
|
|
16
17
|
rule = firstRule; ///
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
3
|
+
import { termFromTermNode, statementFromStatementNode } from "../utilities/element";
|
|
5
4
|
import { BRACKETED_TERM_DEPTH, BRACKETED_STATEMENT_DEPTH } from "../constants";
|
|
6
5
|
import { bracketedConstructorFromNothing, bracketedCombinatorFromNothing } from "../utilities/instance";
|
|
7
6
|
|
|
@@ -10,10 +9,9 @@ export function stripBracketsFromTerm(term, context) {
|
|
|
10
9
|
bracketedTermChildNode = bracketedTermChildNodeFromTermNode(termNode);
|
|
11
10
|
|
|
12
11
|
if (bracketedTermChildNode !== null) {
|
|
13
|
-
const
|
|
14
|
-
termNode = bracketedTermChildNode; ///
|
|
12
|
+
const termNode = bracketedTermChildNode; ///
|
|
15
13
|
|
|
16
|
-
term =
|
|
14
|
+
term = termFromTermNode(termNode, context);
|
|
17
15
|
}
|
|
18
16
|
|
|
19
17
|
return term;
|
|
@@ -34,10 +32,9 @@ export function stripBracketsFromStatement(statement, context) {
|
|
|
34
32
|
bracketedStatementChildNode = bracketedStatementChildNodeFromStatementNode(statementNode);
|
|
35
33
|
|
|
36
34
|
if (bracketedStatementChildNode !== null) {
|
|
37
|
-
const
|
|
38
|
-
statementNode = bracketedStatementChildNode; ///
|
|
35
|
+
const statementNode = bracketedStatementChildNode; ///
|
|
39
36
|
|
|
40
|
-
statement =
|
|
37
|
+
statement = statementFromStatementNode(statementNode, context);
|
|
41
38
|
}
|
|
42
39
|
|
|
43
40
|
return statement;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { FUNCTION } from "../constants";
|
|
4
|
+
|
|
5
|
+
export function chainContext(context) {
|
|
6
|
+
return new Proxy(context, {
|
|
7
|
+
get: (instance, name, receiver) => {
|
|
8
|
+
if (name in instance) {
|
|
9
|
+
return Reflect.get(instance, name, receiver);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const context = instance.context,
|
|
13
|
+
value = context[name];
|
|
14
|
+
|
|
15
|
+
return (typeof value === FUNCTION) ?
|
|
16
|
+
value.bind(context) :
|
|
17
|
+
value;
|
|
18
|
+
}
|
|
19
|
+
});
|
|
20
|
+
}
|