occam-verify-cli 1.0.421 → 1.0.428

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 (278) 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 +312 -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/equivalence.js +116 -0
  79. package/lib/node/substitution/frame.js +15 -1
  80. package/lib/node/substitution/statement.js +37 -1
  81. package/lib/node/substitution/term.js +15 -1
  82. package/lib/nonTerminalNodeMap.js +4 -3
  83. package/lib/preamble.js +63 -63
  84. package/lib/process/assign.js +58 -0
  85. package/lib/process/instantiate.js +74 -7
  86. package/lib/process/unify.js +26 -26
  87. package/lib/process/verify.js +21 -21
  88. package/lib/ruleNames.js +5 -1
  89. package/lib/utilities/brackets.js +9 -18
  90. package/lib/utilities/customGrammar.js +1 -1
  91. package/lib/utilities/element.js +1141 -0
  92. package/lib/utilities/json.js +32 -32
  93. package/lib/utilities/node.js +49 -61
  94. package/lib/utilities/statement.js +83 -0
  95. package/lib/utilities/string.js +80 -57
  96. package/package.json +6 -6
  97. package/src/action/verify.js +8 -1
  98. package/src/context/file.js +9 -39
  99. package/src/context/local.js +5 -11
  100. package/src/context/nominal.js +30 -0
  101. package/src/context/release.js +1 -1
  102. package/src/context/temporary.js +6 -63
  103. package/src/{ontology → element}/assertion/contained.js +4 -25
  104. package/src/{ontology → element}/assertion/defined.js +7 -26
  105. package/src/{ontology → element}/assertion/property.js +7 -26
  106. package/src/{ontology → element}/assertion/satisfies.js +5 -53
  107. package/src/{ontology → element}/assertion/subproof.js +3 -32
  108. package/src/{ontology → element}/assertion/type.js +7 -26
  109. package/src/{ontology → element}/assertion.js +6 -6
  110. package/src/{ontology → element}/assumption.js +3 -27
  111. package/src/{ontology → element}/axiom.js +4 -11
  112. package/src/{ontology/topLevelAssertion.js → element/axiomLemmaTheoremConjecture.js} +9 -105
  113. package/src/{ontology → element}/conclusion.js +4 -19
  114. package/src/{ontology → element}/conjecture.js +4 -11
  115. package/src/{ontology → element}/declaration/combinator.js +3 -14
  116. package/src/{ontology → element}/declaration/complexType.js +3 -19
  117. package/src/{ontology → element}/declaration/constructor.js +3 -14
  118. package/src/{ontology → element}/declaration/metavariable.js +3 -39
  119. package/src/{ontology → element}/declaration/simpleType.js +3 -19
  120. package/src/{ontology → element}/declaration/typePrefix.js +3 -15
  121. package/src/{ontology → element}/declaration/variable.js +3 -14
  122. package/src/{ontology → element}/declaration.js +6 -6
  123. package/src/{ontology → element}/deduction.js +9 -22
  124. package/src/{ontology → element}/derivation.js +2 -32
  125. package/src/{ontology → element}/equality.js +18 -42
  126. package/src/{ontology → element}/equivalence.js +37 -22
  127. package/src/{ontology → element}/equivalences.js +1 -2
  128. package/src/{ontology → element}/error.js +8 -8
  129. package/src/{ontology → element}/frame.js +8 -56
  130. package/src/{ontology → element}/hypothesis.js +5 -5
  131. package/src/{ontology → element}/judgement.js +7 -7
  132. package/src/{ontology → element}/label.js +3 -3
  133. package/src/{ontology → element}/lemma.js +4 -4
  134. package/src/{ontology → element}/metaLemma.js +5 -5
  135. package/src/{ontology/topLevelMetaAssertion.js → element/metaLemmaMetatheorem.js} +11 -11
  136. package/src/{ontology → element}/metaType.js +11 -7
  137. package/src/{ontology → element}/metatheorem.js +5 -5
  138. package/src/{ontology → element}/metavariable.js +10 -60
  139. package/src/{ontology → element}/parameter.js +1 -1
  140. package/src/{ontology → element}/premise.js +14 -14
  141. package/src/{ontology → element}/procedureCall.js +4 -4
  142. package/src/{ontology → element}/procedureReference.js +1 -1
  143. package/src/{ontology → element}/proof.js +3 -3
  144. package/src/{ontology → element}/property.js +7 -15
  145. package/src/{ontology → element}/propertyRelation.js +5 -11
  146. package/src/{ontology → element}/reference.js +5 -19
  147. package/src/{ontology → element}/rule.js +13 -13
  148. package/src/{ontology → element}/section.js +10 -10
  149. package/src/{ontology → element}/signature.js +12 -15
  150. package/src/element/statement/combinator/bracketed.js +38 -0
  151. package/src/element/statement/combinator.js +59 -0
  152. package/src/{ontology → element}/statement.js +11 -27
  153. package/src/{ontology → element}/step.js +10 -44
  154. package/src/{ontology → element}/subDerivation.js +3 -24
  155. package/src/{ontology → element}/subproof.js +3 -43
  156. package/src/{ontology → element}/substitution/frame.js +4 -21
  157. package/src/{ontology → element}/substitution/reference.js +3 -3
  158. package/src/{ontology → element}/substitution/statement.js +6 -10
  159. package/src/{ontology → element}/substitution/term.js +7 -23
  160. package/src/{ontology → element}/substitutions.js +1 -1
  161. package/src/{ontology → element}/supposition.js +10 -10
  162. package/src/{ontology → element/term}/constructor/bracketed.js +12 -13
  163. package/src/element/term/constructor.js +82 -0
  164. package/src/{ontology → element}/term.js +6 -38
  165. package/src/{ontology → element}/theorem.js +5 -5
  166. package/src/{ontology → element}/type.js +17 -64
  167. package/src/{ontology → element}/typePrefix.js +8 -12
  168. package/src/{ontology → element}/variable.js +9 -20
  169. package/src/elements.js +13 -0
  170. package/src/mixins/statement/verify.js +4 -4
  171. package/src/mixins/step/unify.js +6 -6
  172. package/src/mixins/term/verify.js +3 -3
  173. package/src/node/equivalence.js +16 -0
  174. package/src/node/substitution/frame.js +14 -0
  175. package/src/node/substitution/statement.js +40 -0
  176. package/src/node/substitution/term.js +15 -0
  177. package/src/nonTerminalNodeMap.js +4 -1
  178. package/src/preamble.js +62 -62
  179. package/src/process/assign.js +59 -0
  180. package/src/process/instantiate.js +71 -15
  181. package/src/process/unify.js +37 -39
  182. package/src/process/verify.js +20 -20
  183. package/src/ruleNames.js +1 -0
  184. package/src/utilities/brackets.js +12 -17
  185. package/src/utilities/customGrammar.js +3 -3
  186. package/src/utilities/element.js +1399 -0
  187. package/src/utilities/json.js +31 -31
  188. package/src/utilities/node.js +56 -64
  189. package/src/utilities/{context.js → statement.js} +10 -39
  190. package/src/utilities/string.js +83 -53
  191. package/lib/assignment/equality.js +0 -62
  192. package/lib/assignment/judgement.js +0 -62
  193. package/lib/assignment/variable.js +0 -64
  194. package/lib/context/bracketed/combinator.js +0 -121
  195. package/lib/context/bracketed/constructor.js +0 -121
  196. package/lib/context/bracketted.js +0 -86
  197. package/lib/context/partial/metavariable.js +0 -180
  198. package/lib/context/partial/statement.js +0 -180
  199. package/lib/context/partial/term.js +0 -192
  200. package/lib/context/partial/variable.js +0 -192
  201. package/lib/context/partial.js +0 -93
  202. package/lib/ontology/assertion/contained.js +0 -357
  203. package/lib/ontology/assertion/defined.js +0 -331
  204. package/lib/ontology/assertion/property.js +0 -313
  205. package/lib/ontology/assertion/satisfies.js +0 -302
  206. package/lib/ontology/assertion/subproof.js +0 -240
  207. package/lib/ontology/assertion/type.js +0 -308
  208. package/lib/ontology/assumption.js +0 -383
  209. package/lib/ontology/axiom.js +0 -339
  210. package/lib/ontology/combinator/bracketed.js +0 -202
  211. package/lib/ontology/combinator.js +0 -155
  212. package/lib/ontology/conclusion.js +0 -201
  213. package/lib/ontology/constructor.js +0 -185
  214. package/lib/ontology/declaration/combinator.js +0 -210
  215. package/lib/ontology/declaration/complexType.js +0 -393
  216. package/lib/ontology/declaration/constructor.js +0 -242
  217. package/lib/ontology/declaration/metavariable.js +0 -257
  218. package/lib/ontology/declaration/simpleType.js +0 -290
  219. package/lib/ontology/declaration/typePrefix.js +0 -228
  220. package/lib/ontology/declaration/variable.js +0 -245
  221. package/lib/ontology/deduction.js +0 -215
  222. package/lib/ontology/derivation.js +0 -155
  223. package/lib/ontology/equality.js +0 -288
  224. package/lib/ontology/equivalence.js +0 -295
  225. package/lib/ontology/equivalences.js +0 -264
  226. package/lib/ontology/frame.js +0 -419
  227. package/lib/ontology/hypothesis.js +0 -190
  228. package/lib/ontology/judgement.js +0 -248
  229. package/lib/ontology/label.js +0 -198
  230. package/lib/ontology/metavariable.js +0 -502
  231. package/lib/ontology/parameter.js +0 -108
  232. package/lib/ontology/premise.js +0 -310
  233. package/lib/ontology/procedureCall.js +0 -243
  234. package/lib/ontology/property.js +0 -166
  235. package/lib/ontology/propertyRelation.js +0 -202
  236. package/lib/ontology/reference.js +0 -315
  237. package/lib/ontology/rule.js +0 -373
  238. package/lib/ontology/section.js +0 -255
  239. package/lib/ontology/signature.js +0 -217
  240. package/lib/ontology/statement.js +0 -398
  241. package/lib/ontology/step.js +0 -295
  242. package/lib/ontology/subDerivation.js +0 -147
  243. package/lib/ontology/subproof.js +0 -265
  244. package/lib/ontology/substitution/frame.js +0 -261
  245. package/lib/ontology/substitution/term.js +0 -269
  246. package/lib/ontology/substitution.js +0 -206
  247. package/lib/ontology/substitutions.js +0 -425
  248. package/lib/ontology/supposition.js +0 -323
  249. package/lib/ontology/term.js +0 -351
  250. package/lib/ontology/topLevelAssertion.js +0 -431
  251. package/lib/ontology/topLevelMetaAssertion.js +0 -234
  252. package/lib/ontology/type.js +0 -556
  253. package/lib/ontology/typePrefix.js +0 -99
  254. package/lib/ontology/variable.js +0 -343
  255. package/lib/ontology.js +0 -27
  256. package/lib/utilities/assignments.js +0 -19
  257. package/lib/utilities/context.js +0 -101
  258. package/lib/utilities/subproof.js +0 -42
  259. package/lib/utilities/type.js +0 -40
  260. package/src/assignment/equality.js +0 -29
  261. package/src/assignment/judgement.js +0 -29
  262. package/src/assignment/variable.js +0 -34
  263. package/src/context/bracketed/combinator.js +0 -31
  264. package/src/context/bracketed/constructor.js +0 -31
  265. package/src/context/bracketted.js +0 -41
  266. package/src/context/partial/metavariable.js +0 -39
  267. package/src/context/partial/statement.js +0 -39
  268. package/src/context/partial/term.js +0 -49
  269. package/src/context/partial/variable.js +0 -49
  270. package/src/context/partial.js +0 -71
  271. package/src/ontology/combinator/bracketed.js +0 -38
  272. package/src/ontology/combinator.js +0 -72
  273. package/src/ontology/constructor.js +0 -105
  274. package/src/ontology.js +0 -13
  275. package/src/utilities/assignments.js +0 -11
  276. package/src/utilities/subproof.js +0 -56
  277. package/src/utilities/type.js +0 -35
  278. /package/src/{ontology → element}/substitution.js +0 -0
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+
3
+ import CombinatorStatement from "../../statement/combinator";
4
+
5
+ import { define } from "../../elements";
6
+ import { statementFromStatementNode } from "../../utilities/element";
7
+ import { bracketedCombinatorStatementString, instantiateBracketedCombinatorStatement } from "../../../process/instantiate";
8
+
9
+ export default define(class BracketedCombinatorStatement extends CombinatorStatement {
10
+ unifyStatement(statement, assignments, stated, context) {
11
+ let statementUnifies;
12
+
13
+ const statementString = statement.getString();
14
+
15
+ context.trace(`Unifying the '${statementString}' statement with the bracketed combinator...`);
16
+
17
+ statementUnifies = super.unifyStatement(statement, assignments, stated, context);
18
+
19
+ if (statementUnifies) {
20
+ context.debug(`...unified the '${statementString}' statement with the bracketed combinator.`);
21
+ }
22
+
23
+ return statementUnifies;
24
+ }
25
+
26
+ static name = "BracketedCombinatorStatement";
27
+
28
+ static fromNothing() {
29
+ const bracketedCombinatorStatementNode = instantiateBracketedCombinatorStatement(),
30
+ nodeAsString = () => bracketedCombinatorStatementString,
31
+ context = {
32
+ nodeAsString
33
+ },
34
+ bracketedCombinatorStatement = statementFromStatementNode(bracketedCombinatorStatementNode, context);
35
+
36
+ return bracketedCombinatorStatement;
37
+ }
38
+ });
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ import { define } from "../../elements";
4
+ import { unifyStatementWithCombinatorStatement } from "../../process/unify";
5
+ import { statementFromJSON, statementToStatementJSON } from "../../utilities/json";
6
+
7
+ export default define(class CombinatorStatement {
8
+ constructor(statement) {
9
+ this.statement = statement;
10
+ }
11
+
12
+ getStatement() {
13
+ return this.statement;
14
+ }
15
+
16
+ getString() { return this.statement.getString(); }
17
+
18
+ getStatementNode() {
19
+ const statementNode = this.statement.getNode();
20
+
21
+ return statementNode;
22
+ }
23
+
24
+ unifyStatement(statement, assignments, stated, context) {
25
+ let statementUnifies;
26
+
27
+ const statementString = statement.getString(),
28
+ combinatorStatementString = this.getString();
29
+
30
+ context.trace(`Unifying the '${statementString}' statement with the '${combinatorStatementString}' combinator's statement...`);
31
+
32
+ const combinatorStatement = this, ///
33
+ statementUnifiesWithCombinator = unifyStatementWithCombinatorStatement(statement, combinatorStatement, assignments, stated, context);
34
+
35
+ statementUnifies = statementUnifiesWithCombinator; ///
36
+
37
+ if (statementUnifies) {
38
+ context.debug(`...unified the '${statementString}' statement with the '${combinatorStatementString}' combinator's statement.`);
39
+ }
40
+
41
+ return statementUnifies;
42
+ }
43
+
44
+ toJSON() {
45
+ const statementJSON = statementToStatementJSON(this.statement),
46
+ json = statementJSON;
47
+
48
+ return json;
49
+ }
50
+
51
+ static name = "CombinatorStatement";
52
+
53
+ static fromJSON(json, context) {
54
+ const statement = statementFromJSON(json, context),
55
+ combinator = new CombinatorStatement(statement);
56
+
57
+ return combinator;
58
+ }
59
+ });
@@ -3,21 +3,24 @@
3
3
  import { arrayUtilities } from "necessary";
