occam-verify-cli 1.0.396 → 1.0.404

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 (251) hide show
  1. package/lib/assignment/equality.js +2 -2
  2. package/lib/context/file.js +4 -5
  3. package/lib/context/local.js +17 -6
  4. package/lib/context/partial.js +10 -10
  5. package/lib/context/temporary.js +102 -52
  6. package/lib/mixins/step/unify.js +5 -6
  7. package/lib/node/argument.js +4 -4
  8. package/lib/node/assertion/contained.js +6 -6
  9. package/lib/node/assertion/defined.js +6 -6
  10. package/lib/node/assertion/property.js +6 -6
  11. package/lib/node/assertion/satisfies.js +6 -6
  12. package/lib/node/assertion/subproof.js +6 -6
  13. package/lib/node/assertion/type.js +6 -6
  14. package/lib/node/assertion.js +107 -0
  15. package/lib/node/assumption.js +134 -0
  16. package/lib/node/axiom.js +6 -6
  17. package/lib/node/{topLevelAssertion.js → axiomLemmaTheoremConjecture.js} +12 -12
  18. package/lib/node/body.js +4 -5
  19. package/lib/node/combinator.js +4 -4
  20. package/lib/node/conclusion.js +4 -4
  21. package/lib/node/conjecture.js +6 -6
  22. package/lib/node/constructor.js +4 -4
  23. package/lib/node/declaration/combinator.js +6 -6
  24. package/lib/node/declaration/complexType.js +6 -6
  25. package/lib/node/declaration/constructor.js +6 -6
  26. package/lib/node/declaration/metavariable.js +6 -6
  27. package/lib/node/declaration/property.js +6 -6
  28. package/lib/node/declaration/simpleType.js +6 -6
  29. package/lib/node/declaration/typePrefix.js +6 -6
  30. package/lib/node/declaration/variable.js +6 -6
  31. package/lib/node/declaration.js +6 -22
  32. package/lib/node/deduction.js +4 -4
  33. package/lib/node/derivation.js +4 -4
  34. package/lib/node/document.js +107 -0
  35. package/lib/node/equality.js +4 -4
  36. package/lib/node/error.js +4 -4
  37. package/lib/node/frame.js +25 -14
  38. package/lib/node/header.js +4 -4
  39. package/lib/node/hypothesis.js +4 -4
  40. package/lib/node/judgement.js +8 -8
  41. package/lib/node/label.js +4 -4
  42. package/lib/node/labels.js +4 -4
  43. package/lib/node/lemma.js +6 -6
  44. package/lib/node/metaArgument.js +4 -4
  45. package/lib/node/metaLemma.js +6 -6
  46. package/lib/node/{topLevelMetaAssertion.js → metaLemmaMetaTheorem.js} +12 -12
  47. package/lib/node/metaType.js +4 -4
  48. package/lib/node/metatheorem.js +6 -6
  49. package/lib/node/metavariable.js +4 -4
  50. package/lib/node/nonsense.js +4 -4
  51. package/lib/node/parameter.js +4 -4
  52. package/lib/node/parenthesisedLabel.js +4 -4
  53. package/lib/node/parenthesisedLabels.js +4 -4
  54. package/lib/node/placeholder.js +107 -0
  55. package/lib/node/premise.js +4 -4
  56. package/lib/node/procedureCall.js +4 -4
  57. package/lib/node/procedureReference.js +4 -4
  58. package/lib/node/proof.js +4 -4
  59. package/lib/node/property.js +4 -4
  60. package/lib/node/propertyRelation.js +4 -4
  61. package/lib/node/qualification.js +4 -4
  62. package/lib/node/reference.js +4 -4
  63. package/lib/node/rule.js +4 -4
  64. package/lib/node/section.js +4 -4
  65. package/lib/node/signature.js +4 -4
  66. package/lib/node/statement.js +15 -4
  67. package/lib/node/step.js +4 -4
  68. package/lib/node/subDerivation.js +4 -4
  69. package/lib/node/subproof.js +4 -4
  70. package/lib/node/substitution/frame.js +6 -6
  71. package/lib/node/substitution/statement.js +6 -6
  72. package/lib/node/substitution/term.js +6 -6
  73. package/lib/node/substitution.js +107 -0
  74. package/lib/node/supposition.js +4 -4
  75. package/lib/node/term.js +27 -4
  76. package/lib/node/theorem.js +6 -6
  77. package/lib/node/type.js +4 -4
  78. package/lib/node/typePrefix.js +4 -4
  79. package/lib/node/types.js +4 -4
  80. package/lib/node/variable.js +4 -4
  81. package/lib/nominal/parser.js +3 -3
  82. package/lib/nonTerminalNode.js +222 -0
  83. package/lib/nonTerminalNodeMap.js +5 -3
  84. package/lib/ontology/assertion/contained.js +8 -9
  85. package/lib/ontology/assertion/defined.js +9 -10
  86. package/lib/ontology/assertion/satisfies.js +4 -4
  87. package/lib/ontology/assumption.js +379 -0
  88. package/lib/ontology/declaration/combinator.js +75 -33
  89. package/lib/ontology/declaration/complexType.js +110 -63
  90. package/lib/ontology/declaration/constructor.js +81 -38
  91. package/lib/ontology/declaration/metavariable.js +87 -39
  92. package/lib/ontology/declaration/simpleType.js +95 -48
  93. package/lib/ontology/declaration/typePrefix.js +87 -40
  94. package/lib/ontology/declaration/variable.js +87 -39
  95. package/lib/ontology/declaration.js +13 -338
  96. package/lib/ontology/equivalence.js +295 -0
  97. package/lib/ontology/equivalences.js +264 -0
  98. package/lib/ontology/frame.js +49 -54
  99. package/lib/ontology/judgement.js +8 -8
  100. package/lib/ontology/metavariable.js +4 -4
  101. package/lib/ontology/premise.js +14 -5
  102. package/lib/ontology/reference.js +3 -9
  103. package/lib/ontology/rule.js +3 -4
  104. package/lib/ontology/statement.js +28 -24
  105. package/lib/ontology/step.js +2 -3
  106. package/lib/ontology/subproof.js +2 -3
  107. package/lib/ontology/substitution/statement.js +77 -36
  108. package/lib/ontology/substitution/term.js +14 -34
  109. package/lib/ontology/substitution.js +18 -19
  110. package/lib/ontology/substitutions.js +425 -0
  111. package/lib/ontology/supposition.js +14 -5
  112. package/lib/ontology/term.js +33 -36
  113. package/lib/ontology/topLevelAssertion.js +2 -3
  114. package/lib/ontology/topLevelMetaAssertion.js +2 -3
  115. package/lib/ontology/variable.js +1 -34
  116. package/lib/preamble.js +7 -4
  117. package/lib/ruleNames.js +20 -12
  118. package/lib/unifier/intrinsicLevel.js +4 -12
  119. package/lib/unifier/metaLevel.js +14 -22
  120. package/lib/utilities/frame.js +18 -0
  121. package/lib/utilities/statement.js +18 -0
  122. package/lib/utilities/substitutions.js +43 -30
  123. package/lib/utilities/variable.js +5 -17
  124. package/package.json +10 -10
  125. package/src/assignment/equality.js +1 -1
  126. package/src/context/file.js +5 -4
  127. package/src/context/local.js +28 -5
  128. package/src/context/partial.js +9 -14
  129. package/src/context/temporary.js +120 -51
  130. package/src/mixins/step/unify.js +4 -4
  131. package/src/node/argument.js +1 -1
  132. package/src/node/assertion/contained.js +3 -3
  133. package/src/node/assertion/defined.js +3 -3
  134. package/src/node/assertion/property.js +3 -3
  135. package/src/node/assertion/satisfies.js +3 -3
  136. package/src/node/assertion/subproof.js +3 -3
  137. package/src/node/assertion/type.js +3 -3
  138. package/src/node/assertion.js +7 -0
  139. package/src/node/assumption.js +35 -0
  140. package/src/node/axiom.js +3 -3
  141. package/src/node/{topLevelAssertion.js → axiomLemmaTheoremConjecture.js} +2 -2
  142. package/src/node/body.js +1 -3
  143. package/src/node/combinator.js +1 -1
  144. package/src/node/conclusion.js +1 -1
  145. package/src/node/conjecture.js +3 -3
  146. package/src/node/constructor.js +1 -1
  147. package/src/node/declaration/combinator.js +3 -3
  148. package/src/node/declaration/complexType.js +3 -3
  149. package/src/node/declaration/constructor.js +3 -3
  150. package/src/node/declaration/metavariable.js +3 -3
  151. package/src/node/declaration/property.js +3 -3
  152. package/src/node/declaration/simpleType.js +3 -3
  153. package/src/node/declaration/typePrefix.js +3 -3
  154. package/src/node/declaration/variable.js +3 -3
  155. package/src/node/declaration.js +2 -18
  156. package/src/node/deduction.js +1 -1
  157. package/src/node/derivation.js +1 -1
  158. package/src/node/document.js +7 -0
  159. package/src/node/equality.js +1 -1
  160. package/src/node/error.js +1 -1
  161. package/src/node/frame.js +23 -11
  162. package/src/node/header.js +1 -1
  163. package/src/node/hypothesis.js +1 -1
  164. package/src/node/judgement.js +6 -6
  165. package/src/node/label.js +1 -1
  166. package/src/node/labels.js +1 -1
  167. package/src/node/lemma.js +3 -3
  168. package/src/node/metaArgument.js +1 -1
  169. package/src/node/metaLemma.js +3 -3
  170. package/src/node/{topLevelMetaAssertion.js → metaLemmaMetaTheorem.js} +2 -2
  171. package/src/node/metaType.js +1 -1
  172. package/src/node/metatheorem.js +3 -3
  173. package/src/node/metavariable.js +1 -1
  174. package/src/node/nonsense.js +1 -1
  175. package/src/node/parameter.js +1 -1
  176. package/src/node/parenthesisedLabel.js +1 -1
  177. package/src/node/parenthesisedLabels.js +1 -1
  178. package/src/node/placeholder.js +7 -0
  179. package/src/node/premise.js +1 -1
  180. package/src/node/procedureCall.js +1 -1
  181. package/src/node/procedureReference.js +1 -1
  182. package/src/node/proof.js +1 -1
  183. package/src/node/property.js +1 -1
  184. package/src/node/propertyRelation.js +1 -1
  185. package/src/node/qualification.js +1 -1
  186. package/src/node/reference.js +1 -1
  187. package/src/node/rule.js +2 -2
  188. package/src/node/section.js +1 -1
  189. package/src/node/signature.js +1 -1
  190. package/src/node/statement.js +13 -1
  191. package/src/node/step.js +1 -1
  192. package/src/node/subDerivation.js +1 -1
  193. package/src/node/subproof.js +1 -1
  194. package/src/node/substitution/frame.js +3 -3
  195. package/src/node/substitution/statement.js +3 -3
  196. package/src/node/substitution/term.js +3 -3
  197. package/src/node/substitution.js +7 -0
  198. package/src/node/supposition.js +1 -1
  199. package/src/node/term.js +27 -1
  200. package/src/node/theorem.js +3 -3
  201. package/src/node/type.js +1 -1
  202. package/src/node/typePrefix.js +1 -1
  203. package/src/node/types.js +1 -1
  204. package/src/node/variable.js +1 -1
  205. package/src/nominal/parser.js +2 -2
  206. package/src/{node/nonTerminal.js → nonTerminalNode.js} +31 -25
  207. package/src/nonTerminalNodeMap.js +10 -5
  208. package/src/ontology/assertion/contained.js +14 -14
  209. package/src/ontology/assertion/defined.js +13 -13
  210. package/src/ontology/assertion/satisfies.js +2 -1
  211. package/src/ontology/assumption.js +385 -0
  212. package/src/ontology/declaration/combinator.js +15 -24
  213. package/src/ontology/declaration/complexType.js +57 -53
  214. package/src/ontology/declaration/constructor.js +25 -31
  215. package/src/ontology/declaration/metavariable.js +25 -30
  216. package/src/ontology/declaration/simpleType.js +34 -38
  217. package/src/ontology/declaration/typePrefix.js +23 -31
  218. package/src/ontology/declaration/variable.js +26 -31
  219. package/src/ontology/declaration.js +8 -372
  220. package/src/{equivalence.js → ontology/equivalence.js} +4 -3
  221. package/src/{equivalences.js → ontology/equivalences.js} +14 -12
  222. package/src/ontology/frame.js +53 -63
  223. package/src/ontology/judgement.js +8 -8
  224. package/src/ontology/metavariable.js +2 -2
  225. package/src/ontology/premise.js +18 -4
  226. package/src/ontology/reference.js +4 -3
  227. package/src/ontology/rule.js +4 -3
  228. package/src/ontology/statement.js +31 -27
  229. package/src/ontology/step.js +2 -2
  230. package/src/ontology/subproof.js +2 -2
  231. package/src/ontology/substitution/statement.js +56 -53
  232. package/src/ontology/substitution/term.js +9 -35
  233. package/src/ontology/substitution.js +11 -15
  234. package/src/{substitutions.js → ontology/substitutions.js} +4 -3
  235. package/src/ontology/supposition.js +18 -4
  236. package/src/ontology/term.js +27 -39
  237. package/src/ontology/topLevelAssertion.js +2 -2
  238. package/src/ontology/topLevelMetaAssertion.js +2 -2
  239. package/src/ontology/variable.js +0 -54
  240. package/src/preamble.js +6 -3
  241. package/src/ruleNames.js +10 -8
  242. package/src/unifier/intrinsicLevel.js +3 -14
  243. package/src/unifier/metaLevel.js +14 -25
  244. package/src/utilities/frame.js +13 -0
  245. package/src/utilities/statement.js +13 -0
  246. package/src/utilities/substitutions.js +59 -31
  247. package/src/utilities/variable.js +1 -10
  248. package/lib/equivalence.js +0 -294
  249. package/lib/equivalences.js +0 -263
  250. package/lib/node/nonTerminal.js +0 -218
  251. package/lib/substitutions.js +0 -424
