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.
Files changed (165) hide show
  1. package/lib/context/file.js +3 -3
  2. package/lib/dom/assertion/contained.js +12 -24
  3. package/lib/dom/assertion/defined.js +9 -21
  4. package/lib/dom/assertion/property.js +7 -7
  5. package/lib/dom/assertion/satisfies.js +6 -8
  6. package/lib/dom/declaration/complexType.js +3 -3
  7. package/lib/dom/declaration/constructor.js +6 -6
  8. package/lib/dom/declaration/variable.js +6 -6
  9. package/lib/dom/declaration.js +13 -13
  10. package/lib/dom/frame.js +7 -7
  11. package/lib/dom/judgement.js +7 -7
  12. package/lib/dom/propertyRelation.js +7 -7
  13. package/lib/dom/term.js +1 -3
  14. package/lib/dom/topLevelMetaAssertion.js +77 -131
  15. package/lib/dom/type.js +2 -2
  16. package/lib/equivalence.js +4 -6
  17. package/lib/mixins/term/verify.js +4 -8
  18. package/lib/node/argument.js +116 -0
  19. package/lib/node/assertion/contained.js +31 -23
  20. package/lib/node/assertion/defined.js +30 -17
  21. package/lib/node/assertion/property.js +14 -19
  22. package/lib/node/assertion/satisfies.js +20 -13
  23. package/lib/node/assertion/subproof.js +11 -11
  24. package/lib/node/assertion/type.js +12 -17
  25. package/lib/node/combinator.js +9 -4
  26. package/lib/node/conclusion.js +11 -11
  27. package/lib/node/constructor.js +9 -4
  28. package/lib/node/declaration/combinator.js +11 -11
  29. package/lib/node/declaration/complexType.js +38 -34
  30. package/lib/node/declaration/constructor.js +24 -29
  31. package/lib/node/declaration/metavariable.js +12 -17
  32. package/lib/node/declaration/property.js +19 -24
  33. package/lib/node/declaration/type.js +41 -28
  34. package/lib/node/declaration/variable.js +12 -17
  35. package/lib/node/declaration.js +12 -17
  36. package/lib/node/deduction.js +11 -11
  37. package/lib/node/derivation.js +39 -11
  38. package/lib/node/equality.js +21 -18
  39. package/lib/node/error.js +9 -4
  40. package/lib/node/frame.js +13 -30
  41. package/lib/node/judgement.js +13 -18
  42. package/lib/node/label.js +11 -11
  43. package/lib/node/labels.js +11 -11
  44. package/lib/node/metaArgument.js +116 -0
  45. package/lib/node/metaType.js +9 -8
  46. package/lib/node/metavariable.js +12 -17
  47. package/lib/node/nonTerminal.js +218 -0
  48. package/lib/node/parameter.js +9 -4
  49. package/lib/node/parenthesisedLabel.js +116 -0
  50. package/lib/node/parenthesisedLabels.js +11 -11
  51. package/lib/node/premise.js +12 -17
  52. package/lib/node/procedureCall.js +12 -17
  53. package/lib/node/proof.js +11 -11
  54. package/lib/node/property.js +9 -4
  55. package/lib/node/propertyRelation.js +12 -17
  56. package/lib/node/reference.js +11 -11
  57. package/lib/node/rule.js +44 -7
  58. package/lib/node/statement.js +92 -53
  59. package/lib/node/step.js +12 -17
  60. package/lib/node/subDerivation.js +46 -11
  61. package/lib/node/subproof.js +19 -17
  62. package/lib/node/substitution/frame.js +123 -0
  63. package/lib/node/substitution/reference.js +123 -0
  64. package/lib/node/substitution/statement.js +123 -0
  65. package/lib/node/substitution/term.js +123 -0
  66. package/lib/node/supposition.js +12 -17
  67. package/lib/node/term.js +22 -33
  68. package/lib/node/topLevelAssertion.js +14 -29
  69. package/lib/node/topLevelMetaAssertion.js +26 -41
  70. package/lib/node/type.js +9 -4
  71. package/lib/node/types.js +116 -0
  72. package/lib/node/variable.js +9 -4
  73. package/lib/nonTerminalNodeMap.js +11 -3
  74. package/lib/ruleNames.js +33 -1
  75. package/lib/substitution/frame.js +5 -7
  76. package/lib/substitution/reference.js +5 -7
  77. package/lib/substitution/term.js +5 -7
  78. package/lib/unifier/metaLevel.js +4 -4
  79. package/lib/utilities/brackets.js +5 -5
  80. package/lib/utilities/json.js +18 -1
  81. package/lib/utilities/node.js +1 -313
  82. package/lib/utilities/subproof.js +13 -4
  83. package/package.json +1 -1
  84. package/src/context/file.js +2 -2
  85. package/src/dom/assertion/contained.js +12 -34
  86. package/src/dom/assertion/defined.js +9 -30
  87. package/src/dom/assertion/property.js +6 -8
  88. package/src/dom/assertion/satisfies.js +5 -10
  89. package/src/dom/declaration/complexType.js +2 -2
  90. package/src/dom/declaration/constructor.js +6 -7
  91. package/src/dom/declaration/variable.js +6 -7
  92. package/src/dom/declaration.js +11 -15
  93. package/src/dom/frame.js +4 -6
  94. package/src/dom/judgement.js +6 -8
  95. package/src/dom/propertyRelation.js +6 -8
  96. package/src/dom/term.js +0 -3
  97. package/src/dom/topLevelMetaAssertion.js +83 -39
  98. package/src/dom/type.js +2 -2
  99. package/src/equivalence.js +3 -6
  100. package/src/mixins/term/verify.js +5 -11
  101. package/src/node/argument.js +16 -0
  102. package/src/node/assertion/contained.js +30 -22
  103. package/src/node/assertion/defined.js +28 -15
  104. package/src/node/assertion/property.js +7 -17
  105. package/src/node/assertion/satisfies.js +11 -9
  106. package/src/node/assertion/subproof.js +4 -9
  107. package/src/node/assertion/type.js +6 -16
  108. package/src/node/combinator.js +1 -1
  109. package/src/node/conclusion.js +4 -9
  110. package/src/node/constructor.js +1 -1
  111. package/src/node/declaration/combinator.js +4 -9
  112. package/src/node/declaration/complexType.js +31 -35
  113. package/src/node/declaration/constructor.js +16 -26
  114. package/src/node/declaration/metavariable.js +6 -16
  115. package/src/node/declaration/property.js +13 -23
  116. package/src/node/declaration/type.js +35 -29
  117. package/src/node/declaration/variable.js +6 -16
  118. package/src/node/declaration.js +6 -16
  119. package/src/node/deduction.js +4 -9
  120. package/src/node/derivation.js +7 -10
  121. package/src/node/equality.js +19 -18
  122. package/src/node/error.js +1 -1
  123. package/src/node/frame.js +8 -35
  124. package/src/node/judgement.js +7 -17
  125. package/src/node/label.js +4 -9
  126. package/src/node/labels.js +4 -9
  127. package/src/node/metaArgument.js +16 -0
  128. package/src/node/metaType.js +1 -5
  129. package/src/node/metavariable.js +6 -16
  130. package/src/node/nonTerminal.js +130 -0
  131. package/src/node/parameter.js +1 -1
  132. package/src/node/parenthesisedLabel.js +16 -0
  133. package/src/node/parenthesisedLabels.js +5 -10
  134. package/src/node/premise.js +6 -16
  135. package/src/node/procedureCall.js +6 -16
  136. package/src/node/proof.js +4 -9
  137. package/src/node/property.js +1 -1
  138. package/src/node/propertyRelation.js +7 -16
  139. package/src/node/reference.js +4 -9
  140. package/src/node/rule.js +40 -3
  141. package/src/node/statement.js +109 -66
  142. package/src/node/step.js +6 -16
  143. package/src/node/subDerivation.js +14 -10
  144. package/src/node/subproof.js +13 -16
  145. package/src/node/substitution/frame.js +23 -0
  146. package/src/node/substitution/reference.js +23 -0
  147. package/src/node/substitution/statement.js +23 -0
  148. package/src/node/substitution/term.js +23 -0
  149. package/src/node/supposition.js +6 -16
  150. package/src/node/term.js +15 -39
  151. package/src/node/topLevelAssertion.js +13 -33
  152. package/src/node/topLevelMetaAssertion.js +20 -39
  153. package/src/node/type.js +1 -1
  154. package/src/node/types.js +16 -0
  155. package/src/node/variable.js +1 -1
  156. package/src/nonTerminalNodeMap.js +60 -36
  157. package/src/ruleNames.js +8 -0
  158. package/src/substitution/frame.js +7 -10
  159. package/src/substitution/reference.js +7 -10
  160. package/src/substitution/term.js +7 -9
  161. package/src/unifier/metaLevel.js +2 -3
  162. package/src/utilities/brackets.js +8 -8
  163. package/src/utilities/json.js +19 -0
  164. package/src/utilities/node.js +0 -168
  165. 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
