occam-verify-cli 1.0.428 → 1.0.436

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 (123) hide show
  1. package/lib/context/file.js +1 -1
  2. package/lib/element/assertion.js +115 -24
  3. package/lib/element/assumption.js +120 -20
  4. package/lib/element/axiomLemmaTheoremConjecture.js +118 -30
  5. package/lib/element/conclusion.js +113 -25
  6. package/lib/element/declaration.js +112 -37
  7. package/lib/element/deduction.js +112 -66
  8. package/lib/element/derivation.js +114 -5
  9. package/lib/element/equality.js +119 -26
  10. package/lib/element/equivalence.js +121 -28
  11. package/lib/element/equivalences.js +122 -7
  12. package/lib/element/error.js +115 -32
  13. package/lib/element/frame.js +119 -59
  14. package/lib/element/hypothesis.js +115 -27
  15. package/lib/element/judgement.js +120 -33
  16. package/lib/element/label.js +116 -63
  17. package/lib/element/lemma.js +1 -9
  18. package/lib/element/metaLemma.js +1 -8
  19. package/lib/element/metaLemmaMetatheorem.js +117 -29
  20. package/lib/element/metaType.js +68 -61
  21. package/lib/element/metatheorem.js +1 -8
  22. package/lib/element/metavariable.js +122 -93
  23. package/lib/element/parameter.js +120 -20
  24. package/lib/element/premise.js +114 -35
  25. package/lib/element/procedureCall.js +117 -99
  26. package/lib/element/procedureReference.js +120 -20
  27. package/lib/element/proof.js +111 -55
  28. package/lib/element/property.js +121 -35
  29. package/lib/element/propertyRelation.js +116 -72
  30. package/lib/element/reference.js +120 -70
  31. package/lib/element/rule.js +116 -41
  32. package/lib/element/section.js +114 -133
  33. package/lib/element/signature.js +120 -20
  34. package/lib/element/statement/combinator/bracketed.js +4 -9
  35. package/lib/element/statement.js +110 -125
  36. package/lib/element/step.js +115 -27
  37. package/lib/element/subDerivation.js +111 -43
  38. package/lib/element/subproof.js +115 -20
  39. package/lib/element/substitution.js +115 -31
  40. package/lib/element/substitutions.js +120 -6
  41. package/lib/element/supposition.js +114 -35
  42. package/lib/element/term/constructor/bracketed.js +4 -8
  43. package/lib/element/term.js +111 -98
  44. package/lib/element/theorem.js +1 -8
  45. package/lib/element/type.js +71 -91
  46. package/lib/element/typePrefix.js +120 -20
  47. package/lib/element/variable.js +116 -111
  48. package/lib/element.js +67 -0
  49. package/lib/node/{nonsense.js → equivalences.js} +10 -10
  50. package/lib/node/frame.js +11 -5
  51. package/lib/node/procedureReference.js +6 -6
  52. package/lib/node/statement.js +11 -5
  53. package/lib/node/term.js +8 -1
  54. package/lib/nonTerminalNodeMap.js +3 -3
  55. package/lib/process/instantiate.js +8 -39
  56. package/lib/process/verify.js +22 -29
  57. package/lib/ruleNames.js +5 -5
  58. package/lib/utilities/brackets.js +11 -11
  59. package/lib/utilities/element.js +588 -94
  60. package/lib/utilities/instance.js +61 -0
  61. package/lib/utilities/string.js +73 -1
  62. package/package.json +1 -1
  63. package/src/context/file.js +1 -1
  64. package/src/element/assertion.js +4 -16
  65. package/src/element/assumption.js +5 -12
  66. package/src/element/axiomLemmaTheoremConjecture.js +4 -16
  67. package/src/element/conclusion.js +4 -16
  68. package/src/element/declaration.js +4 -16
  69. package/src/element/deduction.js +5 -19
  70. package/src/element/derivation.js +5 -2
  71. package/src/element/equality.js +4 -16
  72. package/src/element/equivalence.js +4 -16
  73. package/src/element/equivalences.js +12 -5
  74. package/src/element/error.js +4 -24
  75. package/src/element/frame.js +5 -56
  76. package/src/element/hypothesis.js +6 -23
  77. package/src/element/judgement.js +5 -30
  78. package/src/element/label.js +8 -19
  79. package/src/element/lemma.js +0 -7
  80. package/src/element/metaLemma.js +0 -7
  81. package/src/element/metaLemmaMetatheorem.js +4 -16
  82. package/src/element/metaType.js +23 -64
  83. package/src/element/metatheorem.js +0 -7
  84. package/src/element/metavariable.js +6 -94
  85. package/src/element/parameter.js +10 -18
  86. package/src/element/premise.js +4 -31
  87. package/src/element/procedureCall.js +5 -77
  88. package/src/element/procedureReference.js +7 -17
  89. package/src/element/proof.js +5 -17
  90. package/src/element/property.js +8 -30
  91. package/src/element/propertyRelation.js +5 -33
  92. package/src/element/reference.js +8 -72
  93. package/src/element/rule.js +4 -41
  94. package/src/element/section.js +4 -129
  95. package/src/element/signature.js +7 -13
  96. package/src/element/statement/combinator/bracketed.js +3 -9
  97. package/src/element/statement.js +3 -126
  98. package/src/element/step.js +4 -16
  99. package/src/element/subDerivation.js +5 -3
  100. package/src/element/subproof.js +5 -12
  101. package/src/element/substitution.js +4 -24
  102. package/src/element/substitutions.js +6 -2
  103. package/src/element/supposition.js +4 -31
  104. package/src/element/term/constructor/bracketed.js +4 -9
  105. package/src/element/term.js +6 -59
  106. package/src/element/theorem.js +0 -7
  107. package/src/element/type.js +9 -104
  108. package/src/element/typePrefix.js +8 -13
  109. package/src/element/variable.js +6 -109
  110. package/src/element.js +29 -0
  111. package/src/node/{nonsense.js → equivalences.js} +2 -2
  112. package/src/node/frame.js +10 -5
  113. package/src/node/procedureReference.js +4 -4
  114. package/src/node/statement.js +10 -5
  115. package/src/node/term.js +7 -0
  116. package/src/nonTerminalNodeMap.js +3 -3
  117. package/src/process/instantiate.js +4 -36
  118. package/src/process/verify.js +42 -47
  119. package/src/ruleNames.js +1 -1
  120. package/src/utilities/brackets.js +13 -13
  121. package/src/utilities/element.js +731 -129
  122. package/src/utilities/instance.js +53 -0
  123. package/src/utilities/string.js +97 -0
