occam-verify-cli 1.0.185 → 1.0.198

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 (244) hide show
  1. package/lib/constants.js +5 -1
  2. package/lib/context/file.js +3 -3
  3. package/lib/dom/assertion/contained.js +12 -24
  4. package/lib/dom/assertion/defined.js +9 -21
  5. package/lib/dom/assertion/property.js +8 -10
  6. package/lib/dom/assertion/satisfies.js +6 -8
  7. package/lib/dom/assertion/subproof.js +3 -5
  8. package/lib/dom/assertion/type.js +6 -8
  9. package/lib/dom/axiom.js +15 -100
  10. package/lib/dom/conjecture.js +5 -4
  11. package/lib/dom/constructor/bracketed.js +6 -7
  12. package/lib/dom/declaration/complexType.js +6 -6
  13. package/lib/dom/declaration/constructor.js +6 -6
  14. package/lib/dom/declaration/metavariable.js +3 -5
  15. package/lib/dom/declaration/type.js +2 -2
  16. package/lib/dom/declaration/variable.js +6 -6
  17. package/lib/dom/declaration.js +14 -16
  18. package/lib/dom/derivation.js +2 -4
  19. package/lib/dom/equality.js +9 -11
  20. package/lib/dom/frame.js +14 -18
  21. package/lib/dom/judgement.js +8 -10
  22. package/lib/dom/lemma.js +5 -4
  23. package/lib/dom/metaLemma.js +5 -4
  24. package/lib/dom/metaType.js +2 -4
  25. package/lib/dom/metatheorem.js +5 -4
  26. package/lib/dom/metavariable.js +12 -15
  27. package/lib/dom/parameter.js +2 -4
  28. package/lib/dom/procedureCall.js +6 -10
  29. package/lib/dom/proof.js +2 -4
  30. package/lib/dom/property.js +16 -51
  31. package/lib/dom/propertyRelation.js +14 -16
  32. package/lib/dom/reference.js +7 -11
  33. package/lib/dom/rule.js +6 -8
  34. package/lib/dom/statement.js +27 -31
  35. package/lib/dom/step.js +4 -6
  36. package/lib/dom/subDerivation.js +2 -4
  37. package/lib/dom/subproof.js +6 -8
  38. package/lib/dom/term.js +12 -20
  39. package/lib/dom/theorem.js +5 -4
  40. package/lib/dom/topLevelAssertion.js +30 -24
  41. package/lib/dom/topLevelMetaAssertion.js +76 -140
  42. package/lib/dom/type.js +8 -25
  43. package/lib/dom/variable.js +5 -11
  44. package/lib/equivalence.js +4 -6
  45. package/lib/mixins/term/verify.js +4 -8
  46. package/lib/node/argument.js +116 -0
  47. package/lib/node/assertion/contained.js +48 -53
  48. package/lib/node/assertion/defined.js +41 -53
  49. package/lib/node/assertion/property.js +23 -53
  50. package/lib/node/assertion/satisfies.js +23 -53
  51. package/lib/node/assertion/subproof.js +16 -53
  52. package/lib/node/assertion/type.js +23 -53
  53. package/lib/node/axiom.js +6 -52
  54. package/lib/node/combinator.js +6 -52
  55. package/lib/node/conclusion.js +16 -53
  56. package/lib/node/conjecture.js +6 -52
  57. package/lib/node/constructor.js +6 -52
  58. package/lib/node/declaration/combinator.js +8 -56
  59. package/lib/node/declaration/complexType.js +42 -86
  60. package/lib/node/declaration/constructor.js +26 -77
  61. package/lib/node/declaration/metavariable.js +30 -53
  62. package/lib/node/declaration/property.js +19 -69
  63. package/lib/node/declaration/type.js +45 -78
  64. package/lib/node/declaration/variable.js +21 -81
  65. package/lib/node/declaration.js +23 -53
  66. package/lib/node/deduction.js +16 -53
  67. package/lib/node/derivation.js +42 -51
  68. package/lib/node/equality.js +32 -53
  69. package/lib/node/error.js +6 -52
  70. package/lib/node/frame.js +30 -53
  71. package/lib/node/judgement.js +23 -53
  72. package/lib/node/label.js +16 -53
  73. package/lib/node/labels.js +116 -0
  74. package/lib/node/lemma.js +6 -52
  75. package/lib/node/metaArgument.js +116 -0
  76. package/lib/node/metaLemma.js +6 -52
  77. package/lib/node/metaType.js +14 -55
  78. package/lib/node/metatheorem.js +6 -52
  79. package/lib/node/metavariable.js +30 -56
  80. package/lib/node/nonTerminal.js +200 -0
  81. package/lib/node/parameter.js +22 -53
  82. package/lib/node/parenthesisedLabel.js +116 -0
  83. package/lib/node/parenthesisedLabels.js +123 -0
  84. package/lib/node/premise.js +23 -53
  85. package/lib/node/procedureCall.js +23 -53
  86. package/lib/node/proof.js +16 -53
  87. package/lib/node/property.js +18 -57
  88. package/lib/node/propertyRelation.js +30 -53
  89. package/lib/node/reference.js +16 -53
  90. package/lib/node/rule.js +44 -53
  91. package/lib/node/statement.js +139 -53
  92. package/lib/node/step.js +37 -53
  93. package/lib/node/subDerivation.js +49 -51
  94. package/lib/node/subproof.js +44 -53
  95. package/lib/node/substitution/frame.js +123 -0
  96. package/lib/node/substitution/reference.js +123 -0
  97. package/lib/node/substitution/statement.js +123 -0
  98. package/lib/node/substitution/term.js +123 -0
  99. package/lib/node/supposition.js +23 -53
  100. package/lib/node/term.js +41 -53
  101. package/lib/node/theorem.js +6 -52
  102. package/lib/node/topLevelAssertion.js +66 -54
  103. package/lib/node/topLevelMetaAssertion.js +45 -54
  104. package/lib/node/type.js +14 -55
  105. package/lib/{node.js → node/types.js} +22 -24
  106. package/lib/node/variable.js +14 -55
  107. package/lib/nominal/parser.js +3 -3
  108. package/lib/nonTerminalNodeMap.js +14 -4
  109. package/lib/ruleNames.js +42 -2
  110. package/lib/substitution/frame.js +5 -7
  111. package/lib/substitution/reference.js +5 -7
  112. package/lib/substitution/term.js +5 -7
  113. package/lib/unifier/metaLevel.js +4 -4
  114. package/lib/utilities/brackets.js +5 -5
  115. package/lib/utilities/json.js +18 -1
  116. package/lib/utilities/node.js +1 -37
  117. package/lib/utilities/subproof.js +13 -4
  118. package/lib/utilities/type.js +16 -4
  119. package/lib/verifier/topLevel.js +6 -6
  120. package/package.json +2 -2
  121. package/src/constants.js +1 -0
  122. package/src/context/file.js +2 -2
  123. package/src/dom/assertion/contained.js +12 -34
  124. package/src/dom/assertion/defined.js +9 -30
  125. package/src/dom/assertion/property.js +7 -12
  126. package/src/dom/assertion/satisfies.js +5 -10
  127. package/src/dom/assertion/subproof.js +2 -6
  128. package/src/dom/assertion/type.js +7 -10
  129. package/src/dom/axiom.js +7 -77
  130. package/src/dom/conjecture.js +6 -1
  131. package/src/dom/constructor/bracketed.js +6 -8
  132. package/src/dom/declaration/complexType.js +8 -7
  133. package/src/dom/declaration/constructor.js +6 -7
  134. package/src/dom/declaration/metavariable.js +2 -6
  135. package/src/dom/declaration/type.js +4 -2
  136. package/src/dom/declaration/variable.js +6 -7
  137. package/src/dom/declaration.js +12 -20
  138. package/src/dom/derivation.js +1 -4
  139. package/src/dom/equality.js +13 -17
  140. package/src/dom/frame.js +11 -25
  141. package/src/dom/judgement.js +7 -12
  142. package/src/dom/lemma.js +6 -1
  143. package/src/dom/metaLemma.js +6 -1
  144. package/src/dom/metaType.js +1 -5
  145. package/src/dom/metatheorem.js +6 -1
  146. package/src/dom/metavariable.js +11 -25
  147. package/src/dom/parameter.js +2 -6
  148. package/src/dom/procedureCall.js +5 -14
  149. package/src/dom/proof.js +1 -4
  150. package/src/dom/property.js +21 -78
  151. package/src/dom/propertyRelation.js +16 -22
  152. package/src/dom/reference.js +6 -18
  153. package/src/dom/rule.js +6 -12
  154. package/src/dom/statement.js +26 -46
  155. package/src/dom/step.js +3 -5
  156. package/src/dom/subDerivation.js +1 -4
  157. package/src/dom/subproof.js +8 -12
  158. package/src/dom/term.js +14 -33
  159. package/src/dom/theorem.js +6 -1
  160. package/src/dom/topLevelAssertion.js +30 -25
  161. package/src/dom/topLevelMetaAssertion.js +87 -55
  162. package/src/dom/type.js +11 -37
  163. package/src/dom/variable.js +4 -12
  164. package/src/equivalence.js +3 -6
  165. package/src/mixins/term/verify.js +5 -11
  166. package/src/node/argument.js +16 -0
  167. package/src/node/assertion/contained.js +49 -3
  168. package/src/node/assertion/defined.js +42 -3
  169. package/src/node/assertion/property.js +19 -3
  170. package/src/node/assertion/satisfies.js +19 -3
  171. package/src/node/assertion/subproof.js +12 -3
  172. package/src/node/assertion/type.js +19 -3
  173. package/src/node/axiom.js +3 -3
  174. package/src/node/combinator.js +3 -3
  175. package/src/node/conclusion.js +12 -3
  176. package/src/node/conjecture.js +3 -3
  177. package/src/node/constructor.js +3 -3
  178. package/src/node/declaration/combinator.js +7 -8
  179. package/src/node/declaration/complexType.js +40 -43
  180. package/src/node/declaration/constructor.js +25 -30
  181. package/src/node/declaration/metavariable.js +26 -3
  182. package/src/node/declaration/property.js +17 -23
  183. package/src/node/declaration/type.js +43 -32
  184. package/src/node/declaration/variable.js +19 -37
  185. package/src/node/declaration.js +19 -3
  186. package/src/node/deduction.js +12 -3
  187. package/src/node/derivation.js +15 -3
  188. package/src/node/equality.js +32 -3
  189. package/src/node/error.js +3 -3
  190. package/src/node/frame.js +26 -3
  191. package/src/node/judgement.js +19 -3
  192. package/src/node/label.js +12 -3
  193. package/src/node/labels.js +16 -0
  194. package/src/node/lemma.js +3 -3
  195. package/src/node/metaArgument.js +16 -0
  196. package/src/node/metaLemma.js +3 -3
  197. package/src/node/metaType.js +15 -8
  198. package/src/node/metatheorem.js +3 -3
  199. package/src/node/metavariable.js +32 -9
  200. package/src/node/nonTerminal.js +112 -0
  201. package/src/node/parameter.js +20 -3
  202. package/src/node/parenthesisedLabel.js +16 -0
  203. package/src/node/parenthesisedLabels.js +23 -0
  204. package/src/node/premise.js +19 -3
  205. package/src/node/procedureCall.js +19 -3
  206. package/src/node/proof.js +12 -3
  207. package/src/node/property.js +18 -12
  208. package/src/node/propertyRelation.js +26 -3
  209. package/src/node/reference.js +12 -3
  210. package/src/node/rule.js +40 -3
  211. package/src/node/statement.js +151 -3
  212. package/src/node/step.js +31 -3
  213. package/src/node/subDerivation.js +22 -3
  214. package/src/node/subproof.js +38 -3
  215. package/src/node/substitution/frame.js +23 -0
  216. package/src/node/substitution/reference.js +23 -0
  217. package/src/node/substitution/statement.js +23 -0
  218. package/src/node/substitution/term.js +23 -0
  219. package/src/node/supposition.js +19 -3
  220. package/src/node/term.js +38 -3
  221. package/src/node/theorem.js +3 -3
  222. package/src/node/topLevelAssertion.js +69 -3
  223. package/src/node/topLevelMetaAssertion.js +40 -3
  224. package/src/node/type.js +15 -8
  225. package/src/node/types.js +16 -0
  226. package/src/node/variable.js +15 -8
  227. package/src/nominal/parser.js +1 -1
  228. package/src/nonTerminalNodeMap.js +67 -37
  229. package/src/ruleNames.js +11 -1
  230. package/src/substitution/frame.js +7 -10
  231. package/src/substitution/reference.js +7 -10
  232. package/src/substitution/term.js +7 -9
  233. package/src/unifier/metaLevel.js +2 -3
  234. package/src/utilities/brackets.js +8 -8
  235. package/src/utilities/json.js +19 -0
  236. package/src/utilities/node.js +0 -27
  237. package/src/utilities/subproof.js +22 -6
  238. package/src/utilities/type.js +9 -0
  239. package/src/verifier/topLevel.js +5 -10
  240. package/lib/defaultTerminalNode.js +0 -20
  241. package/lib/mixins/node.js +0 -145
  242. package/src/defaultTerminalNode.js +0 -7
  243. package/src/mixins/node.js +0 -201
  244. package/src/node.js +0 -29