+ }
@@ -1,30 +1,20 @@
1
1
  "use strict";
2
2
 
3
- import { NonTerminalNode } from "occam-parsers";
3
+ import NonTerminalNode from "../node/nonTerminal";
4
4
 
5
- import { isNodeStatementNode, isNodeProcedureCallNode } from "../utilities/node";
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 statementNode = this.findChildNode((childNode) => {
10
- const childNodeStatementNode = isNodeStatementNode(childNode);
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 procedureCallNode = this.findChildNode((childNode) => {
22
- const childNodeProcedureCallNode = isNodeProcedureCallNode(childNode);
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 { arrayUtilities } from "necessary";
4
- import { NonTerminalNode } from "occam-parsers";
3
+ import NonTerminalNode from "../node/nonTerminal";
5
4
 
6
- import { isNodeTermNode, isNodeVariableNode } from "../utilities/node";
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 variableNodes = this.filterDescendantNode((descendantNode) => {
13
- const descendantNodeVariableNode = isNodeVariableNode(descendantNode);
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 termNodes = this.filterChildNode((childNode) => {
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 (termNodesLength === 1) {
36
- const firstTermNode = first(termNodes);
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
- getSingularVariableNode() {
45
- let singularVariableNode = null;
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
- if (variableNodesLength === 1) {
57
- const firstVariableNode = first(variableNodes);
31
+ return singularArgumentNode;
32
+ }
58
33
 
59
- singularVariableNode = firstVariableNode; ///
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 { NonTerminalNode } from "occam-parsers";
3
+ import NonTerminalNode from "../node/nonTerminal";
4
4
 
5
5
  import { SATISFIABLE } from "../constants";
6
- import { isNodeProofNode,
7
- isNodeDeductionNode,
8
- isNodeSuppositionNode,
9
- isNodeParenthesisedLabelsNode } from "../utilities/node";
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 proofNode = this.findChildNode((childNode) => {
46
- const childNOdeProofNode = isNodeProofNode(childNode);
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 deductionNode = this.findChildNode((childNode) => {
58
- const childNOdeDeductionNode = isNodeDeductionNode(childNode);
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 suppositionNodes = this.filterChildNode((childNode) => {
70
- const childNodeSuppositionNode = isNodeSuppositionNode(childNode);
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 parenthesisedLabelsNode = this.findChildNode((childNode) => {
82
- const childNodeParenthesisedLabelNode = isNodeParenthesisedLabelsNode(childNode);
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 { NonTerminalNode } from "occam-parsers";
4
- import { isNodeProofNode, isNodePremiseNode, isNodeConclusionNode, isNodeParenthesisedLabelsNode } from "../utilities/node";
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
- getLabelNodes() {
8
- const parenthesisedLabelsNode = this.getParenthesisedLabelsNode(),
9
- labelNodes = parenthesisedLabelsNode.getLabelNodes();
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 proofNode = this.findChildNode((childNode) => {
16
- const childNOdeProofNode = isNodeProofNode(childNode);
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
- getPremiseNodes() {
27
- const premiseNodes = this.filterChildNode((childNode) => {
28
- const childNOdePremiseNode = isNodePremiseNode(childNode);
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 premiseNodes;
26
+ return deductionNode;
36
27
  }
37
28
 
38
- getConclusionNode() {
39
- const conclusionNode = this.findChildNode((childNode) => {
40
- const childNOdeConclusionNode = isNodeConclusionNode(childNode);
29
+ getSuppositionNodes() {
30
+ const ruleName = SUPPOSITION_RULE_NAME,
31
+ suppositionNodes = this.getNodesByRuleName(ruleName);
41
32
 
42
- if (childNOdeConclusionNode) {
43
- return true;
44
- }
45
- }) || null;
46
-
47
- return conclusionNode;
33
+ return suppositionNodes;
48
34
  }
49
35
 
50
- getParenthesisedLabelsNode() {
51
- const parenthesisedLabelsNode = this.findChildNode((childNode) => {
52
- const childNodeParenthesisedLabelNode = isNodeParenthesisedLabelsNode(childNode);
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 parenthesisedLabelsNode;
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
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- import { NonTerminalNode } from "occam-parsers";
3
+ import NonTerminalNode from "../node/nonTerminal";
4
4
 
5
5
  export default class TypeNode extends NonTerminalNode {
6
6
  getTypeName() {
@@ -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
+ }
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- import { NonTerminalNode } from "occam-parsers";
3
+ import NonTerminalNode from "../node/nonTerminal";
4
4
 
5
5
  export default class VariableNode extends NonTerminalNode {
6
6
  getVariableName() {
@@ -1,51 +1,59 @@
1
1
  "use strict";
2
2
 
3
- import TermNode from "./node/term"
4
- import TypeNode from "./node/type"
5
- import RuleNode from "./node/rule"
6
- import StepNode from "./node/step"
7
- import ErrorNode from "./node/error"
8
- import FrameNode from "./node/frame"
9
- import AxiomNode from "./node/axiom"
10
- import LemmaNode from "./node/lemma"
11
- import ProofNode from "./node/proof"
12
- import LabelNode from "./node/label"
13
- import LabelsNode from "./node/labels"
14
- import PremiseNode from "./node/premise"
15
- import TheoremNode from "./node/theorem"
16
- import SubproofNode from "./node/subproof"
17
- import PropertyNode from "./node/property"
18
- import MetaTypeNode from "./node/metaType"
19
- import EqualityNode from "./node/equality"
20
- import VariableNode from "./node/variable"
21
- import StatementNode from "./node/statement"
22
- import ReferenceNode from "./node/reference"
23
- import DeductionNode from "./node/deduction"
24
- import JudgementNode from "./node/judgement"
25
- import MetaLemmaNode from "./node/metaLemma"
26
- import ParameterNode from "./node/parameter"
27
- import DerivationNode from "./node/derivation"
28
- import CombinatorNode from "./node/combinator"
29
- import ConclusionNode from "./node/conclusion"
30
- import ConjectureNode from "./node/conjecture"
31
- import SuppositionNode from "./node/supposition"
32
- import ConstructorNode from "./node/constructor"
33
- import DeclarationNode from "./node/declaration"
34
- import MetatheoremNode from "./node/metatheorem"
35
- import MetavariableNode from "./node/metavariable"
36
- import ProcedureCallNode from "./node/procedureCall"
37
- import SubDerivationNode from "./node/subDerivation"
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 = frameSubstitutionNodeQuery(statementNode);
39
+ const frameSubstitutionNode = statementNode.getFrameSubstitutionNode();
46
40
 
47
41
  if (frameSubstitutionNode !== null) {
48
- const frameNode = frameNodeQuery(frameSubstitutionNode),
49
- metavariableNode = metavariableNodeQuery(frameSubstitutionNode);
42
+ const lastFrameNode = frameSubstitutionNode.getLastFrameNode(),
43
+ firstFrameNode = frameSubstitutionNode.getFirstFrameNode(),
44
+ singularMetavariableNode = lastFrameNode.getSingularMetavariableNode();
50
45
 
51
- if ((frameNode !== null) && (metavariableNode !== null)) {
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 = referenceSubstitutionNodeQuery(statementNode);
30
+ const referenceSubstitutionNode = statementNode.getReferenceSubstitutionNode();
37
31
 
38
32
  if (referenceSubstitutionNode !== null) {
39
- const referenceNode = referenceNodeQuery(referenceSubstitutionNode),
40
- metavariableNode = metavariableNodeQuery(referenceSubstitutionNode);
33
+ const lastReferenceNode = referenceSubstitutionNode.getLastReferenceNode(),
34
+ firstReferenceNode = referenceSubstitutionNode.getFirstReferenceNode(),
35
+ singularMetavariableNode = lastReferenceNode.getSingularMetavariableNode();
41
36
 
42
- if ((referenceNode !== null) && (metavariableNode !== null)) {
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, ///