occam-verify-cli 1.0.172 → 1.0.175

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 (149) hide show
  1. package/lib/dom/constructor.js +11 -11
  2. package/lib/dom/declaration/combinator.js +3 -3
  3. package/lib/dom/declaration/complexType.js +41 -23
  4. package/lib/dom/declaration/constructor.js +35 -42
  5. package/lib/dom/declaration/type.js +26 -27
  6. package/lib/dom/declaration/variable.js +29 -44
  7. package/lib/dom/metaType.js +2 -3
  8. package/lib/dom/metavariable.js +4 -5
  9. package/lib/dom/property.js +3 -4
  10. package/lib/dom/statement.js +13 -62
  11. package/lib/dom/term.js +17 -14
  12. package/lib/dom/type.js +35 -102
  13. package/lib/dom/variable.js +8 -6
  14. package/lib/mixins/node.js +145 -0
  15. package/lib/node/assertion/contained.js +23 -1
  16. package/lib/node/assertion/defined.js +23 -1
  17. package/lib/node/assertion/property.js +23 -1
  18. package/lib/node/assertion/satisfies.js +23 -1
  19. package/lib/node/assertion/subproof.js +23 -1
  20. package/lib/node/assertion/type.js +23 -1
  21. package/lib/node/axiom.js +23 -1
  22. package/lib/node/combinator.js +23 -1
  23. package/lib/node/conclusion.js +23 -1
  24. package/lib/node/conjecture.js +23 -1
  25. package/lib/node/constructor.js +23 -1
  26. package/lib/node/declaration/combinator.js +34 -1
  27. package/lib/node/declaration/complexType.js +81 -1
  28. package/lib/node/declaration/constructor.js +62 -1
  29. package/lib/node/declaration/metavariable.js +23 -1
  30. package/lib/node/declaration/property.js +180 -0
  31. package/lib/node/declaration/type.js +67 -1
  32. package/lib/node/declaration/variable.js +78 -1
  33. package/lib/node/declaration.js +23 -1
  34. package/lib/node/deduction.js +23 -1
  35. package/lib/node/derivation.js +23 -1
  36. package/lib/node/equality.js +23 -1
  37. package/lib/node/error.js +23 -1
  38. package/lib/node/frame.js +23 -1
  39. package/lib/node/judgement.js +23 -1
  40. package/lib/node/label.js +23 -1
  41. package/lib/node/lemma.js +23 -1
  42. package/lib/node/metaLemma.js +23 -1
  43. package/lib/node/metaType.js +34 -1
  44. package/lib/node/metatheorem.js +23 -1
  45. package/lib/node/metavariable.js +34 -1
  46. package/lib/node/parameter.js +23 -1
  47. package/lib/node/premise.js +23 -1
  48. package/lib/node/procedureCall.js +23 -1
  49. package/lib/node/proof.js +23 -1
  50. package/lib/node/property.js +35 -1
  51. package/lib/node/propertyRelation.js +23 -1
  52. package/lib/node/reference.js +23 -1
  53. package/lib/node/rule.js +23 -1
  54. package/lib/node/statement.js +23 -1
  55. package/lib/node/step.js +23 -1
  56. package/lib/node/subDerivation.js +23 -1
  57. package/lib/node/subproof.js +23 -1
  58. package/lib/node/supposition.js +23 -1
  59. package/lib/node/term.js +23 -1
  60. package/lib/node/theorem.js +23 -1
  61. package/lib/node/topLevelAssertion.js +23 -1
  62. package/lib/node/topLevelMetaAssertion.js +23 -1
  63. package/lib/node/type.js +34 -1
  64. package/lib/node/variable.js +34 -1
  65. package/lib/node.js +73 -2
  66. package/lib/nodeMap.js +5 -3
  67. package/lib/ruleNames.js +9 -1
  68. package/lib/unifier/metavariable.js +2 -3
  69. package/lib/unifier/statementWithCombinator.js +2 -3
  70. package/lib/unifier/termWithConstructor.js +2 -3
  71. package/lib/utilities/node.js +84 -0
  72. package/lib/verifier/combinator.js +2 -3
  73. package/lib/verifier/constructor.js +2 -3
  74. package/package.json +2 -2
  75. package/src/dom/constructor.js +10 -12
  76. package/src/dom/declaration/combinator.js +2 -2
  77. package/src/dom/declaration/complexType.js +43 -52
  78. package/src/dom/declaration/constructor.js +49 -57
  79. package/src/dom/declaration/type.js +34 -37
  80. package/src/dom/declaration/variable.js +30 -54
  81. package/src/dom/metaType.js +1 -2
  82. package/src/dom/metavariable.js +3 -4
  83. package/src/dom/property.js +5 -7
  84. package/src/dom/statement.js +6 -24
  85. package/src/dom/term.js +8 -14
  86. package/src/dom/type.js +45 -165
  87. package/src/dom/variable.js +19 -11
  88. package/src/mixins/node.js +201 -0
  89. package/src/node/assertion/contained.js +3 -1
  90. package/src/node/assertion/defined.js +3 -1
  91. package/src/node/assertion/property.js +3 -1
  92. package/src/node/assertion/satisfies.js +3 -1
  93. package/src/node/assertion/subproof.js +3 -1
  94. package/src/node/assertion/type.js +3 -1
  95. package/src/node/axiom.js +3 -1
  96. package/src/node/combinator.js +3 -1
  97. package/src/node/conclusion.js +3 -1
  98. package/src/node/conjecture.js +3 -1
  99. package/src/node/constructor.js +3 -1
  100. package/src/node/declaration/combinator.js +13 -1
  101. package/src/node/declaration/complexType.js +73 -1
  102. package/src/node/declaration/constructor.js +47 -1
  103. package/src/node/declaration/metavariable.js +3 -1
  104. package/src/node/declaration/property.js +36 -0
  105. package/src/node/declaration/type.js +58 -1
  106. package/src/node/declaration/variable.js +67 -1
  107. package/src/node/declaration.js +3 -1
  108. package/src/node/deduction.js +3 -1
  109. package/src/node/derivation.js +3 -1
  110. package/src/node/equality.js +3 -1
  111. package/src/node/error.js +3 -1
  112. package/src/node/frame.js +3 -1
  113. package/src/node/judgement.js +3 -1
  114. package/src/node/label.js +3 -1
  115. package/src/node/lemma.js +3 -1
  116. package/src/node/metaLemma.js +3 -1
  117. package/src/node/metaType.js +15 -1
  118. package/src/node/metatheorem.js +3 -1
  119. package/src/node/metavariable.js +15 -1
  120. package/src/node/parameter.js +3 -1
  121. package/src/node/premise.js +3 -1
  122. package/src/node/procedureCall.js +3 -1
  123. package/src/node/proof.js +3 -1
  124. package/src/node/property.js +18 -1
  125. package/src/node/propertyRelation.js +3 -1
  126. package/src/node/reference.js +3 -1
  127. package/src/node/rule.js +3 -1
  128. package/src/node/statement.js +3 -1
  129. package/src/node/step.js +3 -1
  130. package/src/node/subDerivation.js +3 -1
  131. package/src/node/subproof.js +3 -1
  132. package/src/node/supposition.js +3 -1
  133. package/src/node/term.js +3 -1
  134. package/src/node/theorem.js +3 -1
  135. package/src/node/topLevelAssertion.js +3 -1
  136. package/src/node/topLevelMetaAssertion.js +3 -1
  137. package/src/node/type.js +15 -1
  138. package/src/node/variable.js +15 -1
  139. package/src/node.js +23 -1
  140. package/src/nodeMap.js +7 -1
  141. package/src/ruleNames.js +2 -0
  142. package/src/unifier/metavariable.js +1 -2
  143. package/src/unifier/statementWithCombinator.js +1 -2
  144. package/src/unifier/termWithConstructor.js +1 -2
  145. package/src/utilities/node.js +72 -0
  146. package/src/verifier/combinator.js +1 -2
  147. package/src/verifier/constructor.js +1 -2
  148. package/lib/utilities/name.js +0 -44
  149. package/src/utilities/name.js +0 -39