@@ -1,20 +1,14 @@
1
1
  "use strict";
2
2
 
3
- import { define } from "../elements";
3
+ import Element from "../element";
4
4
 
5
- export default define(class TypePrefix {
6
- constructor(string, node, name) {
7
- this.string = string;
8
- this.node = node;
9
- this.name = name;
10
- }
5
+ import { define } from "../elements";
11
6
 
12
- getString() {
13
- return this.string;
14
- }
7
+ export default define(class TypePrefix extends Element {
8
+ constructor(context, string, node, name) {
9
+ super(context, string, node);
15
10
 
16
- getNode() {
17
- return this.node;
11
+ this.name = name;
18
12
  }
19
13
 
20
14
  getName() {
@@ -41,7 +35,8 @@ export default define(class TypePrefix {
41
35
  static fromJSON(json, context) {
42
36
  const { name } = json,
43
37
  string = name, ///
44
- typePrefix = new TypePrefix(string, name);
38
+ node = null,
39
+ typePrefix = new TypePrefix(context, string, node, name);
45
40
 
46
41
  return typePrefix;
47
42
  }
@@ -1,30 +1,21 @@
1
1
  "use strict";
2
2
 
3
+ import Element from "../element";
3
4
  import elements from "../elements";
4
5
 
5
6
  import { define } from "../elements";
6
- import { EMPTY_STRING } from "../constants";
7
- import { typeFromTypeNode } from "../utilities/node.old";
8
7
  import { instantiateVariable } from "../process/instantiate";
9
8
  import { typeFromJSON, typeToTypeJSON } from "../utilities/json";
10
9
 
11
- export default define(class Variable {
12
- constructor(string, node, type, identifier, propertyRelations) {
13
- this.string = string;
14
- this.node = node;
10
+ export default define(class Variable extends Element {
11
+ constructor(context, string, node, type, identifier, propertyRelations) {
12
+ super(context, string, node);
13
+
15
14
  this.type = type;
16
15
  this.identifier = identifier;
17
16
  this.propertyRelations = propertyRelations;
18
17
  }
19
18
 
20
- getString() {
21
- return this.string;
22
- }
23
-
24
- getNode() {
25
- return this.node;
26
- }
27
-
28
19
  getIdentifier() {
29
20
  return this.identifier;
30
21
  }
@@ -43,14 +34,6 @@ export default define(class Variable {
43
34
 
44
35
  getTypeString() { return this.type.getString(); }
45
36
 
46
- isEqualTo(variable) {
47
- const variableNode = variable.getNode(),
48
- matches = this.node.match(variableNode),
49
- equalTo = matches; ///
50
-
51
- return equalTo;
52
- }
53
-
54
37
  matchParameter(parameter) {
55
38
  const parameterName = parameter.getName(),
56
39
  parameterNameMatchesIdentifier = (parameterName === this.identifier),
@@ -197,94 +180,8 @@ export default define(class Variable {
197
180
  identifier = variableIdentifier, ///
198
181
  type = typeFromJSON(json, context),
199
182
  propertyRelations = [],
200
- variable = new Variable(string, node, type, identifier, propertyRelations);
201
-
202
- return variable;
203
- }
204
-
205
- static fromTermNode(termNode, context) {
206
- let variable = null;
207
-
208
- const singularVariableNode = termNode.getSingularVariableNode();
209
-
210
- if (singularVariableNode !== null) {
211
- const variableNode = singularVariableNode, ///
212
- type = null;
213
-
214
- variable = variableFromVariableNodeAndType(variableNode, type);
215
- }
216
-
217
- return variable;
218
- }
219
-
220
- static fromVariableNode(variableNode, context) {
221
- let variable = null;
222
-
223
- if (variableNode !== null) {
224
- const type = null;
225
-
226
- variable = variableFromVariableNodeAndType(variableNode, type);
227
- }
228
-
229
- return variable;
230
- }
231
-
232
- static fromVariableNodeAndType(variableNode, type, context) {
233
- const variable = variableFromVariableNodeAndType(variableNode, type);
234
-
235
- return variable;
236
- }
237
-
238
- static fromVariableDeclarationNode(variableDeclarationNode, context) {
239
- const { Variable } = elements,
240
- provisional = variableDeclarationNode.isProvisional(),
241
- typeNode = variableDeclarationNode.getTypeNode(),
242
- type = typeFromTypeNode(typeNode, context);
243
-
244
- type.setProvisional(provisional);
245
-
246
- const variableNode = variableDeclarationNode.getVariableNode(),
247
- variableIdentifier = variableDeclarationNode.getVariableIdentifier(),
248
- node = variableNode, ///
249
- identifier = variableIdentifier, ///
250
- string = identifier, ///
251
- propertyRelations = [],
252
- variable = new Variable(string, node, type, identifier, propertyRelations);
253
-
254
- return variable;
255
- }
256
-
257
- static fromVariableAndPropertyRelation(variable, propertyRelation, context) {
258
- let propertyRelations;
259
-
260
- const node = variable.getNode(),
261
- type = variable.getType(),
262
- identifier = variable.getIdentifier();
263
-
264
- propertyRelations = variable.getPropertyRelations();
265
-
266
- propertyRelations = [
267
- ...propertyRelations,
268
- propertyRelation
269
- ];
270
-
271
- const string = stringFromNameAndPropertyRelations(identifier, propertyRelations);
272
-
273
- variable = new Variable(string, node, type, identifier, propertyRelations);
183
+ variable = new Variable(context, string, node, type, identifier, propertyRelations);
274
184
 
275
185
  return variable;
276
186
  }
277
187
  });
278
-
279
- function stringFromNameAndPropertyRelations(identifier, propertyRelations) {
280
- const propertyRelationsString = propertyRelations.reduce((propertyRelationsString, propertyRelation) => {
281
- const propertyRelationString = propertyRelation.getString();
282
-
283
- propertyRelationsString = `${propertyRelationsString}, ${propertyRelationString}`;
284
-
285
- return propertyRelationsString;
286
- }, EMPTY_STRING),
287
- string = `${identifier}${propertyRelationsString}`;
288
-
289
- return string;
290
- }
package/src/element.js ADDED
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+
3
+ export default class Element {
4
+ constructor(context, string, node) {
5
+ this.context = context;
6
+ this.string = string;
7
+ this.node = node;
8
+ }
9
+
10
+ getContext() {
11
+ return this.context;
12
+ }
13
+
14
+ getString() {
15
+ return this.string;
16
+ }
17
+
18
+ getNode() {
19
+ return this.node;
20
+ }
21
+
22
+ isEQualTo(element) {
23
+ const elementNode = element.getNode(),
24
+ matches = this.node.match(elementNode),
25
+ equalTo = matches; ///
26
+
27
+ return equalTo;
28
+ }
29
+ }
@@ -2,6 +2,6 @@
2
2
 
3
3
  import NonTerminalNode from "../nonTerminalNode";
4
4
 
5
- export default class NonsenseNode extends NonTerminalNode {
6
- static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(NonsenseNode, ruleName, childNodes, opacity, precedence); }
5
+ export default class EquivalencesNode extends NonTerminalNode {
6
+ static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(EquivalencesNode, ruleName, childNodes, opacity, precedence); }
7
7
  }
package/src/node/frame.js CHANGED
@@ -27,17 +27,22 @@ export default class FrameNode extends NonTerminalNode {
27
27
  getMetavariableName() {
28
28
  let metavariableName = null;
29
29
 
30
- const singular = this.isSingular();
30
+ const metavariableNode = this.getMetavariableNode();
31
31
 
32
- if (singular) {
33
- const singularMetavariableNode = this.getSingularMetavariableNode();
34
-
35
- metavariableName = singularMetavariableNode.getMetavariableName();
32
+ if (metavariableName !== null) {
33
+ metavariableName = metavariableNode.getMetavariableName();
36
34
  }
37
35
 
38
36
  return metavariableName;
39
37
  }
40
38
 
39
+ getMetavariableNode() {
40
+ const singularMetavariableNode = this.getSingularMetavariableNode(),
41
+ metavariableNode = singularMetavariableNode; ///
42
+
43
+ return metavariableNode;
44
+ }
45
+
41
46
  getMetavariableNodes() {
42
47
  const ruleName = METAVARIABLE_RULE_NAME,
43
48
  metavariableNodes = this.getNodesByRuleName(ruleName);
@@ -3,8 +3,8 @@
3
3
  import NonTerminalNode from "../nonTerminalNode";
4
4
 
5
5
  export default class ProcedureReferenceNode extends NonTerminalNode {
6
- getProcedureName() {
7
- let procedureName;
6
+ getName() {
7
+ let name;
8
8
 
9
9
  this.someChildNode((childNode) => {
10
10
  const childNodeTerminalNode = childNode.isTerminalNode();
@@ -13,13 +13,13 @@ export default class ProcedureReferenceNode extends NonTerminalNode {
13
13
  const terminalNode = childNode, ///
14
14
  content = terminalNode.getContent();
15
15
 
16
- procedureName = content; ///
16
+ name = content; ///
17
17
 
18
18
  return true;
19
19
  }
20
20
  });
21
21
 
22
- return procedureName;
22
+ return name;
23
23
  }
24
24
 
25
25
  static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return NonTerminalNode.fromRuleNameChildNodesOpacityAndPrecedence(ProcedureReferenceNode, ruleName, childNodes, opacity, precedence); }
@@ -22,17 +22,22 @@ export default class StatementNode extends NonTerminalNode {
22
22
  getMetavariableName() {
23
23
  let metavariableName = null;
24
24
 
25
- const singular = this.isSingular();
25
+ const metavariableNode = this.getMetavariableNode();
26
26
 
27
- if (singular) {
28
- const singularMetavariableNode = this.getSingularMetavariableNode();
29
-
30
- metavariableName = singularMetavariableNode.getMetavariableName();
27
+ if (metavariableName !== null) {
28
+ metavariableName = metavariableNode.getMetavariableName();
31
29
  }
32
30
 
33
31
  return metavariableName;
34
32
  }
35
33
 
34
+ getMetavariableNode() {
35
+ const singularMetavariableNode = this.getSingularMetavariableNode(),
36
+ metavariableNode = singularMetavariableNode; ///
37
+
38
+ return metavariableNode;
39
+ }
40
+
36
41
  getSubstitutionNode() {
37
42
  const frameSubstitutionNode = this.getFrameSubstitutionNode(),
38
43
  termSubstitutionNode = this.getTermSubstitutionNode(),
package/src/node/term.js CHANGED
@@ -19,6 +19,13 @@ export default class TermNode extends NonTerminalNode {
19
19
  return variableIdentifier;
20
20
  }
21
21
 
22
+ getVariableNode() {
23
+ const singularVariableNode = this.getSingularVariableNode(),
24
+ variableNode = singularVariableNode; //
25
+
26
+ return variableNode;
27
+ }
28
+
22
29
  isSingular() {
23
30
  let singular = false;
24
31
 
@@ -15,7 +15,6 @@ import LabelsNode from "./node/labels";
15
15
  import SectionNode from "./node/section";
16
16
  import PremiseNode from "./node/premise";
17
17
  import TheoremNode from "./node/theorem";
18
- import NonsenseNode from "./node/nonsense";
19
18
  import ArgumentNode from "./node/argument";
20
19
  import SubproofNode from "./node/subproof";
21
20
  import PropertyNode from "./node/property";
@@ -49,6 +48,7 @@ import AxiomHeaderNode from "./node/header/axiom";
49
48
  import LemmaHeaderNode from "./node/header/lemma";
50
49
  import MetatheoremNode from "./node/metatheorem";
51
50
  import EquivalenceNode from "./node/equivalence";
51
+ import EquivalencesNode from "./node/equivalences";
52
52
  import MetaArgumentNode from "./node/metaArgument";
53
53
  import MetavariableNode from "./node/metavariable";
54
54
  import QualificationNode from "./node/qualification";
@@ -99,7 +99,6 @@ import {
99
99
  THEOREM_RULE_NAME,
100
100
  PREMISE_RULE_NAME,
101
101
  SECTION_RULE_NAME,
102
- NONSENSE_RULE_NAME,
103
102
  ARGUMENT_RULE_NAME,
104
103
  SUBPROOF_RULE_NAME,
105
104
  PROPERTY_RULE_NAME,
@@ -130,6 +129,7 @@ import {
130
129
  CONSTRUCTOR_RULE_NAME,
131
130
  METATHEOREM_RULE_NAME,
132
131
  EQUIVALENCE_RULE_NAME,
132
+ EQUIVALENCES_RULE_NAME,
133
133
  AXIOM_HEADER_RULE_NAME,
134
134
  LEMMA_HEADER_RULE_NAME,
135
135
  THEOREM_BODY_RULE_NAME,
@@ -188,7 +188,6 @@ const NonTerminalNodeMap = {
188
188
  [SUBPROOF_RULE_NAME]: SubproofNode,
189
189
  [EQUALITY_RULE_NAME]: EqualityNode,
190
190
  [VARIABLE_RULE_NAME]: VariableNode,
191
- [NONSENSE_RULE_NAME]: NonsenseNode,
192
191
  [DOCUMENT_RULE_NAME]: DocumentNode,
193
192
  [RULE_BODY_RULE_NAME]: RuleBodyNode,
194
193
  [META_TYPE_RULE_NAME]: MetaTypeNode,
@@ -218,6 +217,7 @@ const NonTerminalNodeMap = {
218
217
  [LEMMA_HEADER_RULE_NAME]: LemmaHeaderNode,
219
218
  [THEOREM_BODY_RULE_NAME]: TheoremBodyNode,
220
219
  [METAVARIABLE_RULE_NAME]: MetavariableNode,
220
+ [EQUIVALENCES_RULE_NAME]: EquivalencesNode,
221
221
  [META_ARGUMENT_RULE_NAME]: MetaArgumentNode,
222
222
  [QUALIFICATION_RULE_NAME]: QualificationNode,
223
223
  [TYPE_ASSERTION_RULE_NAME]: TypeAssertionNode,
@@ -1,13 +1,10 @@
1
1
  "use strict";
2
2
 
3
- import nominalContext from "../context/nominal";
4
-
5
3
  import { ruleFromBNF } from "../utilities/bnf";
6
- import { BASE_TYPE_SYMBOL } from "../constants";
7
- import { STATEMENT_META_TYPE_NAME } from "../metaTypeNames";
8
4
 
9
5
  const termPlaceholderBNF = ` _ ::= term... <END_OF_LINE> ; `,
10
6
  variablePlaceholderBNF = ` _ ::= variable... <END_OF_LINE> ; `,
7
+ referencePlaceholderBNF = ` _ ::= reference... <END_OF_LINE> ; `,
11
8
  statementPlaceholderBNF = ` _ ::= statement... <END_OF_LINE> ; `,
12
9
  equivalencePlaceholderBNF = ` _ ::= equivalence... <END_OF_LINE> ; `,
13
10
  metavariablePlaceholderBNF = ` _ ::= metavariable... <END_OF_LINE> ; `,
@@ -17,6 +14,7 @@ const termPlaceholderBNF = ` _ ::= term... <END_OF_LINE> ; `,
17
14
  referenceSubstitutionPlaceholderBNF = ` _ ::= referenceSubstitution... <END_OF_LINE> ; `,
18
15
  termPlaceholderRule = ruleFromBNF(termPlaceholderBNF),
19
16
  variablePlaceholderRule = ruleFromBNF(variablePlaceholderBNF),
17
+ referencePlaceholderRule = ruleFromBNF(referencePlaceholderBNF),
20
18
  statementPlaceholderRule = ruleFromBNF(statementPlaceholderBNF),
21
19
  equivalencePlaceholderRule = ruleFromBNF(equivalencePlaceholderBNF),
22
20
  metavariablePlaceholderRule = ruleFromBNF(metavariablePlaceholderBNF),
@@ -25,16 +23,12 @@ const termPlaceholderBNF = ` _ ::= term... <END_OF_LINE> ; `,
25
23
  statementSubstitutionPlaceholderRule = ruleFromBNF(statementSubstitutionPlaceholderBNF),
26
24
  referenceSubstitutionPlaceholderRule = ruleFromBNF(referenceSubstitutionPlaceholderBNF);
27
25
 
28
- let bracketedConstructorTermNode = null,
29
- bracketedCombinatorStatementNode = null;
30
-
31
- export const bracketedConstructorTermString = `(${BASE_TYPE_SYMBOL})`;
32
- export const bracketedCombinatorStatementString = `(${STATEMENT_META_TYPE_NAME})`;
33
-
34
26
  export function instantiateTerm(string, context) { return instantiate(termPlaceholderRule, string, context); }
35
27
 
36
28
  export function instantiateVariable(string, context) { return instantiate(variablePlaceholderRule, string, context); }
37
29
 
30
+ export function instantiateReference(string, context) { return instantiate(referencePlaceholderRule, string, context); }
31
+
38
32
  export function instantiateStatement(string, context) { return instantiate(statementPlaceholderRule, string, context); }
39
33
 
40
34
  export function instantiateEquivalence(string, context) { return instantiate(equivalencePlaceholderRule, string, context); }
@@ -49,32 +43,6 @@ export function instantiateStatementSubstitution(string, context) { return insta
49
43
 
50
44
  export function instantiateReferenceSubstitution(string, context) { return instantiate(referenceSubstitutionPlaceholderRule, string, context); }
51
45
 
52
- export function instantiateBracketedConstructorTerm() {
53
- if (bracketedConstructorTermNode === null) {
54
- const placeholderRule = termPlaceholderRule, ///
55
- string = bracketedConstructorTermString,
56
- context = nominalContext, ///
57
- node = instantiate(placeholderRule, string, context);
58
-
59
- bracketedConstructorTermNode = node; ///
60
- }
61
-
62
- return bracketedConstructorTermNode;
63
- }
64
-
65
- export function instantiateBracketedCombinatorStatement() {
66
- if (bracketedCombinatorStatementNode === null) {
67
- const placeholderRule = statementPlaceholderRule, ///
68
- string = bracketedCombinatorStatementString, ///
69
- context = nominalContext, ///
70
- node = instantiate(placeholderRule, string, context);
71
-
72
- bracketedCombinatorStatementNode = node; ///
73
- }
74
-
75
- return bracketedCombinatorStatementNode;
76
- }
77
-
78
46
  function instantiate(placeholderRule, string, context) {
79
47
  let node;
80
48
 
@@ -1,22 +1,36 @@
1
1
  "use strict";
2
2
 
3
- import elements from "../elements";
4
-
5
3
  import { nodeQuery } from "../utilities/query";
6
4
  import { isLastRemainingArgumentFunction } from "../utilities/pass";
7
-
8
- const nonTerminalNodeQuery = nodeQuery("/*");
9
-
10
- const termNodeQuery = nodeQuery("/term"),
5
+ import { termFromTermNode,
6
+ ruleFromRuleNode,
7
+ errorFromErrorNode,
8
+ axiomFromAxiomNode,
9
+ lemmaFromLemmaNode,
10
+ sectionFromSectionNode,
11
+ theoremFromTheoremNode,
12
+ metaLemmaFromMetaLemmaNode,
13
+ statementFromStatementNode,
14
+ conjectureFromConjectureNode,
15
+ metatheoremFromMetatheoremNode,
16
+ variableDeclarationFromVariableDeclarationNode,
17
+ simpleTypeDeclarationFromSimpleTypeDeclarationNode,
18
+ typePrefixDeclarationFromTypePrefixDeclarationNode,
19
+ combinatorDeclarationFromCombinatorDeclarationNode,
20
+ constructorDeclarationFromConstructorDeclarationNode,
21
+ complexTypeDeclarationFromComplexTypeDeclarationNode,
22
+ metavariableDeclarationFromMetavariableDeclarationNode } from "../utilities/element";
23
+
24
+ const nonTerminalNodeQuery = nodeQuery("/*"),
25
+ termNodeQuery = nodeQuery("/term"),
11
26
  typeNodeQuery = nodeQuery("/type"),
12
- statementNodeQuery = nodeQuery("/statement");
13
-
14
- const errorNodeQuery = nodeQuery("/error"),
15
27
  ruleNodeQuery = nodeQuery("/rule"),
28
+ errorNodeQuery = nodeQuery("/error"),
16
29
  axiomNodeQuery = nodeQuery("/axiom"),
17
30
  lemmaNodeQuery = nodeQuery("/lemma"),
18
31
  sectionNodeQuery = nodeQuery("/section"),
19
32
  theoremNodeQuery = nodeQuery("/theorem"),
33
+ statementNodeQuery = nodeQuery("/statement"),
20
34
  metaLemmaNodeQuery = nodeQuery("/metaLemma"),
21
35
  conjectureNodeQuery = nodeQuery("/conjecture"),
22
36
  metatheoremNodeQuery = nodeQuery("/metatheorem"),
@@ -182,8 +196,7 @@ class TopLevelPass extends Pass {
182
196
  run: (errorNode, context) => {
183
197
  let success = false;
184
198
 
185
- const { Error } = elements,
186
- error = Error.fromErrorNode(errorNode, context),
199
+ const error = errorFromErrorNode(errorNode, context),
187
200
  errorVerifies = error.verify();
188
201
 
189
202
  if (errorVerifies) {
@@ -198,8 +211,7 @@ class TopLevelPass extends Pass {
198
211
  run: (ruleNode, context) => {
199
212
  let success = false;
200
213
 
201
- const { Rule } = elements,
202
- rule = Rule.fromRuleNode(ruleNode, context),
214
+ const rule = ruleFromRuleNode(ruleNode, context),
203
215
  ruleVerifies = rule.verify();
204
216
 
205
217
  if (ruleVerifies) {
@@ -214,8 +226,7 @@ class TopLevelPass extends Pass {
214
226
  run: (axiomNode, context) => {
215
227
  let success = false;
216
228
 
217
- const { Axiom } = elements,
218
- axiom = Axiom.fromAxiomNode(axiomNode, context),
229
+ const axiom = axiomFromAxiomNode(axiomNode, context),
219
230
  axiomVerifies = axiom.verify();
220
231
 
221
232
  if (axiomVerifies) {
@@ -230,8 +241,7 @@ class TopLevelPass extends Pass {
230
241
  run: (lemmaNode, context) => {
231
242
  let success = false;
232
243
 
233
- const { Lemma } = elements,
234
- lemma = Lemma.fromLemmaNode(lemmaNode, context),
244
+ const lemma = lemmaFromLemmaNode(lemmaNode, context),
235
245
  lemmaVerifies = lemma.verify();
236
246
 
237
247
  if (lemmaVerifies) {
@@ -246,8 +256,7 @@ class TopLevelPass extends Pass {
246
256
  run: (sectionNode, context) => {
247
257
  let success = false;
248
258
 
249
- const { Section } = elements,
250
- section = Section.fromSectionNode(sectionNode, context),
259
+ const section = sectionFromSectionNode(sectionNode, context),
251
260
  sectionVerifies = section.verify();
252
261
 
253
262
  if (sectionVerifies) {
@@ -262,8 +271,7 @@ class TopLevelPass extends Pass {
262
271
  run: (theoremNode, context) => {
263
272
  let success = false;
264
273
 
265
- const { Theorem } = elements,
266
- theorem = Theorem.fromTheoremNode(theoremNode, context),
274
+ const theorem = theoremFromTheoremNode(theoremNode, context),
267
275
  theoremVerifies = theorem.verify();
268
276
 
269
277
  if (theoremVerifies) {
@@ -278,8 +286,7 @@ class TopLevelPass extends Pass {
278
286
  run: (metaLemmaNode, context) => {
279
287
  let success = false;
280
288
 
281
- const { MetaLemma } = elements,
282
- metaLemma = MetaLemma.fromMetaLemmaNode(metaLemmaNode, context),
289
+ const metaLemma = metaLemmaFromMetaLemmaNode(metaLemmaNode, context),
283
290
  metaLemmaVerifies = metaLemma.verify();
284
291
 
285
292
  if (metaLemmaVerifies) {
@@ -294,8 +301,7 @@ class TopLevelPass extends Pass {
294
301
  run: (conjectureNode, context) => {
295
302
  let success = false;
296
303
 
297
- const { Conjecture } = elements,
298
- conjecture = Conjecture.fromConjectureNode(conjectureNode, context),
304
+ const conjecture = conjectureFromConjectureNode(conjectureNode, context),
299
305
  conjectureVerifies = conjecture.verify();
300
306
 
301
307
  if (conjectureVerifies) {
@@ -310,8 +316,7 @@ class TopLevelPass extends Pass {
310
316
  run: (metatheoremNode, context) => {
311
317
  let success = false;
312
318
 
313
- const { Metatheorem } = elements,
314
- metatheorem = Metatheorem.fromMetatheoremNode(metatheoremNode, context),
319
+ const metatheorem = metatheoremFromMetatheoremNode(metatheoremNode, context),
315
320
  metatheoremVerifies = metatheorem.verify();
316
321
 
317
322
  if (metatheoremVerifies) {
@@ -326,8 +331,7 @@ class TopLevelPass extends Pass {
326
331
  run: (variableDeclarationNode, context) => {
327
332
  let success = false;
328
333
 
329
- const { VariableDeclaration } = elements,
330
- variableDeclaration = VariableDeclaration.fromVariableDeclarationNode(variableDeclarationNode, context),
334
+ const variableDeclaration = variableDeclarationFromVariableDeclarationNode(variableDeclarationNode, context),
331
335
  variableDeclarationVerifies = variableDeclaration.verify();
332
336
 
333
337
  if (variableDeclarationVerifies) {
@@ -342,8 +346,7 @@ class TopLevelPass extends Pass {
342
346
  run: (simpleTypeDeclarationNode, context) => {
343
347
  let success = false;
344
348
 
345
- const { SimpleTypeDeclaration } = elements,
346
- simpleTypeDeclaration = SimpleTypeDeclaration.fromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context),
349
+ const simpleTypeDeclaration = simpleTypeDeclarationFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, context),
347
350
  simpleTypeDeclarationVerifies = simpleTypeDeclaration.verify();
348
351
 
349
352
  if (simpleTypeDeclarationVerifies) {
@@ -358,8 +361,7 @@ class TopLevelPass extends Pass {
358
361
  run: (typePrefixDeclarationNode, context) => {
359
362
  let success = false;
360
363
 
361
- const { TypePrefixDeclaration } = elements,
362
- typePrefixDeclaration = TypePrefixDeclaration.fromTypePrefixDeclarationNode(typePrefixDeclarationNode, context),
364
+ const typePrefixDeclaration = typePrefixDeclarationFromTypePrefixDeclarationNode(typePrefixDeclarationNode, context),
363
365
  typePrefixDeclarationVerifies = typePrefixDeclaration.verify();
364
366
 
365
367
  if (typePrefixDeclarationVerifies) {
@@ -374,8 +376,7 @@ class TopLevelPass extends Pass {
374
376
  run: (combinatorDeclarationNode, context) => {
375
377
  let success = false;
376
378
 
377
- const { CombinatorDeclaration } = elements,
378
- combinatorDeclaration = CombinatorDeclaration.fromCombinatorDeclarationNode(combinatorDeclarationNode, context),
379
+ const combinatorDeclaration = combinatorDeclarationFromCombinatorDeclarationNode(combinatorDeclarationNode, context),
379
380
  combinatorDeclarationVerifies = combinatorDeclaration.verify();
380
381
 
381
382
  if (combinatorDeclarationVerifies) {
@@ -390,8 +391,7 @@ class TopLevelPass extends Pass {
390
391
  run: (constructorDeclarationNode, context) => {
391
392
  let success = false;
392
393
 
393
- const { ConstructorDeclaration } = elements,
394
- constructorDeclaration = ConstructorDeclaration.fromConstructorDeclarationNode(constructorDeclarationNode, context),
394
+ const constructorDeclaration = constructorDeclarationFromConstructorDeclarationNode(constructorDeclarationNode, context),
395
395
  constructorDeclarationVerifies = constructorDeclaration.verify();
396
396
 
397
397
  if (constructorDeclarationVerifies) {
@@ -406,8 +406,7 @@ class TopLevelPass extends Pass {
406
406
  run: (complexTypeDeclarationNode, context) => {
407
407
  let success = false;
408
408
 
409
- const { ComplexTypeDeclaration } = elements,
410
- complexTypeDeclaration = ComplexTypeDeclaration.fromComplexTypeDeclarationNode(complexTypeDeclarationNode, context),
409
+ const complexTypeDeclaration = complexTypeDeclarationFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context),
411
410
  complexTypeDeclarationVerifies = complexTypeDeclaration.verify();
412
411
 
413
412
  if (complexTypeDeclarationVerifies) {
@@ -422,8 +421,7 @@ class TopLevelPass extends Pass {
422
421
  run: (metavariableDeclarationNode, context) => {
423
422
  let success = false;
424
423
 
425
- const { MetavariableDeclaration } = elements,
426
- metavariableDeclaration = MetavariableDeclaration.fromMetavariableDeclarationNode(metavariableDeclarationNode, context),
424
+ const metavariableDeclaration = metavariableDeclarationFromMetavariableDeclarationNode(metavariableDeclarationNode, context),
427
425
  metavariableDeclarationVerifies = metavariableDeclaration.verify();
428
426
 
429
427
  if (metavariableDeclarationVerifies) {
@@ -457,8 +455,7 @@ class CombinatorPass extends Pass {
457
455
  run: (statementNode, context) => {
458
456
  let success = false;
459
457
 
460
- const { Statement } = elements,
461
- statement = Statement.fromStatementNode(statementNode, context),
458
+ const statement = statementFromStatementNode(statementNode, context),
462
459
  assignments = null,
463
460
  stated = false,
464
461
  statementVerifies = statement.verify(assignments, stated, context);
@@ -475,8 +472,7 @@ class CombinatorPass extends Pass {
475
472
  run: (termNode, context) => {
476
473
  let success = false;
477
474
 
478
- const { Term } = elements,
479
- term = Term.fromTermNode(termNode, context),
475
+ const term = termFromTermNode(termNode, context),
480
476
  termVerifies = term.verify(context, () => {
481
477
  const verifiesAhead = true;
482
478
 
@@ -529,8 +525,7 @@ class ConstructorPass extends Pass {
529
525
  run: (termNode, context, verifyAhead) => {
530
526
  let success = false;
531
527
 
532
- const { Term } = elements,
533
- term = Term.fromTermNode(termNode, context),
528
+ const term = termFromTermNode(termNode, context),
534
529
  termVerifies = term.verify(context, verifyAhead);
535
530
 
536
531
  if (termVerifies) {