occam-verify-cli 1.0.444 → 1.0.457

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 (173) hide show
  1. package/lib/constants.js +1 -5
  2. package/lib/context/file.js +54 -82
  3. package/lib/context/fragment.js +77 -0
  4. package/lib/context/release.js +5 -9
  5. package/lib/context/scoped.js +314 -0
  6. package/lib/context/transient.js +371 -0
  7. package/lib/element/assumption.js +71 -84
  8. package/lib/element/combinator/bracketed.js +1 -10
  9. package/lib/element/conclusion.js +11 -8
  10. package/lib/element/constructor/bracketed.js +1 -10
  11. package/lib/element/declaration/combinator.js +1 -2
  12. package/lib/element/declaration/metavariable.js +3 -3
  13. package/lib/element/declaration/variable.js +3 -3
  14. package/lib/element/deduction.js +18 -13
  15. package/lib/element/derivation.js +14 -14
  16. package/lib/element/frame.js +40 -46
  17. package/lib/element/hypothesis.js +14 -55
  18. package/lib/element/judgement.js +35 -56
  19. package/lib/element/metaType.js +5 -4
  20. package/lib/element/metavariable.js +14 -10
  21. package/lib/element/proof.js +10 -10
  22. package/lib/element/proofAssertion/premise.js +308 -0
  23. package/lib/element/proofAssertion/step.js +305 -0
  24. package/lib/element/proofAssertion/supposition.js +322 -0
  25. package/lib/element/proofAssertion.js +199 -0
  26. package/lib/element/reference.js +28 -25
  27. package/lib/element/rule.js +29 -29
  28. package/lib/element/section.js +4 -4
  29. package/lib/element/statement.js +9 -14
  30. package/lib/element/subDerivation.js +14 -14
  31. package/lib/element/subproof.js +14 -14
  32. package/lib/element/substitution/frame.js +7 -7
  33. package/lib/element/substitution/statement.js +15 -39
  34. package/lib/element/substitution.js +5 -5
  35. package/lib/element/term.js +12 -10
  36. package/lib/element/topLevelAssertion/axiom.js +329 -0
  37. package/lib/element/{conjecture.js → topLevelAssertion/conjecture.js} +7 -7
  38. package/lib/element/{lemma.js → topLevelAssertion/lemma.js} +6 -6
  39. package/lib/element/{theorem.js → topLevelAssertion/theorem.js} +7 -7
  40. package/lib/element/topLevelAssertion.js +427 -0
  41. package/lib/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +7 -7
  42. package/lib/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +7 -7
  43. package/lib/element/topLevelMetaAssertion.js +289 -0
  44. package/lib/element/type.js +4 -4
  45. package/lib/element/variable.js +20 -20
  46. package/lib/metaTypes.js +33 -19
  47. package/lib/node/proofAssertion/premise.js +116 -0
  48. package/lib/node/proofAssertion/step.js +152 -0
  49. package/lib/node/proofAssertion/supposition.js +116 -0
  50. package/lib/node/{premise.js → proofAssertion.js} +11 -18
  51. package/lib/node/statement.js +2 -2
  52. package/lib/node/subDerivation.js +1 -8
  53. package/lib/node/subproof.js +1 -8
  54. package/lib/node/substitution/statement.js +2 -2
  55. package/lib/node/{axiom.js → topLevelAssertion/axiom.js} +7 -7
  56. package/lib/node/{conjecture.js → topLevelAssertion/conjecture.js} +7 -7
  57. package/lib/node/{lemma.js → topLevelAssertion/lemma.js} +7 -7
  58. package/lib/node/{theorem.js → topLevelAssertion/theorem.js} +7 -7
  59. package/lib/node/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +9 -9
  60. package/lib/node/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +7 -7
  61. package/lib/node/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +7 -7
  62. package/lib/node/{metaLemmaMetaTheorem.js → topLevelMetaAssertion.js} +9 -9
  63. package/lib/nonTerminalNodeMap.js +13 -13
  64. package/lib/preamble.js +10 -10
  65. package/lib/process/instantiate.js +6 -9
  66. package/lib/process/unify.js +7 -6
  67. package/lib/types.js +3 -3
  68. package/lib/utilities/bnf.js +5 -5
  69. package/lib/utilities/brackets.js +6 -11
  70. package/lib/utilities/context.js +28 -0
  71. package/lib/utilities/element.js +101 -99
  72. package/lib/utilities/fragment.js +23 -0
  73. package/lib/utilities/instance.js +12 -21
  74. package/lib/utilities/json.js +3 -2
  75. package/lib/utilities/string.js +44 -23
  76. package/lib/utilities/unification.js +36 -36
  77. package/lib/utilities/validation.js +22 -25
  78. package/package.json +6 -6
  79. package/src/constants.js +0 -1
  80. package/src/context/file.js +51 -58
  81. package/src/context/fragment.js +38 -0
  82. package/src/context/release.js +6 -11
  83. package/src/context/{local.js → scoped.js} +35 -127
  84. package/src/context/{temporary.js → transient.js} +9 -131
  85. package/src/element/assumption.js +69 -85
  86. package/src/element/combinator/bracketed.js +0 -7
  87. package/src/element/conclusion.js +14 -10
  88. package/src/element/constructor/bracketed.js +0 -7
  89. package/src/element/declaration/combinator.js +0 -1
  90. package/src/element/declaration/metavariable.js +2 -2
  91. package/src/element/declaration/variable.js +5 -5
  92. package/src/element/deduction.js +22 -15
  93. package/src/element/derivation.js +12 -12
  94. package/src/element/frame.js +36 -48
  95. package/src/element/hypothesis.js +14 -16
  96. package/src/element/judgement.js +33 -58
  97. package/src/element/metaType.js +4 -4
  98. package/src/element/metavariable.js +17 -10
  99. package/src/element/proof.js +9 -9
  100. package/src/element/{premise.js → proofAssertion/premise.js} +107 -75
  101. package/src/element/{step.js → proofAssertion/step.js} +43 -89
  102. package/src/element/{supposition.js → proofAssertion/supposition.js} +89 -88
  103. package/src/element/proofAssertion.js +69 -0
  104. package/src/element/reference.js +27 -23
  105. package/src/element/rule.js +25 -25
  106. package/src/element/section.js +4 -4
  107. package/src/element/statement.js +8 -15
  108. package/src/element/subDerivation.js +12 -12
  109. package/src/element/subproof.js +10 -10
  110. package/src/element/substitution/frame.js +10 -13
  111. package/src/element/substitution/statement.js +20 -52
  112. package/src/element/substitution.js +3 -3
  113. package/src/element/term.js +10 -9
  114. package/src/element/{axiom.js → topLevelAssertion/axiom.js} +41 -41
  115. package/src/element/{conjecture.js → topLevelAssertion/conjecture.js} +4 -4
  116. package/src/element/{lemma.js → topLevelAssertion/lemma.js} +3 -3
  117. package/src/element/{theorem.js → topLevelAssertion/theorem.js} +4 -4
  118. package/src/element/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +30 -49
  119. package/src/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +4 -4
  120. package/src/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +4 -4
  121. package/src/element/{metaLemmaMetatheorem.js → topLevelMetaAssertion.js} +7 -72
  122. package/src/element/type.js +2 -4
  123. package/src/element/variable.js +17 -17
  124. package/src/metaTypes.js +42 -13
  125. package/src/node/proofAssertion/premise.js +16 -0
  126. package/src/node/{step.js → proofAssertion/step.js} +4 -18
  127. package/src/node/proofAssertion/supposition.js +16 -0
  128. package/src/node/proofAssertion.js +23 -0
  129. package/src/node/statement.js +1 -1
  130. package/src/node/subDerivation.js +0 -7
  131. package/src/node/subproof.js +0 -7
  132. package/src/node/substitution/statement.js +1 -1
  133. package/src/node/topLevelAssertion/axiom.js +13 -0
  134. package/src/node/topLevelAssertion/conjecture.js +13 -0
  135. package/src/node/topLevelAssertion/lemma.js +13 -0
  136. package/src/node/topLevelAssertion/theorem.js +13 -0
  137. package/src/node/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +1 -1
  138. package/src/node/topLevelMetaAssertion/metaLemma.js +13 -0
  139. package/src/node/topLevelMetaAssertion/metatheorem.js +13 -0
  140. package/src/node/{metaLemmaMetaTheorem.js → topLevelMetaAssertion.js} +1 -1
  141. package/src/nonTerminalNodeMap.js +12 -12
  142. package/src/preamble.js +9 -9
  143. package/src/process/instantiate.js +31 -32
  144. package/src/process/unify.js +6 -5
  145. package/src/types.js +4 -2
  146. package/src/utilities/bnf.js +3 -2
  147. package/src/utilities/brackets.js +5 -8
  148. package/src/utilities/context.js +20 -0
  149. package/src/utilities/element.js +169 -162
  150. package/src/utilities/fragment.js +11 -0
  151. package/src/utilities/instance.js +19 -24
  152. package/src/utilities/json.js +3 -1
  153. package/src/utilities/string.js +57 -32
  154. package/src/utilities/unification.js +39 -39
  155. package/src/utilities/validation.js +26 -35
  156. package/lib/context/local.js +0 -605
  157. package/lib/context/temporary.js +0 -752
  158. package/lib/element/axiom.js +0 -329
  159. package/lib/element/axiomLemmaTheoremConjecture.js +0 -434
  160. package/lib/element/metaLemmaMetatheorem.js +0 -322
  161. package/lib/element/premise.js +0 -380
  162. package/lib/element/step.js +0 -390
  163. package/lib/element/supposition.js +0 -410
  164. package/lib/node/step.js +0 -166
  165. package/lib/node/supposition.js +0 -130
  166. package/src/node/axiom.js +0 -13
  167. package/src/node/conjecture.js +0 -13
  168. package/src/node/lemma.js +0 -13
  169. package/src/node/metaLemma.js +0 -13
  170. package/src/node/metatheorem.js +0 -13
  171. package/src/node/premise.js +0 -30
  172. package/src/node/supposition.js +0 -30
  173. package/src/node/theorem.js +0 -13
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  import Element from "../element";
4
- import TemporaryContext from "../context/temporary";
4
+ import TransientContext from "../context/transient";
5
5
 
