occam-verify-cli 0.0.1111 → 0.0.1112

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 (197) hide show
  1. package/lib/combinator/bracketed.js +15 -65
  2. package/lib/combinator.js +4 -8
  3. package/lib/constructor/bracketed.js +24 -101
  4. package/lib/constructor.js +4 -8
  5. package/lib/context/file.js +41 -12
  6. package/lib/context/local.js +45 -25
  7. package/lib/context/release.js +2 -2
  8. package/lib/dom/assertion/contained.js +246 -0
  9. package/lib/dom/assertion/defined.js +266 -0
  10. package/lib/dom/assertion/subproof.js +210 -0
  11. package/lib/dom/assertion/type.js +240 -0
  12. package/lib/{axiom.js → dom/axiom.js} +18 -8
  13. package/lib/dom/conclusion.js +171 -0
  14. package/lib/{conjecture.js → dom/conjecture.js} +18 -8
  15. package/lib/dom/consequent.js +171 -0
  16. package/lib/dom/declaration/combinator.js +105 -0
  17. package/lib/dom/declaration/constructor.js +140 -0
  18. package/lib/dom/declaration/metavariable.js +154 -0
  19. package/lib/dom/declaration/type.js +140 -0
  20. package/lib/dom/declaration/variable.js +155 -0
  21. package/lib/{declaration.js → dom/declaration.js} +62 -18
  22. package/lib/dom/derivation.js +137 -0
  23. package/lib/dom/equality.js +260 -0
  24. package/lib/dom/error.js +85 -0
  25. package/lib/dom/frame.js +372 -0
  26. package/lib/dom/judgement.js +198 -0
  27. package/lib/dom/label.js +190 -0
  28. package/lib/{lemma.js → dom/lemma.js} +19 -9
  29. package/lib/{metaLemma.js → dom/metaLemma.js} +19 -9
  30. package/lib/dom/metaType.js +261 -0
  31. package/lib/dom/metatheorem.js +273 -0
  32. package/lib/dom/metavariable.js +463 -0
  33. package/lib/dom/premise.js +221 -0
  34. package/lib/dom/proof.js +154 -0
  35. package/lib/dom/proofStep.js +239 -0
  36. package/lib/dom/reference.js +218 -0
  37. package/lib/dom/rule.js +311 -0
  38. package/lib/dom/statement.js +379 -0
  39. package/lib/dom/subDerivation.js +137 -0
  40. package/lib/dom/subproof.js +211 -0
  41. package/lib/dom/supposition.js +221 -0
  42. package/lib/dom/term.js +354 -0
  43. package/lib/{theorem.js → dom/theorem.js} +18 -8
  44. package/lib/dom/topLevelAssertion.js +306 -0
  45. package/lib/dom/type.js +327 -0
  46. package/lib/dom/variable.js +328 -0
  47. package/lib/dom.js +27 -0
  48. package/lib/equivalences.js +307 -0
  49. package/lib/index.js +40 -35
  50. package/lib/mixins/proofStep/unify.js +86 -0
  51. package/lib/mixins/statement/verify.js +27 -2
  52. package/lib/mixins/term/verify.js +24 -4
  53. package/lib/substitution/frame.js +3 -3
  54. package/lib/substitution/statement.js +17 -16
  55. package/lib/substitution/term.js +10 -7
  56. package/lib/substitution.js +4 -31
  57. package/lib/substitutions.js +24 -56
  58. package/lib/unifier/equality.js +2 -3
  59. package/lib/unifier/label.js +3 -3
  60. package/lib/unifier/metaLevel.js +9 -8
  61. package/lib/unifier/metavariable.js +3 -3
  62. package/lib/unifier/statementWithCombinator.js +5 -5
  63. package/lib/unifier/termWithConstructor.js +3 -3
  64. package/lib/utilities/json.js +26 -40
  65. package/lib/utilities/string.js +6 -8
  66. package/lib/utilities/subproof.js +2 -2
  67. package/lib/utilities/substitutions.js +7 -6
  68. package/lib/utilities/verification.js +22 -14
  69. package/lib/verifier/combinator.js +4 -4
  70. package/lib/verifier/constructor.js +3 -3
  71. package/lib/verifier/topLevel.js +15 -21
  72. package/package.json +1 -1
  73. package/src/combinator/bracketed.js +11 -4
  74. package/src/combinator.js +3 -10
  75. package/src/constructor/bracketed.js +17 -5
  76. package/src/constructor.js +3 -9
  77. package/src/context/file.js +42 -11
  78. package/src/context/local.js +26 -34
  79. package/src/context/release.js +1 -1
  80. package/src/{assertion → dom/assertion}/contained.js +10 -8
  81. package/src/{assertion → dom/assertion}/defined.js +14 -11
  82. package/src/{assertion → dom/assertion}/subproof.js +11 -62
  83. package/src/{assertion → dom/assertion}/type.js +11 -8
  84. package/src/{axiom.js → dom/axiom.js} +6 -9
  85. package/src/dom/conclusion.js +95 -0
  86. package/src/{conjecture.js → dom/conjecture.js} +5 -8
  87. package/src/dom/consequent.js +95 -0
  88. package/src/{declaration → dom/declaration}/combinator.js +8 -5
  89. package/src/{declaration → dom/declaration}/constructor.js +8 -4
  90. package/src/{declaration → dom/declaration}/metavariable.js +8 -5
  91. package/src/{declaration → dom/declaration}/type.js +8 -4
  92. package/src/{declaration → dom/declaration}/variable.js +9 -6
  93. package/src/{declaration.js → dom/declaration.js} +11 -16
  94. package/src/{derivation.js → dom/derivation.js} +9 -12
  95. package/src/{equality.js → dom/equality.js} +11 -14
  96. package/src/{error.js → dom/error.js} +6 -3
  97. package/src/{frame.js → dom/frame.js} +14 -23
  98. package/src/{judgement.js → dom/judgement.js} +8 -11
  99. package/src/{label.js → dom/label.js} +9 -16
  100. package/src/{lemma.js → dom/lemma.js} +5 -9
  101. package/src/{metaLemma.js → dom/metaLemma.js} +6 -9
  102. package/src/{metaType.js → dom/metaType.js} +7 -10
  103. package/src/{metatheorem.js → dom/metatheorem.js} +6 -10
  104. package/src/{metavariable.js → dom/metavariable.js} +79 -77
  105. package/src/dom/premise.js +173 -0
  106. package/src/{proof.js → dom/proof.js} +8 -11
  107. package/src/dom/proofStep.js +173 -0
  108. package/src/{reference.js → dom/reference.js} +48 -20
  109. package/src/{rule.js → dom/rule.js} +13 -17
  110. package/src/{statement.js → dom/statement.js} +142 -71
  111. package/src/{subDerivation.js → dom/subDerivation.js} +9 -12
  112. package/src/{subproof.js → dom/subproof.js} +14 -47
  113. package/src/dom/supposition.js +173 -0
  114. package/src/{term.js → dom/term.js} +24 -45
  115. package/src/{theorem.js → dom/theorem.js} +5 -8
  116. package/src/{topLevelAssertion.js → dom/topLevelAssertion.js} +12 -14
  117. package/src/{type.js → dom/type.js} +9 -12
  118. package/src/{variable.js → dom/variable.js} +20 -28
  119. package/src/dom.js +13 -0
  120. package/src/equivalences.js +278 -0
  121. package/src/index.js +39 -34
  122. package/src/mixins/proofStep/unify.js +115 -0
  123. package/src/mixins/statement/verify.js +33 -1
  124. package/src/mixins/term/verify.js +33 -3
  125. package/src/substitution/frame.js +2 -2
  126. package/src/substitution/statement.js +20 -18
  127. package/src/substitution/term.js +12 -5
  128. package/src/substitution.js +4 -29
  129. package/src/substitutions.js +35 -73
  130. package/src/unifier/equality.js +1 -2
  131. package/src/unifier/label.js +2 -2
  132. package/src/unifier/metaLevel.js +9 -7
  133. package/src/unifier/metavariable.js +2 -2
  134. package/src/unifier/statementWithCombinator.js +4 -4
  135. package/src/unifier/termWithConstructor.js +2 -2
  136. package/src/utilities/json.js +23 -42
  137. package/src/utilities/string.js +8 -6
  138. package/src/utilities/subproof.js +2 -2
  139. package/src/utilities/substitutions.js +7 -5
  140. package/src/utilities/verification.js +29 -13
  141. package/src/verifier/combinator.js +3 -3
  142. package/src/verifier/constructor.js +3 -3
  143. package/src/verifier/topLevel.js +20 -21
  144. package/lib/assertion/contained.js +0 -232
  145. package/lib/assertion/defined.js +0 -211
  146. package/lib/assertion/subproof.js +0 -203
  147. package/lib/assertion/type.js +0 -185
  148. package/lib/conclusion.js +0 -130
  149. package/lib/consequent.js +0 -130
  150. package/lib/declaration/combinator.js +0 -90
  151. package/lib/declaration/constructor.js +0 -90
  152. package/lib/declaration/metavariable.js +0 -104
  153. package/lib/declaration/type.js +0 -90
  154. package/lib/declaration/variable.js +0 -105
  155. package/lib/derivation.js +0 -91
  156. package/lib/equality.js +0 -209
  157. package/lib/error.js +0 -70
  158. package/lib/frame.js +0 -331
  159. package/lib/judgement.js +0 -147
  160. package/lib/label.js +0 -141
  161. package/lib/metaType.js +0 -255
  162. package/lib/metatheorem.js +0 -263
  163. package/lib/metavariable.js +0 -399
  164. package/lib/mixins/statement/qualified/unify.js +0 -69
  165. package/lib/mixins/statement/unify.js +0 -42
  166. package/lib/mixins/statement/unifyIndependenntly.js +0 -46
  167. package/lib/mixins/term/unify.js +0 -40
  168. package/lib/premise.js +0 -184
  169. package/lib/proof.js +0 -103
  170. package/lib/proofStep.js +0 -179
  171. package/lib/reference.js +0 -145
  172. package/lib/rule.js +0 -259
  173. package/lib/shim.js +0 -14
  174. package/lib/statement/qualified.js +0 -152
  175. package/lib/statement/unqualified.js +0 -175
  176. package/lib/statement.js +0 -270
  177. package/lib/subDerivation.js +0 -91
  178. package/lib/subproof.js +0 -181
  179. package/lib/supposition.js +0 -184
  180. package/lib/term.js +0 -318
  181. package/lib/topLevelAssertion.js +0 -305
  182. package/lib/type.js +0 -321
  183. package/lib/utilities/equivalences.js +0 -178
  184. package/lib/variable.js +0 -281
  185. package/src/conclusion.js +0 -96
  186. package/src/consequent.js +0 -96
  187. package/src/mixins/statement/qualified/unify.js +0 -103
  188. package/src/mixins/statement/unify.js +0 -41
  189. package/src/mixins/statement/unifyIndependenntly.js +0 -58
  190. package/src/mixins/term/unify.js +0 -36
  191. package/src/premise.js +0 -183
  192. package/src/proofStep.js +0 -181
  193. package/src/shim.js +0 -5
  194. package/src/statement/qualified.js +0 -133
  195. package/src/statement/unqualified.js +0 -166
  196. package/src/supposition.js +0 -183
  197. package/src/utilities/equivalences.js +0 -183
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+
3
+ import dom from "../dom";
4
+
5
+ import { domAssigned } from "../dom";
6
+ import { statementFromJSON, statementToStatementJSON } from "../utilities/json";
7
+
8
+ export default domAssigned(class Conclusion {
9
+ constructor(string, statement) {
10
+ this.string = string;
11
+ this.statement = statement;
12
+ }
13
+
14
+ getString() {
15
+ return this.string;
16
+ }
17
+
18
+ getStatement() {
19
+ return this.statement;
20
+ }
21
+
22
+ matchStatementNode(statementNode) { return this.statement.matchStatementNode(statementNode); }
23
+
24
+ unifyStatement(statement, substitutions, generalContext, specificContext) {
25
+ let statementUnified;
26
+
27
+ const conclusion = this, ///
28
+ statementString = statement.getString(),
29
+ conclusionString = conclusion.getString();
30
+
31
+ specificContext.trace(`Unifying the '${statementString}' statement with the '${conclusionString}' conclusion...`);
32
+
33
+ statementUnified = this.statement.unifyStatement(statement, substitutions, generalContext, specificContext);
34
+
35
+ if (statementUnified) {
36
+ specificContext.debug(`...unified the '${statementString}' statement with the '${conclusionString}' conclusion.`);
37
+ }
38
+
39
+ return statementUnified;
40
+ }
41
+
42
+ verify(context) {
43
+ let verified = false;
44
+
45
+ const conclusionString = this.string; ///
46
+
47
+ if (this.statement !== null) {
48
+ context.trace(`Verifying the '${conclusionString}' conclusion...`);
49
+
50
+ const stated = true,
51
+ assignments = null,
52
+ statementVerified = this.statement.verify(assignments, stated, context);
53
+
54
+ verified = statementVerified; ///
55
+
56
+ if (verified) {
57
+ context.debug(`...verified the '${conclusionString}' conclusion.`);
58
+ }
59
+ } else {
60
+ context.debug(`Unable to verify the '${conclusionString}' conclusion because it is nonsense.`);
61
+ }
62
+
63
+ return verified;
64
+ }
65
+
66
+ toJSON() {
67
+ const statementJSON = statementToStatementJSON(this.statement),
68
+ statement = statementJSON, ///
69
+ json = {
70
+ statement
71
+ };
72
+
73
+ return json;
74
+ }
75
+
76
+ static name = "Conclusion";
77
+
78
+ static fromJSON(json, fileContext) {
79
+ const statement = statementFromJSON(json, fileContext),
80
+ string = statement.getString(),
81
+ conclusion = new Conclusion(string, statement);
82
+
83
+ return conclusion;
84
+ }
85
+
86
+ static fromConclusionNode(conclusionNode, fileContext) {
87
+ const { Statement } = dom,
88
+ statement = Statement.fromConclusionNode(conclusionNode, fileContext),
89
+ statementString = statement.getString(),
90
+ string = statementString, ///
91
+ conclusion = new Conclusion(string, statement);
92
+
93
+ return conclusion;
94
+ }
95
+ });
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
 