4
4
 
5
5
  import verifyMixins from "../mixins/statement/verify";
6
- import StatementPartialContext from "../context/partial/statement";
7
6
 
8
- import { define } from "../ontology";
7
+ import { define } from "../elements";
9
8
  import { unifyStatement } from "../process/unify";
9
+ import { instantiateStatement } from "../process/instantiate";
10
10
  import { STATEMENT_META_TYPE_NAME } from "../metaTypeNames";
11
- import { statementFromStatementNode } from "../utilities/node";
12
11
  import { stripBracketsFromStatementNode } from "../utilities/brackets";
13
12
 
14
13
  const { match, backwardsSome } = arrayUtilities;
15
14
 
16
15
  export default define(class Statement {
17
- constructor(string, node, tokens) {
16
+ constructor(context, string, node) {
17
+ this.context = context;
18
18
  this.string = string;
19
19
  this.node = node;
20
- this.tokens = tokens;
20
+ }
21
+
22
+ getContext() {
23
+ return this.context;
21
24
  }
22
25
 
23
26
  getString() {
@@ -28,10 +31,6 @@ export default define(class Statement {
28
31
  return this.node;
29
32
  }
30
33
 
31
- getTokens() {
32
- return this.tokens;
33
- }
34
-
35
34
  getMetavariableName() {
36
35
  let metavariableName = null;
37
36
 
@@ -295,12 +294,9 @@ export default define(class Statement {
295
294
 
296
295
  static fromJSON(json, context) {
297
296
  const { string } = json,
298
- lexer = context.getLexer(),
299
- parser = context.getParser(),
300
- statementPartialContext = StatementPartialContext.fromStringLexerAndParser(string, lexer, parser),
301
- node = statementPartialContext.getNode(),
302
- tokens = statementPartialContext.getTokens(),
303
- statement = new Statement(string, node, tokens);
297
+ statmentNode = instantiateStatement(string, context),
298
+ node = statmentNode, ///,
299
+ statement = new Statement(string, node);
304
300
 
305
301
  return statement;
306
302
  }
@@ -399,18 +395,6 @@ export default define(class Statement {
399
395
  return statement;
400
396
  }
401
397
 
402
- static fromContainedAssertionNode(containedAssertionNode, context) {
403
- let statement = null;
404
-
405
- const statementNode = containedAssertionNode.getStatementNode();
406
-
407
- if (statementNode !== null) {
408
- statement = statementFromStatementNode(statementNode, context);
409
- }
410
-
411
- return statement;
412
- }
413
-
414
398
  static fromCombinatorDeclarationNode(combinatorDeclarationNode, context) {
415
399
  const statementNode = combinatorDeclarationNode.getStatementNode(),
416
400
  statement = statementFromStatementNode(statementNode, context);
@@ -1,18 +1,18 @@
1
1
  "use strict";
2
2
 
3
- import ontology from "../ontology";
3
+ import elements from "../elements";
4
4
  import unifyMixins from "../mixins/step/unify";
5
5
  import TemporaryContext from "../context/temporary";
6
6
 
7
- import { define } from "../ontology";
7
+ import { define } from "../elements";
8
8
  import { equateStatements } from "../process/equate";
9
- import { propertyAssertionFromStatement } from "../utilities/context";
9
+ import { propertyAssertionFromStatement } from "../utilities/statement";
10
10
 
11
11
  export default define(class Step {
12
- constructor(context, node, string, statement, reference, satisfiesAssertion) {
12
+ constructor(context, string, node, statement, reference, satisfiesAssertion) {
13
13
  this.context = context;
14
- this.node = node;
15
14
  this.string = string;
15
+ this.node = node;
16
16
  this.statement = statement;
17
17
  this.reference = reference;
18
18
  this.satisfiesAssertion = satisfiesAssertion;
@@ -22,14 +22,14 @@ export default define(class Step {
22
22
  return this.context;
23
23
  }
24
24
 
25
- getNode() {
26
- return this.node;
27
- }
28
-
29
25
  getString() {
30
26
  return this.string;
31
27
  }
32
28
 
29
+ getNode() {
30
+ return this.node;
31
+ }
32
+
33
33
  getStatement() {
34
34
  return this.statement;
35
35
  }
@@ -181,7 +181,7 @@ export default define(class Step {
181
181
  axiom = context.findAxiomByReference(reference);
182
182
 
183
183
  if (axiom !== null) {
184
- const { Substitutions } = ontology,
184
+ const { Substitutions } = elements,
185
185
  step = this, ///
186
186
  substitutions = Substitutions.fromNothing(),
187
187
  stepUnifies = axiom.unifyStep(step, substitutions, context);
@@ -203,38 +203,4 @@ export default define(class Step {
203
203
  }
204
204
 
205
205
  static name = "Step";
206
-
207
- static fromStatement(statement, context) {
208
- const statementString = statement.getString(),
209
- string = statementString, ///
210
- node = null,
211
- reference = null,
212
- satisfiesAssertion = null,
213
- step = new Step(context, node, string, statement, reference, satisfiesAssertion);
214
-
215
- return step;
216
- }
217
-
218
- static fromStepOrSubproofNode(stepOrSubproofNode, context) {
219
- let step = null;
220
-
221
- const stepNode = stepOrSubproofNode.isStepNode();
222
-
223
- if (stepNode) {
224
- const { Statement, Reference, SatisfiesAssertion } = ontology,
225
- stepNode = stepOrSubproofNode, ///
226
- node = stepNode, ///
227
- string = context.nodeAsString(node),
228
- statement = Statement.fromStepNode(stepNode, context),
229
- reference = Reference.fromStepNode(stepNode, context),
230
- satisfiesAssertion = SatisfiesAssertion.fromStepNode(stepNode, context),
231
- temporaryContext = null;
232
-
233
- context = temporaryContext; ///
234
-
235
- step = new Step(context, node, string, statement, reference, satisfiesAssertion)
236
- }
237
-
238
- return step;
239
- }
240
206
  });
@@ -2,10 +2,10 @@
2
2
 
3
3
  import { arrayUtilities } from "necessary";
4
4
 
5
- import ontology from "../ontology";
5
+ import elements from "../elements";
6
+ import assignAssignments from "../process/assign";
6
7
 
7
- import { define } from "../ontology";
8
- import { assignAssignments } from "../utilities/assignments";
8
+ import { define } from "../elements";
9
9
 
10
10
  const { last } = arrayUtilities;
11
11
 
@@ -51,25 +51,4 @@ export default define(class SubDerivation {
51
51
  }
52
52
 
53
53
  static name = "SubDerivation";
54
-
55
- static fromSubDerivationNode(subDerivationNode, context) {
56
- const stepsOrSubproofs = stepOrSubproofFromSubDerivationNode(subDerivationNode, context),
57
- subDerivation = new SubDerivation(stepsOrSubproofs);
58
-
59
- return subDerivation;
60
- }
61
54
  });
62
-
63
- function stepOrSubproofFromSubDerivationNode(subDerivationNode, context) {
64
- const { Step, Subproof } = ontology,
65
- stepOrSubproofNodes = subDerivationNode.getStepOrSubproofNodes(),
66
- stepsOrSubproofs = stepOrSubproofNodes.map((stepOrSubproofNode) => {
67
- const subproof = Subproof.fromStepOrSubproofNode(stepOrSubproofNode, context),
68
- step = Step.fromStepOrSubproofNode(stepOrSubproofNode, context),
69
- stepOrSubproof = (step || subproof);
70
-
71
- return stepOrSubproof;
72
- });
73
-
74
- return stepsOrSubproofs;
75
- }
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
 
3
- import ontology from "../ontology";
3
+ import elements from "../elements";
4
4
  import LocalContext from "../context/local";
5
5
 
6
- import { define } from "../ontology";
7
- import { subproofStringFromSubproofNode } from "../utilities/subproof";
6
+ import { define } from "../elements";
8
7
 
9
8
  export default define(class Subproof {
10
9
  constructor(string, node, suppositions, subDerivation) {
@@ -109,7 +108,7 @@ export default define(class Subproof {
109
108
  const axiomSatisfiable = axiom.isSatisfiable();
110
109
 
111
110
  if (axiomSatisfiable) {
112
- const { Substitutions } = ontology,
111
+ const { Substitutions } = elements,
113
112
  subproof = this, ///
114
113
  substitutions = Substitutions.fromNothing(),
115
114
  statementUnifies = axiom.unifySubproof(subproof, substitutions, context);
@@ -132,43 +131,4 @@ export default define(class Subproof {
132
131
  }
133
132
 
134
133
  static name = "Subproof";
135
-
136
- static fromStepOrSubproofNode(sStepOrSubproofNode, context) {
137
- let subproof = null;
138
-
139
- const subproofNode = sStepOrSubproofNode.isSubproofNode();
140
-
141
- if (subproofNode) {
142
- const subproofNode = sStepOrSubproofNode, ///
143
- suppositions = suppositionsFromSubproofNode(subproofNode, context),
144
- subDerivation = subDerivationFromSubproofNode(subproofNode, context),
145
- subproofString = subproofStringFromSubproofNode(subproofNode, context),
146
- node = subproofNode, ///
147
- string = subproofString; ///
148
-
149
- subproof = new Subproof(string, node, suppositions, subDerivation);
150
- }
151
-
152
- return subproof;
153
- }
154
134
  });
155
-
156
- function suppositionsFromSubproofNode(subproofNode, context) {
157
- const { Supposition } = ontology,
158
- suppositionNodes = subproofNode.getSuppositionNodes(),
159
- suppositions = suppositionNodes.map((suppositionNode) => {
160
- const supposition = Supposition.fromSuppositionNode(suppositionNode, context);
161
-
162
- return supposition;
163
- });
164
-
165
- return suppositions;
166
- }
167
-
168
- function subDerivationFromSubproofNode(subproofNode, context) {
169
- const { SubDerivation } = ontology,
170
- subDerivationNode = subproofNode.getSubDerivationNode(),
171
- subDerivation = SubDerivation.fromSubDerivationNode(subDerivationNode, context);
172
-
173
- return subDerivation;
174
- }
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
 
3
- import ontology from "../../ontology";
4
3
  import Substitution from "../substitution";
5
4
 
6
- import { define } from "../../ontology";
5
+ import { define } from "../../elements";
7
6
  import { instantiateFrameSubstitution } from "../../process/instantiate";
7
+ import { frameSubstitutionFromFrameSubstitutionNode, frameSubstitutionFromStatementNode } from "../../utilities/element";
8
8
 
9
9
  export default define(class FrameSubstitution extends Substitution {
10
10
  constructor(context, string, node, frame, metavariable) {
@@ -81,24 +81,8 @@ export default define(class FrameSubstitution extends Substitution {
81
81
  static name = "FrameSubstitution";
82
82
 
83
83
  static fromStatement(statement, context) {
84
- let frameSubstitution = null;
85
-
86
84
  const statementNode = statement.getNode(),
87
- frameSubstitutionNode = statementNode.getFrameSubstitutionNode();
88
-
89
- if (frameSubstitutionNode !== null) {
90
- const { Frame, Metavariable } = ontology,
91
- firstFrameNode = frameSubstitutionNode.getFirstFrameNode(),
92
- lastMetavariableNode = frameSubstitutionNode.getLastMetavariableNode(),
93
- metavariableNode = lastMetavariableNode, ///
94
- frameNode = firstFrameNode, ///
95
- node = frameSubstitutionNode, ///
96
- string = context.nodeAsString(node),
97
- frame = Frame.fromFrameNode(frameNode, context),
98
- metavariable = Metavariable.fromMetavariableNode(metavariableNode, context);
99
-
100
- frameSubstitution = new FrameSubstitution(context, string, node, frame, metavariable);
101
- }
85
+ frameSubstitution = frameSubstitutionFromStatementNode(statementNode, context);
102
86
 
103
87
  return frameSubstitution;
104
88
  }
@@ -106,8 +90,7 @@ export default define(class FrameSubstitution extends Substitution {
106
90
  static fromFrameAndMetavariable(frame, metavariable, context) {
107
91
  const string = stringFromFrameAndMetavariable(frame, metavariable),
108
92
  frameSubstitutionNode = instantiateFrameSubstitution(string, context),
109
- node = frameSubstitutionNode, ///
110
- frameSubstitution = new FrameSubstitution(context, string, node, frame, metavariable);
93
+ frameSubstitution = frameSubstitutionFromFrameSubstitutionNode(frameSubstitutionNode, context);
111
94
 
112
95
  return frameSubstitution;
113
96
  }
@@ -2,8 +2,9 @@
2
2
 
3
3
  import Substitution from "../substitution";
4
4
 
5
- import { define } from "../../ontology";
5
+ import { define } from "../../elements";
6
6
  import { instantiateReferenceSubstitution } from "../../process/instantiate";
7
+ import { referenceSubstitutionFromReferenceSubstitutionNode } from "../../utilities/element";
7
8
 
8
9
  export default define(class ReferenceSubstitution extends Substitution {
9
10
  constructor(context, string, node, reference, metavariable) {
@@ -32,8 +33,7 @@ export default define(class ReferenceSubstitution extends Substitution {
32
33
  static fromReferenceAndMetavariable(reference, metavariable, context) {
33
34
  const string = stringFromReferenceAndMetavariable(reference, metavariable),
34
35
  referenceSubstitutionNode = instantiateReferenceSubstitution(string, context),
35
- node = referenceSubstitutionNode, ///
36
- referenceSubstitution = new ReferenceSubstitution(context, string, node, reference, metavariable);
36
+ referenceSubstitution = referenceSubstitutionFromReferenceSubstitutionNode(referenceSubstitutionNode, context);
37
37
 
38
38
  return referenceSubstitution;
39
39
  }
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
 
3
- import ontology from "../../ontology";
3
+ import elements from "../../elements";
4
4
  import Substitution from "../substitution";
5
5
 
6
- import { define } from "../../ontology";
6
+ import { define } from "../../elements";
7
7
  import { unifySubstitution } from "../../process/unify";
8
8
  import { stripBracketsFromStatement } from "../../utilities/brackets";
9
9
  import { instantiateStatementSubstitution } from "../../process/instantiate";
10
+ import { statementSubstitutionFromStatementSubstitutionNode } from "../../utilities/element";
10
11
  import { statementFromJSON, statementToStatementJSON, metavariableFromJSON, metavariableToMetavariableJSON } from "../../utilities/json";
11
12
 
12
13
  export default define(class StatementSubstitution extends Substitution {
@@ -79,7 +80,7 @@ export default define(class StatementSubstitution extends Substitution {
79
80
  unifyStatement(statement, context) {
80
81
  let substitution = null;
81
82
 
82
- const { Substitutions } = ontology,
83
+ const { Substitutions } = elements,
83
84
  substitutions = Substitutions.fromNothing(),
84
85
  specificContext = context; ///
85
86
 
@@ -205,10 +206,7 @@ export default define(class StatementSubstitution extends Substitution {
205
206
 
206
207
  const string = stringFromStatementAndMetavariable(statement, metavariable),
207
208
  statementSubstitutionNode = instantiateStatementSubstitution(string, context),
208
- node = statementSubstitutionNode,
209
- resolved = true,
210
- substitution = null,
211
- statementSubstitution = new StatementSubstitution(context, string, node, resolved, statement, metavariable, substitution);
209
+ statementSubstitution = statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, context);
212
210
 
213
211
  return statementSubstitution;
214
212
  }
@@ -218,9 +216,7 @@ export default define(class StatementSubstitution extends Substitution {
218
216
 
219
217
  const string = stringFromStatementMetavariableAndSubstitution(statement, metavariable, substitution, context),
220
218
  statementSubstitutionNode = instantiateStatementSubstitution(string, context),
221
- node = statementSubstitutionNode,
222
- resolved = false,
223
- statementSubstitution = new StatementSubstitution(context, string, node, resolved, statement, metavariable, substitution);
219
+ statementSubstitution = statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, substitution, context);
224
220
 
225
221
  return statementSubstitution;
226
222
  }
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
 
3
- import ontology from "../../ontology";
3
+ import elements from "../../elements";
4
4
  import Substitution from "../substitution";
5
5
 
6
- import { define } from "../../ontology";
6
+ import { define } from "../../elements";
7
7
  import { stripBracketsFromTerm } from "../../utilities/brackets";
8
8
  import { instantiateTermSubstitution } from "../../process/instantiate";
9
+ import { termSubstitutionFromStatementNode, termSubstitutionFromTermSubstitutionNode } from "../../utilities/element";
9
10
 
10
11
  export default define(class TermSubstitution extends Substitution {
11
12
  constructor(context, string, node, term, variable) {
@@ -101,33 +102,16 @@ export default define(class TermSubstitution extends Substitution {
101
102
  static name = "TermSubstitution";
102
103
 
103
104
  static fromStatement(statement, context) {
104
- let termSubstitution = null;
105
-
106
105
  const statementNode = statement.getNode(),
107
- termSubstitutionNode = statementNode.getTermSubstitutionNode();
108
-
109
- if (termSubstitutionNode !== null) {
110
- const { Term, Variable } = ontology,
111
- firstTermNode = termSubstitutionNode.getFirstTermNode(),
112
- lastVariableNode = termSubstitutionNode.getLastVariableNode(),
113
- termNode = firstTermNode, ///
114
- variableNode = lastVariableNode, ///
115
- term = Term.fromTermNode(termNode, context),
116
- variable = Variable.fromVariableNode(variableNode, context),
117
- node = termSubstitutionNode, ///
118
- string = stringFromTermAndVariable(term, variable);
119
-
120
- termSubstitution = new TermSubstitution(context, string, node, term, variable);
121
- }
106
+ termSubstitution = termSubstitutionFromStatementNode(statementNode, context);
122
107
 
123
108
  return termSubstitution;
124
109
  }
125
110
 
126
- static fromTernAndVariable(term, variable, context) {
127
- const string = stringFromTermAndVariable(term, variable),
111
+ static fromTermAndMetavariable(term, metavariable, context) {
112
+ const string = stringFromTermAndVariable(term, metavariable),
128
113
  termSubstitutionNode = instantiateTermSubstitution(string, context),
129
- node = termSubstitutionNode, ///
130
- termSubstitution = new TermSubstitution(context, string, node, term, variable);
114
+ termSubstitution = termSubstitutionFromTermSubstitutionNode(termSubstitutionNode, context);
131
115
 
132
116
  return termSubstitution;
133
117
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  import { arrayUtilities } from "necessary";
4
4
 
5
- import { define } from "../ontology";
5
+ import { define } from "../elements";
6
6
  import { EMPTY_STRING } from "../constants";
7
7
 
8
8
  const { find, first, clear, prune, filter, compress, correlate } = arrayUtilities;
@@ -1,18 +1,18 @@
1
1
  "use strict";
2
2
 
3
- import ontology from "../ontology";
3
+ import elements from "../elements";
4
4
  import TemporaryContext from "../context/temporary";
5
+ import assignAssignments from "../process/assign";
5
6
 
6
- import { define } from "../ontology";
7
- import { assignAssignments } from "../utilities/assignments";
8
- import { subproofAssertionFromStatement } from "../utilities/context";
7
+ import { define } from "../elements";
8
+ import { subproofAssertionFromStatement } from "../utilities/statement";
9
9
  import { termsFromJSON, framesFromJSON, statementFromJSON, procedureCallFromJSON, termsToTermsJSON, framesToFramesJSON, statementToStatementJSON, procedureCallToProcedureCallJSON } from "../utilities/json";
10
10
 
11
11
  export default define(class Supposition {
12
- constructor(context, node, string, statement, procedureCall) {
12
+ constructor(context, string, node, statement, procedureCall) {
13
13
  this.context = context;
14
- this.node = node;
15
14
  this.string = string;
15
+ this.node = node;
16
16
  this.statement = statement;
17
17
  this.procedureCall = procedureCall;
18
18
  }
@@ -59,7 +59,7 @@ export default define(class Supposition {
59
59
  const assignmentsAssigned = assignAssignments(assignments, context);
60
60
 
61
61
  if (assignmentsAssigned) {
62
- const { Step } = ontology,
62
+ const { Step } = elements,
63
63
  step = Step.fromStatement(this.statement, context),
64
64
  stepOrSubproof = step; ///
65
65
 
@@ -296,13 +296,13 @@ export default define(class Supposition {
296
296
 
297
297
  context = temporaryContext; ///
298
298
 
299
- const supposition = new Supposition(context, node, string, statement, procedureCall);
299
+ const supposition = new Supposition(context, string, node, statement, procedureCall);
300
300
 
301
301
  return supposition;
302
302
  }
303
303
 
304
304
  static fromSuppositionNode(suppositionNode, context) {
305
- const { Statement, ProcedureCall } = ontology,
305
+ const { Statement, ProcedureCall } = elements,
306
306
  node = suppositionNode, ///
307
307
  string = context.nodeAsString(node),
308
308
  statement = Statement.fromSuppositionNode(suppositionNode, context),
@@ -311,7 +311,7 @@ export default define(class Supposition {
311
311
 
312
312
  context = temporaryContext; ///
313
313
 
314
- const supposition = new Supposition(context, node, string, statement, procedureCall);
314
+ const supposition = new Supposition(context, string, node, statement, procedureCall);
315
315
 
316
316
  return supposition
317
317
  }
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
 
3
- import ontology from "../../ontology";
3
+ import elements from "../../elements";
4
4
  import Constructor from "../constructor";
5
- import constructorBracketedContext from "../../context/bracketed/constructor";
6
5
 
7
- import { define } from "../../ontology";
6
+ import { define } from "../../elements";
7
+ import { bracketedConstructorTermString, instantiateBracketedConstructorTerm } from "../../../process/instantiate";
8
8
 
9
9
  export default define(class BracketedConstructor extends Constructor {
10
10
  unifyTerm(term, context, verifyAhead) {
@@ -17,7 +17,7 @@ export default define(class BracketedConstructor extends Constructor {
17
17
  termUnifies = super.unifyTerm(term, context, () => {
18
18
  let verifiesAhead = false;
19
19
 
20
- const { Term } = ontology,
20
+ const { Term } = elements,
21
21
  bracketedTerm = term, ///
22
22
  bracketedTermNode = bracketedTerm.getNode(),
23
23
  singularTermNode = bracketedTermNode.getSingularTermNode();
@@ -55,14 +55,13 @@ export default define(class BracketedConstructor extends Constructor {
55
55
  static name = "BracketedConstructor";
56
56
 
57
57
  static fromNothing() {
58
- const { Term } = ontology,
59
- bracketedTermNode = constructorBracketedContext.getBracketedTermNode(),
60
- termNode = bracketedTermNode, ///
61
- context = constructorBracketedContext, ///
62
- term = Term.fromTermNode(termNode, context),
63
- string = term.getString(),
64
- bracketedConstructor = new BracketedConstructor(string, term);
65
-
66
- return bracketedConstructor;
58
+ const bracketedConstructorTermNode = instantiateBracketedConstructorTerm(),
59
+ nodeAsString = () => bracketedConstructorTermString,
60
+ context = {
61
+ nodeAsString
62
+ },
63
+ bracketedConstructorTerm = statementFromTermNode(bracketedConstructorTermNode, context);
64
+
65
+ return bracketedConstructorTerm;
67
66
  }
68
67
  });