occam-verify-cli 1.0.192 → 1.0.199
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.js +3 -3
- package/lib/dom/assertion/contained.js +12 -24
- package/lib/dom/assertion/defined.js +9 -21
- package/lib/dom/assertion/property.js +7 -7
- package/lib/dom/assertion/satisfies.js +6 -8
- package/lib/dom/declaration/complexType.js +3 -3
- package/lib/dom/declaration/constructor.js +6 -6
- package/lib/dom/declaration/variable.js +6 -6
- package/lib/dom/declaration.js +13 -13
- package/lib/dom/frame.js +7 -7
- package/lib/dom/judgement.js +7 -7
- package/lib/dom/propertyRelation.js +7 -7
- package/lib/dom/term.js +1 -3
- package/lib/dom/topLevelMetaAssertion.js +77 -131
- package/lib/dom/type.js +2 -2
- package/lib/equivalence.js +4 -6
- package/lib/mixins/term/verify.js +4 -8
- package/lib/node/argument.js +116 -0
- package/lib/node/assertion/contained.js +31 -23
- package/lib/node/assertion/defined.js +30 -17
- package/lib/node/assertion/property.js +14 -19
- package/lib/node/assertion/satisfies.js +20 -13
- package/lib/node/assertion/subproof.js +11 -11
- package/lib/node/assertion/type.js +12 -17
- package/lib/node/combinator.js +9 -4
- package/lib/node/conclusion.js +11 -11
- package/lib/node/constructor.js +9 -4
- package/lib/node/declaration/combinator.js +11 -11
- package/lib/node/declaration/complexType.js +38 -34
- package/lib/node/declaration/constructor.js +24 -29
- package/lib/node/declaration/metavariable.js +12 -17
- package/lib/node/declaration/property.js +19 -24
- package/lib/node/declaration/type.js +41 -28
- package/lib/node/declaration/variable.js +12 -17
- package/lib/node/declaration.js +12 -17
- package/lib/node/deduction.js +11 -11
- package/lib/node/derivation.js +39 -11
- package/lib/node/equality.js +21 -18
- package/lib/node/error.js +9 -4
- package/lib/node/frame.js +13 -30
- package/lib/node/judgement.js +13 -18
- package/lib/node/label.js +11 -11
- package/lib/node/labels.js +11 -11
- package/lib/node/metaArgument.js +116 -0
- package/lib/node/metaType.js +9 -8
- package/lib/node/metavariable.js +12 -17
- package/lib/node/nonTerminal.js +218 -0
- package/lib/node/parameter.js +9 -4
- package/lib/node/parenthesisedLabel.js +116 -0
- package/lib/node/parenthesisedLabels.js +11 -11
- package/lib/node/premise.js +12 -17
- package/lib/node/procedureCall.js +12 -17
- package/lib/node/proof.js +11 -11
- package/lib/node/property.js +9 -4
- package/lib/node/propertyRelation.js +12 -17
- package/lib/node/reference.js +11 -11
- package/lib/node/rule.js +44 -7
- package/lib/node/statement.js +92 -53
- package/lib/node/step.js +12 -17
- package/lib/node/subDerivation.js +46 -11
- package/lib/node/subproof.js +19 -17
- package/lib/node/substitution/frame.js +123 -0
- package/lib/node/substitution/reference.js +123 -0
- package/lib/node/substitution/statement.js +123 -0
- package/lib/node/substitution/term.js +123 -0
- package/lib/node/supposition.js +12 -17
- package/lib/node/term.js +22 -33
- package/lib/node/topLevelAssertion.js +14 -29
- package/lib/node/topLevelMetaAssertion.js +26 -41
- package/lib/node/type.js +9 -4
- package/lib/node/types.js +116 -0
- package/lib/node/variable.js +9 -4
- package/lib/nonTerminalNodeMap.js +11 -3
- package/lib/ruleNames.js +33 -1
- package/lib/substitution/frame.js +5 -7
- package/lib/substitution/reference.js +5 -7
- package/lib/substitution/term.js +5 -7
- package/lib/unifier/metaLevel.js +4 -4
- package/lib/utilities/brackets.js +5 -5
- package/lib/utilities/json.js +18 -1
- package/lib/utilities/node.js +1 -313
- package/lib/utilities/subproof.js +13 -4
- package/package.json +1 -1
- package/src/context/file.js +2 -2
- package/src/dom/assertion/contained.js +12 -34
- package/src/dom/assertion/defined.js +9 -30
- package/src/dom/assertion/property.js +6 -8
- package/src/dom/assertion/satisfies.js +5 -10
- package/src/dom/declaration/complexType.js +2 -2
- package/src/dom/declaration/constructor.js +6 -7
- package/src/dom/declaration/variable.js +6 -7
- package/src/dom/declaration.js +11 -15
- package/src/dom/frame.js +4 -6
- package/src/dom/judgement.js +6 -8
- package/src/dom/propertyRelation.js +6 -8
- package/src/dom/term.js +0 -3
- package/src/dom/topLevelMetaAssertion.js +83 -39
- package/src/dom/type.js +2 -2
- package/src/equivalence.js +3 -6
- package/src/mixins/term/verify.js +5 -11
- package/src/node/argument.js +16 -0
- package/src/node/assertion/contained.js +30 -22
- package/src/node/assertion/defined.js +28 -15
- package/src/node/assertion/property.js +7 -17
- package/src/node/assertion/satisfies.js +11 -9
- package/src/node/assertion/subproof.js +4 -9
- package/src/node/assertion/type.js +6 -16
- package/src/node/combinator.js +1 -1
- package/src/node/conclusion.js +4 -9
- package/src/node/constructor.js +1 -1
- package/src/node/declaration/combinator.js +4 -9
- package/src/node/declaration/complexType.js +31 -35
- package/src/node/declaration/constructor.js +16 -26
- package/src/node/declaration/metavariable.js +6 -16
- package/src/node/declaration/property.js +13 -23
- package/src/node/declaration/type.js +35 -29
- package/src/node/declaration/variable.js +6 -16
- package/src/node/declaration.js +6 -16
- package/src/node/deduction.js +4 -9
- package/src/node/derivation.js +7 -10
- package/src/node/equality.js +19 -18
- package/src/node/error.js +1 -1
- package/src/node/frame.js +8 -35
- package/src/node/judgement.js +7 -17
- package/src/node/label.js +4 -9
- package/src/node/labels.js +4 -9
- package/src/node/metaArgument.js +16 -0
- package/src/node/metaType.js +1 -5
- package/src/node/metavariable.js +6 -16
- package/src/node/nonTerminal.js +130 -0
- package/src/node/parameter.js +1 -1
- package/src/node/parenthesisedLabel.js +16 -0
- package/src/node/parenthesisedLabels.js +5 -10
- package/src/node/premise.js +6 -16
- package/src/node/procedureCall.js +6 -16
- package/src/node/proof.js +4 -9
- package/src/node/property.js +1 -1
- package/src/node/propertyRelation.js +7 -16
- package/src/node/reference.js +4 -9
- package/src/node/rule.js +40 -3
- package/src/node/statement.js +109 -66
- package/src/node/step.js +6 -16
- package/src/node/subDerivation.js +14 -10
- package/src/node/subproof.js +13 -16
- package/src/node/substitution/frame.js +23 -0
- package/src/node/substitution/reference.js +23 -0
- package/src/node/substitution/statement.js +23 -0
- package/src/node/substitution/term.js +23 -0
- package/src/node/supposition.js +6 -16
- package/src/node/term.js +15 -39
- package/src/node/topLevelAssertion.js +13 -33
- package/src/node/topLevelMetaAssertion.js +20 -39
- package/src/node/type.js +1 -1
- package/src/node/types.js +16 -0
- package/src/node/variable.js +1 -1
- package/src/nonTerminalNodeMap.js +60 -36
- package/src/ruleNames.js +8 -0
- package/src/substitution/frame.js +7 -10
- package/src/substitution/reference.js +7 -10
- package/src/substitution/term.js +7 -9
- package/src/unifier/metaLevel.js +2 -3
- package/src/utilities/brackets.js +8 -8
- package/src/utilities/json.js +19 -0
- package/src/utilities/node.js +0 -168
- package/src/utilities/subproof.js +22 -6
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import NonTerminalNode from "../../node/nonTerminal";
|
|
4
|
+
|
|
5
|
+
import { TERM_RULE_NAME } from "../../ruleNames";
|
|
6
|
+
|
|
7
|
+
export default class TermSubstitutionNode extends NonTerminalNode {
|
|
8
|
+
getLastTermNode() {
|
|
9
|
+
const ruleName = TERM_RULE_NAME,
|
|
10
|
+
lastTermNode = this.getLastNodeByRuleName(ruleName);
|
|
11
|
+
|
|
12
|
+
return lastTermNode;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
getFirstTermNode() {
|
|
16
|
+
const ruleName = TERM_RULE_NAME,
|
|
17
|
+
firstTermNode = this.getFirstNodeByRuleName(ruleName);
|
|
18
|
+
|
|
19
|
+
return firstTermNode;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(TermSubstitutionNode, ruleName, childNodes, opacity, precedence); }
|
|
23
|
+
}
|
package/src/node/supposition.js
CHANGED
|
@@ -1,30 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import NonTerminalNode from "../node/nonTerminal";
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { STATEMENT_RULE_NAME, PROCEDURE_CALL_RULE_NAME } from "../ruleNames";
|
|
6
6
|
|
|
7
7
|
export default class SuppositionNode extends NonTerminalNode {
|
|
8
8
|
getStatementNode() {
|
|
9
|
-
const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
if (childNodeStatementNode) {
|
|
13
|
-
return true;
|
|
14
|
-
}
|
|
15
|
-
}) || null;
|
|
9
|
+
const ruleName = STATEMENT_RULE_NAME,
|
|
10
|
+
statementNode = this.getNodeByRuleName(ruleName);
|
|
16
11
|
|
|
17
12
|
return statementNode;
|
|
18
13
|
}
|
|
19
14
|
|
|
20
15
|
getProcedureCallNode() {
|
|
21
|
-
const
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
if (childNodeProcedureCallNode) {
|
|
25
|
-
return true;
|
|
26
|
-
}
|
|
27
|
-
}) || null;
|
|
16
|
+
const ruleName = PROCEDURE_CALL_RULE_NAME,
|
|
17
|
+
procedureCallNode = this.getNodeByRuleName(ruleName);
|
|
28
18
|
|
|
29
19
|
return procedureCallNode;
|
|
30
20
|
}
|
package/src/node/term.js
CHANGED
|
@@ -1,21 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import { NonTerminalNode } from "occam-parsers";
|
|
3
|
+
import NonTerminalNode from "../node/nonTerminal";
|
|
5
4
|
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
const { first } = arrayUtilities;
|
|
5
|
+
import { ARGUMENT_RULE_NAME, VARIABLE_RULE_NAME } from "../ruleNames";
|
|
9
6
|
|
|
10
7
|
export default class TermNode extends NonTerminalNode {
|
|
11
8
|
getVariableNodes() {
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
if (descendantNodeVariableNode) {
|
|
16
|
-
return true;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
9
|
+
const ruleName = VARIABLE_RULE_NAME,
|
|
10
|
+
variableNodes = this.getNodesByRuleName(ruleName);
|
|
19
11
|
|
|
20
12
|
return variableNodes;
|
|
21
13
|
}
|
|
@@ -23,41 +15,25 @@ export default class TermNode extends NonTerminalNode {
|
|
|
23
15
|
getSingularTermNode() {
|
|
24
16
|
let singularTermNode = null;
|
|
25
17
|
|
|
26
|
-
const
|
|
27
|
-
const childNodeTermNode = isNodeTermNode(childNode);
|
|
28
|
-
|
|
29
|
-
if (!childNodeTermNode) {
|
|
30
|
-
return true;
|
|
31
|
-
}
|
|
32
|
-
}),
|
|
33
|
-
termNodesLength = termNodes.length;
|
|
18
|
+
const singularArgumentNode = this.getSingularArgumentNode();
|
|
34
19
|
|
|
35
|
-
if (
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
singularTermNode = firstTermNode; ///
|
|
20
|
+
if (singularArgumentNode !== null) {
|
|
21
|
+
singularTermNode = singularArgumentNode.getSingularTermNode();
|
|
39
22
|
}
|
|
40
23
|
|
|
41
24
|
return singularTermNode;
|
|
42
25
|
}
|
|
43
26
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const variableNodes = this.filterChildNode((childNode) => {
|
|
48
|
-
const childNodeVariableNode = isNodeVariableNode(childNode);
|
|
49
|
-
|
|
50
|
-
if (!childNodeVariableNode) {
|
|
51
|
-
return true;
|
|
52
|
-
}
|
|
53
|
-
}),
|
|
54
|
-
variableNodesLength = variableNodes.length;
|
|
27
|
+
getSingularArgumentNode() {
|
|
28
|
+
const ruleName = ARGUMENT_RULE_NAME,
|
|
29
|
+
singularArgumentNode = this.getSingularTNodeByRuleName(ruleName);
|
|
55
30
|
|
|
56
|
-
|
|
57
|
-
|
|
31
|
+
return singularArgumentNode;
|
|
32
|
+
}
|
|
58
33
|
|
|
59
|
-
|
|
60
|
-
|
|
34
|
+
getSingularVariableNode() {
|
|
35
|
+
const ruleName = VARIABLE_RULE_NAME,
|
|
36
|
+
singularVariableNode = this.getSingularTNodeByRuleName(ruleName);
|
|
61
37
|
|
|
62
38
|
return singularVariableNode;
|
|
63
39
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import NonTerminalNode from "../node/nonTerminal";
|
|
4
4
|
|
|
5
5
|
import { SATISFIABLE } from "../constants";
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
import { PROOF_RULE_NAME,
|
|
7
|
+
DEDUCTION_RULE_NAME,
|
|
8
|
+
SUPPOSITION_RULE_NAME,
|
|
9
|
+
PARENTHESISED_LABELS_RULE_NAME } from "../ruleNames";
|
|
10
10
|
|
|
11
11
|
export default class TopLevelAssertionNode extends NonTerminalNode {
|
|
12
12
|
isSatisfiable() {
|
|
@@ -42,49 +42,29 @@ export default class TopLevelAssertionNode extends NonTerminalNode {
|
|
|
42
42
|
}
|
|
43
43
|
|
|
44
44
|
getProofNode() {
|
|
45
|
-
const
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
if (childNOdeProofNode) {
|
|
49
|
-
return true;
|
|
50
|
-
}
|
|
51
|
-
}) || null;
|
|
45
|
+
const ruleName = PROOF_RULE_NAME,
|
|
46
|
+
proofNode = this.getNodeByRuleName(ruleName);
|
|
52
47
|
|
|
53
48
|
return proofNode;
|
|
54
49
|
}
|
|
55
50
|
|
|
56
51
|
getDeductionNode() {
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
if (childNOdeDeductionNode) {
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
63
|
-
}) || null;
|
|
52
|
+
const ruleName = DEDUCTION_RULE_NAME,
|
|
53
|
+
deductionNode = this.getNodeByRuleName(ruleName);
|
|
64
54
|
|
|
65
55
|
return deductionNode;
|
|
66
56
|
}
|
|
67
57
|
|
|
68
58
|
getSuppositionNodes() {
|
|
69
|
-
const
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if (childNodeSuppositionNode) {
|
|
73
|
-
return true;
|
|
74
|
-
}
|
|
75
|
-
});
|
|
59
|
+
const ruleName = SUPPOSITION_RULE_NAME,
|
|
60
|
+
suppositionNodes = this.getNodesByRuleName(ruleName);
|
|
76
61
|
|
|
77
62
|
return suppositionNodes;
|
|
78
63
|
}
|
|
79
64
|
|
|
80
65
|
getParenthesisedLabelsNode() {
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
if (childNodeParenthesisedLabelNode) {
|
|
85
|
-
return true;
|
|
86
|
-
}
|
|
87
|
-
}) || null;
|
|
66
|
+
const ruleName = PARENTHESISED_LABELS_RULE_NAME,
|
|
67
|
+
parenthesisedLabelsNode = this.getNodeByRuleName(ruleName);
|
|
88
68
|
|
|
89
69
|
return parenthesisedLabelsNode;
|
|
90
70
|
}
|
|
@@ -1,62 +1,43 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
3
|
+
import NonTerminalNode from "../node/nonTerminal";
|
|
4
|
+
|
|
5
|
+
import { PROOF_RULE_NAME, DEDUCTION_RULE_NAME, SUPPOSITION_RULE_NAME, PARENTHESISED_LABEL_RULE_NAME } from "../ruleNames";
|
|
5
6
|
|
|
6
7
|
export default class TopLevelMetaAssertionNode extends NonTerminalNode {
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
labelNodes =
|
|
8
|
+
getLabelNode() {
|
|
9
|
+
const parenthesisedLabelNode = this.getParenthesisedLabelNode(),
|
|
10
|
+
labelNodes = parenthesisedLabelNode.getLabelNode();
|
|
10
11
|
|
|
11
12
|
return labelNodes;
|
|
12
13
|
}
|
|
13
14
|
|
|
14
15
|
getProofNode() {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
if (childNOdeProofNode) {
|
|
19
|
-
return true;
|
|
20
|
-
}
|
|
21
|
-
}) || null;
|
|
16
|
+
const ruleName = PROOF_RULE_NAME,
|
|
17
|
+
proofNode = this.getNodeByRuleName(ruleName);
|
|
22
18
|
|
|
23
19
|
return proofNode;
|
|
24
20
|
}
|
|
25
21
|
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
if (childNOdePremiseNode) {
|
|
31
|
-
return true;
|
|
32
|
-
}
|
|
33
|
-
}) || null;
|
|
22
|
+
getDeductionNode() {
|
|
23
|
+
const ruleName = DEDUCTION_RULE_NAME,
|
|
24
|
+
deductionNode = this.getNodeByRuleName(ruleName);
|
|
34
25
|
|
|
35
|
-
return
|
|
26
|
+
return deductionNode;
|
|
36
27
|
}
|
|
37
28
|
|
|
38
|
-
|
|
39
|
-
const
|
|
40
|
-
|
|
29
|
+
getSuppositionNodes() {
|
|
30
|
+
const ruleName = SUPPOSITION_RULE_NAME,
|
|
31
|
+
suppositionNodes = this.getNodesByRuleName(ruleName);
|
|
41
32
|
|
|
42
|
-
|
|
43
|
-
return true;
|
|
44
|
-
}
|
|
45
|
-
}) || null;
|
|
46
|
-
|
|
47
|
-
return conclusionNode;
|
|
33
|
+
return suppositionNodes;
|
|
48
34
|
}
|
|
49
35
|
|
|
50
|
-
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if (childNodeParenthesisedLabelNode) {
|
|
55
|
-
return true;
|
|
56
|
-
}
|
|
57
|
-
}) || null;
|
|
36
|
+
getParenthesisedLabelNode() {
|
|
37
|
+
const ruleName = PARENTHESISED_LABEL_RULE_NAME,
|
|
38
|
+
parenthesisedLabelNode = this.getNodeByRuleName(ruleName);
|
|
58
39
|
|
|
59
|
-
return
|
|
40
|
+
return parenthesisedLabelNode;
|
|
60
41
|
}
|
|
61
42
|
|
|
62
43
|
static fromRuleNameChildNodesOpacityAndPrecedence(Class, ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(Class, ruleName, childNodes, opacity, precedence); }
|
package/src/node/type.js
CHANGED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import NonTerminalNode from "../node/nonTerminal";
|
|
4
|
+
|
|
5
|
+
import { TYPE_RULE_NAME } from "../ruleNames";
|
|
6
|
+
|
|
7
|
+
export default class TypesNode extends NonTerminalNode {
|
|
8
|
+
getTypeNodes() {
|
|
9
|
+
const ruleName = TYPE_RULE_NAME,
|
|
10
|
+
typeNodes = this.getNodesByRuleName(ruleName);
|
|
11
|
+
|
|
12
|
+
return typeNodes;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(TypesNode, ruleName, childNodes, opacity, precedence); }
|
|
16
|
+
}
|
package/src/node/variable.js
CHANGED
|
@@ -1,51 +1,59 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import TermNode from "./node/term"
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import
|
|
34
|
-
import
|
|
35
|
-
import
|
|
36
|
-
import
|
|
37
|
-
import
|
|
3
|
+
import TermNode from "./node/term";
|
|
4
|
+
import RuleNode from "./node/rule";
|
|
5
|
+
import StepNode from "./node/step";
|
|
6
|
+
import TypeNode from "./node/type";
|
|
7
|
+
import TypesNode from "./node/types";
|
|
8
|
+
import ErrorNode from "./node/error";
|
|
9
|
+
import FrameNode from "./node/frame";
|
|
10
|
+
import AxiomNode from "./node/axiom";
|
|
11
|
+
import LemmaNode from "./node/lemma";
|
|
12
|
+
import ProofNode from "./node/proof";
|
|
13
|
+
import LabelNode from "./node/label";
|
|
14
|
+
import LabelsNode from "./node/labels";
|
|
15
|
+
import PremiseNode from "./node/premise";
|
|
16
|
+
import TheoremNode from "./node/theorem";
|
|
17
|
+
import ArgumentNode from "./node/argument";
|
|
18
|
+
import SubproofNode from "./node/subproof";
|
|
19
|
+
import PropertyNode from "./node/property";
|
|
20
|
+
import MetaTypeNode from "./node/metaType";
|
|
21
|
+
import EqualityNode from "./node/equality";
|
|
22
|
+
import VariableNode from "./node/variable";
|
|
23
|
+
import StatementNode from "./node/statement";
|
|
24
|
+
import ReferenceNode from "./node/reference";
|
|
25
|
+
import DeductionNode from "./node/deduction";
|
|
26
|
+
import JudgementNode from "./node/judgement";
|
|
27
|
+
import MetaLemmaNode from "./node/metaLemma";
|
|
28
|
+
import ParameterNode from "./node/parameter";
|
|
29
|
+
import DerivationNode from "./node/derivation";
|
|
30
|
+
import CombinatorNode from "./node/combinator";
|
|
31
|
+
import ConclusionNode from "./node/conclusion";
|
|
32
|
+
import ConjectureNode from "./node/conjecture";
|
|
33
|
+
import SuppositionNode from "./node/supposition";
|
|
34
|
+
import ConstructorNode from "./node/constructor";
|
|
35
|
+
import DeclarationNode from "./node/declaration";
|
|
36
|
+
import MetatheoremNode from "./node/metatheorem";
|
|
37
|
+
import MetaArgumentNode from "./node/metaArgument";
|
|
38
|
+
import MetavariableNode from "./node/metavariable";
|
|
39
|
+
import ProcedureCallNode from "./node/procedureCall";
|
|
40
|
+
import SubDerivationNode from "./node/subDerivation";
|
|
38
41
|
import TypeAssertionNode from "./node/assertion/type";
|
|
39
42
|
import typeDeclarationNode from "./node/declaration/type";
|
|
40
43
|
import PropertyRelationNode from "./node/propertyRelation"
|
|
41
44
|
import DefinedAssertionNode from "./node/assertion/defined";
|
|
45
|
+
import TermSubstitutionNode from "./node/substitution/term";
|
|
42
46
|
import PropertyAssertionNode from "./node/assertion/property";
|
|
43
47
|
import SubproofAssertionNode from "./node/assertion/subproof";
|
|
48
|
+
import FrameSubstitutionNode from "./node/substitution/frame";
|
|
49
|
+
import ParenthesisedLabelNode from "./node/parenthesisedLabel";
|
|
44
50
|
import ContainedAssertionNode from "./node/assertion/contained";
|
|
45
51
|
import SatisfiesAssertionNode from "./node/assertion/satisfies";
|
|
46
52
|
import ParenthesisedLabelsNode from "./node/parenthesisedLabels"
|
|
47
53
|
import PropertyDeclarationNode from "./node/declaration/property";
|
|
48
54
|
import variableDeclarationNode from "./node/declaration/variable";
|
|
55
|
+
import StatementSubstitutionNode from "./node/substitution/statement";
|
|
56
|
+
import ReferenceSubstitutionNode from "./node/substitution/reference";
|
|
49
57
|
import combinatorDeclarationNode from "./node/declaration/combinator";
|
|
50
58
|
import complexTypeDeclarationNode from "./node/declaration/complexType";
|
|
51
59
|
import constructorDeclarationNode from "./node/declaration/constructor";
|
|
@@ -55,6 +63,7 @@ import { RULE_RULE_NAME,
|
|
|
55
63
|
STEP_RULE_NAME,
|
|
56
64
|
TERM_RULE_NAME,
|
|
57
65
|
TYPE_RULE_NAME,
|
|
66
|
+
TYPES_RULE_NAME,
|
|
58
67
|
PROOF_RULE_NAME,
|
|
59
68
|
ERROR_RULE_NAME,
|
|
60
69
|
FRAME_RULE_NAME,
|
|
@@ -64,6 +73,7 @@ import { RULE_RULE_NAME,
|
|
|
64
73
|
LABELS_RULE_NAME,
|
|
65
74
|
THEOREM_RULE_NAME,
|
|
66
75
|
PREMISE_RULE_NAME,
|
|
76
|
+
ARGUMENT_RULE_NAME,
|
|
67
77
|
SUBPROOF_RULE_NAME,
|
|
68
78
|
PROPERTY_RULE_NAME,
|
|
69
79
|
EQUALITY_RULE_NAME,
|
|
@@ -84,19 +94,25 @@ import { RULE_RULE_NAME,
|
|
|
84
94
|
SUPPOSITION_RULE_NAME,
|
|
85
95
|
METATHEOREM_RULE_NAME,
|
|
86
96
|
METAVARIABLE_RULE_NAME,
|
|
97
|
+
META_ARGUMENT_RULE_NAME,
|
|
87
98
|
SUB_DERIVATION_RULE_NAME,
|
|
88
99
|
TYPE_ASSERTION_RULE_NAME,
|
|
89
100
|
PROCEDURE_CALL_RULE_NAME,
|
|
90
101
|
TYPE_DECLARATION_RULE_NAME,
|
|
91
102
|
PROPERTY_RELATION_RULE_NAME,
|
|
92
103
|
DEFINED_ASSERTION_RULE_NAME,
|
|
104
|
+
TERM_SUBSTITUTION_RULE_NAME,
|
|
93
105
|
SUBPROOF_ASSERTION_RULE_NAME,
|
|
94
106
|
PROPERTY_ASSERTION_RULE_NAME,
|
|
107
|
+
FRAME_SUBSTITUTION_RULE_NAME,
|
|
95
108
|
CONTAINED_ASSERTION_RULE_NAME,
|
|
96
109
|
SATISFIES_ASSERTION_RULE_NAME,
|
|
110
|
+
PARENTHESISED_LABEL_RULE_NAME,
|
|
97
111
|
PARENTHESISED_LABELS_RULE_NAME,
|
|
98
112
|
PROPERTY_DECLARATION_RULE_NAME,
|
|
99
113
|
VARIABLE_DECLARATION_RULE_NAME,
|
|
114
|
+
STATEMENT_SUBSTITUTION_RULE_NAME,
|
|
115
|
+
REFERENCE_SUBSTITUTION_RULE_NAME,
|
|
100
116
|
COMBINATOR_DECLARATION_RULE_NAME,
|
|
101
117
|
CONSTRUCTOR_DECLARATION_RULE_NAME,
|
|
102
118
|
COMPLEX_TYPE_DECLARATION_RULE_NAME,
|
|
@@ -107,6 +123,7 @@ const nonTerminalNodeMap = {
|
|
|
107
123
|
[STEP_RULE_NAME]: StepNode,
|
|
108
124
|
[TERM_RULE_NAME]: TermNode,
|
|
109
125
|
[TYPE_RULE_NAME]: TypeNode,
|
|
126
|
+
[TYPES_RULE_NAME]: TypesNode,
|
|
110
127
|
[ERROR_RULE_NAME]: ErrorNode,
|
|
111
128
|
[FRAME_RULE_NAME]: FrameNode,
|
|
112
129
|
[LEMMA_RULE_NAME]: LemmaNode,
|
|
@@ -116,6 +133,7 @@ const nonTerminalNodeMap = {
|
|
|
116
133
|
[LABELS_RULE_NAME]: LabelsNode,
|
|
117
134
|
[THEOREM_RULE_NAME]: TheoremNode,
|
|
118
135
|
[PREMISE_RULE_NAME]: PremiseNode,
|
|
136
|
+
[ARGUMENT_RULE_NAME]: ArgumentNode,
|
|
119
137
|
[PROPERTY_RULE_NAME]: PropertyNode,
|
|
120
138
|
[SUBPROOF_RULE_NAME]: SubproofNode,
|
|
121
139
|
[EQUALITY_RULE_NAME]: EqualityNode,
|
|
@@ -126,29 +144,35 @@ const nonTerminalNodeMap = {
|
|
|
126
144
|
[DEDUCTION_RULE_NAME]: DeductionNode,
|
|
127
145
|
[PARAMETER_RULE_NAME]: ParameterNode,
|
|
128
146
|
[STATEMENT_RULE_NAME]: StatementNode,
|
|
147
|
+
[META_LEMMA_RULE_NAME]: MetaLemmaNode,
|
|
129
148
|
[COMBINATOR_RULE_NAME]: CombinatorNode,
|
|
130
149
|
[CONCLUSION_RULE_NAME]: ConclusionNode,
|
|
131
150
|
[CONJECTURE_RULE_NAME]: ConjectureNode,
|
|
132
151
|
[DERIVATION_RULE_NAME]: DerivationNode,
|
|
133
|
-
[META_LEMMA_RULE_NAME]: MetaLemmaNode,
|
|
134
152
|
[SUPPOSITION_RULE_NAME]: SuppositionNode,
|
|
135
153
|
[CONSTRUCTOR_RULE_NAME]: ConstructorNode,
|
|
136
154
|
[DECLARATION_RULE_NAME]: DeclarationNode,
|
|
137
155
|
[METATHEOREM_RULE_NAME]: MetatheoremNode,
|
|
138
156
|
[METAVARIABLE_RULE_NAME]: MetavariableNode,
|
|
157
|
+
[META_ARGUMENT_RULE_NAME]: MetaArgumentNode,
|
|
139
158
|
[TYPE_ASSERTION_RULE_NAME]: TypeAssertionNode,
|
|
140
159
|
[PROCEDURE_CALL_RULE_NAME]: ProcedureCallNode,
|
|
141
160
|
[SUB_DERIVATION_RULE_NAME]: SubDerivationNode,
|
|
142
161
|
[TYPE_DECLARATION_RULE_NAME]: typeDeclarationNode,
|
|
143
162
|
[PROPERTY_RELATION_RULE_NAME]: PropertyRelationNode,
|
|
144
163
|
[DEFINED_ASSERTION_RULE_NAME]: DefinedAssertionNode,
|
|
164
|
+
[TERM_SUBSTITUTION_RULE_NAME]: TermSubstitutionNode,
|
|
145
165
|
[SUBPROOF_ASSERTION_RULE_NAME]: SubproofAssertionNode,
|
|
146
166
|
[PROPERTY_ASSERTION_RULE_NAME]: PropertyAssertionNode,
|
|
167
|
+
[FRAME_SUBSTITUTION_RULE_NAME]: FrameSubstitutionNode,
|
|
168
|
+
[PARENTHESISED_LABEL_RULE_NAME]: ParenthesisedLabelNode,
|
|
147
169
|
[SATISFIES_ASSERTION_RULE_NAME]: SatisfiesAssertionNode,
|
|
148
170
|
[CONTAINED_ASSERTION_RULE_NAME]: ContainedAssertionNode,
|
|
149
171
|
[PARENTHESISED_LABELS_RULE_NAME]: ParenthesisedLabelsNode,
|
|
150
172
|
[VARIABLE_DECLARATION_RULE_NAME]: variableDeclarationNode,
|
|
151
173
|
[PROPERTY_DECLARATION_RULE_NAME]: PropertyDeclarationNode,
|
|
174
|
+
[STATEMENT_SUBSTITUTION_RULE_NAME]: StatementSubstitutionNode,
|
|
175
|
+
[REFERENCE_SUBSTITUTION_RULE_NAME]: ReferenceSubstitutionNode,
|
|
152
176
|
[COMBINATOR_DECLARATION_RULE_NAME]: combinatorDeclarationNode,
|
|
153
177
|
[CONSTRUCTOR_DECLARATION_RULE_NAME]: constructorDeclarationNode,
|
|
154
178
|
[COMPLEX_TYPE_DECLARATION_RULE_NAME]: complexTypeDeclarationNode,
|
package/src/ruleNames.js
CHANGED
|
@@ -4,6 +4,7 @@ export const RULE_RULE_NAME = "rule";
|
|
|
4
4
|
export const STEP_RULE_NAME = "step";
|
|
5
5
|
export const TERM_RULE_NAME = "term";
|
|
6
6
|
export const TYPE_RULE_NAME = "type";
|
|
7
|
+
export const TYPES_RULE_NAME = "types";
|
|
7
8
|
export const LEMMA_RULE_NAME = "lemma";
|
|
8
9
|
export const AXIOM_RULE_NAME = "axiom";
|
|
9
10
|
export const ERROR_RULE_NAME = "error";
|
|
@@ -13,6 +14,7 @@ export const LABEL_RULE_NAME = "label";
|
|
|
13
14
|
export const LABELS_RULE_NAME = "labels";
|
|
14
15
|
export const THEOREM_RULE_NAME = "theorem";
|
|
15
16
|
export const PREMISE_RULE_NAME = "premise";
|
|
17
|
+
export const ARGUMENT_RULE_NAME = "argument";
|
|
16
18
|
export const PROPERTY_RULE_NAME = "property";
|
|
17
19
|
export const EQUALITY_RULE_NAME = "equality";
|
|
18
20
|
export const VARIABLE_RULE_NAME = "variable";
|
|
@@ -33,19 +35,25 @@ export const CONSTRUCTOR_RULE_NAME = "constructor";
|
|
|
33
35
|
export const DECLARATION_RULE_NAME = "declaration";
|
|
34
36
|
export const METATHEOREM_RULE_NAME = "metatheorem";
|
|
35
37
|
export const METAVARIABLE_RULE_NAME = "metavariable";
|
|
38
|
+
export const META_ARGUMENT_RULE_NAME = "metaArgument";
|
|
36
39
|
export const PROCEDURE_CALL_RULE_NAME = "procedureCall";
|
|
37
40
|
export const SUB_DERIVATION_RULE_NAME = "subDerivation";
|
|
38
41
|
export const TYPE_ASSERTION_RULE_NAME = "typeAssertion";
|
|
39
42
|
export const TYPE_DECLARATION_RULE_NAME = "typeDeclaration";
|
|
40
43
|
export const PROPERTY_RELATION_RULE_NAME = "propertyRelation";
|
|
41
44
|
export const DEFINED_ASSERTION_RULE_NAME = "definedAssertion";
|
|
45
|
+
export const TERM_SUBSTITUTION_RULE_NAME = "termSubstitution";
|
|
42
46
|
export const PROPERTY_ASSERTION_RULE_NAME = "propertyAssertion";
|
|
43
47
|
export const SUBPROOF_ASSERTION_RULE_NAME = "subproofAssertion";
|
|
48
|
+
export const FRAME_SUBSTITUTION_RULE_NAME = "frameSubstitution";
|
|
44
49
|
export const CONTAINED_ASSERTION_RULE_NAME = "containedAssertion";
|
|
45
50
|
export const SATISFIES_ASSERTION_RULE_NAME = "satisfiesAssertion";
|
|
51
|
+
export const PARENTHESISED_LABEL_RULE_NAME = "parenthesisedLabel";
|
|
46
52
|
export const PARENTHESISED_LABELS_RULE_NAME = "parenthesisedLabels";
|
|
47
53
|
export const PROPERTY_DECLARATION_RULE_NAME = "propertyDeclaration";
|
|
48
54
|
export const VARIABLE_DECLARATION_RULE_NAME = "variableDeclaration";
|
|
55
|
+
export const STATEMENT_SUBSTITUTION_RULE_NAME = "statementSubstitution";
|
|
56
|
+
export const REFERENCE_SUBSTITUTION_RULE_NAME = "referenceSubstitution";
|
|
49
57
|
export const COMBINATOR_DECLARATION_RULE_NAME = "combinatorDeclaration";
|
|
50
58
|
export const CONSTRUCTOR_DECLARATION_RULE_NAME = "constructorDeclaration";
|
|
51
59
|
export const COMPLEX_TYPE_DECLARATION_RULE_NAME = "complexTypeDeclaration";
|
|
@@ -4,12 +4,6 @@ import dom from "../dom";
|
|
|
4
4
|
import Substitution from "../substitution";
|
|
5
5
|
import FrameSubstitutionPartialContext from "../context/partial/substitution/frame";
|
|
6
6
|
|
|
7
|
-
import { nodeQuery } from "../utilities/query";
|
|
8
|
-
|
|
9
|
-
const frameNodeQuery = nodeQuery("/frameSubstitution/frame[0]"),
|
|
10
|
-
metavariableNodeQuery = nodeQuery("/frameSubstitution/frame[1]/metavariable!"),
|
|
11
|
-
frameSubstitutionNodeQuery = nodeQuery("/statement/frameSubstitution");
|
|
12
|
-
|
|
13
7
|
export default class FrameSubstitution extends Substitution {
|
|
14
8
|
constructor(string, node, tokens, frame, metavariable) {
|
|
15
9
|
super(string, node, tokens);
|
|
@@ -42,14 +36,17 @@ export default class FrameSubstitution extends Substitution {
|
|
|
42
36
|
static fromStatementNode(statementNode, context) {
|
|
43
37
|
let frameSubstitution = null;
|
|
44
38
|
|
|
45
|
-
const frameSubstitutionNode =
|
|
39
|
+
const frameSubstitutionNode = statementNode.getFrameSubstitutionNode();
|
|
46
40
|
|
|
47
41
|
if (frameSubstitutionNode !== null) {
|
|
48
|
-
const
|
|
49
|
-
|
|
42
|
+
const lastFrameNode = frameSubstitutionNode.getLastFrameNode(),
|
|
43
|
+
firstFrameNode = frameSubstitutionNode.getFirstFrameNode(),
|
|
44
|
+
singularMetavariableNode = lastFrameNode.getSingularMetavariableNode();
|
|
50
45
|
|
|
51
|
-
if (
|
|
46
|
+
if (singularMetavariableNode !== null) {
|
|
52
47
|
const { Frame, Metavariable } = dom,
|
|
48
|
+
frameNode = firstFrameNode, ///
|
|
49
|
+
metavariableNode = singularMetavariableNode, ///
|
|
53
50
|
frame = Frame.fromFrameNode(frameNode, context),
|
|
54
51
|
metavariable = Metavariable.fromMetavariableNode(metavariableNode, context),
|
|
55
52
|
node = frameSubstitutionNode, ///
|
|
@@ -4,12 +4,6 @@ import dom from "../dom";
|
|
|
4
4
|
import Substitution from "../substitution";
|
|
5
5
|
import ReferenceSubstitutionPartialContext from "../context/partial/substitution/reference";
|
|
6
6
|
|
|
7
|
-
import { nodeQuery } from "../utilities/query";
|
|
8
|
-
|
|
9
|
-
const referenceNodeQuery = nodeQuery("/referenceSubstitution/reference[0]"),
|
|
10
|
-
metavariableNodeQuery = nodeQuery("/referenceSubstitution/reference[1]/metavariable!"),
|
|
11
|
-
referenceSubstitutionNodeQuery = nodeQuery("/statement/referenceSubstitution");
|
|
12
|
-
|
|
13
7
|
export default class ReferenceSubstitution extends Substitution {
|
|
14
8
|
constructor(string, node, tokens, reference, metavariable) {
|
|
15
9
|
super(string, node, tokens);
|
|
@@ -33,14 +27,17 @@ export default class ReferenceSubstitution extends Substitution {
|
|
|
33
27
|
static fromStatementNode(statementNode, context) {
|
|
34
28
|
let referenceSubstitution = null;
|
|
35
29
|
|
|
36
|
-
const referenceSubstitutionNode =
|
|
30
|
+
const referenceSubstitutionNode = statementNode.getReferenceSubstitutionNode();
|
|
37
31
|
|
|
38
32
|
if (referenceSubstitutionNode !== null) {
|
|
39
|
-
const
|
|
40
|
-
|
|
33
|
+
const lastReferenceNode = referenceSubstitutionNode.getLastReferenceNode(),
|
|
34
|
+
firstReferenceNode = referenceSubstitutionNode.getFirstReferenceNode(),
|
|
35
|
+
singularMetavariableNode = lastReferenceNode.getSingularMetavariableNode();
|
|
41
36
|
|
|
42
|
-
if (
|
|
37
|
+
if (singularMetavariableNode !== null) {
|
|
43
38
|
const { Reference, Metavariable } = dom,
|
|
39
|
+
referenceNode = firstReferenceNode, ///
|
|
40
|
+
metavariableNode = singularMetavariableNode, ///
|
|
44
41
|
reference = Reference.fromReferenceNode(referenceNode, context),
|
|
45
42
|
metavariable = Metavariable.fromMetavariableNode(metavariableNode, context),
|
|
46
43
|
node = referenceSubstitutionNode, ///
|