occam-verify-cli 1.0.448 → 1.0.472

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 (222) hide show
  1. package/lib/constants.js +13 -5
  2. package/lib/context/ephemeral.js +270 -0
  3. package/lib/context/file.js +136 -128
  4. package/lib/context/liminal.js +120 -0
  5. package/lib/context/literal.js +92 -0
  6. package/lib/context/nominal.js +15 -1
  7. package/lib/context/release.js +68 -9
  8. package/lib/context/scoped.js +322 -0
  9. package/lib/context/synthetic.js +133 -0
  10. package/lib/element/assertion/contained.js +66 -66
  11. package/lib/element/assertion/defined.js +32 -32
  12. package/lib/element/assertion/property.js +39 -39
  13. package/lib/element/assertion/satisfies.js +22 -22
  14. package/lib/element/assumption.js +71 -87
  15. package/lib/element/combinator/bracketed.js +1 -10
  16. package/lib/element/conclusion.js +19 -15
  17. package/lib/element/constructor/bracketed.js +1 -10
  18. package/lib/element/constructor.js +2 -2
  19. package/lib/element/declaration/combinator.js +1 -2
  20. package/lib/element/declaration/metavariable.js +3 -3
  21. package/lib/element/declaration/variable.js +3 -3
  22. package/lib/element/deduction.js +26 -20
  23. package/lib/element/derivation.js +3 -3
  24. package/lib/element/equality.js +5 -5
  25. package/lib/element/equivalence.js +112 -107
  26. package/lib/element/equivalences.js +24 -10
  27. package/lib/element/error.js +3 -3
  28. package/lib/element/frame.js +73 -62
  29. package/lib/element/hypothesis.js +2 -2
  30. package/lib/element/judgement.js +40 -60
  31. package/lib/element/metaType.js +4 -4
  32. package/lib/element/metavariable.js +49 -38
  33. package/lib/element/parameter.js +13 -5
  34. package/lib/element/procedureCall.js +16 -16
  35. package/lib/element/proof.js +14 -13
  36. package/lib/element/proofAssertion/premise.js +319 -0
  37. package/lib/element/proofAssertion/step.js +309 -0
  38. package/lib/element/proofAssertion/supposition.js +333 -0
  39. package/lib/element/proofAssertion.js +20 -10
  40. package/lib/element/propertyRelation.js +2 -2
  41. package/lib/element/reference.js +72 -30
  42. package/lib/element/rule.js +26 -28
  43. package/lib/element/section.js +5 -5
  44. package/lib/element/signature.js +9 -6
  45. package/lib/element/statement.js +44 -36
  46. package/lib/element/subproof.js +18 -17
  47. package/lib/element/substitution/frame.js +86 -49
  48. package/lib/element/substitution/reference.js +101 -19
  49. package/lib/element/substitution/statement.js +128 -105
  50. package/lib/element/substitution/term.js +93 -57
  51. package/lib/element/substitution.js +20 -69
  52. package/lib/element/substitutions.js +49 -34
  53. package/lib/element/term.js +41 -30
  54. package/lib/element/topLevelAssertion/axiom.js +331 -0
  55. package/lib/element/{conjecture.js → topLevelAssertion/conjecture.js} +10 -10
  56. package/lib/element/{lemma.js → topLevelAssertion/lemma.js} +9 -9
  57. package/lib/element/{theorem.js → topLevelAssertion/theorem.js} +8 -8
  58. package/lib/element/topLevelAssertion.js +434 -0
  59. package/lib/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +8 -8
  60. package/lib/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +8 -8
  61. package/lib/element/topLevelMetaAssertion.js +293 -0
  62. package/lib/element/type.js +4 -4
  63. package/lib/element/variable.js +48 -40
  64. package/lib/index.js +3 -3
  65. package/lib/main.js +3 -3
  66. package/lib/metaTypes.js +18 -15
  67. package/lib/node/frame.js +2 -2
  68. package/lib/node/metavariable.js +4 -4
  69. package/lib/node/parameter.js +28 -7
  70. package/lib/node/proofAssertion/premise.js +116 -0
  71. package/lib/node/proofAssertion/step.js +152 -0
  72. package/lib/node/proofAssertion/supposition.js +116 -0
  73. package/lib/node/{premise.js → proofAssertion.js} +11 -18
  74. package/lib/node/statement.js +2 -2
  75. package/lib/node/substitution/frame.js +9 -31
  76. package/lib/node/substitution/reference.js +137 -0
  77. package/lib/node/substitution/statement.js +9 -31
  78. package/lib/node/substitution/term.js +9 -23
  79. package/lib/node/{axiom.js → topLevelAssertion/axiom.js} +7 -7
  80. package/lib/node/{conjecture.js → topLevelAssertion/conjecture.js} +7 -7
  81. package/lib/node/{lemma.js → topLevelAssertion/lemma.js} +7 -7
  82. package/lib/node/{theorem.js → topLevelAssertion/theorem.js} +7 -7
  83. package/lib/node/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +9 -9
  84. package/lib/node/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +7 -7
  85. package/lib/node/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +7 -7
  86. package/lib/node/{metaLemmaMetaTheorem.js → topLevelMetaAssertion.js} +9 -9
  87. package/lib/nonTerminalNodeMap.js +15 -14
  88. package/lib/preamble.js +10 -10
  89. package/lib/process/instantiate.js +6 -21
  90. package/lib/process/unify.js +11 -10
  91. package/lib/tokenTypes.js +22 -0
  92. package/lib/types.js +3 -3
  93. package/lib/utilities/bnf.js +5 -5
  94. package/lib/utilities/context.js +63 -0
  95. package/lib/utilities/element.js +235 -408
  96. package/lib/utilities/instance.js +12 -34
  97. package/lib/utilities/json.js +3 -2
  98. package/lib/utilities/string.js +56 -21
  99. package/lib/utilities/unification.js +38 -32
  100. package/lib/utilities/validation.js +47 -50
  101. package/package.json +2 -2
  102. package/src/constants.js +12 -1
  103. package/src/context/ephemeral.js +257 -0
  104. package/src/context/file.js +108 -116
  105. package/src/context/liminal.js +67 -0
  106. package/src/context/literal.js +51 -0
  107. package/src/context/nominal.js +12 -0
  108. package/src/context/release.js +48 -8
  109. package/src/context/{local.js → scoped.js} +43 -125
  110. package/src/context/synthetic.js +60 -0
  111. package/src/element/assertion/contained.js +49 -47
  112. package/src/element/assertion/defined.js +29 -27
  113. package/src/element/assertion/property.js +35 -35
  114. package/src/element/assertion/satisfies.js +19 -18
  115. package/src/element/assumption.js +71 -93
  116. package/src/element/combinator/bracketed.js +0 -7
  117. package/src/element/conclusion.js +25 -24
  118. package/src/element/constructor/bracketed.js +0 -7
  119. package/src/element/constructor.js +1 -1
  120. package/src/element/declaration/combinator.js +0 -1
  121. package/src/element/declaration/metavariable.js +2 -2
  122. package/src/element/declaration/variable.js +5 -5
  123. package/src/element/deduction.js +33 -31
  124. package/src/element/derivation.js +2 -2
  125. package/src/element/equality.js +4 -4
  126. package/src/element/equivalence.js +115 -135
  127. package/src/element/equivalences.js +9 -7
  128. package/src/element/error.js +4 -2
  129. package/src/element/frame.js +80 -65
  130. package/src/element/hypothesis.js +1 -1
  131. package/src/element/judgement.js +42 -62
  132. package/src/element/metaType.js +3 -4
  133. package/src/element/metavariable.js +59 -56
  134. package/src/element/parameter.js +10 -5
  135. package/src/element/procedureCall.js +20 -18
  136. package/src/element/proof.js +14 -16
  137. package/src/element/{premise.js → proofAssertion/premise.js} +57 -53
  138. package/src/element/{step.js → proofAssertion/step.js} +59 -62
  139. package/src/element/{supposition.js → proofAssertion/supposition.js} +67 -56
  140. package/src/element/proofAssertion.js +24 -13
  141. package/src/element/propertyRelation.js +1 -1
  142. package/src/element/reference.js +87 -37
  143. package/src/element/rule.js +31 -37
  144. package/src/element/section.js +5 -5
  145. package/src/element/signature.js +8 -8
  146. package/src/element/statement.js +52 -48
  147. package/src/element/subproof.js +16 -18
  148. package/src/element/substitution/frame.js +104 -50
  149. package/src/element/substitution/reference.js +120 -20
  150. package/src/element/substitution/statement.js +169 -130
  151. package/src/element/substitution/term.js +104 -63
  152. package/src/element/substitution.js +16 -58
  153. package/src/element/substitutions.js +43 -41
  154. package/src/element/term.js +47 -41
  155. package/src/element/{axiom.js → topLevelAssertion/axiom.js} +22 -20
  156. package/src/element/{conjecture.js → topLevelAssertion/conjecture.js} +5 -6
  157. package/src/element/{lemma.js → topLevelAssertion/lemma.js} +5 -6
  158. package/src/element/{theorem.js → topLevelAssertion/theorem.js} +5 -5
  159. package/src/element/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +37 -33
  160. package/src/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +5 -6
  161. package/src/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +5 -6
  162. package/src/element/{metaLemmaMetatheorem.js → topLevelMetaAssertion.js} +19 -17
  163. package/src/element/type.js +2 -4
  164. package/src/element/variable.js +47 -48
  165. package/src/index.js +2 -1
  166. package/src/main.js +2 -1
  167. package/src/metaTypes.js +25 -9
  168. package/src/node/frame.js +1 -1
  169. package/src/node/metavariable.js +3 -3
  170. package/src/node/parameter.js +32 -5
  171. package/src/node/proofAssertion/premise.js +16 -0
  172. package/src/node/{step.js → proofAssertion/step.js} +4 -18
  173. package/src/node/proofAssertion/supposition.js +16 -0
  174. package/src/node/proofAssertion.js +23 -0
  175. package/src/node/statement.js +1 -1
  176. package/src/node/substitution/frame.js +6 -32
  177. package/src/node/substitution/reference.js +38 -0
  178. package/src/node/substitution/statement.js +6 -32
  179. package/src/node/substitution/term.js +6 -22
  180. package/src/node/topLevelAssertion/axiom.js +13 -0
  181. package/src/node/topLevelAssertion/conjecture.js +13 -0
  182. package/src/node/topLevelAssertion/lemma.js +13 -0
  183. package/src/node/topLevelAssertion/theorem.js +13 -0
  184. package/src/node/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +1 -1
  185. package/src/node/topLevelMetaAssertion/metaLemma.js +13 -0
  186. package/src/node/topLevelMetaAssertion/metatheorem.js +13 -0
  187. package/src/node/{metaLemmaMetaTheorem.js → topLevelMetaAssertion.js} +1 -1
  188. package/src/nonTerminalNodeMap.js +15 -12
  189. package/src/preamble.js +9 -9
  190. package/src/process/instantiate.js +27 -36
  191. package/src/process/unify.js +10 -9
  192. package/src/tokenTypes.js +4 -0
  193. package/src/types.js +4 -2
  194. package/src/utilities/bnf.js +3 -2
  195. package/src/utilities/context.js +46 -0
  196. package/src/utilities/element.js +302 -509
  197. package/src/utilities/instance.js +19 -42
  198. package/src/utilities/json.js +3 -1
  199. package/src/utilities/string.js +69 -28
  200. package/src/utilities/unification.js +41 -38
  201. package/src/utilities/validation.js +66 -75
  202. package/lib/context/local.js +0 -605
  203. package/lib/context/temporary.js +0 -752
  204. package/lib/element/axiom.js +0 -329
  205. package/lib/element/axiomLemmaTheoremConjecture.js +0 -427
  206. package/lib/element/metaLemmaMetatheorem.js +0 -289
  207. package/lib/element/premise.js +0 -307
  208. package/lib/element/step.js +0 -311
  209. package/lib/element/supposition.js +0 -320
  210. package/lib/log.js +0 -150
  211. package/lib/node/step.js +0 -166
  212. package/lib/node/supposition.js +0 -130
  213. package/src/context/temporary.js +0 -476
  214. package/src/log.js +0 -118
  215. package/src/node/axiom.js +0 -13
  216. package/src/node/conjecture.js +0 -13
  217. package/src/node/lemma.js +0 -13
  218. package/src/node/metaLemma.js +0 -13
  219. package/src/node/metatheorem.js +0 -13
  220. package/src/node/premise.js +0 -30
  221. package/src/node/supposition.js +0 -30
  222. package/src/node/theorem.js +0 -13
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
 