package/src/dom/axiom.js CHANGED
@@ -4,34 +4,12 @@ import { arrayUtilities } from "necessary";
4
4
 
5
5
  import TopLevelAssertion from "./topLevelAssertion";
6
6
 
7
- import { nodeQuery } from "../utilities/query";
8
- import { SATISFIABLE } from "../constants";
9
7
  import { domAssigned } from "../dom";
10
- import { labelsFromJSON,
11
- deductionFromJSON,
12
- satisfiableFromJSON,
13
- labelsToLabelsJSON,
14
- suppositionsFromJSON,
15
- deductionToDeductionJSON,
16
- suppositionsToSuppositionsJSON } from "../utilities/json";
17
8
  import { satisfiesAssertionFromStatement } from "../utilities/context";
18
- import { proofFromNode, labelsFromNode, deductionFromNode, suppositionsFromNode, stringFromLabelsAndDeduction } from "./topLevelAssertion";
19
9
 
20
10
  const { match, backwardsSome } = arrayUtilities;
21
11
 
22
- const firstPrimaryKeywordTerminalNodeQuery = nodeQuery("/axiom/@primary-keyword[0]");
23
-
24
12
  export default domAssigned(class Axiom extends TopLevelAssertion {
25
- constructor(fileContext, string, labels, suppositions, deduction, proof, satisfiable) {
26
- super(fileContext, string, labels, suppositions, deduction, proof);
27
-
28
- this.satisfiable = satisfiable;
29
- }
30
-
31
- isSatisfiable() {
32
- return this.satisfiable;
33
- }
34
-
35
13
  verify() {
36
14
  let verified;
37
15
 
@@ -163,7 +141,9 @@ export default domAssigned(class Axiom extends TopLevelAssertion {
163
141
  statementAndStepsOrSubproofsUnified = super.unifyStatementAndStepsOrSubproofs(statement, stepsOrSubproofs, substitutions, context);
164
142
 
165
143
  if (statementAndStepsOrSubproofsUnified) {
166
- if (this.satisfiable) {
144
+ const satisfiable = this.isSatisfiable();
145
+
146
+ if (satisfiable) {
167
147
  const substitutionsMatch = backwardsSome(stepsOrSubproofs, (stepOrSubproof) => {
168
148
  const stepSubstep = stepOrSubproof.isStep();
169
149
 
@@ -189,64 +169,14 @@ export default domAssigned(class Axiom extends TopLevelAssertion {
189
169
  return statementAndStepsOrSubproofsUnified;
190
170
  }
191
171
 
192
- toJSON() {
193
- let labels = this.getLabels(),
194
- deduction = this.getDeduction(),
195
- suppositions = this.getSuppositions();
196
-
197
- const labelsJSON = labelsToLabelsJSON(labels),
198
- deductionJSON = deductionToDeductionJSON(deduction),
199
- suppositionsJSON = suppositionsToSuppositionsJSON(suppositions);
200
-
201
- labels = labelsJSON; ///
202
- deduction = deductionJSON; ///
203
- suppositions = suppositionsJSON; ///
204
-
205
- const satisfiable = this.satisfiable,
206
- json = {
207
- labels,
208
- deduction,
209
- suppositions,
210
- satisfiable
211
- };
212
-
213
- return json;
214
- }
215
-
216
172
  static name = "Axiom";
217
173
 
218
- static fromJSON(json, fileContext) {
219
- const labels = labelsFromJSON(json, fileContext),
220
- suppositions = suppositionsFromJSON(json, fileContext),
221
- deduction = deductionFromJSON(json, fileContext),
222
- proof = null,
223
- satisfiable = satisfiableFromJSON(json, fileContext),
224
- string = stringFromLabelsAndDeduction(labels, deduction),
225
- topLevelAssertion = new Axiom(fileContext, string, labels, suppositions, deduction, proof, satisfiable);
226
-
227
- return topLevelAssertion;
228
- }
174
+ static fromJSON(json, fileContext) { return TopLevelAssertion.fromJSON(Axiom, json, fileContext); }
229
175
 
230
176
  static fromAxiomNode(axiomNode, fileContext) {
231
177
  const node = axiomNode, ///
232
- proof = proofFromNode(node, fileContext),
233
- labels = labelsFromNode(node, fileContext),
234
- deduction = deductionFromNode(node, fileContext),
235
- satisfiable = satisfiableFromNode(node, fileContext),
236
- suppositions = suppositionsFromNode(node, fileContext),
237
- string = stringFromLabelsAndDeduction(labels, deduction),
238
- topLevelAssertion = new Axiom(fileContext, string, labels, suppositions, deduction, proof, satisfiable);
239
-
240
- return topLevelAssertion;
178
+ axiom = TopLevelAssertion.fromNode(Axiom, node, fileContext);
179
+
180
+ return axiom;
241
181
  }
242
182
  });
243
-
244
- export function satisfiableFromNode(node, fileContext) {
245
- const firstPrimaryKeywordTerminalNode = firstPrimaryKeywordTerminalNodeQuery(node),
246
- content = firstPrimaryKeywordTerminalNode.getContent(),
247
- contentSatisfiable = (content === SATISFIABLE),
248
- satisfiable = contentSatisfiable; ///
249
-
250
- return satisfiable;
251
- }
252
-
@@ -31,5 +31,10 @@ export default domAssigned(class Conjecture extends TopLevelAssertion {
31
31
 
32
32
  static fromJSON(json, fileContext) { return TopLevelAssertion.fromJSON(Conjecture, json, fileContext); }
33
33
 
34
- static fromNode(node, fileContext) { return TopLevelAssertion.fromNode(Conjecture, node, fileContext); }
34
+ static fromConjectureNode(conjectureNode, fileContext) {
35
+ const node = conjectureNode, ///
36
+ conjecture = TopLevelAssertion.fromNode(Conjecture, node, fileContext);
37
+
38
+ return conjecture;
39
+ }
35
40
  });
@@ -4,11 +4,8 @@ import dom from "../../dom";
4
4
  import Constructor from "../constructor";
5
5
  import constructorBracketedContext from "../../context/bracketed/constructor";
6
6
 
7
- import { nodeQuery } from "../../utilities/query";
8
7
  import { domAssigned } from "../../dom";
9
8
 
10
- const termNodeQuery = nodeQuery("/term/argument/term");
11
-
12
9
  export default domAssigned(class BracketedConstructor extends Constructor {
13
10
  unifyTerm(term, context, verifyAhead) {
14
11
  let termUnified;
@@ -23,11 +20,13 @@ export default domAssigned(class BracketedConstructor extends Constructor {
23
20
  const { Term } = dom,
24
21
  bracketedTerm = term, ///
25
22
  bracketedTermNode = bracketedTerm.getNode(),
26
- termNode = termNodeQuery(bracketedTermNode); ///
23
+ singularTermNode = bracketedTermNode.getSingularTermNode();
24
+
25
+ if (singularTermNode !== null) {
26
+ const termNode = singularTermNode; ///
27
27
 
28
- term = Term.fromTermNode(termNode, context);
28
+ term = Term.fromTermNode(termNode, context);
29
29
 
30
- if (term !== null) {
31
30
  const termVVerified = term.verify(context, () => {
32
31
  let verifiedAhead;
33
32
 
@@ -60,8 +59,7 @@ export default domAssigned(class BracketedConstructor extends Constructor {
60
59
  context = constructorBracketedContext, ///
61
60
  term = Term.fromTermNode(termNode, context),
62
61
  string = term.getString(),
63
- provisional = null,
64
- bracketedConstructor = new BracketedConstructor(string, term, provisional);
62
+ bracketedConstructor = new BracketedConstructor(string, term);
65
63
 
66
64
  return bracketedConstructor;
67
65
  }
@@ -3,7 +3,7 @@
3
3
  import dom from "../../dom";
4
4
 
5
5
  import { domAssigned } from "../../dom";
6
- import { superTypesStringFromSuperTypes } from "../../utilities/type";
6
+ import { superTypesStringFromSuperTypes, stringFromTypeNameNameAndSuperTypes } from "../../utilities/type";
7
7
 
8
8
  export default domAssigned(class ComplexTypeDeclaration {
9
9
  constructor(fileContext, string, type) {
@@ -145,11 +145,11 @@ export default domAssigned(class ComplexTypeDeclaration {
145
145
 
146
146
  this.fileContext.trace(`Verifying the '${propertyString}' property...`);
147
147
 
148
- const propertyNames = property.getNames(),
148
+ const propertyName = property.getName(),
149
149
  count = properties.reduce((count, property) => {
150
- const propertyNamesMatch = property.matchPropertyNames(propertyNames);
150
+ const propertyNameMatches = property.matchPropertyName(propertyName);
151
151
 
152
- if (propertyNamesMatch) {
152
+ if (propertyNameMatches) {
153
153
  count++;
154
154
  }
155
155
 
@@ -160,7 +160,7 @@ export default domAssigned(class ComplexTypeDeclaration {
160
160
  this.fileContext.debug(`The '${propertyString}' property appears more than once.`);
161
161
  } else {
162
162
  const superTypeProperty = superTypeProperties.find((superTypeProperty) => {
163
- const propertyNameMatches = superTypeProperty.matchPropertyNames(propertyNames);
163
+ const propertyNameMatches = superTypeProperty.matchPropertyName(propertyName);
164
164
 
165
165
  if (propertyNameMatches) {
166
166
  return true;
@@ -259,9 +259,10 @@ export default domAssigned(class ComplexTypeDeclaration {
259
259
 
260
260
  static fromComplexTypeDeclarationNode(complexTypeDeclarationNode, fileContext) {
261
261
  const { Type } = dom,
262
- node = complexTypeDeclarationNode, ///
263
- string = fileContext.nodeAsString(node),
264
262
  type = Type.fromComplexTypeDeclarationNode(complexTypeDeclarationNode, fileContext),
263
+ typeName = type.getName(),
264
+ superTypes = type.getSuperTypes(),
265
+ string = stringFromTypeNameNameAndSuperTypes(typeName, superTypes),
265
266
  complexTypeDeclaration = new ComplexTypeDeclaration(fileContext, string, type);
266
267
 
267
268
  return complexTypeDeclaration;
@@ -78,10 +78,9 @@ export default domAssigned(class ConstructorDeclaration {
78
78
  type = this.constructor.getType();
79
79
 
80
80
  const typeName = type.getName(),
81
- typeString = type.getString(),
82
- constructorString = this.constructor.getString();
81
+ typeString = type.getString();
83
82
 
84
- this.fileContext.trace(`Verifying the '${constructorString}' constructor's '${typeString}' type...`);
83
+ this.fileContext.trace(`Verifying the '${typeString}' type...`);
85
84
 
86
85
  const includeSupertypes = false,
87
86
  provisional = type.isProvisional(includeSupertypes);
@@ -91,14 +90,14 @@ export default domAssigned(class ConstructorDeclaration {
91
90
  const typePresent = (type !== null)
92
91
 
93
92
  if (!typePresent) {
94
- this.fileContext.debug(`The '${constructorString}' constructor's '${typeString}' type is not present.`);
93
+ this.fileContext.debug(`The '${typeString}' type is not present.`);
95
94
  } else {
96
95
  const provisionalMatches = type.matchProvisional(provisional);
97
96
 
98
97
  if (!provisionalMatches) {
99
98
  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.`);
99
+ this.fileContext.debug(`The '${typeString}' type is present but it should be provisional.`) :
100
+ this.fileContext.debug(`The '${typeString}' type is present but it should not be provisional.`);
102
101
  } else {
103
102
  this.constructor.setType(type);
104
103
 
@@ -107,7 +106,7 @@ export default domAssigned(class ConstructorDeclaration {
107
106
  }
108
107
 
109
108
  if (constructorTypeVerified) {
110
- this.fileContext.debug(`...verified the '${constructorString}' constructor's '${typeString}' type.`);
109
+ this.fileContext.debug(`...verified the '${typeString}' type.`);
111
110
  }
112
111
 
113
112
  return constructorTypeVerified;
@@ -2,12 +2,8 @@
2
2
 
3
3
  import dom from "../../dom";
4
4
 
5
- import { nodeQuery } from "../../utilities/query";
6
5
  import { domAssigned } from "../../dom";
7
6
 
8
- const termNodeQuery = nodeQuery("/metavariable/argument/term"),
9
- metaTypeNodeQuery = nodeQuery("/metavariableDeclaration/metaType");
10
-
11
7
  export default domAssigned(class MetavariableDeclaration {
12
8
  constructor(fileContext, string, metavariable) {
13
9
  this.fileContext = fileContext;
@@ -84,7 +80,7 @@ export default domAssigned(class MetavariableDeclaration {
84
80
  this.fileContext.trace(`Verifying the '${metavariableString}' metavariable when declared...`);
85
81
 
86
82
  const metavariableNode = metavariable.getNode(), ///
87
- termNode = termNodeQuery(metavariableNode);
83
+ termNode = metavariableNode.getTermNode();
88
84
 
89
85
  if (termNode !== null) {
90
86
  this.fileContext.debug(`A term was found in the '${metavariableString}' metavariable when a type should have been present.`);
@@ -140,7 +136,7 @@ function stringFromMetavariableAndMetaType(metavariable, metaType) {
140
136
 
141
137
  function metaTypeFromMetavariableDeclarationNode(metavariableDeclarationNode, fileContext) {
142
138
  const { MetaType } = dom,
143
- metaTypeNode = metaTypeNodeQuery(metavariableDeclarationNode),
139
+ metaTypeNode = metavariableDeclarationNode.getMetaTypeNode(),
144
140
  metaType = MetaType.fromMetaTypeNode(metaTypeNode, fileContext);
145
141
 
146
142
  return metaType;
@@ -4,6 +4,7 @@ import dom from "../../dom";
4
4
 
5
5
  import { domAssigned } from "../../dom";
6
6
  import { superTypesStringFromSuperTypes } from "../../utilities/type";
7
+ import { stringFromTypeNameNameAndSuperTypes } from "../../utilities/type";
7
8
 
8
9
  export default domAssigned(class TypeDeclaration {
9
10
  constructor(fileContext, string, type) {
@@ -139,8 +140,9 @@ export default domAssigned(class TypeDeclaration {
139
140
  static fromTypeDeclarationNode(typeDeclarationNode, fileContext) {
140
141
  const { Type } = dom,
141
142
  type = Type.fromTypeDeclarationNode(typeDeclarationNode, fileContext),
142
- node = typeDeclarationNode, ///
143
- string = fileContext.nodeAsString(node),
143
+ typeName = type.getName(),
144
+ superTypes = type.getSuperTypes(),
145
+ string = stringFromTypeNameNameAndSuperTypes(typeName, superTypes),
144
146
  typeDeclaration = new TypeDeclaration(fileContext, string, type);
145
147
 
146
148
  return typeDeclaration;
@@ -80,10 +80,9 @@ export default domAssigned(class VariableDeclaration {
80
80
  type = this.variable.getType();
81
81
 
82
82
  const typeName = type.getName(),
83
- typeString = type.getString(),
84
- variableString = this.variable.getString();
83
+ typeString = type.getString();
85
84
 
86
- this.fileContext.trace(`Verifying the '${variableString}' variable's '${typeString}' type...`);
85
+ this.fileContext.trace(`Verifying the '${typeString}' type...`);
87
86
 
88
87
  const includeSupertypes = false,
89
88
  provisional = type.isProvisional(includeSupertypes);
@@ -93,14 +92,14 @@ export default domAssigned(class VariableDeclaration {
93
92
  const typePresent = (type !== null)
94
93
 
95
94
  if (!typePresent) {
96
- this.fileContext.debug(`The '${variableString}' variable's '${typeString}' type is not present.`);
95
+ this.fileContext.debug(`The '${typeString}' type is not present.`);
97
96
  } else {
98
97
  const provisionalMatches = type.matchProvisional(provisional);
99
98
 
100
99
  if (!provisionalMatches) {
101
100
  provisional ?
102
- this.fileContext.debug(`The '${variableString}' variable's '${typeString}' type is present but it should be provisional.`) :
103
- this.fileContext.debug(`The '${variableString}' variable's '${typeString}' type is present but it should not be provisional.`);
101
+ this.fileContext.debug(`The '${typeString}' type is present but it should be provisional.`) :
102
+ this.fileContext.debug(`The '${typeString}' type is present but it should not be provisional.`);
104
103
  } else {
105
104
  this.variable.setType(type);
106
105
 
@@ -109,7 +108,7 @@ export default domAssigned(class VariableDeclaration {
109
108
  }
110
109
 
111
110
  if (variableTypeVerified) {
112
- this.fileContext.debug(`...verified the '${variableString}' variable's '${typeString}' type.`);
111
+ this.fileContext.debug(`...verified the '${typeString}' type.`);
113
112
  }
114
113
 
115
114
  return variableTypeVerified;
@@ -3,12 +3,9 @@
3
3
  import dom from "../dom";
4
4
  import Substitutions from "../substitutions";
5
5
 
6
- import { nodeQuery } from "../utilities/query";
7
6
  import { domAssigned } from "../dom";
8
7
  import { unifyStatementIntrinsically } from "../utilities/unification";
9
8
 
10
- const judgementDeclarationNodeQuery = nodeQuery("/judgement/declaration");
11
-
12
9
  export default domAssigned(class Declaration {
13
10
  constructor(string, reference, statement) {
14
11
  this.string = string;
@@ -88,15 +85,14 @@ export default domAssigned(class Declaration {
88
85
  verifyReference(assignments, stated, context) {
89
86
  let referenceVerified;
90
87
 
91
- const referenceString = this.reference.getString(),
92
- declarationString = this.string; ///
88
+ const referenceString = this.reference.getString();
93
89
 
94
- context.trace(`Verifying the '${declarationString}' declaration's '${referenceString}' reference...`);
90
+ context.trace(`Verifying the '${referenceString}' reference...`);
95
91
 
96
92
  referenceVerified = this.reference.verify(context);
97
93
 
98
94
  if (referenceVerified) {
99
- context.debug(`...verified the '${declarationString}' declaration's '${referenceString}' reference.`);
95
+ context.debug(`...verified the '${referenceString}' reference.`);
100
96
  }
101
97
 
102
98
  return referenceVerified;
@@ -105,10 +101,9 @@ export default domAssigned(class Declaration {
105
101
  verifyStatement(assignments, stated, context) {
106
102
  let statementVerified;
107
103
 
108
- const statementString = this.statement.getString(),
109
- declarationString = this.string; ///
104
+ const statementString = this.statement.getString();
110
105
 
111
- context.trace(`Verifying the '${declarationString}' declaration's '${statementString}' statement...`);
106
+ context.trace(`Verifying the '${statementString}' statement...`);
112
107
 
113
108
  stated = true; ///
114
109
 
@@ -117,7 +112,7 @@ export default domAssigned(class Declaration {
117
112
  statementVerified = this.statement.verify(assignments, stated, context);
118
113
 
119
114
  if (statementVerified) {
120
- context.debug(`...verified the '${declarationString}' declaration's '${statementString}' statement.`);
115
+ context.debug(`...verified the '${statementString}' statement.`);
121
116
  }
122
117
 
123
118
  return statementVerified;
@@ -177,10 +172,9 @@ export default domAssigned(class Declaration {
177
172
 
178
173
  const context = generalContext, ///
179
174
  statementString = statement.getString(),
180
- declarationString = this.string, ///
181
175
  declarationStatementString = this.statement.getString();
182
176
 
183
- context.trace(`Unifying the '${statementString}' statement with the '${declarationString}' declaration's '${declarationStatementString}' statement...`);
177
+ context.trace(`Unifying the '${statementString}' statement with the '${declarationStatementString}' statement...`);
184
178
 
185
179
  const generalStatement = this.statement,
186
180
  specificStatement = statement, ///
@@ -189,7 +183,7 @@ export default domAssigned(class Declaration {
189
183
  statementUnified = statementUUnifiedIntrinsically; ///
190
184
 
191
185
  if (statementUnified) {
192
- context.debug(`...unified the '${statementString}' statement with the '${declarationString}' declaration's '${declarationStatementString}' statement.`);
186
+ context.debug(`...unified the '${statementString}' statement with the '${declarationStatementString}' statement.`);
193
187
  }
194
188
 
195
189
  return statementUnified;
@@ -200,17 +194,16 @@ export default domAssigned(class Declaration {
200
194
 
201
195
  const context = generalContext, ///
202
196
  labelString = label.getString(),
203
- referenceString = this.reference.getString(),
204
- declarationString = this.string; ///
197
+ referenceString = this.reference.getString();
205
198
 
206
- context.trace(`Unifying the '${labelString}' label with the '${declarationString}' declaration's '${referenceString}' reference...`);
199
+ context.trace(`Unifying the '${labelString}' label with the '${referenceString}' reference...`);
207
200
 
208
201
  const labelUnified = this.reference.unifyLabel(label, substitutions, context);
209
202
 
210
203
  labelUnifiedWithReference = labelUnified; ///
211
204
 
212
205
  if (labelUnifiedWithReference) {
213
- context.debug(`...unified the '${labelString}' label with the '${declarationString}' declaration's '${referenceString}' reference.`);
206
+ context.debug(`...unified the '${labelString}' label with the '${referenceString}' reference.`);
214
207
  }
215
208
 
216
209
  return labelUnifiedWithReference;
@@ -255,8 +248,7 @@ export default domAssigned(class Declaration {
255
248
  static name = "Declaration";
256
249
 
257
250
  static fromJudgementNode(judgementNode, context) {
258
- const judgementDeclarationNode = judgementDeclarationNodeQuery(judgementNode),
259
- declarationNode = judgementDeclarationNode, ///
251
+ const declarationNode = judgementNode.getDeclarationNode(),
260
252
  declaration = declarationFromDeclarationNode(declarationNode, context);
261
253
 
262
254
  return declaration;
@@ -4,14 +4,11 @@ import { arrayUtilities } from "necessary";
4
4
 
5
5
  import dom from "../dom";
6
6
 
7
- import { nodesQuery } from "../utilities/query";
8
7
  import { domAssigned } from "../dom";
9
8
  import { assignAssignments } from "../utilities/assignments";
10
9
 
11
10
  const { last } = arrayUtilities;
12
11
 
13
- const stepOrSubproofNodesQuery = nodesQuery("/derivation/step|subproof");
14
-
15
12
  export default domAssigned(class Derivation {
16
13
  constructor(stepsOrSubproofs) {
17
14
  this.stepsOrSubproofs = stepsOrSubproofs;
@@ -65,7 +62,7 @@ export default domAssigned(class Derivation {
65
62
 
66
63
  function stepsOrSubproofsFromDerivationNode(derivationNode, fileContext) {
67
64
  const { Step, Subproof } = dom,
68
- stepOrSubproofNodes = stepOrSubproofNodesQuery(derivationNode),
65
+ stepOrSubproofNodes = derivationNode.getStepOrSubproofNodes(),
69
66
  stepsOrSubproofs = stepOrSubproofNodes.map((stepOrSubproofNode) => {
70
67
  let stepOrSubproof;
71
68
 
@@ -4,15 +4,9 @@ import dom from "../dom";
4
4
  import EqualityAssignment from "../assignment/equality";
5
5
  import VariableAssignment from "../assignment/variable";
6
6
 
7
- import { nodeQuery } from "../utilities/query";
8
7
  import { domAssigned } from "../dom";
9
8
  import { unifyEquality } from "../utilities/unification";
10
9
 
11
- const equalityNodeQuery = nodeQuery("/statement/equality"),
12
- variableNodeQuery = nodeQuery("/term/variable!"),
13
- leftTermNodeQuery = nodeQuery("/equality/term[0]"),
14
- rightTermNodeQuery = nodeQuery("/equality/term[1]");
15
-
16
10
  export default domAssigned(class Equality {
17
11
  constructor(string, leftTerm, rightTerm) {
18
12
  this.string = string;
@@ -179,23 +173,25 @@ export default domAssigned(class Equality {
179
173
  type = this.getType(),
180
174
  leftTermNode = this.leftTerm.getNode(),
181
175
  rightTermNode = this.rightTerm.getNode(),
182
- leftVariableNode = variableNodeQuery(leftTermNode),
183
- rightVariableNode = variableNodeQuery(rightTermNode),
184
- leftVariable = Variable.fromVariableNodeAndType(leftVariableNode, type, context),
185
- rightVariable = Variable.fromVariableNodeAndType(rightVariableNode, type, context);
176
+ leftTermNodeSingularVariableNode = leftTermNode.getSingularVariableNode(),
177
+ rightTermNodeSingularVariableNode = rightTermNode.getSingularVariableNode(),
178
+ leftVariableNode = leftTermNodeSingularVariableNode, ///
179
+ rightVariableNode = rightTermNodeSingularVariableNode; ///
186
180
 
187
181
  let assignment;
188
182
 
189
- if (leftVariable !== null) {
190
- const leftVariableAssignment = VariableAssignment.fromVariable(leftVariable);
183
+ if (leftVariableNode !== null) {
184
+ const leftVariable = Variable.fromVariableNodeAndType(leftVariableNode, type, context),
185
+ leftVariableAssignment = VariableAssignment.fromVariable(leftVariable);
191
186
 
192
187
  assignment = leftVariableAssignment; ///
193
188
 
194
189
  assignments.push(assignment);
195
190
  }
196
191
 
197
- if (rightVariable !== null) {
198
- const rightVariableAssignment = VariableAssignment.fromVariable(rightVariable);
192
+ if (rightVariableNode !== null) {
193
+ const rightVariable = Variable.fromVariableNodeAndType(rightVariableNode, type, context),
194
+ rightVariableAssignment = VariableAssignment.fromVariable(rightVariable);
199
195
 
200
196
  assignment = rightVariableAssignment; ///
201
197
 
@@ -215,7 +211,7 @@ export default domAssigned(class Equality {
215
211
  static fromStatementNode(statementNode, context) {
216
212
  let equality = null;
217
213
 
218
- const equalityNode = equalityNodeQuery(statementNode);
214
+ const equalityNode = statementNode.getEqualityNode();
219
215
 
220
216
  if (equalityNode !== null) {
221
217
  const node = equalityNode, ///
@@ -232,7 +228,7 @@ export default domAssigned(class Equality {
232
228
 
233
229
  function leftTermFromEqualityNode(equalityNode, context) {
234
230
  const { Term } = dom,
235
- leftTermNode = leftTermNodeQuery(equalityNode),
231
+ leftTermNode = equalityNode.getLeftTermNode(),
236
232
  leftTerm = Term.fromTermNode(leftTermNode, context);
237
233
 
238
234
  return leftTerm;
@@ -240,7 +236,7 @@ function leftTermFromEqualityNode(equalityNode, context) {
240
236
 
241
237
  function rightTermFromEqualityNode(equalityNode, context) {
242
238
  const { Term } = dom,
243
- rightTermNode = rightTermNodeQuery(equalityNode),
239
+ rightTermNode = equalityNode.getRightTermNode(),
244
240
  rightTerm = Term.fromTermNode(rightTermNode, context);
245
241
 
246
242
  return rightTerm;
package/src/dom/frame.js CHANGED
@@ -7,13 +7,6 @@ import dom from "../dom";
7
7
  import { S, NOTHING } from "../constants";
8
8
  import { domAssigned } from "../dom";
9
9
  import { FRAME_META_TYPE_NAME } from "../metaTypeNames";
10
- import { nodeQuery, nodesQuery } from "../utilities/query";
11
-
12
- const declarationNodesQuery = nodesQuery("/frame/declaration"),
13
- metavariableNodesQuery = nodesQuery("/frame/metavariable"),
14
- judgementFrameNodeQuery = nodeQuery("/judgement/frame"),
15
- definedAssertionFrameNodeQuery = nodeQuery("/definedAssertion/frame"),
16
- containedAssertionFrameNodeQuery = nodeQuery("/containedAssertion/frame");
17
10
 
18
11
  const { first } = arrayUtilities;
19
12
 
@@ -221,10 +214,9 @@ export default domAssigned(class Frame {
221
214
  const sOrNothing = (declarationsLength > 1) ?
222
215
  S :
223
216
  NOTHING,
224
- frameString = this.string, ///
225
217
  declarationsString = declarationsStringFromDeclarations(this.declarations);
226
218
 
227
- context.trace(`Verifying the '${frameString}' frame's '${declarationsString}' declaration${sOrNothing}...`);
219
+ context.trace(`Verifying the '${declarationsString}' declaration${sOrNothing}...`);
228
220
 
229
221
  stated = true; ///
230
222
 
@@ -237,7 +229,7 @@ export default domAssigned(class Frame {
237
229
  });
238
230
 
239
231
  if (declarationsVerified) {
240
- context.debug(`...verified the '${frameString}' frame's '${declarationsString}' declaration${sOrNothing}.`);
232
+ context.debug(`...verified the '${declarationsString}' declaration${sOrNothing}.`);
241
233
  }
242
234
  }
243
235
 
@@ -253,10 +245,9 @@ export default domAssigned(class Frame {
253
245
  const sOrNothing = (metavariablesLength > 1) ?
254
246
  S :
255
247
  NOTHING,
256
- frameString = this.string, ///
257
248
  metavariablesString = metavariablesStringFromMetavariables(this.metavariables);
258
249
 
259
- context.trace(`Verifying the '${frameString}' frame's '${metavariablesString}' metavariable${sOrNothing}...`);
250
+ context.trace(`Verifying the '${metavariablesString}' metavariable${sOrNothing}...`);
260
251
 
261
252
  metavariablesVerified = this.metavariables.every((metavariable) => {
262
253
  const metavariableVerified = metavariable.verify(context);
@@ -265,7 +256,7 @@ export default domAssigned(class Frame {
265
256
  });
266
257
 
267
258
  if (metavariablesVerified) {
268
- context.debug(`...verified the '${frameString}' frame's '${metavariablesString}' metavariable${sOrNothing}.`);
259
+ context.debug(`...verified the '${metavariablesString}' metavariable${sOrNothing}.`);
269
260
  }
270
261
  }
271
262
 
@@ -308,8 +299,7 @@ export default domAssigned(class Frame {
308
299
  }
309
300
 
310
301
  static fromJudgementNode(judgementNode, context) {
311
- const judgementFrameNode = judgementFrameNodeQuery(judgementNode),
312
- frameNode = judgementFrameNode,
302
+ const frameNode = judgementNode.getFrameNode(),
313
303
  frame = frameFromFrameNode(frameNode, context);
314
304
 
315
305
  return frame;
@@ -318,11 +308,9 @@ export default domAssigned(class Frame {
318
308
  static fromDefinedAssertionNode(definedAssertionNode, context) {
319
309
  let frame = null;
320
310
 
321
- const definedAssertionFrameNode = definedAssertionFrameNodeQuery(definedAssertionNode);
322
-
323
- if (definedAssertionFrameNode !== null) {
324
- const frameNode = definedAssertionFrameNode; ///
311
+ const frameNode = definedAssertionNode.getFrameNode();
325
312
 
313
+ if (frameNode !== null) {
326
314
  frame = frameFromFrameNode(frameNode, context);
327
315
  }
328
316
 
@@ -332,11 +320,9 @@ export default domAssigned(class Frame {
332
320
  static fromContainedAssertionNode(containedAssertionNode, context) {
333
321
  let frame = null;
334
322
 
335
- const containedAssertionFrameNode = containedAssertionFrameNodeQuery(containedAssertionNode);
336
-
337
- if (containedAssertionFrameNode !== null) {
338
- const frameNode = containedAssertionFrameNode; ///
323
+ const frameNode = containedAssertionNode.getFrameNode();
339
324
 
325
+ if (frameNode !== null) {
340
326
  frame = frameFromFrameNode(frameNode, context)
341
327
  }
342
328
 
@@ -358,7 +344,7 @@ function frameFromFrameNode(frameNode, context) {
358
344
 
359
345
  function declarationsFromFrameNode(frameNode, context) {
360
346
  const { Declaration } = dom,
361
- declarationNodes = declarationNodesQuery(frameNode),
347
+ declarationNodes = frameNode.getDeclarationNodes(),
362
348
  declarations = declarationNodes.map((declarationNode) => {
363
349
  const declaration = Declaration.fromDeclarationNode(declarationNode, context);
364
350
 
@@ -370,7 +356,7 @@ function declarationsFromFrameNode(frameNode, context) {
370
356
 
371
357
  function metavariablesFromFrameNode(frameNode, context) {
372
358
  const { Metavariable } = dom,
373
- metavariableNodes = metavariableNodesQuery(frameNode),
359
+ metavariableNodes = frameNode.getMetavariableNodes(),
374
360
  metavariables = metavariableNodes.map((metavariableNode) => {
375
361
  const metavariable = Metavariable.fromMetavariableNode(metavariableNode, context);
376
362