@@ -6,10 +6,10 @@ import JudgementAssignment from "../assignment/judgement";
6
6
  import { define } from "../ontology";
7
7
 
8
8
  export default define(class Judgement {
9
- constructor(string, frame, declaration) {
9
+ constructor(string, frame, assumption) {
10
10
  this.string = string;
11
11
  this.frame = frame;
12
- this.declaration = declaration;
12
+ this.assumption = assumption;
13
13
  }
14
14
 
15
15
  getString() {
@@ -21,7 +21,7 @@ export default define(class Judgement {
21
21
  }
22
22
 
23
23
  getDeclaration() {
24
- return this.declaration;
24
+ return this.assumption;
25
25
  }
26
26
 
27
27
  isSimple() { return this.frame.isSimple(); }
@@ -88,7 +88,7 @@ export default define(class Judgement {
88
88
  verifyDeclaration(assignments, stated, context) {
89
89
  let declarationVerifies;
90
90
 
91
- declarationVerifies = this.declaration.verify(assignments, stated, context);
91
+ declarationVerifies = this.assumption.verify(assignments, stated, context);
92
92
 
93
93
  return declarationVerifies;
94
94
  }
@@ -116,7 +116,7 @@ export default define(class Judgement {
116
116
 
117
117
  context.trace(`Verifying the '${judgementString}' derived judgement...`);
118
118
 
119
- const metavariable = this.declaration.getMetavariable(),
119
+ const metavariable = this.assumption.getMetavariable(),
120
120
  reference = referenceFromMetavariable(metavariable, context),
121
121
  metaLemmaMetatheorem = context.findMetaLemmaMetatheoremByReference(reference),
122
122
  substitutions = metaLemmaMetatheorem.getSubstitutions(),
@@ -151,13 +151,13 @@ export default define(class Judgement {
151
151
  const judgementNode = statementNode.getJudgementNode();
152
152
 
153
153
  if (judgementNode !== null) {
154
- const { Frame, Declaration } = ontology,
154
+ const { Frame, Assumption } = ontology,
155
155
  node = judgementNode, ///
156
156
  string = context.nodeAsString(node),
157
157
  frame = Frame.fromJudgementNode(judgementNode, context),
158
- declaration = Declaration.fromJudgementNode(judgementNode, context);
158
+ assumption = Assumption.fromJudgementNode(judgementNode, context);
159
159
 
160
- judgement = new Judgement(string, frame, declaration);
160
+ judgement = new Judgement(string, frame, assumption);
161
161
  }
162
162
 
163
163
  return judgement;
@@ -474,8 +474,8 @@ export default define(class Metavariable {
474
474
  return metavariable;
475
475
  }
476
476
 
477
- static fromDeclarationNode(declarationNode, context) {
478
- const metavariableNode = declarationNode.getMetavariableNode(),
477
+ static fromAssumptionNode(assumptionNode, context) {
478
+ const metavariableNode = assumptionNode.getMetavariableNode(),
479
479
  metavariable = metavariableFromMetavariableNode(metavariableNode, context);
480
480
 
481
481
  return metavariable;
@@ -90,18 +90,32 @@ export default define(class Premise {
90
90
  }
91
91
 
92
92
  unifyIndependently(substitutions, context) {
93
- let unifiesIndependently;
93
+ let unifiesIndependently = false;
94
+
95
+ const premiseString = this.string, ///
96
+ generalContext = this.context, ///
97
+ specificContext = context; ///
98
+
99
+ context.trace(`Unifying the '${premiseString}' premise independently...`, this.node);
94
100
 
95
101
  if (this.statement !== null) {
96
- const statementResolvedIndependently = this.statement.unifyIndependently(substitutions, context);
102
+ const statementUnifiesIndependently = this.statement.unifyIndependently(substitutions, generalContext, specificContext);
97
103
 
98
- unifiesIndependently = statementResolvedIndependently; ///
104
+ if (statementUnifiesIndependently) {
105
+ unifiesIndependently = true;
106
+ }
99
107
  }
100
108
 
101
109
  if (this.procedureCall !== null) {
102
110
  const procedureCallResolvedIndependently = this.procedureCall.unifyIndependently(substitutions, context);
103
111
 
104
- unifiesIndependently = procedureCallResolvedIndependently; ///
112
+ if (procedureCallResolvedIndependently) {
113
+ unifiesIndependently = true;
114
+ }
115
+ }
116
+
117
+ if (unifiesIndependently) {
118
+ context.debug(`...unified the '${premiseString}' premise independenly.`, this.node);
105
119
  }
106
120
 
107
121
  return unifiesIndependently;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  import ontology from "../ontology";
4
- import Substitutions from "../substitutions";
5
4
 
6
5
  import { define } from "../ontology";
7
6
  import { referenceMetaType } from ".//metaType";
@@ -115,7 +114,8 @@ export default define(class Reference {
115
114
 
116
115
  context.trace(`Unifying the '${metavariableString}' metavariable with the '${referenceString}' reference...`);
117
116
 
118
- const substitutions = Substitutions.fromNothing(),
117
+ const { Substitutions } = ontology,
118
+ substitutions = Substitutions.fromNothing(),
119
119
  generalContext = context, ///
120
120
  specificContext = context, ///
121
121
  generalMetavariable = this.metavariable, ///
@@ -140,7 +140,8 @@ export default define(class Reference {
140
140
 
141
141
  context.trace(`Unifying the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem with the '${referenceString}' reference...`);
142
142
 
143
- const label = metaLemmaMetatheorem.getLabel(),
143
+ const { Substitutions } = ontology,
144
+ label = metaLemmaMetatheorem.getLabel(),
144
145
  substitutions = Substitutions.fromNothing(),
145
146
  labelUnifies = this.unifyLabel(label, substitutions, context);
146
147
 
@@ -4,7 +4,6 @@ import { arrayUtilities } from "necessary";
4
4
 
5
5
  import ontology from "../ontology";
6
6
  import LocalContext from "../context/local";
7
- import Substitutions from "../substitutions";
8
7
 
9
8
  import { define } from "../ontology";
10
9
  import { labelsStringFromLabels } from "./topLevelAssertion";
@@ -149,7 +148,8 @@ export default define(class Rule {
149
148
  if (this.proof === null) {
150
149
  proofVerifies = true;
151
150
  } else {
152
- const substitutions = Substitutions.fromNothing();
151
+ const { Substitutions } = ontology,
152
+ substitutions = Substitutions.fromNothing();
153
153
 
154
154
  proofVerifies = this.proof.verify(substitutions, this.conclusion, context);
155
155
  }
@@ -172,7 +172,8 @@ export default define(class Rule {
172
172
  unifyStatementAndStepsOrSubproofs(statement, stepsOrSubproofs, context) {
173
173
  let statementAndStepsOrSubproofsUnify = false;
174
174
 
175
- const substitutions = Substitutions.fromNothing(),
175
+ const { Substitutions } = ontology,
176
+ substitutions = Substitutions.fromNothing(),
176
177
  statementUnifiesWithConclusion = this.unifyStatementWithConclusion(statement, substitutions, context);
177
178
 
178
179
  if (statementUnifiesWithConclusion) {
@@ -10,7 +10,6 @@ import { unifyStatement } from "../utilities/unification";
10
10
  import { STATEMENT_META_TYPE_NAME } from "../metaTypeNames";
11
11
  import { statementFromStatementNode } from "../utilities/node";
12
12
  import { stripBracketsFromStatementNode } from "../utilities/brackets";
13
- import { definedAssertionFromStatement, containedAssertionFromStatement, subproofAssertionFromStatement } from "../utilities/context";
14
13
 
15
14
  const { match, backwardsSome } = arrayUtilities;
16
15
 
@@ -33,6 +32,8 @@ export default define(class Statement {
33
32
  return this.tokens;
34
33
  }
35
34
 
35
+ isSimple() { return this.node.isSimple();}
36
+
36
37
  isEqualTo(statement) {
37
38
  const statementString = statement.getString(),
38
39
  equalTo = (statementString === this.string);
@@ -150,14 +151,18 @@ export default define(class Statement {
150
151
  let subproofUnifies = false;
151
152
 
152
153
  const context = specificContext, ///
153
- statement = this, ///
154
- subproofAssertion = subproofAssertionFromStatement(statement, context);
154
+ statementNode = this.node,
155
+ subproofAssertionNode = statementNode.getSubproofAssertionNode(),
156
+ assertionNode = subproofAssertionNode; ///
157
+
158
+ if (assertionNode !== null) {
159
+ const assertion = generalContext.findAssertionByAssertionNode(assertionNode),
160
+ subproofAssertion = assertion; ///
155
161
 
156
- if (subproofAssertion !== null) {
157
162
  const subproofString = subproof.getString(),
158
163
  subproofAssertionString = subproofAssertion.getString();
159
164
 
160
- specificContext.trace(`Unifying the '${subproofString}' subproof with the '${subproofAssertionString}' subproof assertion...`);
165
+ context.trace(`Unifying the '${subproofString}' subproof with the '${subproofAssertionString}' subproof assertion...`);
161
166
 
162
167
  const subproofStatements = subproof.getStatements(),
163
168
  subproofAssertionStatements = subproofAssertion.getStatements();
@@ -173,7 +178,7 @@ export default define(class Statement {
173
178
  });
174
179
 
175
180
  if (subproofUnifies) {
176
- specificContext.debug(`...unified the '${subproofString}' subproof with the '${subproofAssertionString}' subproof assertion.`);
181
+ context.debug(`...unified the '${subproofString}' subproof with the '${subproofAssertionString}' subproof assertion.`);
177
182
  }
178
183
  }
179
184
 
@@ -199,27 +204,26 @@ export default define(class Statement {
199
204
  return statementUnifies;
200
205
  }
201
206
 
202
- unifyIndependently(substitutions, context) {
207
+ unifyIndependently(substitutions, generalContext, specificContext) {
203
208
  let unifiesIndependently = false;
204
209
 
205
- const statement = this, ///
210
+ const context = specificContext, ///
206
211
  statementString = this.string; ///
207
212
 
208
213
  context.trace(`Unifying the '${statementString}' statement independently...`);
209
214
 
210
- const definedAssertion = definedAssertionFromStatement(statement, context),
211
- containedAssertion = containedAssertionFromStatement(statement, context);
212
-
213
- if (definedAssertion !== null) {
214
- const definedAssertionUnifiesIndependently = definedAssertion.unifyIndependently(substitutions, context);
215
+ const statementNode = this.node,
216
+ definedAssertionNode = statementNode.getDefinedAssertionNode(),
217
+ containedAssertionNode = statementNode.getContainedAssertionNode();
215
218
 
216
- unifiesIndependently = definedAssertionUnifiesIndependently; ///
217
- }
218
-
219
- if (containedAssertion !== null) {
220
- const containedAssertionUnifiesIndependently = containedAssertion.unifyIndependently(substitutions, context);
219
+ if ((definedAssertionNode !== null) || (containedAssertionNode !== null)) {
220
+ const assertionNode = (definedAssertionNode || containedAssertionNode),
221
+ assertion = generalContext.findAssertionByAssertionNode(assertionNode),
222
+ assertionUnifiesIndependently = assertion.unifyIndependently(substitutions, generalContext, specificContext);
221
223
 
222
- unifiesIndependently = containedAssertionUnifiesIndependently; ///
224
+ if (assertionUnifiesIndependently) {
225
+ unifiesIndependently = true;
226
+ }
223
227
  }
224
228
 
225
229
  if (unifiesIndependently) {
@@ -333,28 +337,28 @@ export default define(class Statement {
333
337
  return statement;
334
338
  }
335
339
 
336
- static fromSuppositionNode(suppositionNode, context) {
340
+ static fromAssumptionNode(assumptionNode, context) {
337
341
  let statement = null;
338
342
 
339
- const statementNode = suppositionNode.getStatementNode();
343
+ let statementNode;
344
+
345
+ statementNode = assumptionNode.getStatementNode(); ///
340
346
 
341
347
  if (statementNode !== null) {
348
+ statementNode = stripBracketsFromStatementNode(statementNode); ///
349
+
342
350
  statement = statementFromStatementNode(statementNode, context);
343
351
  }
344
352
 
345
353
  return statement;
346
354
  }
347
355
 
348
- static fromDeclarationNode(declarationNode, context) {
356
+ static fromSuppositionNode(suppositionNode, context) {
349
357
  let statement = null;
350
358
 
351
- let statementNode;
352
-
353
- statementNode = declarationNode.getStatementNode(); ///
359
+ const statementNode = suppositionNode.getStatementNode();
354
360
 
355
361
  if (statementNode !== null) {
356
- statementNode = stripBracketsFromStatementNode(statementNode); ///
357
-
358
362
  statement = statementFromStatementNode(statementNode, context);
359
363
  }
360
364
 
@@ -2,7 +2,6 @@
2
2
 
3
3
  import ontology from "../ontology";
4
4
  import unifyMixins from "../mixins/step/unify";
5
- import Substitutions from "../substitutions";
6
5
  import TemporaryContext from "../context/temporary";
7
6
  import equationalUnifier from "../unifier/equantional";
8
7
 
@@ -182,7 +181,8 @@ export default define(class Step {
182
181
  axiom = context.findAxiomByReference(reference);
183
182
 
184
183
  if (axiom !== null) {
185
- const step = this, ///
184
+ const { Substitutions } = ontology,
185
+ step = this, ///
186
186
  substitutions = Substitutions.fromNothing(),
187
187
  stepUnifies = axiom.unifyStep(step, substitutions, context);
188
188
 
@@ -2,7 +2,6 @@
2
2
 
3
3
  import ontology from "../ontology";
4
4
  import LocalContext from "../context/local";
5
- import Substitutions from "../substitutions";
6
5
 
7
6
  import { define } from "../ontology";
8
7
  import { subproofStringFromSubproofNode } from "../utilities/subproof";
@@ -110,7 +109,8 @@ export default define(class Subproof {
110
109
  const axiomSatisfiable = axiom.isSatisfiable();
111
110
 
112
111
  if (axiomSatisfiable) {
113
- const subproof = this, ///
112
+ const { Substitutions } = ontology,
113
+ subproof = this, ///
114
114
  substitutions = Substitutions.fromNothing(),
115
115
  statementUnifies = axiom.unifySubproof(subproof, substitutions, context);
116
116
 
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ import ontology from "../../ontology";
3
4
  import Substitution from "../substitution";
4
- import Substitutions from "../../substitutions";
5
5
  import StatementSubstitutionPartialContext from "../../context/partial/substitution/statement";
6
6
 
7
7
  import { define } from "../../ontology";
@@ -67,7 +67,7 @@ export default define(class StatementSubstitution extends Substitution {
67
67
  if (substitution === null) {
68
68
  substitutionEqualToSubstitution = false;
69
69
  } else {
70
- substitutionEqualToSubstitution = this.substitution.isEqualToSubstitution(substitution);
70
+ substitutionEqualToSubstitution = this.substitution.isEqualTo(substitution);
71
71
  }
72
72
  }
73
73
 
@@ -76,16 +76,63 @@ export default define(class StatementSubstitution extends Substitution {
76
76
 
77
77
  matchParameter(parameter) { return this.metavariable.matchParameter(parameter); }
78
78
 
79
+ resolve(substitutions, context) {
80
+ const substitutionString = this.string; ///
81
+
82
+ context.trace(`Resolving the ${substitutionString} substitution...`);
83
+
84
+ substitutions.snapshot();
85
+
86
+ const metavariable = this.getMetavariable(),
87
+ simpleSubstitution = substitutions.findSimpleSubstitutionByMetavariable(metavariable);
88
+
89
+ if (simpleSubstitution !== null) {
90
+ let context;
91
+
92
+ context = this.getContext();
93
+
94
+ const substitution = simpleSubstitution.unifyStatement(this.statement, context);
95
+
96
+ if (substitution !== null) {
97
+ context = simpleSubstitution.getContext();
98
+
99
+ const terms = context.getTerms(),
100
+ frames = context.getFrames();
101
+
102
+ context = substitution.getContext();
103
+
104
+ context.addTerms(terms);
105
+
106
+ context.addFrames(frames);
107
+
108
+ const substitutionUnifies = this.unifySubstitution(substitution, substitutions, context);
109
+
110
+ if (substitutionUnifies) {
111
+ this.resolved = true;
112
+ }
113
+ }
114
+ }
115
+
116
+ this.resolved ?
117
+ substitutions.continue() :
118
+ substitutions.rollback(context);
119
+
120
+ if (this.resolved) {
121
+ context.debug(`...resolved the ${substitutionString} substitution.`);
122
+ }
123
+ }
124
+
79
125
  unifyStatement(statement, context) {
80
126
  let substitution = null;
81
127
 
82
- const substitutions = Substitutions.fromNothing(),
83
- generalContext = context; ///
128
+ const { Substitutions } = ontology,
129
+ substitutions = Substitutions.fromNothing(),
130
+ specificContext = context; ///
84
131
 
85
132
  context = this.getContext();
86
133
 
87
- const specificContext = context, ///
88
- statementUnifies = statement.unifyStatement(this.statement, substitutions, generalContext, specificContext);
134
+ const generalContext = context, ///
135
+ statementUnifies = this.statement.unifyStatement(statement, substitutions, generalContext, specificContext);
89
136
 
90
137
  if (statementUnifies) {
91
138
  const substitutionsNonTrivialLength = substitutions.getNonTrivialLength();
@@ -101,8 +148,7 @@ export default define(class StatementSubstitution extends Substitution {
101
148
  }
102
149
 
103
150
  unifySubstitution(substitution, substitutions, context) {
104
- const frame = context.getFrame(),
105
- generalSubstitution = this.substitution, ///
151
+ const generalSubstitution = this.substitution, ///
106
152
  specificSubstitution = substitution, ///
107
153
  generalSubstitutionString = generalSubstitution.getString(),
108
154
  specificSubstitutionString = specificSubstitution.getString();
@@ -117,19 +163,8 @@ export default define(class StatementSubstitution extends Substitution {
117
163
 
118
164
  substitutionContext = substitution.getContext();
119
165
 
120
- const specificContext = substitutionContext; ///
121
-
122
- specificContext.addFrame(frame);
123
-
124
- substitutions.snapshot();
125
-
126
- const substitutionUnifies = unifySubstitution(generalSubstitution, specificSubstitution, substitutions, generalContext, specificContext);
127
-
128
- specificContext.removeFrame(frame);
129
-
130
- substitutionUnifies ?
131
- substitutions.continue() :
132
- substitutions.rollback(context);
166
+ const specificContext = substitutionContext, ///
167
+ substitutionUnifies = unifySubstitution(generalSubstitution, specificSubstitution, substitutions, generalContext, specificContext);
133
168
 
134
169
  if (substitutionUnifies) {
135
170
  context.trace(`...unified the '${specificSubstitutionString}' substitution with the '${generalSubstitutionString}' substitution.`);
@@ -138,38 +173,6 @@ export default define(class StatementSubstitution extends Substitution {
138
173
  return substitutionUnifies;
139
174
  }
140
175
 
141
- resolve(substitutions, context) {
142
- const substitutionString = this.string; ///
143
-
144
- context.trace(`Resolving the ${substitutionString} substitution...`);
145
-
146
- const metavariable = this.getMetavariable(),
147
- simpleSubstitution = substitutions.findSimpleSubstitutionByMetavariable(metavariable);
148
-
149
- if (simpleSubstitution !== null) {
150
- let substitution;
151
-
152
- substitution = simpleSubstitution; ///
153
-
154
- const context = substitution.getContext(),
155
- statement = substitution.getStatement();
156
-
157
- substitution = this.unifyStatement(statement, context);
158
-
159
- if (substitution !== null) {
160
- const substitutionUnifies = this.unifySubstitution(substitution, substitutions, context);
161
-
162
- if (substitutionUnifies) {
163
- this.resolved = true;
164
- }
165
- }
166
- }
167
-
168
- if (this.resolved) {
169
- context.debug(`...resolved the ${substitutionString} substitution.`);
170
- }
171
- }
172
-
173
176
  toJSON() {
174
177
  const metavariableJSON = metavariableToMetavariableJSON(this.metavariable),
175
178
  statementJSON = statementToStatementJSON(this.statement),
@@ -1,14 +1,13 @@
1
1
  "use strict";
2
2
 
3
+ import ontology from "../../ontology";
3
4
  import Substitution from "../substitution";
4
5
  import TermSubstitutionPartialContext from "../../context/partial/substitution/term";
5
6
 
6
- import ontology, { define } from "../../ontology";
7
- import { nodeQuery } from "../../utilities/query";
7
+ import { define } from "../../ontology";
8
8
  import { stripBracketsFromTerm } from "../../utilities/brackets";
9
- import { variableIdentifierFromVariableNode } from "../../utilities/variable";
9
+ import { termVariableIdentifierFromTermNode } from "../../utilities/variable";
10
10
 
11
- const termVariableNodeQuery = nodeQuery("/term/variable!");
12
11
 
13
12
  export default define(class TermSubstitution extends Substitution {
14
13
  constructor(context, string, node, tokens, term, variable) {
@@ -49,31 +48,6 @@ export default define(class TermSubstitution extends Substitution {
49
48
  return termEqualToTerm;
50
49
  }
51
50
 
52
- isTermVariableEqualToTerm(termVariable, context) {
53
- let termVariableEqualToTerm = false;
54
-
55
- const termNode = this.term.getNode();
56
-
57
- let termVariableNode;
58
-
59
- termVariableNode = termVariableNodeQuery(termNode);
60
-
61
- if (termVariableNode !== null) {
62
- const termVariableNodeA = termVariableNode; ///
63
-
64
- termVariableNode = termVariable.getNode();
65
-
66
- const termVariableNodeB = termVariableNode, ///
67
- termVariableNodeAMatchesTermVariableNodeB = termVariableNodeA.match(termVariableNodeB);
68
-
69
- if (termVariableNodeAMatchesTermVariableNodeB) {
70
- termVariableEqualToTerm = true;
71
- }
72
- }
73
-
74
- return termVariableEqualToTerm;
75
- }
76
-
77
51
  matchParameter(parameter) { return this.variable.matchParameter(parameter); }
78
52
 
79
53
  verify(context) {
@@ -89,15 +63,15 @@ export default define(class TermSubstitution extends Substitution {
89
63
  if (this.variable === null) {
90
64
  context.debug(`The specific term is not simple.`);
91
65
  } else {
92
- const variableIdentigier = this.variable.getIdentifier(),
93
- variablePresent = context.isVariablePresentByVariableIdentifier(variableIdentigier);
66
+ const variableIdentifier = this.variable.getIdentifier(),
67
+ variablePresent = context.isVariablePresentByVariableIdentifier(variableIdentifier);
94
68
 
95
69
  if (variablePresent) {
96
- const variable = this.term.getVariable(),
97
- variableIdentigier = variable.getIdentifier(),
98
- variablePresent = context.isVariablePresentByVariableIdentifier(variableIdentigier);
70
+ const termNode = this.term.getNode(),
71
+ termVariableIdentifier = termVariableIdentifierFromTermNode(termNode),
72
+ termVariablePresent = context.isVariablePresentByVariableIdentifier(termVariableIdentifier);
99
73
 
100
- if (variablePresent) {
74
+ if (termVariablePresent) {
101
75
  verifies = true;
102
76
  } else {
103
77
  const variableString = variable.getString();
@@ -66,6 +66,12 @@ export default class Substitution {
66
66
  return substitution;
67
67
  }
68
68
 
69
+ getReplacementNode() {
70
+ const replacementNode = null;
71
+
72
+ return replacementNode;
73
+ }
74
+
69
75
  isSimple() {
70
76
  const simple = true;
71
77
 
@@ -104,12 +110,6 @@ export default class Substitution {
104
110
  return frameEqualToFrame;
105
111
  }
106
112
 
107
- isTermVariableEqualToTerm(termVariable, context) {
108
- const termVariableEqualToTerm = false;
109
-
110
- return termVariableEqualToTerm;
111
- }
112
-
113
113
  isReferenceEqualToReference(reference, context) {
114
114
  const referenceEqualToReference = false;
115
115
 
@@ -134,21 +134,17 @@ export default class Substitution {
134
134
  return substitutionEqualToSubstitution;
135
135
  }
136
136
 
137
- resolve(substitutions, context) {
138
- const resolved = true;
139
-
140
- return resolved;
141
- }
142
-
143
137
  matchParameter(parameter) {
144
138
  const parameterMatches = false;
145
139
 
146
140
  return parameterMatches;
147
141
  }
148
142
 
149
- getReplacementNode() {
150
- const replacementNode = null;
143
+ matchSubstitutionNode(substitutionNode) { return this.node.match(substitutionNode); }
151
144
 
152
- return replacementNode;
145
+ resolve(substitutions, context) {
146
+ const resolved = true;
147
+
148
+ return resolved;
153
149
  }
154
150
  }
@@ -2,11 +2,12 @@
2
2
 
3
3
  import { arrayUtilities } from "necessary";
4
4
 
5
- import { EMPTY_STRING } from "./constants";
5
+ import { define } from "../ontology";
6
+ import { EMPTY_STRING } from "../constants";
6
7
 
7
8
  const { find, first, clear, prune, filter, compress, correlate } = arrayUtilities;
8
9
 
9
- export default class Substitutions {
10
+ export default define(class Substitutions {
10
11
  constructor(array, savedArray) {
11
12
  this.array = array;
12
13
  this.savedArray = savedArray;
@@ -357,7 +358,7 @@ export default class Substitutions {
357
358
 
358
359
  return substitutions;
359
360
  }
360
- }
361
+ });
361
362
 
362
363
  function leftDifference(arrayA, arrayB) {
363
364
  filter(arrayA, (elementA) => {
@@ -112,18 +112,32 @@ export default define(class Supposition {
112
112
  }
113
113
 
114
114
  unifyIndependently(substitutions, context) {
115
- let unifiesIndependently;
115
+ let unifiesIndependently = false;
116
+
117
+ const suppositionString = this.string, ///
118
+ generalContext = this.context, ///
119
+ specificContext = context; ///
120
+
121
+ context.trace(`Unifying the '${suppositionString}' supposition independently...`, this.node);
116
122
 
117
123
  if (this.statement !== null) {
118
- const statementResolvedIndependently = this.statement.unifyIndependently(substitutions, context);
124
+ const statementUnifiesIndependently = this.statement.unifyIndependently(substitutions, generalContext, specificContext);
119
125
 
120
- unifiesIndependently = statementResolvedIndependently; ///
126
+ if (statementUnifiesIndependently) {
127
+ unifiesIndependently = true;
128
+ }
121
129
  }
122
130
 
123
131
  if (this.procedureCall !== null) {
124
132
  const procedureCallResolvedIndependently = this.procedureCall.unifyIndependently(substitutions, context);
125
133
 
126
- unifiesIndependently = procedureCallResolvedIndependently; ///
134
+ if (procedureCallResolvedIndependently) {
135
+ unifiesIndependently = true;
136
+ }
137
+ }
138
+
139
+ if (unifiesIndependently) {
140
+ context.debug(`...unified the '${suppositionString}' supposition independenly.`, this.node);
127
141
  }
128
142
 
129
143
  return unifiesIndependently;