6
6
  import { define } from "../elements";
7
7
  import { termsFromJSON, framesFromJSON, statementFromJSON, termsToTermsJSON, framesToFramesJSON, statementToStatementJSON } from "../utilities/json";
@@ -20,9 +20,9 @@ export default define(class Deduction extends Element {
20
20
  verify(context) {
21
21
  let verifies = false;
22
22
 
23
- const temporaryContext = TemporaryContext.fromNothing(context);
23
+ const transientContext = TransientContext.fromNothing(context);
24
24
 
25
- context = temporaryContext; ///
25
+ context = transientContext; ///
26
26
 
27
27
  const node = this.getNode(),
28
28
  deductionString = this.getString(); ///
@@ -53,14 +53,18 @@ export default define(class Deduction extends Element {
53
53
  unifyStatement(statement, substitutions, context) {
54
54
  let statementUnifies;
55
55
 
56
- const deduction = this, ///
57
- statementString = statement.getString(),
58
- deductionString = deduction.getString();
56
+ const statementString = statement.getString(),
57
+ deductionString = this.getString(); ///
59
58
 
60
59
  context.trace(`Unifying the '${statementString}' statement with the '${deductionString}' deduction...`);
61
60
 
62
- const generalContext = this.context, ///
63
- specificContext = context; ///
61
+ const specificContext = context; ///
62
+
63
+ context = this.getContext();
64
+
65
+ const generalContext = context; ///
66
+
67
+ context = specificContext; ///
64
68
 
65
69
  statementUnifies = this.statement.unifyStatement(statement, substitutions, generalContext, specificContext);
66
70
 
@@ -72,22 +76,25 @@ export default define(class Deduction extends Element {
72
76
  }
73
77
 
74
78
  unifyDeduction(deduction, substitutions, generalContext, specificContext) {
75
- let deductionUnifies;
79
+ let deductionUnifies = false;
76
80
 
77
81
  const context = specificContext, ///
82
+ generalDeduction = this, ///
78
83
  specificDeduction = deduction, ///
79
- generalDeductionString = this.string, ///
84
+ generalDeductionString = generalDeduction.getString(),
80
85
  specificDeductionString = specificDeduction.getString();
81
86
 
82
- context.trace(`Unifying the '${specificDeductionString}' deduction with the '${generalDeductionString}' deduction...`, this.node);
87
+ context.trace(`Unifying the '${specificDeductionString}' deduction with the '${generalDeductionString}' deduction...`);
83
88
 
84
89
  const statement = specificDeduction.getStatement(),
85
90
  statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
86
91
 
87
- deductionUnifies = statementUnifies; ///
92
+ if (statementUnifies) {
93
+ deductionUnifies = true;
94
+ }
88
95
 
89
96
  if (deductionUnifies) {
90
- context.debug(`...unified the '${specificDeductionString}' deduction with the '${generalDeductionString}' deduction.`, this.node);
97
+ context.debug(`...unified the '${specificDeductionString}' deduction with the '${generalDeductionString}' deduction.`);
91
98
  }
92
99
 
93
100
  return deductionUnifies;
@@ -127,9 +134,9 @@ export default define(class Deduction extends Element {
127
134
  statement = statementFromJSON(json, context),
128
135
  node = null,
129
136
  string = statement.getString(),
130
- temporaryContext = TemporaryContext.fromTermsAndFrames(terms, frames, context);
137
+ transientContext = TransientContext.fromTermsAndFrames(terms, frames, context);
131
138
 
132
- context = temporaryContext; ///
139
+ context = transientContext; ///
133
140
 
134
141
  const deduction = new Deduction(context, string, statement);
135
142
 
@@ -10,35 +10,35 @@ import { define } from "../elements";
10
10
  const { last } = arrayUtilities;
11
11
 
12
12
  export default define(class Derivation extends Element {
13
- constructor(context, string, node, stepsOrSubproofs) {
13
+ constructor(context, string, node, subproofOrProofAssertions) {
14
14
  super(context, string, node);
15
15
 
16
- this.stepsOrSubproofs = stepsOrSubproofs;
16
+ this.subproofOrProofAssertions = subproofOrProofAssertions;
17
17
  }
18
18
 
19
- getStepsOrSubproofs() {
20
- return this.stepsOrSubproofs;
19
+ getSubproofOrProofAssertions() {
20
+ return this.subproofOrProofAssertions;
21
21
  }
22
22
 
23
- getLastStep() {
24
- const lastStepOrSubproof = last(this.stepsOrSubproofs),
25
- lastStep = lastStepOrSubproof; ///
23
+ getLastProofAssertion() {
24
+ const lastSubproofOrProofAssertion = last(this.subproofOrProofAssertions),
25
+ lastProofAssertion = lastSubproofOrProofAssertion; ///
26
26
 
27
- return lastStep;
27
+ return lastProofAssertion;
28
28
  }
29
29
 
30
30
  verify(substitutions, context) {
31
31
  let verifies;
32
32
 
33
- verifies = this.stepsOrSubproofs.every((stepOrSubproof) => { ///
33
+ verifies = this.subproofOrProofAssertions.every((subproofOrProofAssertion) => { ///
34
34
  const assignments = [],
35
- stepOrSubproofVerifies = stepOrSubproof.verify(substitutions, assignments, context);
35
+ subproofOrProofAssertionVerifies = subproofOrProofAssertion.verify(substitutions, assignments, context);
36
36
 
37
- if (stepOrSubproofVerifies) {
37
+ if (subproofOrProofAssertionVerifies) {
38
38
  const assignmentsAssigned = assignAssignments(assignments, context);
39
39
 
40
40
  if (assignmentsAssigned) {
41
- context.addStepOrSubproof(stepOrSubproof);
41
+ context.addSubproofOrProofAssertion(subproofOrProofAssertion);
42
42
 
43
43
  return true;
44
44
  }
@@ -6,7 +6,6 @@ import Element from "../element";
6
6
  import elements from "../elements";
7
7
 
8
8
  import { define } from "../elements";
9
- import { S, NOTHING } from "../constants";
10
9
  import { FRAME_META_TYPE_NAME } from "../metaTypeNames";
11
10
 
12
11
  const { first } = arrayUtilities;
@@ -115,7 +114,7 @@ export default define(class Frame extends Element {
115
114
  compareSubstitutions(substitutions, context) {
116
115
  let comparesToSubstitutions;
117
116
 
118
- const frameString = this.string, ///
117
+ const frameString = this.getString(), ///
119
118
  substitutionsString = substitutions.asString();
120
119
 
121
120
  context.trace(`Comparing the '${frameString}' frame to the '${substitutionsString}' substitutions...`);
@@ -135,114 +134,103 @@ export default define(class Frame extends Element {
135
134
  return comparesToSubstitutions;
136
135
  }
137
136
 
138
- verify(assignments, stated, context) {
139
- let verifies = false;
137
+ validate(assignments, stated, context) {
138
+ let validates = false;
140
139
 
141
- const frameString = this.string; ///
140
+ const frameString = this.getString(); ///
142
141
 
143
- context.trace(`Verifying the '${frameString}' frame...`);
142
+ context.trace(`Validating the '${frameString}' frame...`);
144
143
 
145
- const assumptionsVerify = this.verifyAssumptions(assignments, stated, context);
144
+ const assumptionsValidate = this.validateAssumptions(assignments, stated, context);
146
145
 
147
- if (assumptionsVerify) {
148
- let verifiesWhenStated = false,
149
- verifiesWhenDerived = false;
146
+ if (assumptionsValidate) {
147
+ let validatesWhenStated = false,
148
+ validatesWhenDerived = false;
150
149
 
151
150
  if (stated) {
152
- verifiesWhenStated = this.verifyWhenStated(assignments, context);
151
+ validatesWhenStated = this.validateWhenStated(assignments, context);
153
152
  } else {
154
- verifiesWhenDerived = this.verifyWhenDerived(context);
153
+ validatesWhenDerived = this.validateWhenDerived(context);
155
154
  }
156
155
 
157
- if (verifiesWhenStated || verifiesWhenDerived) {
158
- verifies = true;
156
+ if (validatesWhenStated || validatesWhenDerived) {
157
+ validates = true;
159
158
  }
160
159
  }
161
160
 
162
- if (verifies) {
161
+ if (validates) {
163
162
  const frame = this; ///
164
163
 
165
164
  context.addFrame(frame);
166
165
 
167
- context.debug(`...verified the '${frameString}' frame.`);
166
+ context.debug(`...validated the '${frameString}' frame.`);
168
167
  }
169
168
 
170
- return verifies;
169
+ return validates;
171
170
  }
172
171
 
173
- verifyWhenStated(assignments, context) {
174
- let verifiesWhenStated = false;
172
+ validateWhenStated(assignments, context) {
173
+ let validatesWhenStated = false;
175
174
 
176
- const frameString = this.string; ///
175
+ const frameString = this.getString(); ///
177
176
 
178
- context.trace(`Verifying the '${frameString}' stated frame...`);
177
+ context.trace(`Validating the '${frameString}' stated frame...`);
179
178
 
180
179
  const singular = this.isSingular();
181
180
 
182
181
  if (!singular) {
183
182
  context.trace(`The '${frameString}' stated frame must be singular.`);
184
183
  } else {
185
- verifiesWhenStated = true;
184
+ validatesWhenStated = true;
186
185
  }
187
186
 
188
- if (verifiesWhenStated) {
189
- context.debug(`...verified the '${frameString}' stated frame.`);
187
+ if (validatesWhenStated) {
188
+ context.debug(`...validated the '${frameString}' stated frame.`);
190
189
  }
191
190
 
192
- return verifiesWhenStated;
191
+ return validatesWhenStated;
193
192
  }
194
193
 
195
- verifyWhenDerived(context) {
196
- let verifiesWhenDerived;
194
+ validateWhenDerived(context) {
195
+ let validatesWhenDerived;
197
196
 
198
- const frameString = this.string; ///
197
+ const frameString = this.getString(); ///
199
198
 
200
199
  context.trace(`Verifying the '${frameString}' derived frame...`);
201
200
 
202
- verifiesWhenDerived = true;
201
+ validatesWhenDerived = true;
203
202
 
204
- if (verifiesWhenDerived) {
203
+ if (validatesWhenDerived) {
205
204
  context.debug(`...verified the '${frameString}' derived frame.`);
206
205
  }
207
206
 
208
- return verifiesWhenDerived;
207
+ return validatesWhenDerived;
209
208
  }
210
209
 
211
- verifyAssumptions(assignments, stated, context) {
212
- let assumptionsVerify = true; ///
210
+ validateAssumptions(assignments, stated, context) {
211
+ let assumptionsValidate = true; ///
213
212
 
214
213
  const length = this.getLength();
215
214
 
216
215
  if (length > 0) {
217
- const sOrNothing = (length > 1) ?
218
- S :
219
- NOTHING,
220
- assumptionsString = assumptionsStringFromAssumptions(this.assumptions);
221
-
222
- context.trace(`Verifying the '${assumptionsString}' assumption${sOrNothing}...`);
223
-
224
216
  stated = true; ///
225
217
 
226
218
  assignments = null; ///
227
219
 
228
- assumptionsVerify = this.assumptions.every((assumption) => {
229
- const assumptionVerifies = assumption.verify(assignments, stated, context);
220
+ assumptionsValidate = this.assumptions.every((assumption) => {
221
+ const assumptionVerifies = assumption.validate(assignments, stated, context);
230
222
 
231
223
  return assumptionVerifies;
232
224
  });
233
-
234
- if (assumptionsVerify) {
235
- context.debug(`...verified the '${assumptionsString}' assumption${sOrNothing}.`);
236
- }
237
225
  }
238
226
 
239
- return assumptionsVerify;
227
+ return assumptionsValidate;
240
228
  }
241
229
 
242
230
  validateGivenMetaType(metaType, assignments, stated, context) {
243
231
  let validatesGivenMetaType = false;
244
232
 
245
- const frameString = this.string, ///
233
+ const frameString = this.getString(), ///
246
234
  metaTypeString = metaType.getString();
247
235
 
248
236
  context.trace(`Validatin the '${frameString}' frame given the '${metaTypeString}' meta-type...`);
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  import Element from "../element";
4
- import elements from "../elements";
5
4
  import assignAssignments from "../process/assign";
6
5
 
7
6
  import { define } from "../elements";
@@ -36,11 +35,9 @@ export default define(class Hypothesis extends Element {
36
35
  const assignmentsAssigned = assignAssignments(assignments, context);
37
36
 
38
37
  if (assignmentsAssigned) {
39
- const { Step } = elements,
40
- step = Step.fromStatement(this.statement, context),
41
- stepOrSubproof = step; ///
38
+ const subproofOrProofAssertion = this; ///
42
39
 
43
- context.addStepOrSubproof(stepOrSubproof);
40
+ context.addSubproofOrProofAssertion(subproofOrProofAssertion);
44
41
 
45
42
  verifies = true;
46
43
  }
@@ -56,26 +53,27 @@ export default define(class Hypothesis extends Element {
56
53
  return verifies;
57
54
  }
58
55
 
59
- isEqualToStep(step, context) {
60
- let equalToStep = false;
56
+ compareProofAssertion(proofAssertion, context) {
57
+ let comparesToProofAssertion = false;
61
58
 
62
- const stepString = step.getString(),
63
- hypothesisString = this.string; ///
59
+ const node = this.getNode(),
60
+ hypothesisString = this.getString(), ///
61
+ proofAssertionString = proofAssertion.getString();
64
62
 
65
- context.trace(`Is the '${hypothesisString}' hypothesis equal to the '${stepString}' step...`, this.node);
63
+ context.trace(`Is the '${hypothesisString}' hypothesis equal to the '${proofAssertionString}' proof assertion...`, node);
66
64
 
67
- const stepStatement = step.getStatement(),
68
- statementEqualToStepStatement = this.statement.isEqualTo(stepStatement);
65
+ const proofAssertionStatement = proofAssertion.getStatement(),
66
+ statementEqualToStepStatement = this.statement.isEqualTo(proofAssertionStatement);
69
67
 
70
68
  if (statementEqualToStepStatement) {
71
- equalToStep = true;
69
+ comparesToProofAssertion = true;
72
70
  }
73
71
 
74
- if (equalToStep) {
75
- context.trace(`...the '${hypothesisString}' hypothesis is equal to the '${stepString}' step.`, this.node);
72
+ if (comparesToProofAssertion) {
73
+ context.trace(`...the '${hypothesisString}' hypothesis is equal to the '${proofAssertionString}' proof assertion.`, node);
76
74
  }
77
75
 
78
- return equalToStep;
76
+ return comparesToProofAssertion;
79
77
  }
80
78
 
81
79
  toJSON() {
@@ -26,110 +26,85 @@ export default define(class Judgement extends Element {
26
26
 
27
27
  getMetavariable() { return this.frame.getMetavariable(); }
28
28
 
29
- verify(assignments, stated, context) {
30
- let verifies = false;
29
+ validate(assignments, stated, context) {
30
+ let validates = false;
31
31
 
32
32
  const judgementString = this.string; ///
33
33
 
34
- context.trace(`Verifying the '${judgementString}' judgement...`);
34
+ context.trace(`Validating the '${judgementString}' judgement...`);
35
35
 
36
- const frameVerifies = this.verifyFrame(assignments, stated, context);
36
+ const frameValidates = this.frame.validate(assignments, stated, context);
37
37
 
38
- if (frameVerifies) {
39
- const declarationVerifies = this.verifyDeclaration(assignments, stated, context);
38
+ if (frameValidates) {
39
+ const assumptionValidates = this.assumption.validate(assignments, stated, context);
40
40
 
41
- if (declarationVerifies) {
42
- let verifiesWhenStated = false,
43
- verifiesWhenDerived = false;
41
+ if (assumptionValidates) {
42
+ let validatesWhenStated = false,
43
+ validatesWhenDerived = false;
44
44
 
45
45
  if (stated) {
46
- verifiesWhenStated = this.verifyWhenStated(assignments, context);
46
+ validatesWhenStated = this.validateWhenStated(assignments, context);
47
47
  } else {
48
- verifiesWhenDerived = this.verifyWhenDerived(context);
48
+ validatesWhenDerived = this.validateWhenDerived(context);
49
49
  }
50
50
 
51
- if (verifiesWhenStated || verifiesWhenDerived) {
52
- verifies = true;
51
+ if (validatesWhenStated || validatesWhenDerived) {
52
+ validates = true;
53
53
  }
54
54
  }
55
55
  }
56
56
 
57
- if (verifies) {
57
+ if (validates) {
58
58
  if (stated) {
59
59
  this.assign(assignments, context);
60
60
  }
61
61
  }
62
62
 
63
- if (verifies) {
64
- context.debug(`...verified the '${judgementString}' judgement.`);
63
+ if (validates) {
64
+ context.debug(`...validated the '${judgementString}' judgement.`);
65
65
  }
66
66
 
67
- return verifies;
67
+ return validates;
68
68
  }
69
69
 
70
- verifyFrame(assignments, stated, context) {
71
- let frameVerifies;
72
-
73
- const frameString = this.frame.getString();
74
-
75
- context.trace(`Verifying the '${frameString}' frame...`);
76
-
77
- frameVerifies = this.frame.verify(assignments, stated, context);
78
-
79
- if (frameVerifies) {
80
- context.debug(`...verified the '${frameString}' frame.`);
81
- }
82
-
83
- return frameVerifies;
84
- }
85
-
86
- verifyDeclaration(assignments, stated, context) {
87
- let declarationVerifies;
88
-
89
- declarationVerifies = this.assumption.verify(assignments, stated, context);
90
-
91
- return declarationVerifies;
92
- }
93
-
94
- verifyWhenStated(assignments, context) {
95
- let verifiesWhenStated;
70
+ validateWhenStated(assignments, context) {
71
+ let validatesWhenStated;
96
72
 
97
73
  const judgementString = this.string; ///
98
74
 
99
- context.trace(`Verifying the '${judgementString}' stated judgement...`);
75
+ context.trace(`Validating the '${judgementString}' stated judgement...`);
100
76
 
101
- verifiesWhenStated = true;
77
+ validatesWhenStated = true;
102
78
 
103
- if (verifiesWhenStated) {
104
- context.debug(`...verified the '${judgementString}' stated judgement.`);
79
+ if (validatesWhenStated) {
80
+ context.debug(`...validated the '${judgementString}' stated judgement.`);
105
81
  }
106
82
 
107
- return verifiesWhenStated;
83
+ return validatesWhenStated;
108
84
  }
109
85
 
110
- verifyWhenDerived(context) {
111
- let verifiesWhenDerived = false;
86
+ validateWhenDerived(context) {
87
+ let validatesWhenDerived = false;
112
88
 
113
89
  const judgementString = this.string; ///
114
90
 
115
- context.trace(`Verifying the '${judgementString}' derived judgement...`);
91
+ context.trace(`Validating the '${judgementString}' derived judgement...`);
116
92
 
117
93
  const metavariable = this.assumption.getMetavariable(),
118
94
  reference = referenceFromMetavariable(metavariable, context),
119
- metaLemmaMetatheorem = context.findMetaLemmaMetatheoremByReference(reference),
120
- substitutions = metaLemmaMetatheorem.getSubstitutions(),
95
+ topLevelMetaAssertion = context.findTopLevelMetaAssertionByReference(reference),
96
+ substitutions = topLevelMetaAssertion.getSubstitutions(),
121
97
  frameComparesToSubstitutions = this.frame.compareSubstitutions(substitutions, context);
122
98
 
123
99
  if (frameComparesToSubstitutions) {
124
- verifiesWhenDerived = true;
125
-
100
+ validatesWhenDerived = true;
126
101
  }
127
102
 
128
- if (verifiesWhenDerived) {
129
- context.debug(`...verified the '${judgementString}' derived judgement.`);
103
+ if (validatesWhenDerived) {
104
+ context.debug(`...validated the '${judgementString}' derived judgement.`);
130
105
  }
131
106
 
132
- return verifiesWhenDerived;
107
+ return validatesWhenDerived;
133
108
  }
134
109
 
135
110
  assign(assignments, context) {
@@ -3,6 +3,7 @@
3
3
  import Element from "../element";
4
4
 
5
5
  import { define } from "../elements";
6
+ import { findMetaTypeFromTypeName } from "../metaTypes";
6
7
 
7
8
  export default define(class MetaType extends Element {
8
9
  constructor(context, string, node, name) {
@@ -41,14 +42,13 @@ export default define(class MetaType extends Element {
41
42
  static fromJSON(json, context) {
42
43
  const { name } = json,
43
44
  metaTypeName = name, ///
44
- metaType = metaTypeFromMetaTypeName(metaTypeName);
45
+ metaType = findMetaTypeByMetaTypeName(metaTypeName);
45
46
 
46
47
  return metaType;
47
48
  }
48
49
 
49
- static fromName(name) {
50
- const context = null,
51
- string = name,
50
+ static fromName(name, context) {
51
+ const string = name,
52
52
  node = null,
53
53
  metaType = new MetaType(context, string, node, name);
54
54
 
@@ -46,7 +46,8 @@ export default define(class Metavariable extends Element {
46
46
  }
47
47
 
48
48
  compareMetavariableName(metavariableName) {
49
- const comparesToMetavariableName = (metavariableName === this.name);
49
+ const nameMetavariableName = (this.name === metavariableName),
50
+ comparesToMetavariableName = nameMetavariableName; ///
50
51
 
51
52
  return comparesToMetavariableName;
52
53
  }
@@ -54,7 +55,7 @@ export default define(class Metavariable extends Element {
54
55
  isMetaTypeEqualTo(metaType) { return this.metaType.isEqualTo(metaType); }
55
56
 
56
57
  validate(context) {
57
- let validates;
58
+ let validates = false;
58
59
 
59
60
  const metavariableString = this.getString(); ///
60
61
 
@@ -63,7 +64,9 @@ export default define(class Metavariable extends Element {
63
64
  const metavariable = this, ///
64
65
  metavariablePresent = context.isMetavariablePresent(metavariable);
65
66
 
66
- validates = metavariablePresent; ///
67
+ if (metavariablePresent) {
68
+ validates = true;
69
+ }
67
70
 
68
71
  if (validates) {
69
72
  context.debug(`...va;idated the '${metavariableString}' metavariable.`);
@@ -75,8 +78,8 @@ export default define(class Metavariable extends Element {
75
78
  validateGivenMetaType(metaType, context) {
76
79
  let validatesGivenMetaType = false;
77
80
 
78
- const metavariableString = this.getString(), ///
79
- metaTypeString = metaType.getString();
81
+ const metaTypeString = metaType.getString(),
82
+ metavariableString = this.getString(); ///
80
83
 
81
84
  context.trace(`Validating the '${metavariableString}' metavariable given the '${metaTypeString}' meta-type...`);
82
85
 
@@ -87,7 +90,9 @@ export default define(class Metavariable extends Element {
87
90
  if (metavariable !== null) {
88
91
  const metavariableMetaTypeEqualToMetaType = metavariable.isMetaTypeEqualTo(metaType);
89
92
 
90
- validatesGivenMetaType = metavariableMetaTypeEqualToMetaType; ///
93
+ if (metavariableMetaTypeEqualToMetaType) {
94
+ validatesGivenMetaType = true;
95
+ }
91
96
  }
92
97
 
93
98
  if (validatesGivenMetaType) {
@@ -164,15 +169,17 @@ export default define(class Metavariable extends Element {
164
169
  if (substitutionPresent) {
165
170
  substitution = substitutions.findSubstitutionByMetavariableAndSubstitution(metavariable, substitution); ///
166
171
 
167
- const substitutionStatementEqualToStatement = substitution.isStatementEqualToStatement(statement, context);
172
+ const substitutionComparesToStatement = substitution.compareStatement(statement, context);
168
173
 
169
- if (substitutionStatementEqualToStatement) {
174
+ if (substitutionComparesToStatement) {
170
175
  statementUnifies = true;
171
176
  }
172
177
  } else {
173
178
  const { StatementSubstitution } = elements,
174
179
  metavariable = this,
175
- statementSubstitution = StatementSubstitution.fromStatementMetavariableAndSubstitution(statement, metavariable, substitution, context);
180
+ statementSubstitution = (substitution !== null ) ?
181
+ StatementSubstitution.fromStatementMetavariableAndSubstitution(statement, metavariable, substitution, context) :
182
+ StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context);
176
183
 
177
184
  substitution = statementSubstitution; ///
178
185
 
@@ -303,7 +310,7 @@ export default define(class Metavariable extends Element {
303
310
 
304
311
  if (generalContextFilePath === specificContextFilePath) {
305
312
  const metavariable = this, ///
306
- metavariableString = this.getString(), ///
313
+ metavariableString = metavariable.getString(),
307
314
  statementMetavariableEqualToMetvariable = statement.isMetavariableEqualToMetavariable(metavariable, context);
308
315
 
309
316
  if (statementMetavariableEqualToMetvariable) {
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  import Element from "../element";
4
- import LocalContext from "../context/local";
4
+ import ScopedContext from "../context/scoped";
5
5
 
6
6
  import { define } from "../elements";
7
7
 
@@ -16,12 +16,12 @@ export default define(class Proof extends Element {
16
16
  return this.derivation;
17
17
  }
18
18
 
19
- getLastStep() { return this.derivation.getLastStep(); }
19
+ getLastProofAssertion() { return this.derivation.getLastProofAssertion(); }
20
20
 
21
21
  getStatement() {
22
- const lastStep = this.getLastStep(),
23
- lastStepStatement = lastStep.getStatement(),
24
- statement = lastStepStatement; ///
22
+ const lastProofAssertion = this.getLastProofAssertion(),
23
+ lastProofAssertionStatement = lastProofAssertion.getStatement(),
24
+ statement = lastProofAssertionStatement; ///
25
25
 
26
26
  return statement;
27
27
  }
@@ -29,16 +29,16 @@ export default define(class Proof extends Element {
29
29
  verify(substitutions, conclusion, context) {
30
30
  let verifies = false;
31
31
 
32
- const localContext = LocalContext.fromNothing(context); ///
32
+ const scopedContext = ScopedContext.fromNothing(context); ///
33
33
 
34
- context = localContext; ///
34
+ context = scopedContext; ///
35
35
 
36
36
  const derivationVerifies = this.derivation.verify(substitutions, context);
37
37
 
38
38
  if (derivationVerifies) {
39
- const lastStep = context.getLastStep();
39
+ const lastProofAssertion = context.getLastProofAssertion();
40
40
 
41
- if (lastStep !== null) {
41
+ if (lastProofAssertion !== null) {
42
42
  const statement = this.getStatement(),
43
43
  conclusionStatement = conclusion.getStatement(),
44
44
  conclusionStatementEqualToStatement = conclusionStatement.isEqualTo(statement);