3
- import ProofAssertion from "./proofAssertion";
4
- import TemporaryContext from "../context/temporary";
5
- import assignAssignments from "../process/assign";
3
+ import ProofAssertion from "../proofAssertion";
4
+ import assignAssignments from "../../process/assign";
6
5
 
7
- import { define } from "../elements";
6
+ import { define } from "../../elements";
7
+ import { attempt, synthetically } from "../../utilities/context";
8
8
  import { termsFromJSON,
9
9
  framesFromJSON,
10
10
  termsToTermsJSON,
@@ -12,7 +12,7 @@ import { termsFromJSON,
12
12
  framesToFramesJSON,
13
13
  procedureCallFromJSON,
14
14
  statementToStatementJSON,
15
- procedureCallToProcedureCallJSON } from "../utilities/json";
15
+ procedureCallToProcedureCallJSON } from "../../utilities/json";
16
16
 
17
17
  export default define(class Premise extends ProofAssertion {
18
18
  constructor(context, string, node, statement, procedureCall) {
@@ -25,55 +25,59 @@ export default define(class Premise extends ProofAssertion {
25
25
  return this.procedureCall;
26
26
  }
27
27
 
28
- verify(context) {
29
- let verifies = false;
28
+ isStated() {
29
+ const stated = true; ///
30
30
 
31
- const temporaryContext = TemporaryContext.fromNothing(context);
31
+ return stated;
32
+ }
32
33
 
33
- context = temporaryContext; ///
34
+ verify(context) {
35
+ let verifies = false;
34
36
 
35
37
  const node = this.getNode(),
36
38
  premiseString = this.getString(); ///
37
39
 
38
40
  context.trace(`Verifying the '${premiseString}' premise...`, node);
39
41
 
40
- const statement = this.getStatement();
42
+ const statement = this.getStatement(),
43
+ procedureCall = this.getProcedureCall();
41
44
 
42
- if ((statement === null) && (this.procedureCall === null)) {
43
- context.debug(`Unable to verify the '${premiseString}' premise because it is nonsense.`, node);
44
- } else {
45
- if (statement !== null) {
46
- const stated = true,
47
- assignments = [],
48
- statementValidates = statement.validate(assignments, stated, context);
45
+ if ((statement !== null) || (procedureCall !== null)) {
46
+ attempt((context) => {
47
+ if (statement !== null) {
48
+ const assignments = [],
49
+ statementValidates = this.validateStatement(assignments, context);
49
50
 
50
- if (statementValidates) {
51
- const assignmentsAssigned = assignAssignments(assignments, context);
51
+ if (statementValidates) {
52
+ const assignmentsAssigned = assignAssignments(assignments, context);
52
53
 
53
- if (assignmentsAssigned) {
54
- const subproofOrProofAssertion = this; ///
54
+ if (assignmentsAssigned) {
55
+ const subproofOrProofAssertion = this; ///
55
56
 
56
- context.addSubproofOrProofAssertion(subproofOrProofAssertion);
57
+ context.addSubproofOrProofAssertion(subproofOrProofAssertion);
57
58
 
58
- verifies = true;
59
+ this.setContext(context);
60
+
61
+ verifies = true;
62
+ }
59
63
  }
60
64
  }
61
- }
62
65
 
63
- if (this.procedureCall !== null) {
64
- const stated = true,
65
- assignments = null,
66
- procedureCallVerifies = this.procedureCall.verify(assignments, stated, context);
66
+ if (procedureCall !== null) {
67
+ const procedureCallValidates = procedureCall.validate(context);
68
+
69
+ if (procedureCallValidates) {
70
+ this.setContext(context);
67
71
 
68
- if (procedureCallVerifies) {
69
- verifies = true;
72
+ verifies = true;
73
+ }
70
74
  }
71
- }
75
+ }, context);
76
+ } else {
77
+ context.debug(`Unable to verify the '${premiseString}' premise because it is nonsense.`, node);
72
78
  }
73
79
 
74
80
  if (verifies) {
75
- this.setContext(context);
76
-
77
81
  context.debug(`...verified the '${premiseString}' premise.`, node);
78
82
  }
79
83
 
@@ -83,16 +87,15 @@ export default define(class Premise extends ProofAssertion {
83
87
  unifyIndependently(substitutions, context) {
84
88
  let unifiesIndependently = false;
85
89
 
86
- const node = this.getNode(),
87
- premiseString = this.getString(); ///
90
+ const premiseString = this.getString(); ///
88
91
 
89
- context.trace(`Unifying the '${premiseString}' premise independently...`, node);
92
+ context.trace(`Unifying the '${premiseString}' premise independently...`);
90
93
 
91
- const generalContext = context; ///
94
+ const specificContext = context; ///
92
95
 
93
96
  context = this.getContext();
94
97
 
95
- const specificContext = context; ///
98
+ const generalContext = context; ///
96
99
 
97
100
  context = specificContext; ///
98
101
 
@@ -115,7 +118,7 @@ export default define(class Premise extends ProofAssertion {
115
118
  }
116
119
 
117
120
  if (unifiesIndependently) {
118
- context.debug(`...unified the '${premiseString}' premise independenly.`, node);
121
+ context.debug(`...unified the '${premiseString}' premise independenly.`);
119
122
  }
120
123
 
121
124
  return unifiesIndependently;
@@ -126,13 +129,13 @@ export default define(class Premise extends ProofAssertion {
126
129
 
127
130
  const subproofOrProofAssertionProofAssertion = subproofOrProofAssertion.isProofAssertion(),
128
131
  proofAssertion = subproofOrProofAssertionProofAssertion ?
129
- subproofOrProofAssertion :
130
- null,
132
+ subproofOrProofAssertion :
133
+ null,
131
134
  subproof = subproofOrProofAssertionProofAssertion ?
132
135
  null :
133
136
  subproofOrProofAssertion;
134
137
 
135
- substitutions.snapshot();
138
+ substitutions.snapshot(context);
136
139
 
137
140
  if (subproof !== null) {
138
141
  const subproofUnifies = this.unifySubproof(subproof, substitutions, context);
@@ -155,7 +158,7 @@ export default define(class Premise extends ProofAssertion {
155
158
  }
156
159
 
157
160
  subproofOrProofAssertionUnifies ?
158
- substitutions.continue() :
161
+ substitutions.continue(context) :
159
162
  substitutions.rollback(context);
160
163
 
161
164
  return subproofOrProofAssertionUnifies;
@@ -164,11 +167,10 @@ export default define(class Premise extends ProofAssertion {
164
167
  unifyProofAssertion(proofAssertion, substitutions, context) {
165
168
  let proofAssertionUnifies = false;
166
169
 
167
- const node = this.getNode(),
168
- premiseString = this.getString(),
170
+ const premiseString = this.getString(), ///
169
171
  proofAssertionString = proofAssertion.getString();
170
172
 
171
- context.trace(`Unifying the '${proofAssertionString}' proof assertion with the '${premiseString}' premise...`, node);
173
+ context.trace(`Unifying the '${proofAssertionString}' proof assertion with the '${premiseString}' premise...`);
172
174
 
173
175
  const specificContext = context; ///
174
176
 
@@ -178,15 +180,20 @@ export default define(class Premise extends ProofAssertion {
178
180
 
179
181
  context = specificContext; ///
180
182
 
181
- const statement = proofAssertion.getStatement(),
182
- statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
183
+ const proofAssertionContext = proofAssertion.getContext(),
184
+ statementUnifies = synthetically((specificContext) => {
185
+ const statement = proofAssertion.getStatement(),
186
+ statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
187
+
188
+ return statementUnifies;
189
+ }, specificContext, proofAssertionContext);
183
190
 
184
191
  if (statementUnifies) {
185
192
  proofAssertionUnifies = true;
186
193
  }
187
194
 
188
195
  if (proofAssertionUnifies) {
189
- context.debug(`...unified the '${proofAssertionString}' proof assertion with the '${premiseString}' premise.`, node);
196
+ context.debug(`...unified the '${proofAssertionString}' proof assertion with the '${premiseString}' premise.`);
190
197
  }
191
198
 
192
199
  return proofAssertionUnifies;
@@ -270,8 +277,7 @@ export default define(class Premise extends ProofAssertion {
270
277
  const terms = termsFromJSON(json, context),
271
278
  frames = framesFromJSON(json, context),
272
279
  statement = statementFromJSON(json, context),
273
- procedureCall = procedureCallFromJSON(json, context),
274
- temporaryContext = TemporaryContext.fromTermsAndFrames(terms, frames, context);
280
+ procedureCall = procedureCallFromJSON(json, context);
275
281
 
276
282
  let string;
277
283
 
@@ -285,8 +291,6 @@ export default define(class Premise extends ProofAssertion {
285
291
 
286
292
  const node = null;
287
293
 
288
- context = temporaryContext; ///
289
-
290
294
  const premise = new Premise(context, string, node, statement, procedureCall);
291
295
 
292
296
  return premise;
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
 
3
- import elements from "../elements";
4
- import ProofAssertion from "./proofAssertion";
5
- import TemporaryContext from "../context/temporary";
3
+ import elements from "../../elements";
4
+ import ProofAssertion from "../proofAssertion";
6
5
 
7
- import { define } from "../elements";
8
- import { unifyStatements } from "../utilities/unification";
9
- import { propertyAssertionFromStatement } from "../utilities/statement";
6
+ import { define } from "../../elements";
7
+ import { unifyStatements } from "../../utilities/unification";
8
+ import { attempt, liminally } from "../../utilities/context";
9
+ import { propertyAssertionFromStatement } from "../../utilities/statement";
10
10
 
11
11
  export default define(class Step extends ProofAssertion {
12
12
  constructor(context, string, node, statement, reference, satisfiesAssertion) {
@@ -56,13 +56,9 @@ export default define(class Step extends ProofAssertion {
56
56
  return comparesToTermAndPropertyRelation;
57
57
  }
58
58
 
59
- verify(substitutions, assignments, context) {
59
+ verify(assignments, context) {
60
60
  let verifies = false;
61
61
 
62
- const temporaryContext = TemporaryContext.fromNothing(context);
63
-
64
- context = temporaryContext; ///
65
-
66
62
  const node = this.getNode(),
67
63
  stepString = this.getString(); ///
68
64
 
@@ -70,39 +66,44 @@ export default define(class Step extends ProofAssertion {
70
66
 
71
67
  const statement = this.getStatement();
72
68
 
73
- if (statement === null) {
74
- context.debug(`Unable to verify the '${stepString}' step because it is nonsense.`, node);
75
- } else {
76
- const referenceVerifies = this.verifyReference(context);
69
+ if (statement !== null) {
70
+ attempt((context) => {
71
+ const referenceValidates = this.validateReference(context);
77
72
 
78
- if (referenceVerifies) {
79
- const satisfiesAssertioVeriries = this.verifySatisfiesAssertion(context);
73
+ if (referenceValidates) {
74
+ const satisfiesAssertioValidates = this.validateSatisfiesAssertion(context);
80
75
 
81
- if (satisfiesAssertioVeriries) {
82
- const stated = this.isStated(),
83
- statementValidates = statement.validate(assignments, stated, context);
76
+ if (satisfiesAssertioValidates) {
77
+ const statementValidates = this.validateStatement(assignments, context);
84
78
 
85
- if (statementValidates) {
86
- const statementUnifies = unifyStatements.some((unifyStatement) => {
87
- const statementUnifies = unifyStatement(statement, this.reference, this.satisfiesAssertion, substitutions, context);
88
-
89
- if (statementUnifies) {
90
- return true;
91
- }
92
- });
79
+ if (statementValidates) {
80
+ const reference = this.getReference(),
81
+ satisfiesAssertion = this.getSatisfiesAssertion(),
82
+ statementUnifies = liminally((context) => {
83
+ const statementUnifies = unifyStatements.some((unifyStatement) => {
84
+ const statementUnifies = unifyStatement(statement, reference, satisfiesAssertion, context);
93
85
 
94
- if (statementUnifies) {
95
- const subproofOrProofAssertion = this; ///
86
+ if (statementUnifies) {
87
+ this.setContext(context);
96
88
 
97
- context.addSubproofOrProofAssertion(subproofOrProofAssertion);
89
+ return true;
90
+ }
91
+ });
98
92
 
99
- this.setContext(context);
93
+ return statementUnifies;
94
+ }, context);
100
95
 
101
- verifies = true;
96
+ if (statementUnifies) {
97
+ verifies = true;
98
+ }
102
99
  }
103
100
  }
104
101
  }
105
- }
102
+
103
+ return verifies;
104
+ }, context);
105
+ } else {
106
+ context.debug(`Unable to verify the '${stepString}' step because it is nonsense.`, node);
106
107
  }
107
108
 
108
109
  if (verifies) {
@@ -112,55 +113,51 @@ export default define(class Step extends ProofAssertion {
112
113
  return verifies;
113
114
  }
114
115
 
115
- verifyReference(context) {
116
- let referenceVeriries;
116
+ validateReference(context) {
117
+ let referenceValidates = true;
117
118
 
118
- const node = this.getNode(),
119
- stepString = this.getString(); ///
119
+ if (this.reference !== null) {
120
+ const stepString = this.getString(), ///
121
+ referenceString = this.reference.getString();
120
122
 
121
- context.trace(`Verifying the '${stepString}' step's reference... `, node);
123
+ context.trace(`Validating the '${stepString}' step's '${referenceString}' reference... `);
122
124
 
123
- if (this.reference !== null) {
124
- referenceVeriries = this.reference.verify(context);
125
- } else {
126
- referenceVeriries = true;
127
- }
125
+ referenceValidates = this.reference.validate(context);
128
126
 
129
- if (referenceVeriries) {
130
- context.debug(`...verified the '${stepString}' step's reference. `, node);
127
+ if (referenceValidates) {
128
+ context.debug(`...validated the '${stepString}' step's '${referenceString}' reference. `);
129
+ }
131
130
  }
132
131
 
133
- return referenceVeriries;
132
+ return referenceValidates;
134
133
  }
135
134
 
136
- verifySatisfiesAssertion(context) {
137
- let satisfiesAssertionVerifies;
135
+ validateSatisfiesAssertion(context) {
136
+ let satisfiesAssertionValidates = true; ///
138
137
 
139
- const node = this.getNode(),
140
- stepString = this.getString(); ///
138
+ if (this.satisfiesAssertion !== null) {
139
+ const stepString = this.getString(), ///
140
+ satisfiesAssertion = this.satisfiesAssertion.getString();
141
141
 
142
- context.trace(`Verifying the '${stepString}' step's satisfies assertion... `, node);
142
+ context.trace(`Validating the '${stepString}' step's '${satisfiesAssertion}' satisfies assertion... `);
143
143
 
144
- if (this.satisfiesAssertion !== null) {
145
144
  const stated = true,
146
145
  assignments = null;
147
146
 
148
- satisfiesAssertionVerifies = this.satisfiesAssertion.validate(assignments, stated, context);
149
- } else {
150
- satisfiesAssertionVerifies = true;
151
- }
147
+ satisfiesAssertionValidates = this.satisfiesAssertion.validate(assignments, stated, context);
152
148
 
153
- if (satisfiesAssertionVerifies) {
154
- context.debug(`...verified the '${stepString}' step's satisfies assertion. `, node);
149
+ if (satisfiesAssertionValidates) {
150
+ context.debug(`...validating the '${stepString}' step's '${satisfiesAssertion}' satisfies assertion. `);
151
+ }
155
152
  }
156
153
 
157
- return satisfiesAssertionVerifies;
154
+ return satisfiesAssertionValidates;
158
155
  }
159
156
 
160
157
  unifyWithSatisfiesAssertion(satisfiesAssertion, context) {
161
158
  let unifiesWithSatisfiesAssertion = false;
162
159
 
163
- const stepString = this.string, ///
160
+ const stepString = this.getString(), ///
164
161
  satisfiesAssertionString = satisfiesAssertion.getString();
165
162
 
166
163
  context.trace(`Unifying the '${stepString}' step with the '${satisfiesAssertionString}' satisfies assertion...`, this.node);
@@ -171,7 +168,7 @@ export default define(class Step extends ProofAssertion {
171
168
  if (axiom !== null) {
172
169
  const { Substitutions } = elements,
173
170
  step = this, ///
174
- substitutions = Substitutions.fromNothing(),
171
+ substitutions = Substitutions.fromNothing(context),
175
172
  stepUnifies = axiom.unifyStep(step, substitutions, context);
176
173
 
177
174
  if (stepUnifies) {
@@ -1,15 +1,22 @@
1
1
  "use strict";
2
2
 
3
- import ProofAssertion from "./proofAssertion";
4
- import TemporaryContext from "../context/temporary";
5
- import assignAssignments from "../process/assign";
6
-
7
- import { define } from "../elements";
8
- import { termsFromJSON, framesFromJSON, statementFromJSON, procedureCallFromJSON, termsToTermsJSON, framesToFramesJSON, statementToStatementJSON, procedureCallToProcedureCallJSON } from "../utilities/json";
3
+ import ProofAssertion from "../proofAssertion";
4
+ import assignAssignments from "../../process/assign";
5
+
6
+ import { define } from "../../elements";
7
+ import { attempt, synthetically } from "../../utilities/context";
8
+ import { termsFromJSON,
9
+ framesFromJSON,
10
+ termsToTermsJSON,
11
+ statementFromJSON,
12
+ framesToFramesJSON,
13
+ procedureCallFromJSON,
14
+ statementToStatementJSON,
15
+ procedureCallToProcedureCallJSON } from "../../utilities/json";
9
16
 
10
17
  export default define(class Supposition extends ProofAssertion {
11
18
  constructor(context, string, node, statement, procedureCall) {
12
- super(context, string, node);
19
+ super(context, string, node, statement);
13
20
 
14
21
  this.procedureCall = procedureCall;
15
22
  }
@@ -18,55 +25,59 @@ export default define(class Supposition extends ProofAssertion {
18
25
  return this.procedureCall;
19
26
  }
20
27
 
21
- verify(context) {
22
- let verifies = false;
28
+ isStated() {
29
+ const stated = true; ///
23
30
 
24
- const temporaryContext = TemporaryContext.fromNothing(context);
31
+ return stated;
32
+ }
25
33
 
26
- context = temporaryContext; ///
34
+ verify(context) {
35
+ let verifies = false;
27
36
 
28
37
  const node = this.getNode(),
29
38
  suppositionString = this.getString(); ///
30
39
 
31
40
  context.trace(`Verifying the '${suppositionString}' supposition...`, node);
32
41
 
33
- const statement = this.getStatement();
42
+ const statement = this.getStatement(),
43
+ procedureCall = this.getProcedureCall();
34
44
 
35
- if ((statement === null) && (this.procedureCall === null)) {
36
- context.debug(`Unable to verify the '${suppositionString}' supposition because it is nonsense.`, node);
37
- } else {
38
- if (statement !== null) {
39
- const stated = true,
40
- assignments = [],
41
- statementValidates = statement.validate(assignments, stated, context);
45
+ if ((statement !== null) || (procedureCall !== null)) {
46
+ attempt((context) => {
47
+ if (statement !== null) {
48
+ const assignments = [],
49
+ statementValidates = this.validateStatement(assignments, context);
42
50
 
43
- if (statementValidates) {
44
- const assignmentsAssigned = assignAssignments(assignments, context);
51
+ if (statementValidates) {
52
+ const assignmentsAssigned = assignAssignments(assignments, context);
45
53
 
46
- if (assignmentsAssigned) {
47
- const subproofOrProofAssertion = this; ///
54
+ if (assignmentsAssigned) {
55
+ const subproofOrProofAssertion = this; ///
48
56
 
49
- context.addSubproofOrProofAssertion(subproofOrProofAssertion);
57
+ context.addSubproofOrProofAssertion(subproofOrProofAssertion);
50
58
 
51
- verifies = true;
59
+ this.setContext(context);
60
+
61
+ verifies = true;
62
+ }
52
63
  }
53
64
  }
54
- }
55
65
 
56
- if (this.procedureCall !== null) {
57
- const stated = true,
58
- assignments = null,
59
- procedureCallVerifies = this.procedureCall.verify(assignments, stated, context);
66
+ if (procedureCall !== null) {
67
+ const procedureCallValidates = procedureCall.validate(context);
68
+
69
+ if (procedureCallValidates) {
70
+ this.setContext(context);
60
71
 
61
- if (procedureCallVerifies) {
62
- verifies = true;
72
+ verifies = true;
73
+ }
63
74
  }
64
- }
75
+ }, context);
76
+ } else {
77
+ context.debug(`Unable to verify the '${suppositionString}' supposition because it is nonsense.`, node);
65
78
  }
66
79
 
67
80
  if (verifies) {
68
- this.setContext(context);
69
-
70
81
  context.debug(`...verified the '${suppositionString}' supposition.`, node);
71
82
  }
72
83
 
@@ -76,10 +87,9 @@ export default define(class Supposition extends ProofAssertion {
76
87
  unifyIndependently(substitutions, context) {
77
88
  let unifiesIndependently = false;
78
89
 
79
- const node = this.getNode(),
80
- suppositionString = this.getString();
90
+ const suppositionString = this.getString(); ///
81
91
 
82
- context.trace(`Unifying the '${suppositionString}' supposition independently...`, node);
92
+ context.trace(`Unifying the '${suppositionString}' supposition independently...`);
83
93
 
84
94
  const specificContext = context; ///
85
95
 
@@ -108,7 +118,7 @@ export default define(class Supposition extends ProofAssertion {
108
118
  }
109
119
 
110
120
  if (unifiesIndependently) {
111
- context.debug(`...unified the '${suppositionString}' supposition independenly.`, node);
121
+ context.debug(`...unified the '${suppositionString}' supposition independenly.`);
112
122
  }
113
123
 
114
124
  return unifiesIndependently;
@@ -125,7 +135,7 @@ export default define(class Supposition extends ProofAssertion {
125
135
  subproofOrProofAssertion :
126
136
  null;
127
137
 
128
- substitutions.snapshot();
138
+ substitutions.snapshot(context);
129
139
 
130
140
  if (subproof !== null) {
131
141
  const subproofUnifies = this.unifySubproof(subproof, substitutions, context);
@@ -148,20 +158,19 @@ export default define(class Supposition extends ProofAssertion {
148
158
  }
149
159
 
150
160
  subproofOrProofAssertionUnifies ?
151
- substitutions.continue() :
161
+ substitutions.continue(context) :
152
162
  substitutions.rollback(context);
153
163
 
154
164
  return subproofOrProofAssertionUnifies;
155
165
  }
156
166
 
157
167
  unifyProofAssertion(proofAssertion, substitutions, context) {
158
- let stepUnifies = false;
168
+ let proofAssertionUnifies = false;
159
169
 
160
- const node = this.getNode(),
161
- suppositionString = this.getString(),
170
+ const suppositionString = this.getString(), ///
162
171
  proofAssertionString = proofAssertion.getString();
163
172
 
164
- context.trace(`Unifying the '${proofAssertionString}' proof assertion with the '${suppositionString}' supposition...`, node);
173
+ context.trace(`Unifying the '${proofAssertionString}' proof assertion with the '${suppositionString}' supposition...`);
165
174
 
166
175
  const specificContext = context; ///
167
176
 
@@ -171,18 +180,23 @@ export default define(class Supposition extends ProofAssertion {
171
180
 
172
181
  context = specificContext; ///
173
182
 
174
- const statement = proofAssertion.getStatement(),
175
- statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
183
+ const proofAssertionContext = proofAssertion.getContext(),
184
+ statementUnifies = synthetically((specificContext) => {
185
+ const statement = proofAssertion.getStatement(),
186
+ statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
187
+
188
+ return statementUnifies;
189
+ }, specificContext, proofAssertionContext);
176
190
 
177
191
  if (statementUnifies) {
178
- stepUnifies = true;
192
+ proofAssertionUnifies = true;
179
193
  }
180
194
 
181
- if (stepUnifies) {
182
- context.debug(`...unified the '${proofAssertionString}' proof assertion with the '${suppositionString}' supposition.`, node);
195
+ if (proofAssertionUnifies) {
196
+ context.debug(`...unified the '${proofAssertionString}' proof assertion with the '${suppositionString}' supposition.`);
183
197
  }
184
198
 
185
- return stepUnifies;
199
+ return proofAssertionUnifies;
186
200
  }
187
201
 
188
202
  unifySubproof(subproof, substitutions, context) {
@@ -190,7 +204,7 @@ export default define(class Supposition extends ProofAssertion {
190
204
 
191
205
  const node = this.getNode(),
192
206
  subproofString = subproof.getString(),
193
- suppositionString = this.getString();
207
+ suppositionString = this.getString(); ///
194
208
 
195
209
  context.trace(`Unifying the '${subproofString}' subproof with the '${suppositionString}' supposition...`, node);
196
210
 
@@ -286,8 +300,7 @@ export default define(class Supposition extends ProofAssertion {
286
300
  const terms = termsFromJSON(json, context),
287
301
  frames = framesFromJSON(json, context),
288
302
  statement = statementFromJSON(json, context),
289
- procedureCall = procedureCallFromJSON(json, context),
290
- temporaryContext = TemporaryContext.fromTermsAndFrames(terms, frames, context);
303
+ procedureCall = procedureCallFromJSON(json, context);
291
304
 
292
305
  let string;
293
306
 
@@ -301,8 +314,6 @@ export default define(class Supposition extends ProofAssertion {
301
314
 
302
315
  const node = null;
303
316
 
304
- context = temporaryContext; ///
305
-
306
317
  const supposition = new Supposition(context, string, node, statement, procedureCall);
307
318
 
308
319
  return supposition;