occam-verify-cli 1.0.421 → 1.0.427

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 (272) hide show
  1. package/lib/action/verify.js +7 -3
  2. package/lib/context/file.js +8 -44
  3. package/lib/context/local.js +8 -26
  4. package/lib/context/nominal.js +64 -0
  5. package/lib/context/release.js +2 -2
  6. package/lib/context/temporary.js +6 -58
  7. package/lib/element/assertion/contained.js +303 -0
  8. package/lib/element/assertion/defined.js +318 -0
  9. package/lib/element/assertion/property.js +299 -0
  10. package/lib/element/assertion/satisfies.js +264 -0
  11. package/lib/element/assertion/subproof.js +178 -0
  12. package/lib/element/assertion/type.js +294 -0
  13. package/lib/{ontology → element}/assertion.js +9 -9
  14. package/lib/element/assumption.js +365 -0
  15. package/lib/element/axiom.js +332 -0
  16. package/lib/element/axiomLemmaTheoremConjecture.js +346 -0
  17. package/lib/element/conclusion.js +151 -0
  18. package/lib/{ontology → element}/conjecture.js +7 -14
  19. package/lib/element/declaration/combinator.js +161 -0
  20. package/lib/element/declaration/complexType.js +343 -0
  21. package/lib/element/declaration/constructor.js +193 -0
  22. package/lib/element/declaration/metavariable.js +193 -0
  23. package/lib/element/declaration/simpleType.js +240 -0
  24. package/lib/element/declaration/typePrefix.js +179 -0
  25. package/lib/element/declaration/variable.js +196 -0
  26. package/lib/{ontology → element}/declaration.js +9 -9
  27. package/lib/element/deduction.js +207 -0
  28. package/lib/element/derivation.js +96 -0
  29. package/lib/element/equality.js +275 -0
  30. package/lib/element/equivalence.js +316 -0
  31. package/lib/element/equivalences.js +264 -0
  32. package/lib/{ontology → element}/error.js +12 -12
  33. package/lib/element/frame.js +387 -0
  34. package/lib/element/hypothesis.js +195 -0
  35. package/lib/element/judgement.js +243 -0
  36. package/lib/element/label.js +198 -0
  37. package/lib/{ontology → element}/lemma.js +7 -7
  38. package/lib/{ontology → element}/metaLemma.js +8 -8
  39. package/lib/element/metaLemmaMetatheorem.js +234 -0
  40. package/lib/{ontology → element}/metaType.js +18 -11
  41. package/lib/{ontology → element}/metatheorem.js +8 -8
  42. package/lib/element/metavariable.js +459 -0
  43. package/lib/element/parameter.js +108 -0
  44. package/lib/element/premise.js +310 -0
  45. package/lib/element/procedureCall.js +243 -0
  46. package/lib/{ontology → element}/procedureReference.js +3 -3
  47. package/lib/{ontology → element}/proof.js +4 -4
  48. package/lib/element/property.js +128 -0
  49. package/lib/element/propertyRelation.js +195 -0
  50. package/lib/element/reference.js +304 -0
  51. package/lib/element/rule.js +373 -0
  52. package/lib/element/section.js +255 -0
  53. package/lib/element/signature.js +217 -0
  54. package/lib/element/statement/combinator/bracketed.js +166 -0
  55. package/lib/element/statement/combinator.js +105 -0
  56. package/lib/element/statement.js +386 -0
  57. package/lib/element/step.js +274 -0
  58. package/lib/element/subDerivation.js +137 -0
  59. package/lib/element/subproof.js +240 -0
  60. package/lib/element/substitution/frame.js +216 -0
  61. package/lib/{ontology → element}/substitution/reference.js +5 -4
  62. package/lib/{ontology → element}/substitution/statement.js +7 -6
  63. package/lib/element/substitution/term.js +265 -0
  64. package/lib/element/substitution.js +206 -0
  65. package/lib/element/substitutions.js +425 -0
  66. package/lib/element/supposition.js +323 -0
  67. package/lib/{ontology → element/term}/constructor/bracketed.js +11 -7
  68. package/lib/element/term/constructor.js +172 -0
  69. package/lib/element/term.js +322 -0
  70. package/lib/{ontology → element}/theorem.js +8 -8
  71. package/lib/element/type.js +490 -0
  72. package/lib/element/typePrefix.js +99 -0
  73. package/lib/element/variable.js +345 -0
  74. package/lib/elements.js +27 -0
  75. package/lib/mixins/statement/verify.js +14 -14
  76. package/lib/mixins/step/unify.js +12 -12
  77. package/lib/mixins/term/verify.js +4 -4
  78. package/lib/node/substitution/frame.js +15 -1
  79. package/lib/node/substitution/statement.js +37 -1
  80. package/lib/node/substitution/term.js +15 -1
  81. package/lib/preamble.js +63 -63
  82. package/lib/process/assign.js +58 -0
  83. package/lib/process/instantiate.js +68 -7
  84. package/lib/process/unify.js +26 -26
  85. package/lib/process/verify.js +21 -21
  86. package/lib/utilities/brackets.js +9 -18
  87. package/lib/utilities/customGrammar.js +1 -1
  88. package/lib/utilities/element.js +1128 -0
  89. package/lib/utilities/json.js +32 -32
  90. package/lib/utilities/node.js +49 -61
  91. package/lib/utilities/statement.js +83 -0
  92. package/lib/utilities/string.js +98 -56
  93. package/package.json +6 -6
  94. package/src/action/verify.js +8 -1
  95. package/src/context/file.js +9 -39
  96. package/src/context/local.js +5 -11
  97. package/src/context/nominal.js +30 -0
  98. package/src/context/release.js +1 -1
  99. package/src/context/temporary.js +6 -63
  100. package/src/{ontology → element}/assertion/contained.js +4 -25
  101. package/src/{ontology → element}/assertion/defined.js +7 -26
  102. package/src/{ontology → element}/assertion/property.js +7 -26
  103. package/src/{ontology → element}/assertion/satisfies.js +5 -53
  104. package/src/{ontology → element}/assertion/subproof.js +3 -32
  105. package/src/{ontology → element}/assertion/type.js +7 -26
  106. package/src/{ontology → element}/assertion.js +6 -6
  107. package/src/{ontology → element}/assumption.js +3 -27
  108. package/src/{ontology → element}/axiom.js +4 -11
  109. package/src/{ontology/topLevelAssertion.js → element/axiomLemmaTheoremConjecture.js} +9 -105
  110. package/src/{ontology → element}/conclusion.js +4 -19
  111. package/src/{ontology → element}/conjecture.js +4 -11
  112. package/src/{ontology → element}/declaration/combinator.js +3 -14
  113. package/src/{ontology → element}/declaration/complexType.js +3 -19
  114. package/src/{ontology → element}/declaration/constructor.js +3 -14
  115. package/src/{ontology → element}/declaration/metavariable.js +3 -39
  116. package/src/{ontology → element}/declaration/simpleType.js +3 -19
  117. package/src/{ontology → element}/declaration/typePrefix.js +3 -15
  118. package/src/{ontology → element}/declaration/variable.js +3 -14
  119. package/src/{ontology → element}/declaration.js +6 -6
  120. package/src/{ontology → element}/deduction.js +9 -22
  121. package/src/{ontology → element}/derivation.js +2 -32
  122. package/src/{ontology → element}/equality.js +18 -42
  123. package/src/{ontology → element}/equivalence.js +17 -2
  124. package/src/{ontology → element}/equivalences.js +1 -1
  125. package/src/{ontology → element}/error.js +8 -8
  126. package/src/{ontology → element}/frame.js +8 -56
  127. package/src/{ontology → element}/hypothesis.js +5 -5
  128. package/src/{ontology → element}/judgement.js +7 -7
  129. package/src/{ontology → element}/label.js +3 -3
  130. package/src/{ontology → element}/lemma.js +4 -4
  131. package/src/{ontology → element}/metaLemma.js +5 -5
  132. package/src/{ontology/topLevelMetaAssertion.js → element/metaLemmaMetatheorem.js} +11 -11
  133. package/src/{ontology → element}/metaType.js +11 -7
  134. package/src/{ontology → element}/metatheorem.js +5 -5
  135. package/src/{ontology → element}/metavariable.js +10 -60
  136. package/src/{ontology → element}/parameter.js +1 -1
  137. package/src/{ontology → element}/premise.js +14 -14
  138. package/src/{ontology → element}/procedureCall.js +4 -4
  139. package/src/{ontology → element}/procedureReference.js +1 -1
  140. package/src/{ontology → element}/proof.js +3 -3
  141. package/src/{ontology → element}/property.js +7 -15
  142. package/src/{ontology → element}/propertyRelation.js +5 -11
  143. package/src/{ontology → element}/reference.js +5 -19
  144. package/src/{ontology → element}/rule.js +13 -13
  145. package/src/{ontology → element}/section.js +10 -10
  146. package/src/{ontology → element}/signature.js +12 -15
  147. package/src/element/statement/combinator/bracketed.js +38 -0
  148. package/src/element/statement/combinator.js +59 -0
  149. package/src/{ontology → element}/statement.js +11 -27
  150. package/src/{ontology → element}/step.js +10 -44
  151. package/src/{ontology → element}/subDerivation.js +3 -24
  152. package/src/{ontology → element}/subproof.js +3 -43
  153. package/src/{ontology → element}/substitution/frame.js +4 -21
  154. package/src/{ontology → element}/substitution/reference.js +3 -3
  155. package/src/{ontology → element}/substitution/statement.js +6 -10
  156. package/src/{ontology → element}/substitution/term.js +7 -23
  157. package/src/{ontology → element}/substitutions.js +1 -1
  158. package/src/{ontology → element}/supposition.js +10 -10
  159. package/src/{ontology → element/term}/constructor/bracketed.js +12 -13
  160. package/src/element/term/constructor.js +82 -0
  161. package/src/{ontology → element}/term.js +6 -38
  162. package/src/{ontology → element}/theorem.js +5 -5
  163. package/src/{ontology → element}/type.js +17 -64
  164. package/src/{ontology → element}/typePrefix.js +8 -12
  165. package/src/{ontology → element}/variable.js +9 -20
  166. package/src/elements.js +13 -0
  167. package/src/mixins/statement/verify.js +4 -4
  168. package/src/mixins/step/unify.js +6 -6
  169. package/src/mixins/term/verify.js +3 -3
  170. package/src/node/substitution/frame.js +14 -0
  171. package/src/node/substitution/statement.js +40 -0
  172. package/src/node/substitution/term.js +15 -0
  173. package/src/preamble.js +62 -62
  174. package/src/process/assign.js +59 -0
  175. package/src/process/instantiate.js +67 -15
  176. package/src/process/unify.js +37 -39
  177. package/src/process/verify.js +20 -20
  178. package/src/utilities/brackets.js +12 -17
  179. package/src/utilities/customGrammar.js +3 -3
  180. package/src/utilities/element.js +1380 -0
  181. package/src/utilities/json.js +31 -31
  182. package/src/utilities/node.js +56 -64
  183. package/src/utilities/{context.js → statement.js} +10 -39
  184. package/src/utilities/string.js +120 -52
  185. package/lib/assignment/equality.js +0 -62
  186. package/lib/assignment/judgement.js +0 -62
  187. package/lib/assignment/variable.js +0 -64
  188. package/lib/context/bracketed/combinator.js +0 -121
  189. package/lib/context/bracketed/constructor.js +0 -121
  190. package/lib/context/bracketted.js +0 -86
  191. package/lib/context/partial/metavariable.js +0 -180
  192. package/lib/context/partial/statement.js +0 -180
  193. package/lib/context/partial/term.js +0 -192
  194. package/lib/context/partial/variable.js +0 -192
  195. package/lib/context/partial.js +0 -93
  196. package/lib/ontology/assertion/contained.js +0 -357
  197. package/lib/ontology/assertion/defined.js +0 -331
  198. package/lib/ontology/assertion/property.js +0 -313
  199. package/lib/ontology/assertion/satisfies.js +0 -302
  200. package/lib/ontology/assertion/subproof.js +0 -240
  201. package/lib/ontology/assertion/type.js +0 -308
  202. package/lib/ontology/assumption.js +0 -383
  203. package/lib/ontology/axiom.js +0 -339
  204. package/lib/ontology/combinator/bracketed.js +0 -202
  205. package/lib/ontology/combinator.js +0 -155
  206. package/lib/ontology/conclusion.js +0 -201
  207. package/lib/ontology/constructor.js +0 -185
  208. package/lib/ontology/declaration/combinator.js +0 -210
  209. package/lib/ontology/declaration/complexType.js +0 -393
  210. package/lib/ontology/declaration/constructor.js +0 -242
  211. package/lib/ontology/declaration/metavariable.js +0 -257
  212. package/lib/ontology/declaration/simpleType.js +0 -290
  213. package/lib/ontology/declaration/typePrefix.js +0 -228
  214. package/lib/ontology/declaration/variable.js +0 -245
  215. package/lib/ontology/deduction.js +0 -215
  216. package/lib/ontology/derivation.js +0 -155
  217. package/lib/ontology/equality.js +0 -288
  218. package/lib/ontology/equivalence.js +0 -295
  219. package/lib/ontology/equivalences.js +0 -264
  220. package/lib/ontology/frame.js +0 -419
  221. package/lib/ontology/hypothesis.js +0 -190
  222. package/lib/ontology/judgement.js +0 -248
  223. package/lib/ontology/label.js +0 -198
  224. package/lib/ontology/metavariable.js +0 -502
  225. package/lib/ontology/parameter.js +0 -108
  226. package/lib/ontology/premise.js +0 -310
  227. package/lib/ontology/procedureCall.js +0 -243
  228. package/lib/ontology/property.js +0 -166
  229. package/lib/ontology/propertyRelation.js +0 -202
  230. package/lib/ontology/reference.js +0 -315
  231. package/lib/ontology/rule.js +0 -373
  232. package/lib/ontology/section.js +0 -255
  233. package/lib/ontology/signature.js +0 -217
  234. package/lib/ontology/statement.js +0 -398
  235. package/lib/ontology/step.js +0 -295
  236. package/lib/ontology/subDerivation.js +0 -147
  237. package/lib/ontology/subproof.js +0 -265
  238. package/lib/ontology/substitution/frame.js +0 -261
  239. package/lib/ontology/substitution/term.js +0 -269
  240. package/lib/ontology/substitution.js +0 -206
  241. package/lib/ontology/substitutions.js +0 -425
  242. package/lib/ontology/supposition.js +0 -323
  243. package/lib/ontology/term.js +0 -351
  244. package/lib/ontology/topLevelAssertion.js +0 -431
  245. package/lib/ontology/topLevelMetaAssertion.js +0 -234
  246. package/lib/ontology/type.js +0 -556
  247. package/lib/ontology/typePrefix.js +0 -99
  248. package/lib/ontology/variable.js +0 -343
  249. package/lib/ontology.js +0 -27
  250. package/lib/utilities/assignments.js +0 -19
  251. package/lib/utilities/context.js +0 -101
  252. package/lib/utilities/subproof.js +0 -42
  253. package/lib/utilities/type.js +0 -40
  254. package/src/assignment/equality.js +0 -29
  255. package/src/assignment/judgement.js +0 -29
  256. package/src/assignment/variable.js +0 -34
  257. package/src/context/bracketed/combinator.js +0 -31
  258. package/src/context/bracketed/constructor.js +0 -31
  259. package/src/context/bracketted.js +0 -41
  260. package/src/context/partial/metavariable.js +0 -39
  261. package/src/context/partial/statement.js +0 -39
  262. package/src/context/partial/term.js +0 -49
  263. package/src/context/partial/variable.js +0 -49
  264. package/src/context/partial.js +0 -71
  265. package/src/ontology/combinator/bracketed.js +0 -38
  266. package/src/ontology/combinator.js +0 -72
  267. package/src/ontology/constructor.js +0 -105
  268. package/src/ontology.js +0 -13
  269. package/src/utilities/assignments.js +0 -11
  270. package/src/utilities/subproof.js +0 -56
  271. package/src/utilities/type.js +0 -35
  272. /package/src/{ontology → element}/substitution.js +0 -0
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+
3
+ import elements from "../../elements";
4
+
5
+ import { define } from "../../elements";
6
+ import { unifyTermWithConstructorTerm } from "../../process/unify";
7
+ import { termFromJSON, termToTermJSON } from "../../utilities/json";
8
+
9
+ export default define(class ConstructorTerm {
10
+ constructor(term) {
11
+ this.term = term;
12
+ }
13
+
14
+ getTerm() {
15
+ return this.term;
16
+ }
17
+
18
+ getType() { return this.term.getType(); }
19
+
20
+ getString() { return this.term.getString(); }
21
+
22
+ isProvisional() { return this.term.isProvisional(); }
23
+
24
+ setType(type) { this.term.setType(type); }
25
+
26
+ unifyTerm(term, context, verifyAhead) {
27
+ let termUnifies = false;
28
+
29
+ const termString = term.getString(),
30
+ constructorTermString = this.getString();
31
+
32
+ context.trace(`Unifying the '${termString}' term with the '${constructorTermString}' constructor's term...`);
33
+
34
+ const constructorTerm = this, ///
35
+ termUnifiesWithConstructor = unifyTermWithConstructorTerm(term, constructorTerm, context);
36
+
37
+ if (termUnifiesWithConstructor) {
38
+ let verifiesAhead;
39
+
40
+ const type = this.getType();
41
+
42
+ term.setType(type);
43
+
44
+ verifiesAhead = verifyAhead();
45
+
46
+ termUnifies = verifiesAhead; ///
47
+ }
48
+
49
+ if (termUnifies) {
50
+ context.debug(`...unified the '${termString}' term with the '${constructorTermString}' constructor's term.`);
51
+ }
52
+
53
+ return termUnifies;
54
+ }
55
+
56
+ toJSON() {
57
+ const termJSON = termToTermJSON(this.term),
58
+ term = termJSON, ///
59
+ json = {
60
+ term
61
+ };
62
+
63
+ return json;
64
+ }
65
+
66
+ static name = "ConstructorTerm";
67
+
68
+ static fromJSON(json, context) {
69
+ const term = termFromJSON(json, context),
70
+ constructor = new ConstructorTerm(term);
71
+
72
+ return constructor;
73
+ }
74
+
75
+ static fromConstructorDeclarationNode(constructorDeclarationNode, context) {
76
+ const { Term } = elements,
77
+ term = Term.fromConstructorDeclarationNode(constructorDeclarationNode, context),
78
+ constructor = new ConstructorTerm(term);
79
+
80
+ return constructor;
81
+ }
82
+ });
@@ -2,12 +2,12 @@
2
2
 