3
- import shim from "./shim";
4
3
  import TopLevelAssertion from "./topLevelAssertion";
5
4
 
6
- class Conjecture extends TopLevelAssertion {
5
+ import { domAssigned } from "../dom";
6
+
7
+ export default domAssigned(class Conjecture extends TopLevelAssertion {
7
8
  verify() {
8
9
  let verified;
9
10
 
@@ -26,13 +27,9 @@ class Conjecture extends TopLevelAssertion {
26
27
  return verified;
27
28
  }
28
29
 
30
+ static name = "Conjecture";
31
+
29
32
  static fromJSON(json, fileContext) { return TopLevelAssertion.fromJSON(Conjecture, json, fileContext); }
30
33
 
31
34
  static fromConjectureNode(conjectureNode, fileContext) { return TopLevelAssertion.fromNode(Conjecture, conjectureNode, fileContext); }
32
- }
33
-
34
- Object.assign(shim, {
35
- Conjecture
36
35
  });
37
-
38
- export default Conjecture;
@@ -0,0 +1,95 @@
1
+ "use strict";
2
+
3
+ import dom from "../dom";
4
+
5
+ import { domAssigned } from "../dom";
6
+ import { statementFromJSON, statementToStatementJSON } from "../utilities/json";
7
+
8
+ export default domAssigned(class Consequent {
9
+ constructor(string, statement) {
10
+ this.string = string;
11
+ this.statement = statement;
12
+ }
13
+
14
+ getString() {
15
+ return this.string;
16
+ }
17
+
18
+ getStatement() {
19
+ return this.statement;
20
+ }
21
+
22
+ matchStatementNode(statementNode) { return this.statement.matchStatementNode(statementNode); }
23
+
24
+ unifyStatement(statement, substitutions, generalContext, specificContext) {
25
+ let statementUnified;
26
+
27
+ const consequent = this, ///
28
+ statementString = statement.getString(),
29
+ consequentString = consequent.getString();
30
+
31
+ specificContext.trace(`Unifying the '${statementString}' statement with the '${consequentString}' consequent...`);
32
+
33
+ statementUnified = this.statement.unifyStatement(statement, substitutions, generalContext, specificContext);
34
+
35
+ if (statementUnified) {
36
+ specificContext.debug(`...unified the '${statementString}' statement with the '${consequentString}' consequent.`);
37
+ }
38
+
39
+ return statementUnified;
40
+ }
41
+
42
+ verify(context) {
43
+ let verified = false;
44
+
45
+ const consequentString = this.string; ///
46
+
47
+ if (this.statement !== null) {
48
+ context.trace(`Verifying the '${consequentString}' consequent...`);
49
+
50
+ const stated = true,
51
+ assignments = null,
52
+ statementVerified = this.statement.verify(assignments, stated, context);
53
+
54
+ verified = statementVerified; ///
55
+
56
+ if (verified) {
57
+ context.debug(`...verified the '${consequentString}' consequent.`);
58
+ }
59
+ } else {
60
+ context.debug(`Unable to verify the '${consequentString}' consequent because it is nonsense.`);
61
+ }
62
+
63
+ return verified;
64
+ }
65
+
66
+ toJSON() {
67
+ const statementJSON = statementToStatementJSON(this.statement),
68
+ statement = statementJSON, ///
69
+ json = {
70
+ statement
71
+ };
72
+
73
+ return json;
74
+ }
75
+
76
+ static name = "Consequent";
77
+
78
+ static fromJSON(json, fileContext) {
79
+ const statement = statementFromJSON(json, fileContext),
80
+ string = statement.getString(),
81
+ consequent = new Consequent(string, statement);
82
+
83
+ return consequent;
84
+ }
85
+
86
+ static fromConsequentNode(consequentNode, fileContext) {
87
+ const { Statement } = dom,
88
+ statement = Statement.fromConsequentNode(consequentNode, fileContext),
89
+ statementString = statement.getString(),
90
+ string = statementString, ///
91
+ consequent = new Consequent(string, statement);
92
+
93
+ return consequent;
94
+ }
95
+ });
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
 
3
- import shim from "../shim";
3
+ import Combinator from "../../combinator";
4
4
 
5
- export default class CombinatorDeclaration {
5
+ import { domAssigned } from "../../dom";
6
+
7
+ export default domAssigned(class CombinatorDeclaration {
6
8
  constructor(fileContext, combinator) {
7
9
  this.fileContext = fileContext;
8
10
  this.combinator = combinator;
@@ -40,11 +42,12 @@ export default class CombinatorDeclaration {
40
42
  return verified;
41
43
  }
42
44
 
45
+ static name = "CombinatorDeclaration";
46
+
43
47
  static fromCombinatorDeclarationNode(combinatorDeclarationNode, fileContext) {
44
- const { Combinator } = shim,
45
- combinator = Combinator.fromCombinatorDeclarationNode(combinatorDeclarationNode, fileContext),
48
+ const combinator = Combinator.fromCombinatorDeclarationNode(combinatorDeclarationNode, fileContext),
46
49
  combinatorDeclaration = new CombinatorDeclaration(fileContext, combinator);
47
50
 
48
51
  return combinatorDeclaration;
49
52
  }
50
- }
53
+ });
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
 
3
- import shim from "../shim";
3
+ import dom from "../../dom";
4
4
 
5
- export default class ConstructorDeclaration {
5
+ import { domAssigned } from "../../dom";
6
+
7
+ export default domAssigned(class ConstructorDeclaration {
6
8
  constructor(fileContext, constructor) {
7
9
  this.fileContext = fileContext;
8
10
  this.constructor = constructor;
@@ -40,11 +42,13 @@ export default class ConstructorDeclaration {
40
42
  return verified;
41
43
  }
42
44
 
45
+ static name = "ConstructorDeclaration";
46
+
43
47
  static fromConstructorDeclarationNode(constructorDeclarationNode, fileContext) {
44
- const { Constructor } = shim,
48
+ const { Constructor } = dom,
45
49
  constructor = Constructor.fromConstructorDeclarationNode(constructorDeclarationNode, fileContext),
46
50
  constructorDeclaration = new ConstructorDeclaration(fileContext, constructor);
47
51
 
48
52
  return constructorDeclaration;
49
53
  }
50
- }
54
+ });
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
 
3
- import shim from "../shim";
3
+ import dom from "../../dom";
4
4
 
5
- import { nodeQuery } from "../utilities/query";
5
+ import { nodeQuery } from "../../utilities/query";
6
+ import { domAssigned } from "../../dom";
6
7
 
7
8
  const metaTypeNodeQuery = nodeQuery("/metavariableDeclaration/metaType");
8
9
 
9
- export default class MetavariableDeclaration {
10
+ export default domAssigned(class MetavariableDeclaration {
10
11
  constructor(fileContext, string, metavariable) {
11
12
  this.fileContext = fileContext;
12
13
  this.string = string;
@@ -47,8 +48,10 @@ export default class MetavariableDeclaration {
47
48
  return verified;
48
49
  }
49
50
 
51
+ static name = "MetavariableDeclaration";
52
+
50
53
  static fromMetavariableDeclarationNode(metavariableDeclarationNode, fileContext) {
51
- const { MetaType, Metavariable } = shim,
54
+ const { MetaType, Metavariable } = dom,
52
55
  metaTypeNode = metaTypeNodeQuery(metavariableDeclarationNode),
53
56
  metaType = MetaType.fromMetaTypeNode(metaTypeNode, fileContext),
54
57
  metavariable = Metavariable.fromMetavariableDeclarationNode(metavariableDeclarationNode, fileContext),
@@ -57,7 +60,7 @@ export default class MetavariableDeclaration {
57
60
 
58
61
  return metavariableDeclaration;
59
62
  }
60
- }
63
+ });
61
64
 
62
65
  function stringFromMetavariableAndMetaType(metavariable, metaType) {
63
66
  let string;
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
 
3
- import shim from "../shim";
3
+ import dom from "../../dom";
4
4
 
5
- export default class TypeDeclaration {
5
+ import { domAssigned } from "../../dom";
6
+
7
+ export default domAssigned(class TypeDeclaration {
6
8
  constructor(fileContext, type) {
7
9
  this.fileContext = fileContext;
8
10
  this.type = type;
@@ -40,11 +42,13 @@ export default class TypeDeclaration {
40
42
  return verified;
41
43
  }
42
44
 
45
+ static name = "TypeDeclaration";
46
+
43
47
  static fromTypeDeclarationNode(typeDeclarationNode, fileContext) {
44
- const { Type } = shim,
48
+ const { Type } = dom,
45
49
  type = Type.fromTypeDeclarationNode(typeDeclarationNode, fileContext),
46
50
  typeDeclaration = new TypeDeclaration(fileContext, type);
47
51
 
48
52
  return typeDeclaration;
49
53
  }
50
- }
54
+ });
@@ -1,13 +1,14 @@
1
1
  "use strict";
2
2
 
3
- import shim from "../shim";
3
+ import dom from "../../dom";
4
4
 
5
- import { nodeQuery } from "../utilities/query";
6
- import { typeNameFromTypeNode } from "../utilities/name";
5
+ import { nodeQuery } from "../../utilities/query";
6
+ import { domAssigned } from "../../dom";
7
+ import { typeNameFromTypeNode } from "../../utilities/name";
7
8
 
8
9
  const typeNodeQuery = nodeQuery("/variableDeclaration/type");
9
10
 
10
- export default class VariableDeclaration {
11
+ export default domAssigned(class VariableDeclaration {
11
12
  constructor(fileContext, string, variable) {
12
13
  this.fileContext = fileContext;
13
14
  this.string = string;
@@ -48,8 +49,10 @@ export default class VariableDeclaration {
48
49
  return verified;
49
50
  }
50
51
 
52
+ static name = "VariableDeclaration";
53
+
51
54
  static fromVariableDeclarationNode(variableDeclarationNode, fileContext) {
52
- const { Variable } = shim,
55
+ const { Variable } = dom,
53
56
  typeNode = typeNodeQuery(variableDeclarationNode),
54
57
  variable = Variable.fromVariableDeclarationNode(variableDeclarationNode, fileContext),
55
58
  string = stringFromVariableAndTypeNode(variable, typeNode),
@@ -57,7 +60,7 @@ export default class VariableDeclaration {
57
60
 
58
61
  return variableDeclaration;
59
62
  }
60
- }
63
+ });
61
64
 
62
65
  function stringFromVariableAndTypeNode(variable, typeNode) {
63
66
  let string;
@@ -1,16 +1,15 @@
1
1
  "use strict";
2
2
 
3
- import shim from "./shim";
4
- import Reference from "./reference";
5
- import LocalContext from "./context/local";
3
+ import dom from "../dom";
6
4
 
7
- import { nodeQuery } from "./utilities/query";
8
- import { stripBracketsFromStatementNode } from "./utilities/brackets";
5
+ import { nodeQuery } from "../utilities/query";
6
+ import { domAssigned } from "../dom";
7
+ import { stripBracketsFromStatementNode } from "../utilities/brackets";
9
8
 
10
9
  const referenceNodeQuery = nodeQuery("/declaration/reference"),
11
10
  statementNodeQuery = nodeQuery("/declaration/statement");
12
11
 
13
- class Declaration {
12
+ export default domAssigned(class Declaration {
14
13
  constructor(string, reference, statement) {
15
14
  this.string = string;
16
15
  this.reference = reference;
@@ -102,8 +101,7 @@ class Declaration {
102
101
 
103
102
  context.trace(`Unifying the '${metalemmaMetatheoremString}' meta-lemma or metatheorem with the '${declarationString}' declaration...`);
104
103
 
105
- const { Substitutions } = shim,
106
- substitutions = Substitutions.fromNothing(),
104
+ const substitutions = Substitutions.fromNothing(),
107
105
  referenceUnified = metaLemmaMetatheorem.unifyReference(this.reference, substitutions, context);
108
106
 
109
107
  if (referenceUnified) {
@@ -297,18 +295,21 @@ class Declaration {
297
295
  return verifiedWhenDerived;
298
296
  }
299
297
 
298
+ static name = "Declaration";
299
+
300
300
  static fromDeclarationNode(declarationNode, context) {
301
301
  let declaration = null;
302
302
 
303
303
  if (declarationNode !== null) {
304
- const { Statement } = shim,
304
+ const { Statement } = dom,
305
305
  referenceNode = referenceNodeQuery(declarationNode);
306
306
 
307
307
  let statementNode = statementNodeQuery(declarationNode);
308
308
 
309
309
  statementNode = stripBracketsFromStatementNode(statementNode); ///
310
310
 
311
- const reference = Reference.fromReferenceNode(referenceNode, context),
311
+ const { Reference } = dom,
312
+ reference = Reference.fromReferenceNode(referenceNode, context),
312
313
  statement = Statement.fromStatementNode(statementNode, context),
313
314
  node = declarationNode, ///
314
315
  string = context.nodeAsString(node);
@@ -318,10 +319,4 @@ class Declaration {
318
319
 
319
320
  return declaration;
320
321
  }
321
- }
322
-
323
- Object.assign(shim, {
324
- Declaration
325
322
  });
326
-
327
- export default Declaration;
@@ -2,15 +2,16 @@
2
2
 
3
3
  import { arrayUtilities } from "necessary";
4
4
 
5
- import shim from "./shim";
5
+ import dom from "../dom";
6
6
 
7
- import { nodesQuery } from "./utilities/query";
7
+ import { nodesQuery } from "../utilities/query";
8
+ import { domAssigned } from "../dom";
8
9
 
9
10
  const { last } = arrayUtilities;
10
11
 
11
12
  const proofStepNodesQuery = nodesQuery("/derivation/proofStep|lastProofStep");
12
13
 
13
- class Derivation {
14
+ export default domAssigned(class Derivation {
14
15
  constructor(proofSteps) {
15
16
  this.proofSteps = proofSteps;
16
17
  }
@@ -29,9 +30,9 @@ class Derivation {
29
30
  let verified;
30
31
 
31
32
  verified = this.proofSteps.every((proofStep) => { ///
32
- const proofStepVerified = proofStep.verify(substitutions, context);
33
+ const proofStepVerifiedAndUnified = proofStep.verifyAndUnify(substitutions, context);
33
34
 
34
- if (proofStepVerified) {
35
+ if (proofStepVerifiedAndUnified) {
35
36
  return true;
36
37
  }
37
38
  });
@@ -39,8 +40,10 @@ class Derivation {
39
40
  return verified;
40
41
  }
41
42
 
43
+ static name = "Derivation";
44
+
42
45
  static fromDerivationNode(derivationNode, fileContext) {
43
- const { ProofStep } = shim,
46
+ const { ProofStep } = dom,
44
47
  proofStepNodes = proofStepNodesQuery(derivationNode),
45
48
  proofSteps = proofStepNodes.map((proofStepNode) => {
46
49
  const proofStep = ProofStep.fromProofStepNode(proofStepNode, fileContext);
@@ -51,10 +54,4 @@ class Derivation {
51
54
 
52
55
  return derivation;
53
56
  }
54
- }
55
-
56
- Object.assign(shim, {
57
- Derivation
58
57
  });
59
-
60
- export default Derivation;
@@ -1,18 +1,19 @@
1
1
  "use strict";
2
2
 
3
- import shim from "./shim";
4
- import EqualityAssignment from "./assignment/equality";
5
- import VariableAssignment from "./assignment/variable";
3
+ import dom from "../dom";
4
+ import EqualityAssignment from "../assignment/equality";
5
+ import VariableAssignment from "../assignment/variable";
6
6
 
7
- import { nodeQuery } from "./utilities/query";
8
- import { unifyEquality } from "./utilities/unification";
7
+ import { nodeQuery } from "../utilities/query";
8
+ import { domAssigned } from "../dom";
9
+ import { unifyEquality } from "../utilities/unification";
9
10
 
10
11
  const equalityNodeQuery = nodeQuery("/statement/equality"),
11
12
  variableNodeQuery = nodeQuery("/term/variable!"),
12
13
  leftTermNodeQuery = nodeQuery("/equality/term[0]"),
13
14
  rightTermNodeQuery = nodeQuery("/equality/term[1]");
14
15
 
15
- class Equality {
16
+ export default domAssigned(class Equality {
16
17
  constructor(string,leftTerm, rightTerm) {
17
18
  this.string = string;
18
19
  this.leftTerm = leftTerm;
@@ -87,7 +88,7 @@ class Equality {
87
88
 
88
89
  if (verifiedWhenStated || verifiedWhenDerived) {
89
90
  if (assignments !== null) {
90
- const { Variable } = shim,
91
+ const { Variable } = dom,
91
92
  type = this.getType(),
92
93
  leftTermNode = this.leftTerm.getNode(),
93
94
  rightTermNode = this.rightTerm.getNode(),
@@ -203,13 +204,15 @@ class Equality {
203
204
  return verifiedWhenDerived;
204
205
  }
205
206
 
207
+ static name = "Equality";
208
+
206
209
  static fromStatementNode(statementNode, context) {
207
210
  let equality = null;
208
211
 
209
212
  const equalityNode = equalityNodeQuery(statementNode);
210
213
 
211
214
  if (equalityNode !== null) {
212
- const { Term } = shim,
215
+ const { Term } = dom,
213
216
  leftTermNode = leftTermNodeQuery(equalityNode),
214
217
  rightTermNode = rightTermNodeQuery(equalityNode),
215
218
  leftTerm = Term.fromTermNode(leftTermNode, context),
@@ -222,10 +225,4 @@ class Equality {
222
225
 
223
226
  return equality;
224
227
  }
225
- }
226
-
227
- Object.assign(shim, {
228
- Equality
229
228
  });
230
-
231
- export default Equality;
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
 
3
- export default class Error {
3
+ import { domAssigned } from "../dom";
4
+
5
+ export default domAssigned(class Error {
4
6
  constructor(fileContext, string) {
5
7
  this.fileContext = fileContext;
6
8
  this.string = string;
@@ -24,6 +26,8 @@ export default class Error {
24
26
  return verified;
25
27
  }
26
28
 
29
+ static name = "Error";
30
+
27
31
  static fromErrorNode(errorNode, fileContext) {
28
32
  const node = errorNode, ///
29
33
  string = fileContext.nodeAsString(node),
@@ -31,5 +35,4 @@ export default class Error {
31
35
 
32
36
  return error;
33
37
  }
34
- }
35
-
38
+ });
@@ -2,10 +2,11 @@
2
2
 
3
3
  import { arrayUtilities } from "necessary";
4
4
 
5
- import shim from "./shim";
5
+ import dom from "../dom";
6
6
 
7
- import { FRAME_META_TYPE_NAME } from "./metaTypeNames";
8
- import { nodeQuery, nodesQuery } from "./utilities/query";
7
+ import { domAssigned } from "../dom";
8
+ import { FRAME_META_TYPE_NAME } from "../metaTypeNames";
9
+ import { nodeQuery, nodesQuery } from "../utilities/query";
9
10
 
10
11
  const frameNodeQuery = nodeQuery("/*/frame"),
11
12
  declarationNodesQuery = nodesQuery("/frame/declaration"),
@@ -14,7 +15,7 @@ const frameNodeQuery = nodeQuery("/*/frame"),
14
15
 
15
16
  const { first } = arrayUtilities;
16
17
 
17
- class Frame {
18
+ export default domAssigned(class Frame {
18
19
  constructor(string, node, tokens, declarations, metavariables) {
19
20
  this.string = string;
20
21
  this.node = node;
@@ -62,13 +63,8 @@ class Frame {
62
63
  }
63
64
 
64
65
  isEqualTo(frame) {
65
- let equalTo = false;
66
-
67
- if (frame !== null) {
68
- const frameString = frame.getString();
69
-
70
- equalTo = (frameString === this.string);
71
- }
66
+ const frameString = frame.getString(),
67
+ equalTo = (frameString === this.string);
72
68
 
73
69
  return equalTo;
74
70
  }
@@ -204,10 +200,9 @@ class Frame {
204
200
 
205
201
  assignments = null; ///
206
202
 
207
- const frame = null; ///
208
-
209
203
  const declarationsVerified = declarations.every((declaration) => {
210
- const declarationVerified = declaration.verify(frame, assignments, stated, context);
204
+ const frame = null, ///
205
+ declarationVerified = declaration.verify(frame, assignments, stated, context);
211
206
 
212
207
  return declarationVerified;
213
208
  });
@@ -282,11 +277,13 @@ class Frame {
282
277
  return verifiedGivenMetaType;
283
278
  }
284
279
 
280
+ static name = "Frame";
281
+
285
282
  static fromFrameNode(frameNode, context) {
286
283
  let frame = null;
287
284
 
288
285
  if (frameNode !== null) {
289
- const { Declaration, Metavariable } = shim,
286
+ const { Declaration, Metavariable } = dom,
290
287
  node = frameNode, ///
291
288
  string = context.nodeAsString(node),
292
289
  tokens = context.nodeAsTokens(node),
@@ -318,7 +315,7 @@ class Frame {
318
315
  const metavariableNode = metavariableNodeQuery(frameNode);
319
316
 
320
317
  if (metavariableNode !== null) {
321
- const { Metavariable } = shim,
318
+ const { Metavariable } = dom,
322
319
  metavariable = Metavariable.fromMetavariableNode(metavariableNode, context),
323
320
  declarations = [],
324
321
  metavariables = [
@@ -344,7 +341,7 @@ class Frame {
344
341
  const metavariableNode = metavariableNodeQuery(frameNode);
345
342
 
346
343
  if (metavariableNode !== null) {
347
- const { Metavariable } = shim,
344
+ const { Metavariable } = dom,
348
345
  metavariable = Metavariable.fromMetavariableNode(metavariableNode, context),
349
346
  declarations = [],
350
347
  metavariables = [
@@ -360,10 +357,4 @@ class Frame {
360
357
 
361
358
  return frame;
362
359
  }
363
- }
364
-
365
- Object.assign(shim, {
366
- Frame
367
360
  });
368
-
369
- export default Frame;