@@ -32,41 +32,15 @@ export default domAssigned(class ConstructorDeclaration {
32
32
 
33
33
  this.fileContext.trace(`Verifying the '${constructorDeclarationString}' constructor declaration...`);
34
34
 
35
- const constructorVerified = this.verifyConstructor();
35
+ const constructorTypeVerified = this.verifyConstructorType();
36
36
 
37
- if (constructorVerified) {
38
- const typeVerified = this.verifyType();
39
-
40
- if (typeVerified) {
41
- let type;
42
-
43
- type = this.constructor.getType();
44
-
45
- const typeName = type.getName();
46
-
47
- type = this.fileContext.findTypeByTypeName(typeName);
48
-
49
- const typeProvisional = type.isProvisional(),
50
- constructorProvisional = this.constructor.isProvisional();
37
+ if (constructorTypeVerified) {
38
+ const constructorVerified = this.verifyConstructor();
51
39
 
52
- if (typeProvisional !== constructorProvisional) {
53
- const typeString = type.getString(),
54
- constructorString = this.constructor.getString();
40
+ if (constructorVerified) {
41
+ this.fileContext.addConstructor(this.constructor);
55
42
 
56
- if (typeProvisional) {
57
- this.fileContext.debug(`The '${typeString}' type is provisional whilst the '${constructorString}' constructor's type is not.`);
58
- }
59
-
60
- if (constructorProvisional) {
61
- this.fileContext.debug(`The '${typeString}' type is not provisional whilst the '${constructorString}' constructor's type is.`);
62
- }
63
- } else {
64
- this.constructor.setType(type);
65
-
66
- this.fileContext.addConstructor(this.constructor);
67
-
68
- verified = true;
69
- }
43
+ verified = true;
70
44
  }
71
45
  }
72
46
 
@@ -77,31 +51,6 @@ export default domAssigned(class ConstructorDeclaration {
77
51
  return verified;
78
52
  }
79
53
 
80
- verifyType() {
81
- let typeVerified;
82
-
83
- const type = this.constructor.getType();
84
-
85
- const typeName = type.getName(),
86
- typeString = type.getString();
87
-
88
- this.fileContext.trace(`Verifying the '${typeString}' type...`);
89
-
90
- const typePresent = this.fileContext.isTypePresentByTypeName(typeName);
91
-
92
- if (!typePresent) {
93
- this.fileContext.debug(`The '${typeString}' type is not present.`);
94
- } else {
95
- typeVerified = true;
96
- }
97
-
98
- if (typeVerified) {
99
- this.fileContext.debug(`...verified the '${typeString}' type.`);
100
- }
101
-
102
- return typeVerified;
103
- }
104
-
105
54
  verifyConstructor() {
106
55
  let constructorVerified;
107
56
 
@@ -121,6 +70,49 @@ export default domAssigned(class ConstructorDeclaration {
121
70
  return constructorVerified;
122
71
  }
123
72
 
73
+ verifyConstructorType() {
74
+ let constructorTypeVerified = false;
75
+
76
+ let type;
77
+
78
+ type = this.constructor.getType();
79
+
80
+ const typeName = type.getName(),
81
+ typeString = type.getString(),
82
+ constructorString = this.constructor.getString();
83
+
84
+ this.fileContext.trace(`Verifying the '${constructorString}' constructor's '${typeString}' type...`);
85
+
86
+ const includeSupertypes = false,
87
+ provisional = type.isProvisional(includeSupertypes);
88
+
89
+ type = this.fileContext.findTypeByTypeName(typeName);
90
+
91
+ const typePresent = (type !== null)
92
+
93
+ if (!typePresent) {
94
+ this.fileContext.debug(`The '${constructorString}' constructor's '${typeString}' type is not present.`);
95
+ } else {
96
+ const provisionalMatches = type.matchProvisional(provisional);
97
+
98
+ if (!provisionalMatches) {
99
+ provisional ?
100
+ this.fileContext.debug(`The '${constructorString}' constructor's '${typeString}' type is present but it should be provisional.`) :
101
+ this.fileContext.debug(`The '${constructorString}' constructor's '${typeString}' type is present but it should not be provisional.`);
102
+ } else {
103
+ this.constructor.setType(type);
104
+
105
+ constructorTypeVerified = true;
106
+ }
107
+ }
108
+
109
+ if (constructorTypeVerified) {
110
+ this.fileContext.debug(`...verified the '${constructorString}' constructor's '${typeString}' type.`);
111
+ }
112
+
113
+ return constructorTypeVerified;
114
+ }
115
+
124
116
  static name = "ConstructorDeclaration";
125
117
 
126
118
  static fromConstructorDeclarationNode(constructorDeclarationNode, fileContext) {
@@ -37,20 +37,6 @@ export default domAssigned(class TypeDeclaration {
37
37
  const superTypesVerified = this.verifySuperTypes();
38
38
 
39
39
  if (superTypesVerified) {
40
- let superTypes;
41
-
42
- superTypes = this.type.getSuperTypes();
43
-
44
- superTypes = superTypes.map((superType) => {
45
- const superTypeName = superType.getName();
46
-
47
- superType = this.fileContext.findTypeByTypeName(superTypeName);
48
-
49
- return superType;
50
- });
51
-
52
- this.type.setSuperTypes(superTypes);
53
-
54
40
  this.fileContext.addType(this.type);
55
41
 
56
42
  verified = true;
@@ -87,6 +73,25 @@ export default domAssigned(class TypeDeclaration {
87
73
  return typeVerified;
88
74
  }
89
75
 
76
+ verifySuperType(superType) {
77
+ let superTypeVerified;
78
+
79
+ const superTypeString = superType.getString();
80
+
81
+ this.fileContext.trace(`Verifying the '${superTypeString}' super-type...`);
82
+
83
+ const superTypeName = superType.getName(),
84
+ superTypePresent = this.fileContext.isTypePresentByTypeName(superTypeName);
85
+
86
+ superTypeVerified = superTypePresent; ///
87
+
88
+ if (superTypeVerified) {
89
+ this.fileContext.debug(`...verified the '${superTypeString}' super-type.`);
90
+ }
91
+
92
+ return superTypeVerified;
93
+ }
94
+
90
95
  verifySuperTypes() {
91
96
  let superTypesVerified;
92
97
 
@@ -95,11 +100,13 @@ export default domAssigned(class TypeDeclaration {
95
100
  if (typeBasic) {
96
101
  superTypesVerified = true;
97
102
  } else {
98
- const typeString = this.type.getString(),
99
- superTypes = this.type.getSuperTypes(),
100
- superTypesString = superTypesStringFromSuperTypes(superTypes);
103
+ let superTypes;
104
+
105
+ superTypes = this.type.getSuperTypes();
106
+
107
+ const superTypesString = superTypesStringFromSuperTypes(superTypes);
101
108
 
102
- this.fileContext.trace(`Verifying the '${typeString}' type's ${superTypesString} super-types...`);
109
+ this.fileContext.trace(`Verifying the ${superTypesString} super-types...`);
103
110
 
104
111
  superTypesVerified = superTypes.every((superType) => {
105
112
  const superTypeVerified = this.verifySuperType(superType);
@@ -110,31 +117,21 @@ export default domAssigned(class TypeDeclaration {
110
117
  });
111
118
 
112
119
  if (superTypesVerified) {
113
- this.fileContext.debug(`...verified the '${typeString}' type's ${superTypesString} super-types.`);
114
- }
115
- }
116
-
117
- return superTypesVerified;
118
- }
119
-
120
- verifySuperType(superType) {
121
- let superTypeVerified;
122
-
123
- const typeString = this.type.getString(),
124
- superTypeString = superType.getString();
120
+ superTypes = superTypes.map((superType) => {
121
+ const superTypeName = superType.getName();
125
122
 
126
- this.fileContext.trace(`Verifying the '${typeString}' type's '${superTypeString}' super-type...`);
123
+ superType = this.fileContext.findTypeByTypeName(superTypeName);
127
124
 
128
- const superTypeName = superType.getName(),
129
- superTypePresent = this.fileContext.isTypePresentByTypeName(superTypeName);
125
+ return superType;
126
+ });
130
127
 
131
- superTypeVerified = superTypePresent; ///
128
+ this.type.setSuperTypes(superTypes);
132
129
 
133
- if (superTypeVerified) {
134
- this.fileContext.debug(`...verified the '${typeString}' type's '${superTypeString}' super-type.`);
130
+ this.fileContext.debug(`...verified the ${superTypesString} super-types.`);
131
+ }
135
132
  }
136
133
 
137
- return superTypeVerified;
134
+ return superTypesVerified;
138
135
  }
139
136
 
140
137
  static name = "TypeDeclaration";
@@ -30,51 +30,50 @@ export default domAssigned(class VariableDeclaration {
30
30
 
31
31
  this.fileContext.trace(`Verifying the '${variableDeclarationString}' variable declaration...`);
32
32
 
33
- const variableVerified = this.verifyVariable();
33
+ const variableTypeVerified = this.verifyVariableType();
34
34
 
35
- if (variableVerified) {
36
- const variableTypeVerified = this.verifyVariableType();
35
+ if (variableTypeVerified) {
36
+ const variableVerified = this.verifyVariable();
37
37
 
38
- if (variableTypeVerified) {
39
- let type;
38
+ if (variableVerified) {
39
+ this.fileContext.addVariable(this.variable);
40
40
 
41
- type = this.variable.getType();
41
+ verified = true;
42
+ }
43
+ }
42
44
 
43
- const typeName = type.getName();
45
+ if (verified) {
46
+ this.fileContext.debug(`...verified the '${variableDeclarationString}' variable declaration.`);
47
+ }
44
48
 
45
- type = this.fileContext.findTypeByTypeName(typeName);
49
+ return verified;
50
+ }
46
51
 
47
- const typeProvisional = type.isProvisional(),
48
- variableProvisional = this.variable.isProvisional();
52
+ verifyVariable() {
53
+ let variableVerified = false;
49
54
 
50
- if (typeProvisional !== variableProvisional) {
51
- const typeString = type.getString(),
52
- variableString = this.variable.getString();
55
+ const variableString = this.variable.getString();
53
56
 
54
- if (typeProvisional) {
55
- this.fileContext.debug(`The '${typeString}' type is provisional whilst the '${variableString}' variable's type is not.`);
56
- }
57
+ this.fileContext.trace(`Verifying the '${variableString}' variable...`);
57
58
 
58
- if (variableProvisional) {
59
- this.fileContext.debug(`The '${typeString}' type is not provisional whilst the '${variableString}' variable's type is.`);
60
- }
61
- } else {
62
- this.fileContext.addVariable(this.variable);
59
+ const variableName = this.variable.getName(),
60
+ variablePresent = this.fileContext.isVariablePresentByVariableName(variableName);
63
61
 
64
- verified = true;
65
- }
66
- }
62
+ if (variablePresent) {
63
+ this.fileContext.debug(`The '${variableName}' variable is already present.`);
64
+ } else {
65
+ variableVerified = true;
67
66
  }
68
67
 
69
- if (verified) {
70
- this.fileContext.debug(`...verified the '${variableDeclarationString}' variable declaration.`);
68
+ if ( variableVerified) {
69
+ this.fileContext.debug(`...verified the '${variableString}' variable.`);
71
70
  }
72
71
 
73
- return verified;
72
+ return variableVerified;
74
73
  }
75
74
 
76
75
  verifyVariableType() {
77
- let typeVerified = false;
76
+ let variableTypeVerified = false;
78
77
 
79
78
  let type;
80
79
 
@@ -105,38 +104,15 @@ export default domAssigned(class VariableDeclaration {
105
104
  } else {
106
105
  this.variable.setType(type);
107
106
 
108
- typeVerified = true;
107
+ variableTypeVerified = true;
109
108
  }
110
109
  }
111
110
 
112
- if (typeVerified) {
111
+ if (variableTypeVerified) {
113
112
  this.fileContext.debug(`...verified the '${variableString}' variable's '${typeString}' type.`);
114
113
  }
115
114
 
116
- return typeVerified;
117
- }
118
-
119
- verifyVariable() {
120
- let variableVerified = false;
121
-
122
- const variableString = this.variable.getString();
123
-
124
- this.fileContext.trace(`Verifying the '${variableString}' variable...`);
125
-
126
- const variableName = this.variable.getName(),
127
- variablePresent = this.fileContext.isVariablePresentByVariableName(variableName);
128
-
129
- if (variablePresent) {
130
- this.fileContext.debug(`The '${variableName}' variable is already present.`);
131
- } else {
132
- variableVerified = true;
133
- }
134
-
135
- if ( variableVerified) {
136
- this.fileContext.debug(`...verified the '${variableString}' variable.`);
137
- }
138
-
139
- return variableVerified;
115
+ return variableTypeVerified;
140
116
  }
141
117
 
142
118
  static name = "VariableDeclaration";
@@ -4,7 +4,6 @@ import LocalContext from "../context/local";
4
4
 
5
5
  import { nodeQuery } from "../utilities/query";
6
6
  import { domAssigned } from "../dom";
7
- import { metaTypeNameFromMetaTypeNode } from "../utilities/name";
8
7
  import { FRAME_META_TYPE_NAME, REFERENCE_META_TYPE_NAME, STATEMENT_META_TYPE_NAME } from "../metaTypeNames";
9
8
 
10
9
  const metavariableDeclarationMetaTypeNodeQuery = nodeQuery("/metavariableDeclaration/metaType");
@@ -73,7 +72,7 @@ class MetaType {
73
72
  }
74
73
 
75
74
  function metaTypeFromMetaTypeNode(metaTypeNode, context) {
76
- const metaTypeName = metaTypeNameFromMetaTypeNode(metaTypeNode),
75
+ const metaTypeName = metaTypeNode.getMetaTypeName(),
77
76
  metaType = metaTypeFromMetaTypeName(metaTypeName);
78
77
 
79
78
  return metaType;
@@ -14,7 +14,6 @@ import { typeFromJSON, typeToTypeJSON } from "../utilities/json";
14
14
  import { metaTypeFromJSON, metaTypeToMetaTypeJSON } from "../utilities/json";
15
15
  import { metavariableFromFrame, metavariableFromStatement } from "../utilities/context";
16
16
  import { unifyMetavariable, unifyMetavariableIntrinsically } from "../utilities/unification";
17
- import { typeNameFromTypeNode, metavariableNameFromMetavariableNode } from "../utilities/name";
18
17
 
19
18
  const frameMetavariableNodeQuery = nodeQuery("/frame/metavariable!"),
20
19
  labelMetavariableNodeQuery = nodeQuery("/label/metavariable"),
@@ -458,7 +457,7 @@ export default domAssigned(class Metavariable {
458
457
  metavariablePartialContext = MetavariablePartialContext.fromStringLexerAndParser(string, lexer, parser),
459
458
  metavariableTokens = metavariablePartialContext.getMetavariableTokens(),
460
459
  metavariableNode = metavariablePartialContext.getMetavariableNode(),
461
- metavariableName = metavariableNameFromMetavariableNode(metavariableNode),
460
+ metavariableName = metavariableNode.getMetavariableName(),
462
461
  name = metavariableName, ///
463
462
  node = metavariableNode, ///
464
463
  tokens = metavariableTokens, ///
@@ -543,7 +542,7 @@ export default domAssigned(class Metavariable {
543
542
 
544
543
  function metavariableFromMetavariableNode(metavariableNode, context) {
545
544
  const { Metavariable } = dom,
546
- metavariableName = metavariableNameFromMetavariableNode(metavariableNode),
545
+ metavariableName = metavariableNode.getMetavariableName(),
547
546
  type = null,
548
547
  name = metavariableName, ///
549
548
  node = metavariableNode, ///
@@ -562,7 +561,7 @@ function typeFromMetavariableDeclarationNode(metavariableDeclarationNode, fileCo
562
561
 
563
562
  if (metavariableDeclarationMetavariableTypeNode !== null) {
564
563
  const typeNode = metavariableDeclarationMetavariableTypeNode, ///
565
- typeName = typeNameFromTypeNode(typeNode);
564
+ typeName = typeNode.getTypeName();
566
565
 
567
566
  type = fileContext.findTypeByTypeName(typeName);
568
567
  }
@@ -12,8 +12,7 @@ import { typeFromJSON, typeToTypeJSON } from "../utilities/json";
12
12
  const { match } = arrayUtilities;
13
13
 
14
14
  const nameTerminalNodesQuery = nodesQuery("/property/@name"),
15
- propertyRelationPropertyNodeQuery = nodeQuery("/propertyRelation/property"),
16
- propertyDeclarationPropertyNodeQuery = nodeQuery("/propertyDeclaration/property");
15
+ propertyRelationPropertyNodeQuery = nodeQuery("/propertyRelation/property");
17
16
 
18
17
  export default domAssigned(class Property {
19
18
  constructor(string, names, type) {
@@ -88,11 +87,10 @@ export default domAssigned(class Property {
88
87
  static fromPropertyDeclarationNode(propertyDeclarationNode, fileContext) {
89
88
  const { Type } = dom,
90
89
  type = Type.fromPropertyDeclarationNode(propertyDeclarationNode),
91
- propertyDeclarationPropertyNode = propertyDeclarationPropertyNodeQuery(propertyDeclarationNode),
92
- propertyNode = propertyDeclarationPropertyNode, ///
93
- property = propertyFromPropertyNode(propertyNode, fileContext);
94
-
95
- property.setType(type);
90
+ propertyNames = propertyDeclarationNode.getPropertyNames(),
91
+ names = propertyNames, ///
92
+ string = stringFromNamesAndType(names, type),
93
+ property = new Property(string, names, type);
96
94
 
97
95
  return property;
98
96
  }
@@ -2,7 +2,6 @@
2
2
 
3
3
  import { arrayUtilities } from "necessary";
4
4
 
5
- import dom from "../dom";
6
5
  import LocalContext from "../context/local";
7
6
  import verifyMixins from "../mixins/statement/verify";
8
7
  import StatementPartialContext from "../context/partial/statement";
@@ -11,6 +10,7 @@ import { domAssigned } from "../dom";
11
10
  import { unifyStatement } from "../utilities/unification";
12
11
  import { nodeQuery, nodesQuery } from "../utilities/query";
13
12
  import { STATEMENT_META_TYPE_NAME } from "../metaTypeNames";
13
+ import { statementFromStatementNode } from "../utilities/node";
14
14
  import { stripBracketsFromStatementNode } from "../utilities/brackets";
15
15
  import { definedAssertionFromStatement, containedAssertionFromStatement, subproofAssertionFromStatement } from "../utilities/context";
16
16
 
@@ -24,8 +24,7 @@ const stepStatementNodeQuery = nodeQuery("/step/statement"),
24
24
  conclusionStatementNodeQuery = nodeQuery("/conclusion/statement"),
25
25
  suppositionStatementNodeQuery = nodeQuery("/supposition/statement"),
26
26
  declarationStatementNodeQuery = nodeQuery("/declaration/statement"),
27
- containedAssertionStatementNodeQuery = nodeQuery("/containedAssertion/statement"),
28
- combinatorDeclarationStatementNodeQuery = nodeQuery("/combinatorDeclaration/statement");
27
+ containedAssertionStatementNodeQuery = nodeQuery("/containedAssertion/statement");
29
28
 
30
29
  export default domAssigned(class Statement {
31
30
  constructor(string, node, tokens) {
@@ -391,28 +390,11 @@ export default domAssigned(class Statement {
391
390
  }
392
391
 
393
392
  static fromCombinatorDeclarationNode(combinatorDeclarationNode, fileContext) {
394
- let statement = null;
395
-
396
- const combinatorDeclarationStatementNode = combinatorDeclarationStatementNodeQuery(combinatorDeclarationNode);
397
-
398
- if (combinatorDeclarationStatementNode !== null) {
399
- const statementNode = combinatorDeclarationStatementNode, ///
400
- localContext = LocalContext.fromFileContext(fileContext),
401
- context = localContext; ///
402
-
403
- statement = statementFromStatementNode(statementNode, context);
404
- }
393
+ const statementNode = combinatorDeclarationNode.getStatementNode(),
394
+ localContext = LocalContext.fromFileContext(fileContext),
395
+ context = localContext, ///
396
+ statement = statementFromStatementNode(statementNode, context);
405
397
 
406
398
  return statement;
407
399
  }
408
400
  });
409
-
410
- function statementFromStatementNode(statementNode, context) {
411
- const { Statement } = dom,
412
- node = statementNode, ///
413
- tokens = context.nodeAsTokens(node),
414
- string = context.tokensAsString(tokens),
415
- statement = new Statement(string, node, tokens);
416
-
417
- return statement;
418
- }
package/src/dom/term.js CHANGED
@@ -7,6 +7,7 @@ import LocalContext from "../context/local";
7
7
  import verifyMixins from "../mixins/term/verify";
8
8
 
9
9
  import { domAssigned } from "../dom";
10
+ import { termFromTermNode } from "../utilities/node";
10
11
  import { nodeQuery, nodesQuery } from "../utilities/query"
11
12
  import { termNodeFromTermString } from "../context/partial/term";
12
13
  import { typeFromJSON, typeToTypeJSON } from "../utilities/json";
@@ -19,8 +20,7 @@ const variableNodesQuery = nodesQuery("//variable"),
19
20
  definedAssertionTermNodeQuery = nodeQuery("/definedAssertion/term"),
20
21
  propertyRelationTermNodeQuery = nodeQuery("/propertyRelation/term"),
21
22
  propertyAssertionTermNodeQuery = nodeQuery("/propertyAssertion/term"),
22
- containedAssertionTermNodeQuery = nodeQuery("/containedAssertion/term"),
23
- constructorDeclarationTermNodeQuery = nodeQuery("/constructorDeclaration/term");
23
+ containedAssertionTermNodeQuery = nodeQuery("/containedAssertion/term");
24
24
 
25
25
  export default domAssigned(class Term {
26
26
  constructor(string, node, type) {
@@ -79,6 +79,8 @@ export default domAssigned(class Term {
79
79
  return termNodeMatches;
80
80
  }
81
81
 
82
+ isProvisional() { return this.type.isProvisional(); }
83
+
82
84
  isEqualTo(term) {
83
85
  const termString = term.getString(),
84
86
  equalTo = (termString === this.string);
@@ -282,10 +284,11 @@ export default domAssigned(class Term {
282
284
  return term;
283
285
  }
284
286
 
285
- static fromConstructorDeclarationNode(constructorDeclarationNode, context) {
287
+ static fromConstructorDeclarationNode(constructorDeclarationNode, fileContext) {
286
288
  const { Type } = dom,
287
- constructorDeclarationTermNode = constructorDeclarationTermNodeQuery(constructorDeclarationNode),
288
- termNode = constructorDeclarationTermNode, ///
289
+ termNode = constructorDeclarationNode.getTermNode(),
290
+ localContext = LocalContext.fromFileContext(fileContext),
291
+ context = localContext, ///
289
292
  term = termFromTermNode(termNode, context),
290
293
  type = Type.fromConstructorDeclarationNode(constructorDeclarationNode, context);
291
294
 
@@ -295,12 +298,3 @@ export default domAssigned(class Term {
295
298
  }
296
299
  });
297
300
 
298
- function termFromTermNode(termNode, context) {
299
- const { Term } = dom,
300
- node = termNode, ///
301
- string = context.nodeAsString(node),
302
- type = null,
303
- term = new Term(string, node, type);
304
-
305
- return term;
306
- }