3
3
  import { arrayUtilities } from "necessary";
4
4
 
5
- import ontology from "../ontology";
5
+ import elements from "../elements";
6
6
  import verifyMixins from "../mixins/term/verify";
7
7
 
8
- import { define } from "../ontology";
9
- import { termFromTermNode } from "../utilities/node";
10
- import { termNodeFromTermString } from "../context/partial/term";
8
+ import { define } from "../elements";
9
+ import { instantiateTerm } from "../process/instantiate";
10
+ import { termFromTermNode } from "../utilities/node.old";
11
11
  import { typeFromJSON, typeToTypeJSON } from "../utilities/json";
12
12
 
13
13
  const { filter, compress } = arrayUtilities;
@@ -177,8 +177,7 @@ export default define(class Term {
177
177
 
178
178
  static fromJSON(json, context) {
179
179
  const { string } = json,
180
- termString = string, ///
181
- termNode = termNodeFromTermString(termString, context),
180
+ termNode = instantiateTerm(string, context),
182
181
  node = termNode, ///
183
182
  type = typeFromJSON(json, context),
184
183
  term = new Term(string, node, type);
@@ -200,18 +199,6 @@ export default define(class Term {
200
199
  return term;
201
200
  }
202
201
 
203
- static fromTypeAssertionNode(typeAssertionNode, context) {
204
- let term = null;
205
-
206
- const termNode = typeAssertionNode.getTermNode();
207
-
208
- if (termNode !== null) {
209
- term = termFromTermNode(termNode, context);
210
- }
211
-
212
- return term;
213
- }
214
-
215
202
  static fromDefinedAssertionNode(definedAssertionNode, context) {
216
203
  let term = null;
217
204
 
@@ -231,27 +218,8 @@ export default define(class Term {
231
218
  return term;
232
219
  }
233
220
 
234
- static fromPropertyAssertionNode(propertyAssertionNode, context) {
235
- const termNode = propertyAssertionNode.getTermNode(),
236
- term = termFromTermNode(termNode, context);
237
-
238
- return term;
239
- }
240
-
241
- static fromContainedAssertionNode(containedAssertionNode, context) {
242
- let term = null;
243
-
244
- const termNode = containedAssertionNode.getTermNode();
245
-
246
- if (termNode !== null) {
247
- term = termFromTermNode(termNode, context);
248
- }
249
-
250
- return term;
251
- }
252
-
253
221
  static fromConstructorDeclarationNode(constructorDeclarationNode, context) {
254
- const { Type } = ontology,
222
+ const { Type } = elements,
255
223
  termNode = constructorDeclarationNode.getTermNode(),
256
224
  term = termFromTermNode(termNode, context),
257
225
  type = Type.fromConstructorDeclarationNode(constructorDeclarationNode, context);
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
 
3
- import TopLevelAssertion from "./topLevelAssertion";
3
+ import AxiomLemmaTheoremConjecture from "./axiomLemmaTheoremConjecture";
4
4
 
5
- import { define } from "../ontology";
5
+ import { define } from "../elements";
6
6
 
7
- export default define(class Theorem extends TopLevelAssertion {
7
+ export default define(class Theorem extends AxiomLemmaTheoremConjecture {
8
8
  verify() {
9
9
  let verifies;
10
10
 
@@ -29,11 +29,11 @@ export default define(class Theorem extends TopLevelAssertion {
29
29
 
30
30
  static name = "Theorem";
31
31
 
32
- static fromJSON(json, context) { return TopLevelAssertion.fromJSON(Theorem, json, context); }
32
+ static fromJSON(json, context) { return AxiomLemmaTheoremConjecture.fromJSON(Theorem, json, context); }
33
33
 
34
34
  static fromTheoremNode(theoremNode, context) {
35
35
  const node = theoremNode, ///
36
- theorem = TopLevelAssertion.fromNode(Theorem, node, context);
36
+ theorem = AxiomLemmaTheoremConjecture.fromNode(Theorem, node, context);
37
37
 
38
38
  return theorem;
39
39
  }
@@ -2,19 +2,18 @@
2
2
 
3
3
  import { arrayUtilities } from "necessary";
4
4
 
5
- import ontology from "../ontology";
6
-
7
- import { define } from "../ontology";
5
+ import { define } from "../elements";
8
6
  import { BASE_TYPE_SYMBOL } from "../constants";
9
- import { typeFromTypeNode } from "../utilities/node";
10
- import { stringFromTypeNameTypePrefixNameAndSuperTypes } from "../utilities/type";
7
+ import { typeFromTypeNode } from "../utilities/node.old";
8
+ import { typeStringFromTypeNameTypePrefixNameAndSuperTypes } from "../utilities/string";
11
9
  import { superTypesFromJSON, propertiesFromJSON, superTypesToSuperTypesJSON, propertiesToPropertiesJSON } from "../utilities/json";
12
10
 
13
11
  const { push, first } = arrayUtilities;
14
12
 
15
13
  class Type {
16
- constructor(string, name, prefixName, superTypes, properties, provisional) {
14
+ constructor(string, node, name, prefixName, superTypes, properties, provisional) {
17
15
  this.string = string;
16
+ this.node = node;
18
17
  this.name = name;
19
18
  this.prefixName = prefixName;
20
19
  this.superTypes = superTypes;
@@ -26,6 +25,10 @@ class Type {
26
25
  return this.string;
27
26
  }
28
27
 
28
+ getNode() {
29
+ return this.node;
30
+ }
31
+
29
32
  getName() {
30
33
  return this.name;
31
34
  }
@@ -306,8 +309,8 @@ class Type {
306
309
  superTypes = superTypesFromJSON(json, context),
307
310
  typeName = name, ///
308
311
  typePrefixName = null,
309
- string = stringFromTypeNameTypePrefixNameAndSuperTypes(typeName, typePrefixName, superTypes),
310
- type = new Type(string, name, prefixName, superTypes, properties, provisional);
312
+ string = typeStringFromTypeNameTypePrefixNameAndSuperTypes(typeName, typePrefixName, superTypes),
313
+ type = new Type(string, node, name, prefixName, superTypes, properties, provisional);
311
314
 
312
315
  return type;
313
316
  }
@@ -327,13 +330,6 @@ class Type {
327
330
  return type;
328
331
  }
329
332
 
330
- static fromTypeAssertionNode(typeAssertionNode, context) {
331
- const typeNode = typeAssertionNode.getTypeNode(),
332
- type = typeFromTypeNode(typeNode, context);
333
-
334
- return type;
335
- }
336
-
337
333
  static fromTypeAndProvisional(type, provisional) {
338
334
  const name = type.getName(),
339
335
  prefixName = type.getPrefixName(),
@@ -343,10 +339,10 @@ class Type {
343
339
  superTypes = [
344
340
  superType
345
341
  ],
346
- string = stringFromTypeNameTypePrefixNameAndSuperTypes(typeName, typePrefixName, superTypes),
342
+ string = typeStringFromTypeNameTypePrefixNameAndSuperTypes(typeName, typePrefixName, superTypes),
347
343
  properties = type.getProperties();
348
344
 
349
- type = new Type(string, name, prefixName, superTypes, properties, provisional); ///
345
+ type = new Type(string, node, name, prefixName, superTypes, properties, provisional); ///
350
346
 
351
347
  return type;
352
348
  }
@@ -366,22 +362,8 @@ class Type {
366
362
  name = typeName, ///
367
363
  prefixName = typePrefixName, ///
368
364
  properties = [],
369
- string = stringFromTypeNameTypePrefixNameAndSuperTypes(typeName, typePrefixName, superTypes),
370
- type = new Type(string, name, prefixName, superTypes, properties, provisional);
371
-
372
- return type;
373
- }
374
-
375
- static fromComplexTypeDeclarationNode(complexTypeDeclarationNode, context) {
376
- const typeName = complexTypeDeclarationNode.getTypeName(),
377
- provisional = complexTypeDeclarationNode.isProvisional(),
378
- typePrefixName = complexTypeDeclarationNode.getTypePrefixName(),
379
- superTypes = superTypesFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context),
380
- name = typeName, ///
381
- prefixName = typePrefixName, ///
382
- properties = propertiesFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context),
383
- string = stringFromTypeNameTypePrefixNameAndSuperTypes(typeName, typePrefixName, superTypes),
384
- type = new Type(string, name, prefixName, superTypes, properties, provisional);
365
+ string = typeStringFromTypeNameTypePrefixNameAndSuperTypes(typeName, typePrefixName, superTypes),
366
+ type = new Type(string, node, name, prefixName, superTypes, properties, provisional);
385
367
 
386
368
  return type;
387
369
  }
@@ -425,45 +407,16 @@ function superTypesFromSimpleTypeDeclarationNode(simpleTypeDeclarationNode, cont
425
407
  return superTypes;
426
408
  }
427
409
 
428
- function superTypesFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context) {
429
- const superTypeNodes = complexTypeDeclarationNode.getSuperTypeNodes(),
430
- superTypes = superTypeNodes.map((superTypeNode) => {
431
- const superType = Type.fromSuperTypeNode(superTypeNode, context);
432
-
433
- return superType;
434
- }),
435
- superTypesLength = superTypes.length;
436
-
437
- if (superTypesLength === 0) {
438
- const superType = baseType; ///
439
-
440
- superTypes.push(superType);
441
- }
442
-
443
- return superTypes;
444
- }
445
-
446
- function propertiesFromComplexTypeDeclarationNode(complexTypeDeclarationNode, context) {
447
- const { Property } = ontology,
448
- propertyDeclarationNodes = complexTypeDeclarationNode.getPropertyDeclarationNodes(),
449
- properties = propertyDeclarationNodes.map((propertyDeclarationNode) => {
450
- const property = Property.fromPropertyDeclarationNode(propertyDeclarationNode, context);
451
-
452
- return property;
453
- });
454
-
455
- return properties;
456
- }
457
-
458
410
  class BaseType extends Type {
459
411
  static fromNothing() {
460
412
  const name = BASE_TYPE_SYMBOL, ///
461
413
  string = name, ///
414
+ node = null,
462
415
  prefixName = null,
463
416
  superTypes = [],
464
417
  properties = [],
465
418
  provisional = false,
466
- baseType = new BaseType(string, name, prefixName, superTypes, properties, provisional);
419
+ baseType = new BaseType(string, node, name, prefixName, superTypes, properties, provisional);
467
420
 
468
421
  return baseType;
469
422
  }
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
 
3
- import { define } from "../ontology";
3
+ import { define } from "../elements";
4
4
 
5
- export default define (class TypePrefix {
6
- constructor(string, name) {
5
+ export default define(class TypePrefix {
6
+ constructor(string, node, name) {
7
7
  this.string = string;
8
+ this.node = node;
8
9
  this.name = name;
9
10
  }
10
11
 
@@ -12,6 +13,10 @@ export default define (class TypePrefix {
12
13
  return this.string;
13
14
  }
14
15
 
16
+ getNode() {
17
+ return this.node;
18
+ }
19
+
15
20
  getName() {
16
21
  return this.name;
17
22
  }
@@ -40,13 +45,4 @@ export default define (class TypePrefix {
40
45
 
41
46
  return typePrefix;
42
47
  }
43
-
44
- static fromTypePrefixDeclarationNode(typePrefixDeclarationNode, context) {
45
- const typePrefix = typePrefixDeclarationNode.getTypePrefix(),
46
- name = typePrefix, ///
47
- string = name, ///
48
- type = new TypePrefix(string, name);
49
-
50
- return type;
51
- }
52
48
  });
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
 
3
- import ontology from "../ontology";
3
+ import elements from "../elements";
4
4
 
5
- import { define } from "../ontology";
5
+ import { define } from "../elements";
6
6
  import { EMPTY_STRING } from "../constants";
7
- import { typeFromTypeNode } from "../utilities/node";
7
+ import { typeFromTypeNode } from "../utilities/node.old";
8
+ import { instantiateVariable } from "../process/instantiate";
8
9
  import { typeFromJSON, typeToTypeJSON } from "../utilities/json";
9
- import { variableNodeFromVariableString } from "../context/partial/variable";
10
10
 
11
11
  export default define(class Variable {
12
12
  constructor(string, node, type, identifier, propertyRelations) {
@@ -41,6 +41,8 @@ export default define(class Variable {
41
41
  this.type = type;
42
42
  }
43
43
 
44
+ getTypeString() { return this.type.getString(); }
45
+
44
46
  isEqualTo(variable) {
45
47
  const variableNode = variable.getNode(),
46
48
  matches = this.node.match(variableNode),
@@ -156,7 +158,7 @@ export default define(class Variable {
156
158
  termTypeEqualToOrSubTypeOfVariableType = termType.isEqualToOrSubTypeOf(variableType);
157
159
 
158
160
  if (termTypeEqualToOrSubTypeOfVariableType) {
159
- const { TermSubstitution } = ontology,
161
+ const { TermSubstitution } = elements,
160
162
  termSubstitution = TermSubstitution.fromTernAndVariable(term, variable, context),
161
163
  substitution = termSubstitution; ///
162
164
 
@@ -189,8 +191,7 @@ export default define(class Variable {
189
191
 
190
192
  static fromJSON(json, context) {
191
193
  const { string } = json,
192
- variableString = string, ///
193
- variableNode = variableNodeFromVariableString(variableString, context),
194
+ variableNode = instantiateVariable(string, context),
194
195
  variableIdentifier = variableNode.getVariableIdentifier(),
195
196
  node = variableNode,
196
197
  identifier = variableIdentifier, ///
@@ -235,7 +236,7 @@ export default define(class Variable {
235
236
  }
236
237
 
237
238
  static fromVariableDeclarationNode(variableDeclarationNode, context) {
238
- const { Variable } = ontology,
239
+ const { Variable } = elements,
239
240
  provisional = variableDeclarationNode.isProvisional(),
240
241
  typeNode = variableDeclarationNode.getTypeNode(),
241
242
  type = typeFromTypeNode(typeNode, context);
@@ -275,18 +276,6 @@ export default define(class Variable {
275
276
  }
276
277
  });
277
278
 
278
- function variableFromVariableNodeAndType(variableNode, type) {
279
- const { Variable } = ontology,
280
- node = variableNode, ///
281
- variableIdentifier = variableNode.getVariableIdentifier(),
282
- string = variableIdentifier, ///,
283
- identifier = variableIdentifier, ///
284
- propertyRelations = [],
285
- variable = new Variable(string, node, type, identifier, propertyRelations);
286
-
287
- return variable;
288
- }
289
-
290
279
  function stringFromNameAndPropertyRelations(identifier, propertyRelations) {
291
280
  const propertyRelationsString = propertyRelations.reduce((propertyRelationsString, propertyRelation) => {
292
281
  const propertyRelationString = propertyRelation.getString();
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+
3
+ const elements = {};
4
+
5
+ export function define(Element) {
6
+ const { name } = Element;
7
+
8
+ elements[name] = Element;
9
+
10
+ return Element;
11
+ }
12
+
13
+ export default elements;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- import ontology from "../../ontology";
3
+ import elements from "../../elements";
4
4
 
5
5
  import { equalityFromStatement,
6
6
  judgementFromStatement,
@@ -10,7 +10,7 @@ import { equalityFromStatement,
10
10
  propertyAssertionFromStatement,
11
11
  subproofAssertionFromStatement,
12
12
  containedAssertionFromStatement,
13
- satisfiesAssertionFromStatement } from "../../utilities/context";
13
+ satisfiesAssertionFromStatement } from "../../utilities/statement";
14
14
 
15
15
  function verifyAsMetavariableAndSubstitution(statement, assignments, stated, context) {
16
16
  let verifiesAsMetavariableAndSubstitution = false;
@@ -25,7 +25,7 @@ function verifyAsMetavariableAndSubstitution(statement, assignments, stated, con
25
25
  const metavariableVerifies = metavariable.verify(context);
26
26
 
27
27
  if (metavariableVerifies) {
28
- const { TermSubstitution, FrameSubstitution } = ontology,
28
+ const { TermSubstitution, FrameSubstitution } = elements,
29
29
  frameSubstitution = FrameSubstitution.fromStatement(statement, context),
30
30
  termSubstitution = TermSubstitution.fromStatement(statement, context),
31
31
  substitution = (termSubstitution || frameSubstitution);
@@ -54,7 +54,7 @@ function unifyWithBracketedCombinator(statement, assignments, stated, context) {
54
54
 
55
55
  assignments = null; ///
56
56
 
57
- const { BracketedCombinator } = ontology,
57
+ const { BracketedCombinator } = elements,
58
58
  bracketedCombinator = BracketedCombinator.fromNothing(),
59
59
  unifiesWithBracketedCombinator = bracketedCombinator.unifyStatement(statement, assignments, stated, context);
60
60
 
@@ -2,13 +2,13 @@
2
2
 
3
3
  import { arrayUtilities } from "necessary";
4
4
 
5
- import ontology from "../../ontology";
5
+ import elements from "../../elements";
6
6
 
7
7
  import { equalityFromStatement,
8
8
  judgementFromStatement,
9
9
  typeAssertionFromStatement,
10
10
  propertyAssertionFromStatement,
11
- satisfiesAssertionFromStatement } from "../../utilities/context";
11
+ satisfiesAssertionFromStatement } from "../../utilities/statement";
12
12
 
13
13
  const { backwardsSome } = arrayUtilities;
14
14
 
@@ -52,7 +52,7 @@ function unifyWithReference(statement, reference, satisfiesAssertion, substituti
52
52
 
53
53
  context.trace(`Unifying the '${statementString}' statement with the '${referenceString}' reference...`);
54
54
 
55
- const { StatementSubstitution } = ontology,
55
+ const { StatementSubstitution } = elements,
56
56
  metavariable = reference.getMetavariable(),
57
57
  statementSubstitution = StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context),
58
58
  substitution = statementSubstitution; ///
@@ -107,7 +107,7 @@ function unifyAsSatisfiesAssertion(statement, reference, satisfiesAssertion, sub
107
107
  const satisfiable = axiom.isSatisfiable();
108
108
 
109
109
  if (satisfiable) {
110
- const { Substitutions } = ontology,
110
+ const { Substitutions } = elements,
111
111
  substitutions = Substitutions.fromNothing(),
112
112
  axiomLemmaTheoremOrConjectureUnifies = axiom.unifyAxiomLemmaTheoremOrConjecture(axiomLemmaTheoremOrConjecture, substitutions, context);
113
113
 
@@ -139,7 +139,7 @@ function unifyWithAxiomLemmaTheoremOrConjecture(statement, reference, satisfiesA
139
139
  let unifiesWithAxiomLemmaTheoremOrConjecture = false;
140
140
 
141
141
  if (reference !== null) {
142
- const { Substitutions } = ontology,
142
+ const { Substitutions } = elements,
143
143
  axiomLemmaTheoremOrConjecture = context.findAxiomLemmaTheoremOrConjectureByReference(reference),
144
144
  generalSubstitutions = substitutions; ///
145
145
 
@@ -156,7 +156,7 @@ function unifyWithAxiomLemmaTheoremOrConjecture(statement, reference, satisfiesA
156
156
  const statementAndStepsUnify = axiomLemmaTheoremOrConjecture.unifyStatementAndStepsOrSubproofs(statement, stepsOrSubproofs, substitutions, context);
157
157
 
158
158
  if (statementAndStepsUnify) {
159
- const { StatementSubstitution } = ontology,
159
+ const { StatementSubstitution } = elements,
160
160
  metavariable = reference.getMetavariable(),
161
161
  statementSubstitution = StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context),
162
162
  substitution = statementSubstitution; ///
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
 
3
- import ontology from "../../ontology";
3
+ import elements from "../../elements";
4
4
 
5
5
  function unifyWithBracketedConstructor(term, context, verifyAhead) {
6
6
  let unifiesWithBracketedConstructor;
7
7
 
8
- const { BracketedConstructor } = ontology,
8
+ const { BracketedConstructor } = elements,
9
9
  bracketedConstructor = BracketedConstructor.fromNothing();
10
10
 
11
11
  unifiesWithBracketedConstructor = bracketedConstructor.unifyTerm(term, context, verifyAhead);
@@ -32,7 +32,7 @@ function unifyWithConstructors(term, context, verifyAhead) {
32
32
  function verifyTermAsVariable(term, context, verifyAhead) {
33
33
  let termVerifiesAsVariable = false;
34
34
 
35
- const { Variable } = ontology,
35
+ const { Variable } = elements,
36
36
  termNode = term.getNode(),
37
37
  singularVariableNode = termNode.getSingularVariableNode();
38
38
 
@@ -5,6 +5,20 @@ import SubstitutionNode from "../../node/substitution";
5
5
  import { FRAME_RULE_NAME } from "../../ruleNames";
6
6
 
7
7
  export default class FrameSubstitutionNode extends SubstitutionNode {
8
+ getMetavariableNode() {
9
+ const lastMetavariableNode = this.getLastMetavariableNode(),
10
+ metavariableNode = lastMetavariableNode; ///
11
+
12
+ return metavariableNode;
13
+ }
14
+
15
+ getFrameNode() {
16
+ const firstFrameNode = this.getFirstFrameNode(),
17
+ frameNode = firstFrameNode; ///
18
+
19
+ return frameNode;
20
+ }
21
+
8
22
  getLastFrameNode() {
9
23
  const ruleName = FRAME_RULE_NAME,
10
24
  lastFrameNode = this.getLastNodeByRuleName(ruleName);
@@ -5,6 +5,20 @@ import SubstitutionNode from "../../node/substitution";
5
5
  import { STATEMENT_RULE_NAME } from "../../ruleNames";
6
6
 
7
7
  export default class StatementSubstitutionNode extends SubstitutionNode {
8
+ getMetavariableNode() {
9
+ const lastMetavariableNode = this.getLastVariableNode(),
10
+ metavariableNode = lastMetavariableNode; ///
11
+
12
+ return metavariableNode;
13
+ }
14
+
15
+ getStatementNode() {
16
+ const firstStatementNode = this.getFirstStatementNode(),
17
+ statementNode = firstStatementNode; ///
18
+
19
+ return statementNode;
20
+ }
21
+
8
22
  getLastStatementNode() {
9
23
  const ruleName = STATEMENT_RULE_NAME,
10
24
  lastStatementNode = this.getLastNodeByRuleName(ruleName);
@@ -19,5 +33,31 @@ export default class StatementSubstitutionNode extends SubstitutionNode {
19
33
  return firstStatementNode;
20
34
  }
21
35
 
36
+ getLastMetavariableNode() {
37
+ let lastMetavariableNode = null;
38
+
39
+ const lastStatementNode = this.getLastStatementNode(),
40
+ singularMetavariableNode = lastStatementNode.getSingularMetavariableNode();
41
+
42
+ if (singularMetavariableNode !== null) {
43
+ lastMetavariableNode = singularMetavariableNode; ///
44
+ }
45
+
46
+ return lastMetavariableNode;
47
+ }
48
+
49
+ getFirstMetavariableNode() {
50
+ let firstMetavariableNode = null;
51
+
52
+ const firstStatementNode = this.getFirstStatementNode(),
53
+ singularMetavariableNode = firstStatementNode.getSingularMetavariableNode();
54
+
55
+ if (singularMetavariableNode !== null) {
56
+ firstMetavariableNode = singularMetavariableNode; ///
57
+ }
58
+
59
+ return firstMetavariableNode;
60
+ }
61
+
22
62
  static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return SubstitutionNode.fromRuleNameChildNodesOpacityAndPrecedence(StatementSubstitutionNode, ruleName, childNodes, opacity, precedence); }
23
63
  }
@@ -5,6 +5,20 @@ import SubstitutionNode from "../../node/substitution";
5
5
  import { TERM_RULE_NAME } from "../../ruleNames";
6
6
 
7
7
  export default class TermSubstitutionNode extends SubstitutionNode {
8
+ getVariableNode() {
9
+ const lastVariableNode = this.getLastVariableNode(),
10
+ variableNode = lastVariableNode; ///
11
+
12
+ return variableNode;
13
+ }
14
+
15
+ getTermNode() {
16
+ const firstTermNode = this.getFirstTermNode(),
17
+ termNode = firstTermNode; ///
18
+
19
+ return termNode;
20
+ }
21
+
8
22
  getLastTermNode() {
9
23
  const ruleName = TERM_RULE_NAME,
10
24
  lastTermNode = this.getLastNodeByRuleName(ruleName);
@@ -37,3 +51,4 @@ export default class TermSubstitutionNode extends SubstitutionNode {
37
51
 
38
52
  static fromRuleNameChildNodesOpacityAndPrecedence(ruleName, childNodes, opacity, precedence) { return SubstitutionNode.fromRuleNameChildNodesOpacityAndPrecedence(TermSubstitutionNode, ruleName, childNodes, opacity, precedence); }
39
53
  }
54
+