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
@@ -34,7 +34,7 @@ export default define(class Assumption extends Element {
34
34
  compareSubstitution(substitution, context) {
35
35
  let comparesToSubstituion = false;
36
36
 
37
- const assumptionString = this.string, ///
37
+ const assumptionString = this.getString(), ///
38
38
  substitutionString = substitution.getString();
39
39
 
40
40
  context.trace(`Comparing the '${assumptionString}' assumption to the '${substitutionString}' substitution...`);
@@ -71,75 +71,59 @@ export default define(class Assumption extends Element {
71
71
  return comparesToSubstituion;
72
72
  }
73
73
 
74
- verify(assignments, stated, context) {
75
- let verifies = false;
74
+ validate(assignments, stated, context) {
75
+ let validates = false;
76
76
 
77
- const assumptionString = this.string; ///
77
+ const assumptionString = this.getString(); ///
78
78
 
79
- context.trace(`Verifying the '${assumptionString}' assumption...`);
79
+ context.trace(`Validating the '${assumptionString}' assumption...`);
80
80
 
81
81
  const simple = this.isSimple();
82
82
 
83
83
  if (simple) {
84
- const referenceVerifiesAsMetavariable = this.verifyReferenceAsMetavariable(assignments, stated, context);
84
+ const referenceValidatesAsMetavariable = this.validateReferenceAsMetavariable(assignments, stated, context);
85
85
 
86
- verifies = referenceVerifiesAsMetavariable; ///
86
+ if (referenceValidatesAsMetavariable) {
87
+ validates = true;
88
+ }
87
89
  } else {
88
- const referenceVerified = this.verifyReference(assignments, stated, context);
90
+ const referenceValidates = this.reference.validate(context);
89
91
 
90
- if (referenceVerified) {
92
+ if (referenceValidates) {
91
93
  const statementValidates = this.validateStatement(assignments, stated, context);
92
94
 
93
95
  if (statementValidates) {
94
- let verifiesWhenStated = false,
95
- verifiesWhenDerived = false;
96
+ let validatesWhenStated = false,
97
+ validatesWhenDerived = false;
96
98
 
97
99
  if (stated) {
98
- verifiesWhenStated = this.verifyWhenStated(assignments, context);
100
+ validatesWhenStated = this.validateWhenStated(assignments, context);
99
101
  } else {
100
- verifiesWhenDerived = this.verifyWhenDerived(context);
102
+ validatesWhenDerived = this.validateWhenDerived(context);
101
103
  }
102
104
 
103
- if (verifiesWhenStated || verifiesWhenDerived) {
104
- verifies = true;
105
+ if (validatesWhenStated || validatesWhenDerived) {
106
+ validates = true;
105
107
  }
106
108
  }
107
109
  }
108
110
 
109
- if (verifies) {
110
- context.debug(`...verified the '${assumptionString}' assumption.`);
111
+ if (validates) {
112
+ context.debug(`...validated the '${assumptionString}' assumption.`);
111
113
  }
112
114
  }
113
115
 
114
- return verifies;
115
- }
116
-
117
- verifyReference(assignments, stated, context) {
118
- let referenceVerified;
119
-
120
- const referenceString = this.reference.getString(),
121
- assumptionString = this.string; ///
122
-
123
- context.trace(`Verifying the '${assumptionString}' assumption's '${referenceString}' reference...`);
124
-
125
- referenceVerified = this.reference.verify(context);
126
-
127
- if (referenceVerified) {
128
- context.debug(`...verified the '${assumptionString}' assumption's '${referenceString}' reference.`);
129
- }
130
-
131
- return referenceVerified;
116
+ return validates;
132
117
  }
133
118
 
134
119
  validateStatement(assignments, stated, context) {
135
- let statementValidates;
120
+ let statementValidates = true; ///
136
121
 
137
- if (this.statement === null) {
138
- statementValidates = true;
139
- } else {
140
- const statementString = this.statement.getString();
122
+ if (this.statement !== null) {
123
+ const assumptionString = this.getString(),
124
+ statementString = this.statement.getString();
141
125
 
142
- context.trace(`Validating the '${statementString}' statement...`);
126
+ context.trace(`Validating the '${assumptionString}' assumption's '${statementString}' statement...`);
143
127
 
144
128
  stated = true; ///
145
129
 
@@ -148,83 +132,77 @@ export default define(class Assumption extends Element {
148
132
  statementValidates = this.statement.validate(assignments, stated, context);
149
133
 
150
134
  if (statementValidates) {
151
- context.debug(`...validated the '${statementString}' statement.`);
135
+ context.debug(`...validated the '${assumptionString}' assumption's '${statementString}' statement.`);
152
136
  }
153
137
  }
154
138
 
155
139
  return statementValidates;
156
140
  }
157
141
 
158
- verifyReferenceAsMetavariable(assignments, stated, context) {
159
- let referenceVerifiesAsMetavariable = false;
142
+ validateReferenceAsMetavariable(assignments, stated, context) {
143
+ let referenceValidatesAsMetavariable;
160
144
 
161
145
  const referenceString = this.reference.getString(),
162
- assumptionString = this.string; ///
146
+ assumptionString = this.getString(); ///
163
147
 
164
- context.trace(`Verifying the '${assumptionString}' assumption's '${referenceString}' reference as s metavariable...`);
148
+ context.trace(`Validating the '${assumptionString}' assumption's '${referenceString}' reference as s metavariable...`);
165
149
 
166
- const metavariable = this.reference.getMetavariable(),
167
- metavariableName = metavariable.getName(),
168
- metavariablePresent = context.isMetavariablePresentByMetavariableName(metavariableName);
169
-
170
- if (metavariablePresent) {
171
- referenceVerifiesAsMetavariable = true;
172
- }
150
+ referenceValidatesAsMetavariable = this.reference.validateAsMetavariable(context);
173
151
 
174
- if (referenceVerifiesAsMetavariable) {
175
- context.debug(`...verified the '${assumptionString}' assumption's '${referenceString}' reference as a metavariable.`);
152
+ if (referenceValidatesAsMetavariable) {
153
+ context.debug(`...validated the '${assumptionString}' assumption's '${referenceString}' reference as a metavariable.`);
176
154
  }
177
155
 
178
- return referenceVerifiesAsMetavariable;
156
+ return referenceValidatesAsMetavariable;
179
157
  }
180
158
 
181
- verifyWhenStated(assignments, context) {
182
- let verifiesWhenStated;
159
+ validateWhenStated(assignments, context) {
160
+ let validatesWhenStated;
183
161
 
184
- const assumptionString = this.string; ///
162
+ const assumptionString = this.getString(); ///
185
163
 
186
- context.trace(`Verifying the '${assumptionString}' stated assumption...`);
164
+ context.trace(`Validating the '${assumptionString}' stated assumption...`);
187
165
 
188
166
  const metavariablePresent = context.isMetavariablePresentByReference(this.reference);
189
167
 
190
168
  if (metavariablePresent) {
191
- verifiesWhenStated = true;
169
+ validatesWhenStated = true;
192
170
  } else {
193
- const metaLemmaMetatheorems = context.findMetaLemmaMetatheoremsByReference(this.reference),
194
- metaLemmaMetatheoremsUnify = metaLemmaMetatheorems.every((metaLemmaMetatheorem) => {
195
- const metaLemmaMetatheoremUnifies = this.unifyMetaLemmaMetatheorem(metaLemmaMetatheorem, context);
171
+ const topLevelMetaAssertions = context.findTopLevelMetaAssertionsByReference(this.reference),
172
+ topLevelMetaAssertionsUnify = topLevelMetaAssertions.every((topLevelMetaAssertion) => {
173
+ const topLevelMetaAssertionUnifies = this.unifyTopLevelMetaAssertion(topLevelMetaAssertion, context);
196
174
 
197
- if (metaLemmaMetatheoremUnifies) {
175
+ if (topLevelMetaAssertionUnifies) {
198
176
  return true;
199
177
  }
200
178
  });
201
179
 
202
- verifiesWhenStated = metaLemmaMetatheoremsUnify; ///
180
+ validatesWhenStated = topLevelMetaAssertionsUnify; ///
203
181
  }
204
182
 
205
- if (verifiesWhenStated) {
206
- context.debug(`...verified the '${assumptionString}' stated assumption.`);
183
+ if (validatesWhenStated) {
184
+ context.debug(`...validated the '${assumptionString}' stated assumption.`);
207
185
  }
208
186
 
209
- return verifiesWhenStated;
187
+ return validatesWhenStated;
210
188
  }
211
189
 
212
- verifyWhenDerived(context) {
213
- let verifiesWhenDerived;
190
+ validateWhenDerived(context) {
191
+ let validatesWhenDerived;
214
192
 
215
- const assumptionString = this.string; ///
193
+ const assumptionString = this.getString(); ///
216
194
 
217
- context.trace(`Verifying the '${assumptionString}' derived assumption...`);
195
+ context.trace(`Validating the '${assumptionString}' derived assumption...`);
218
196
 
219
- const metaLemmaMetatheoremPresent = context.isMetaLemmaMetatheoremPresentByReference(this.reference);
197
+ const topLevelMetaAssertionPresent = context.isTopLevelMetaAssertionPresentByReference(this.reference);
220
198
 
221
- verifiesWhenDerived = metaLemmaMetatheoremPresent; ///
199
+ validatesWhenDerived = topLevelMetaAssertionPresent; ///
222
200
 
223
- if (verifiesWhenDerived) {
224
- context.debug(`...verified the '${assumptionString}' derived assumption.`);
201
+ if (validatesWhenDerived) {
202
+ context.debug(`...validated the '${assumptionString}' derived assumption.`);
225
203
  }
226
204
 
227
- return verifiesWhenDerived;
205
+ return validatesWhenDerived;
228
206
  }
229
207
 
230
208
  unifyStatement(statement, substitutions, generalContext, specificContext) {
@@ -260,7 +238,7 @@ export default define(class Assumption extends Element {
260
238
 
261
239
  const context = generalContext, ///
262
240
  labelString = label.getString(),
263
- assumptionString = this.string; //;/
241
+ assumptionString = this.getString(); //;/
264
242
 
265
243
  context.trace(`Unifying the '${labelString}' label with the '${assumptionString}' assumption...`);
266
244
 
@@ -275,28 +253,28 @@ export default define(class Assumption extends Element {
275
253
  return labelUnifiesWithReference;
276
254
  }
277
255
 
278
- unifyMetaLemmaMetatheorem(metaLemmaMetatheorem, context) {
279
- let metaLemmaMetatheoremUnifies = false;
256
+ unifyTopLevelMetaAssertion(topLevelMetaAssertion, context) {
257
+ let topLevelMetaAssertionUnifies = false;
280
258
 
281
- const assumptionString = this.string, ///
282
- metaLemmaMetatheoremString = metaLemmaMetatheorem.getString();
259
+ const assumptionString = this.getString(), ///
260
+ topLevelMetaAssertionString = topLevelMetaAssertion.getString();
283
261
 
284
- context.trace(`Unifying the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem with the '${assumptionString}' assumption...`);
262
+ context.trace(`Unifying the '${topLevelMetaAssertionString}' top level meta-assertion with the '${assumptionString}' assumption...`);
285
263
 
286
264
  const generalContext = context; ///
287
265
 
288
- context = metaLemmaMetatheorem.getContext(); ///
266
+ context = topLevelMetaAssertion.getContext(); ///
289
267
 
290
268
  const { Substitutions } = elements,
291
269
  specificContext = context, ///
292
- labelSubstitutions = Substitutions.fromNothing(),
293
- label = metaLemmaMetatheorem.getLabel(),
270
+ labelSubstitutions = Substitutions.fromNothing(context),
271
+ label = topLevelMetaAssertion.getLabel(),
294
272
  substitutions = labelSubstitutions, ///
295
273
  labelUnifies = this.unifyLabel(label, substitutions, generalContext, specificContext);
296
274
 
297
275
  if (labelUnifies) {
298
- const statementSubstitutions = Substitutions.fromNothing(),
299
- statement = metaLemmaMetatheorem.getStatement(),
276
+ const statementSubstitutions = Substitutions.fromNothing(context),
277
+ statement = topLevelMetaAssertion.getStatement(),
300
278
  substitutions = statementSubstitutions, ///
301
279
  statementUUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
302
280
 
@@ -304,18 +282,18 @@ export default define(class Assumption extends Element {
304
282
  const labelSubstitutionsCorrelateStatementSubstitutions = labelSubstitutions.correlateSubstitutions(statementSubstitutions);
305
283
 
306
284
  if (labelSubstitutionsCorrelateStatementSubstitutions) {
307
- metaLemmaMetatheoremUnifies = true; ///
285
+ topLevelMetaAssertionUnifies = true; ///
308
286
  }
309
287
  }
310
288
  }
311
289
 
312
- if (metaLemmaMetatheoremUnifies) {
290
+ if (topLevelMetaAssertionUnifies) {
313
291
  context = generalContext; ///
314
292
 
315
- context.trace(`...unified the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem with the '${assumptionString}' assumption...`);
293
+ context.trace(`...unified the '${topLevelMetaAssertionString}' top level meta-assertion with the '${assumptionString}' assumption...`);
316
294
  }
317
295
 
318
- return metaLemmaMetatheoremUnifies;
296
+ return topLevelMetaAssertionUnifies;
319
297
  }
320
298
 
321
299
  toJSON() {
@@ -3,7 +3,6 @@
3
3
  import Combinator from "../combinator";
4
4
 
5
5
  import { define } from "../../elements";
6
- import { bracketedCombinatorFromNothing } from "../../utilities/instance";
7
6
 
8
7
  export default define(class BracketedCombinator extends Combinator {
9
8
  unifyStatement(statement, assignments, stated, context) {
@@ -23,10 +22,4 @@ export default define(class BracketedCombinator extends Combinator {
23
22
  }
24
23
 
25
24
  static name = "BracketedCombinator";
26
-
27
- static fromNothing() {
28
- const bracketedCombinator = bracketedCombinatorFromNothing();
29
-
30
- return bracketedCombinator;
31
- }
32
25
  });
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
 
3
3
  import Element from "../element";
4
- import TemporaryContext from "../context/temporary";
5
4
 
6
5
  import { define } from "../elements";
6
+ import { attempt } from "../utilities/context";
7
7
  import { termsFromJSON, framesFromJSON, statementFromJSON, termsToTermsJSON, framesToFramesJSON, statementToStatementJSON } from "../utilities/json";
8
8
 
9
9
  export default define(class Conclusion extends Element {
@@ -20,30 +20,28 @@ export default define(class Conclusion extends Element {
20
20
  verify(context) {
21
21
  let verifies = false;
22
22
 
23
- const temporaryContext = TemporaryContext.fromNothing(context);
24
-
25
- context = temporaryContext; ///
26
-
27
23
  const node = this.getNode(),
28
24
  conclusionString = this.getString(); ///
29
25
 
30
26
  context.trace(`Verifying the '${conclusionString}' conclusion...`, node);
31
27
 
32
- if (this.statement === null) {
33
- context.debug(`Unable to verify the '${conclusionString}' conclusion because it is nonsense.`, node);
34
- } else {
35
- const stated = true,
36
- assignments = null,
37
- statementValidates = this.statement.validate(assignments, stated, context);
28
+ if (this.statement !== null) {
29
+ attempt((context) => {
30
+ const stated = true,
31
+ assignments = null,
32
+ statementValidates = this.statement.validate(assignments, stated, context);
33
+
34
+ if (statementValidates) {
35
+ this.setContext(context);
38
36
 
39
- if (statementValidates) {
40
- verifies = true;
41
- }
37
+ verifies = true;
38
+ }
39
+ }, context);
40
+ } else {
41
+ context.debug(`Unable to verify the '${conclusionString}' conclusion because it is nonsense.`, node);
42
42
  }
43
43
 
44
44
  if (verifies) {
45
- this.setContext(context);
46
-
47
45
  context.debug(`...verified the '${conclusionString}' conclusion.`, node);
48
46
  }
49
47
 
@@ -53,14 +51,18 @@ export default define(class Conclusion extends Element {
53
51
  unifyStatement(statement, substitutions, context) {
54
52
  let statementUnifies;
55
53
 
56
- const conclusion = this, ///
57
- statementString = statement.getString(),
58
- conclusionString = conclusion.getString();
54
+ const statementString = statement.getString(),
55
+ conclusionString = this.getString(); ///
59
56
 
60
57
  context.trace(`Unifying the '${statementString}' statement with the '${conclusionString}' conclusion...`);
61
58
 
62
- const generalContext = this.context, ///
63
- specificContext = context; ///
59
+ const specificContext = context; ///
60
+
61
+ context = this.getContext();
62
+
63
+ const generalContext = context; ///
64
+
65
+ context = specificContext; ///
64
66
 
65
67
  statementUnifies = this.statement.unifyStatement(statement, substitutions, generalContext, specificContext);
66
68
 
@@ -104,10 +106,9 @@ export default define(class Conclusion extends Element {
104
106
  frames = framesFromJSON(json, context),
105
107
  statement = statementFromJSON(json, context),
106
108
  node = null,
107
- string = statement.getString(),
108
- temporaryContext = TemporaryContext.fromTermsAndFrames(terms, frames, context);
109
+ string = statement.getString();
109
110
 
110
- context = temporaryContext; ///
111
+ context = ephemeralContext; ///
111
112
 
112
113
  const conclusion = new Conclusion(context, string, node, statement);
113
114
 
@@ -4,7 +4,6 @@ import elements from "../../elements";
4
4
  import Constructor from "../constructor";
5
5
 
6
6
  import { define } from "../../elements";
7
- import { bracketedConstructorFromNothing } from "../../utilities/instance";
8
7
 
9
8
  export default define(class BracketedConstructor extends Constructor {
10
9
  unifyTerm(term, context, verifyAhead) {
@@ -53,10 +52,4 @@ export default define(class BracketedConstructor extends Constructor {
53
52
  }
54
53
 
55
54
  static name = "BracketedConstructor";
56
-
57
- static fromNothing() {
58
- const bracketedConstructor = bracketedConstructorFromNothing();
59
-
60
- return bracketedConstructor;
61
- }
62
55
  });
@@ -27,7 +27,7 @@ export default define(class Constructor extends Element {
27
27
  let termUnifies = false;
28
28
 
29
29
  const termString = term.getString(),
30
- constructorString = this.getString();
30
+ constructorString = this.getString(); ///
31
31
 
32
32
  context.trace(`Unifying the '${termString}' term with the '${constructorString}' constructor...`);
33
33
 
@@ -3,7 +3,6 @@
3
3
  import Declaration from "../declaration";
4
4
 
5
5
  import { define } from "../../elements";
6
- import { verifyStatement } from "../../process/verify";
7
6
 
8
7
  export default define(class CombinatorDeclaration extends Declaration {
9
8
  constructor(context, string, node, combinator) {
@@ -76,7 +76,7 @@ export default define(class MetavariableDeclaration extends Declaration {
76
76
  context = this.getContext(),
77
77
  metavariableString = metavariable.getString();
78
78
 
79
- context.trace(`Verifying the '${metavariableString}' metavariable when declared...`, node);
79
+ context.trace(`Verifying the '${metavariableString}' metavariable...`, node);
80
80
 
81
81
  const metavariableNode = metavariable.getNode(), ///
82
82
  termNode = metavariableNode.getTermNode();
@@ -98,7 +98,7 @@ export default define(class MetavariableDeclaration extends Declaration {
98
98
  }
99
99
 
100
100
  if (metavariableVerifies) {
101
- context.debug(`...verified the '${metavariableString}' metavariable when declared.`, node);
101
+ context.debug(`...verified the '${metavariableString}' metavariable.`, node);
102
102
  }
103
103
 
104
104
  return metavariableVerifies;
@@ -65,7 +65,7 @@ export default define(class VariableDeclaration extends Declaration {
65
65
  context.debug(`...verified the '${variableString}' variable.`, node);
66
66
  }
67
67
 
68
- return variableVerifies;
68
+ return variableVerifies;
69
69
  }
70
70
 
71
71
  verifyVariableType() {
@@ -82,7 +82,9 @@ export default define(class VariableDeclaration extends Declaration {
82
82
 
83
83
  context.trace(`Verifying the '${typeString}' type...`, node);
84
84
 
85
- const nominalTypeName = type.getNominalTypeName();
85
+ const includeSupertypes = false,
86
+ provisional = type.isProvisional(includeSupertypes),
87
+ nominalTypeName = type.getNominalTypeName();
86
88
 
87
89
  type = context.findTypeByNominalTypeName(nominalTypeName);
88
90
 
@@ -91,9 +93,7 @@ export default define(class VariableDeclaration extends Declaration {
91
93
  if (!typePresent) {
92
94
  context.debug(`The '${typeString}' type is not present.`, node);
93
95
  } else {
94
- const includeSupertypes = false,
95
- provisional = type.isProvisional(includeSupertypes),
96
- typeComparesToProvisional = type.compareProvisional(provisional);
96
+ const typeComparesToProvisional = type.compareProvisional(provisional);
97
97
 
98
98
  if (!typeComparesToProvisional) {
99
99
  provisional ?
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
 
3
3
  import Element from "../element";
4
- import TemporaryContext from "../context/temporary";
4
+ import EphemeralContext from "../context/ephemeral";
5
5
 
6
6
  import { define } from "../elements";
7
+ import { attempt } from "../utilities/context";
7
8
  import { termsFromJSON, framesFromJSON, statementFromJSON, termsToTermsJSON, framesToFramesJSON, statementToStatementJSON } from "../utilities/json";
8
9
 
9
10
  export default define(class Deduction extends Element {
@@ -20,30 +21,28 @@ export default define(class Deduction extends Element {
20
21
  verify(context) {
21
22
  let verifies = false;
22
23
 
23
- const temporaryContext = TemporaryContext.fromNothing(context);
24
-
25
- context = temporaryContext; ///
26
-
27
24
  const node = this.getNode(),
28
25
  deductionString = this.getString(); ///
29
26
 
30
27
  context.trace(`Verifying the '${deductionString}' deduction...`, node);
31
28
 
32
- if (this.statement === null) {
33
- context.debug(`Unable to verify the '${deductionString}' deduction because it is nonsense.`, node);
34
- } else {
35
- const stated = true,
36
- assignments = null,
37
- statementVealidates = this.statement.validate(assignments, stated, context);
29
+ if (this.statement !== null) {
30
+ attempt((context) => {
31
+ const stated = true,
32
+ assignments = null,
33
+ statementValidates = this.statement.validate(assignments, stated, context);
38
34
 
39
- if (statementVealidates) {
40
- verifies = true;
41
- }
35
+ if (statementValidates) {
36
+ this.setContext(context);
37
+
38
+ verifies = true;
39
+ }
40
+ }, context);
41
+ } else {
42
+ context.debug(`Unable to verify the '${deductionString}' deduction because it is nonsense.`, node);
42
43
  }
43
44
 
44
45
  if (verifies) {
45
- this.setContext(context);
46
-
47
46
  context.debug(`...verified the '${deductionString}' deduction.`, node);
48
47
  }
49
48
 
@@ -53,14 +52,18 @@ export default define(class Deduction extends Element {
53
52
  unifyStatement(statement, substitutions, context) {
54
53
  let statementUnifies;
55
54
 
56
- const deduction = this, ///
57
- statementString = statement.getString(),
58
- deductionString = deduction.getString();
55
+ const statementString = statement.getString(),
56
+ deductionString = this.getString(); ///
59
57
 
60
58
  context.trace(`Unifying the '${statementString}' statement with the '${deductionString}' deduction...`);
61
59
 
62
- const generalContext = this.context, ///
63
- specificContext = context; ///
60
+ const specificContext = context; ///
61
+
62
+ context = this.getContext();
63
+
64
+ const generalContext = context; ///
65
+
66
+ context = specificContext; ///
64
67
 
65
68
  statementUnifies = this.statement.unifyStatement(statement, substitutions, generalContext, specificContext);
66
69
 
@@ -72,22 +75,25 @@ export default define(class Deduction extends Element {
72
75
  }
73
76
 
74
77
  unifyDeduction(deduction, substitutions, generalContext, specificContext) {
75
- let deductionUnifies;
78
+ let deductionUnifies = false;
76
79
 
77
80
  const context = specificContext, ///
81
+ generalDeduction = this, ///
78
82
  specificDeduction = deduction, ///
79
- generalDeductionString = this.string, ///
83
+ generalDeductionString = generalDeduction.getString(),
80
84
  specificDeductionString = specificDeduction.getString();
81
85
 
82
- context.trace(`Unifying the '${specificDeductionString}' deduction with the '${generalDeductionString}' deduction...`, this.node);
86
+ context.trace(`Unifying the '${specificDeductionString}' deduction with the '${generalDeductionString}' deduction...`);
83
87
 
84
88
  const statement = specificDeduction.getStatement(),
85
89
  statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
86
90
 
87
- deductionUnifies = statementUnifies; ///
91
+ if (statementUnifies) {
92
+ deductionUnifies = true;
93
+ }
88
94
 
89
95
  if (deductionUnifies) {
90
- context.debug(`...unified the '${specificDeductionString}' deduction with the '${generalDeductionString}' deduction.`, this.node);
96
+ context.debug(`...unified the '${specificDeductionString}' deduction with the '${generalDeductionString}' deduction.`);
91
97
  }
92
98
 
93
99
  return deductionUnifies;
@@ -125,11 +131,7 @@ export default define(class Deduction extends Element {
125
131
  const terms = termsFromJSON(json, context),
126
132
  frames = framesFromJSON(json, context),
127
133
  statement = statementFromJSON(json, context),
128
- node = null,
129
- string = statement.getString(),
130
- temporaryContext = TemporaryContext.fromTermsAndFrames(terms, frames, context);
131
-
132
- context = temporaryContext; ///
134
+ string = statement.getString();
133
135
 
134
136
  const deduction = new Deduction(context, string, statement);
135
137
 
@@ -27,12 +27,12 @@ export default define(class Derivation extends Element {
27
27
  return lastProofAssertion;
28
28
  }
29
29
 
30
- verify(substitutions, context) {
30
+ verify(context) {
31
31
  let verifies;
32
32
 
33
33
  verifies = this.subproofOrProofAssertions.every((subproofOrProofAssertion) => { ///
34
34
  const assignments = [],
35
- subproofOrProofAssertionVerifies = subproofOrProofAssertion.verify(substitutions, assignments, context);
35
+ subproofOrProofAssertionVerifies = subproofOrProofAssertion.verify(assignments, context);
36
36
 
37
37
  if (subproofOrProofAssertionVerifies) {
38
38
  const assignmentsAssigned = assignAssignments(assignments, context);