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,25 +1,19 @@
1
1
  "use strict";
2
2
 
3
- import Element from "../element";
4
- import elements from "../elements";
5
- import TemporaryContext from "../context/temporary";
6
- import assignAssignments from "../process/assign";
3
+ import ProofAssertion from "../proofAssertion";
4
+ import TransientContext from "../../context/transient";
5
+ import assignAssignments from "../../process/assign";
7
6
 
8
- import { define } from "../elements";
9
- import { termsFromJSON, framesFromJSON, statementFromJSON, procedureCallFromJSON, termsToTermsJSON, framesToFramesJSON, statementToStatementJSON, procedureCallToProcedureCallJSON } from "../utilities/json";
7
+ import { define } from "../../elements";
8
+ import { termsFromJSON, framesFromJSON, statementFromJSON, procedureCallFromJSON, termsToTermsJSON, framesToFramesJSON, statementToStatementJSON, procedureCallToProcedureCallJSON } from "../../utilities/json";
10
9
 
11
- export default define(class Supposition extends Element {
10
+ export default define(class Supposition extends ProofAssertion {
12
11
  constructor(context, string, node, statement, procedureCall) {
13
- super(context, string, node);
12
+ super(context, string, node, statement);
14
13
 
15
- this.statement = statement;
16
14
  this.procedureCall = procedureCall;
17
15
  }
18
16
 
19
- getStatement() {
20
- return this.statement;
21
- }
22
-
23
17
  getProcedureCall() {
24
18
  return this.procedureCall;
25
19
  }
@@ -27,32 +21,32 @@ export default define(class Supposition extends Element {
27
21
  verify(context) {
28
22
  let verifies = false;
29
23
 
30
- const temporaryContext = TemporaryContext.fromNothing(context);
24
+ const transientContext = TransientContext.fromNothing(context);
31
25
 
32
- context = temporaryContext; ///
26
+ context = transientContext; ///
33
27
 
34
28
  const node = this.getNode(),
35
29
  suppositionString = this.getString(); ///
36
30
 
37
31
  context.trace(`Verifying the '${suppositionString}' supposition...`, node);
38
32
 
39
- if ((this.statement === null) && (this.procedureCall === null)) {
33
+ const statement = this.getStatement();
34
+
35
+ if ((statement === null) && (this.procedureCall === null)) {
40
36
  context.debug(`Unable to verify the '${suppositionString}' supposition because it is nonsense.`, node);
41
37
  } else {
42
- if (this.statement !== null) {
38
+ if (statement !== null) {
43
39
  const stated = true,
44
40
  assignments = [],
45
- statementValidates = this.statement.validate(assignments, stated, context);
41
+ statementValidates = statement.validate(assignments, stated, context);
46
42
 
47
43
  if (statementValidates) {
48
44
  const assignmentsAssigned = assignAssignments(assignments, context);
49
45
 
50
46
  if (assignmentsAssigned) {
51
- const { Step } = elements,
52
- step = Step.fromStatement(this.statement, context),
53
- stepOrSubproof = step; ///
47
+ const subproofOrProofAssertion = this; ///
54
48
 
55
- context.addStepOrSubproof(stepOrSubproof);
49
+ context.addSubproofOrProofAssertion(subproofOrProofAssertion);
56
50
 
57
51
  verifies = true;
58
52
  }
@@ -82,10 +76,9 @@ export default define(class Supposition extends Element {
82
76
  unifyIndependently(substitutions, context) {
83
77
  let unifiesIndependently = false;
84
78
 
85
- const node = this.getNode(),
86
- suppositionString = this.getString();
79
+ const suppositionString = this.getString();
87
80
 
88
- context.trace(`Unifying the '${suppositionString}' supposition independently...`, node);
81
+ context.trace(`Unifying the '${suppositionString}' supposition independently...`);
89
82
 
90
83
  const specificContext = context; ///
91
84
 
@@ -95,8 +88,10 @@ export default define(class Supposition extends Element {
95
88
 
96
89
  context = specificContext; ///
97
90
 
98
- if (this.statement !== null) {
99
- const statementUnifiesIndependently = this.statement.unifyIndependently(substitutions, generalContext, specificContext);
91
+ const statement = this.getStatement();
92
+
93
+ if (statement !== null) {
94
+ const statementUnifiesIndependently = statement.unifyIndependently(substitutions, generalContext, specificContext);
100
95
 
101
96
  if (statementUnifiesIndependently) {
102
97
  unifiesIndependently = true;
@@ -112,119 +107,125 @@ export default define(class Supposition extends Element {
112
107
  }
113
108
 
114
109
  if (unifiesIndependently) {
115
- context.debug(`...unified the '${suppositionString}' supposition independenly.`, node);
110
+ context.debug(`...unified the '${suppositionString}' supposition independenly.`);
116
111
  }
117
112
 
118
113
  return unifiesIndependently;
119
114
  }
120
115
 
121
- unifyStepOrSubproof(stepOrSubproof, substitutions, context) {
122
- let stepOrSubproofUnifies = false;
116
+ unifySubproofOrProosAssertion(subproofOrProofAssertion, substitutions, context) {
117
+ let subproofOrProofAssertionUnifies = false;
123
118
 
124
- const stepOrSubProofStep = stepOrSubproof.isStep(),
125
- subproof = stepOrSubProofStep ?
119
+ const subproofOrProofAssertionProofAssertion = subproofOrProofAssertion.isProofAssertion(),
120
+ subproof = subproofOrProofAssertionProofAssertion ?
126
121
  null :
127
- stepOrSubproof,
128
- step = stepOrSubProofStep ?
129
- stepOrSubproof :
130
- null;
122
+ subproofOrProofAssertion,
123
+ proofAssertion = subproofOrProofAssertionProofAssertion ?
124
+ subproofOrProofAssertion :
125
+ null;
131
126
 
132
127
  substitutions.snapshot();
133
128
 
134
129
  if (subproof !== null) {
135
130
  const subproofUnifies = this.unifySubproof(subproof, substitutions, context);
136
131
 
137
- stepOrSubproofUnifies = subproofUnifies; ///
132
+ if (subproofUnifies) {
133
+ subproofOrProofAssertionUnifies = true;
134
+ }
138
135
  }
139
136
 
140
- if (step !== null) {
141
- const statementUnifies = this.unifyStep(step, substitutions, context);
137
+ if (proofAssertion !== null) {
138
+ const proofAssertionUnifies = this.unifyProofAssertion(proofAssertion, substitutions, context);
142
139
 
143
- stepOrSubproofUnifies = statementUnifies; ///
140
+ if (proofAssertionUnifies) {
141
+ subproofOrProofAssertionUnifies = true;
142
+ }
144
143
  }
145
144
 
146
- if (stepOrSubproofUnifies) {
145
+ if (subproofOrProofAssertionUnifies) {
147
146
  substitutions.resolve(context);
148
147
  }
149
148
 
150
- stepOrSubproofUnifies ?
149
+ subproofOrProofAssertionUnifies ?
151
150
  substitutions.continue() :
152
151
  substitutions.rollback(context);
153
152
 
154
- return stepOrSubproofUnifies;
153
+ return subproofOrProofAssertionUnifies;
155
154
  }
156
155
 
157
- unifySubproof(subproof, substitutions, context) {
158
- let subproofUnifies = false;
156
+ unifyProofAssertion(proofAssertion, substitutions, context) {
157
+ let proofAssertionUnifies = false;
159
158
 
160
- const supposition = this, ///
161
- subproofString = subproof.getString(),
162
- suppositionStatement = supposition.getStatement(),
163
- suppositionStatementString = suppositionStatement.getString();
164
-
165
- context.trace(`Unifying the '${subproofString}' subproof with the supposition's '${suppositionStatementString}' statement...`);
159
+ const suppositionString = this.getString(),
160
+ proofAssertionString = proofAssertion.getString();
166
161
 
167
- const specificContext = context; ///
162
+ context.trace(`Unifying the '${proofAssertionString}' proof assertion with the '${suppositionString}' supposition...`);
168
163
 
169
164
  context = this.getContext();
170
165
 
171
- const generalContext = context; ///
166
+ const generalContext = context; ///
172
167
 
173
- context = specificContext; ///
168
+ context = proofAssertion.getContext();
174
169
 
175
- if (this.statement !== null) {
176
- const node = this.getNode(),
177
- assertionNode = node, ///
178
- assertion = context.findAssertionByAssertionNode(assertionNode);
170
+ const specificContext = context; ///
179
171
 
180
- if (assertion !== null) {}
172
+ context = specificContext; ///
181
173
 
182
- if (subproofAssertion !== null) {
183
- subproofUnifies = subproofAssertion.unifySubproof(subproof, substitutions, generalContext, specificContext);
184
- }
174
+ const statement = proofAssertion.getStatement(),
175
+ statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
176
+
177
+ if (statementUnifies) {
178
+ proofAssertionUnifies = true;
185
179
  }
186
180
 
187
- if (subproofUnifies) {
188
- context.debug(`...unified the '${subproofString}' subproof with the supposition's '${suppositionStatementString}' statement.`);
181
+ if (proofAssertionUnifies) {
182
+ context.debug(`...unified the '${proofAssertionString}' proof assertion with the '${suppositionString}' supposition.`);
189
183
  }
190
184
 
191
- return subproofUnifies;
185
+ return proofAssertionUnifies;
192
186
  }
193
187
 
194
- unifyStep(step, substitutions, context) {
195
- let stepUnifies;
188
+ unifySubproof(subproof, substitutions, context) {
189
+ let subproofUnifies = false;
196
190
 
197
- context = step.getContext();
191
+ const node = this.getNode(),
192
+ subproofString = subproof.getString(),
193
+ suppositionString = this.getString();
198
194
 
199
- const statement = step.getStatement(),
200
- statementUnifies = this.unifyStatement(statement, substitutions, context);
195
+ context.trace(`Unifying the '${subproofString}' subproof with the '${suppositionString}' supposition...`, node);
201
196
 
202
- stepUnifies = statementUnifies; ///
197
+ const specificContext = context; ///
203
198
 
204
- return stepUnifies;
205
- }
199
+ context = this.getContext();
206
200
 
207
- unifyStatement(statement, substitutions, context) {
208
- let statementUnifies;
201
+ const generalContext = context; ///
202
+
203
+ context = specificContext; ///
209
204
 
210
- const supposition = this, ///
211
- statementString = statement.getString(),
212
- suppositionString = supposition.getString();
205
+ const statement = this.getStatement();
206
+
207
+ if (statement !== null) {
208
+ const statementNode = statement.getNode(),
209
+ subproofAssertionNode = statementNode.getSubproofAssertionNode();
213
210
 
214
- context.trace(`Unifying the '${statementString}' statement with the '${suppositionString}' supposition...`);
211
+ if (subproofAssertionNode !== null) {
212
+ const context = generalContext, ///
213
+ assertionNode = subproofAssertionNode, ///
214
+ assertion = context.findAssertionByAssertionNode(assertionNode)
215
215
 
216
- if (this.statement !== null) {
217
- const generalContext = this.context, ///
218
- specificContext = context; ///
216
+ if (assertion !== null) {
217
+ const subproofAssertion = assertion; ///
219
218
 
220
- statementUnifies = this.statement.unifyStatement(statement, substitutions, generalContext, specificContext);
219
+ subproofUnifies = subproofAssertion.unifySubproof(subproof, substitutions, generalContext, specificContext);
220
+ }
221
+ }
221
222
  }
222
223
 
223
- if (statementUnifies) {
224
- context.debug(`...unified the '${statementString}' statement with the '${suppositionString}' supposition.`);
224
+ if (subproofUnifies) {
225
+ context.debug(`...unified the '${subproofString}' subproof with the '${suppositionString}' supposition.`, node);
225
226
  }
226
227
 
227
- return statementUnifies;
228
+ return subproofUnifies;
228
229
  }
229
230
 
230
231
  unifySupposition(supposition, substitutions, generalContext, specificContext) {
@@ -286,7 +287,7 @@ export default define(class Supposition extends Element {
286
287
  frames = framesFromJSON(json, context),
287
288
  statement = statementFromJSON(json, context),
288
289
  procedureCall = procedureCallFromJSON(json, context),
289
- temporaryContext = TemporaryContext.fromTermsAndFrames(terms, frames, context);
290
+ transientContext = TransientContext.fromTermsAndFrames(terms, frames, context);
290
291
 
291
292
  let string;
292
293
 
@@ -300,7 +301,7 @@ export default define(class Supposition extends Element {
300
301
 
301
302
  const node = null;
302
303
 
303
- context = temporaryContext; ///
304
+ context = transientContext; ///
304
305
 
305
306
  const supposition = new Supposition(context, string, node, statement, procedureCall);
306
307
 
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+
3
+ import Element from "../element";
4
+
5
+ import { equateStatements } from "../process/equate";
6
+
7
+ export default class ProofAssertion extends Element {
8
+ constructor(context, string, node, statement) {
9
+ super(context, string, node);
10
+
11
+ this.statement = statement;
12
+ }
13
+
14
+ getStatement() {
15
+ return this.statement;
16
+ }
17
+
18
+ isProofAssertion() {
19
+ const proofAssertion = true;
20
+
21
+ return proofAssertion;
22
+ }
23
+
24
+ compareStatement(statement, context) {
25
+ let comparesToStatement = false;
26
+
27
+ const statementString = statement.getString(),
28
+ proofAssertionString = this.getString();
29
+
30
+ context.trace(`Comparing the '${statementString}' statement to the '${proofAssertionString}' proof assertion...`);
31
+
32
+ const leftStatement = statement, ///
33
+ rightStatement = this.statement, ///
34
+ leftStatementNode = leftStatement.getNode(),
35
+ rightStatementNode = rightStatement.getNode(),
36
+ statementsEquate = equateStatements(leftStatementNode, rightStatementNode, context);
37
+
38
+ if (statementsEquate) {
39
+ comparesToStatement = true;
40
+ }
41
+
42
+ if (comparesToStatement) {
43
+ context.debug(`...compared the '${statementString}' statement to the '${proofAssertionString}' proof assertion.`);
44
+ }
45
+
46
+ return comparesToStatement;
47
+ }
48
+
49
+ unifyStatement(statement, substitutions, generalContext, specificContext) {
50
+ let statementUnifies = false;
51
+
52
+ if (this.statement !== null) {
53
+ const node = this.getNode(),
54
+ context = specificContext, ///
55
+ statementString = statement.getString(),
56
+ proorAssertionString = this.getString(); ///
57
+
58
+ context.trace(`Unifying the '${statementString}' statement with the '${proorAssertionString}' proof assertion...`, node);
59
+
60
+ statementUnifies = this.statement.unifyStatement(statement, substitutions, generalContext, specificContext);
61
+
62
+ if (statementUnifies) {
63
+ context.debug(`...unified the '${statementString}' statement with the '${proorAssertionString}' proof assertion.`, node);
64
+ }
65
+ }
66
+
67
+ return statementUnifies;
68
+ }
69
+ }
@@ -4,7 +4,8 @@ import Element from "../element";
4
4
  import elements from "../elements";
5
5
 
6
6
  import { define } from "../elements";
7
- import { referenceMetaTypeFromNothing } from "../metaTypes";
7
+ import { REFERENCE_META_TYPE_NAME } from "../metaTypeNames";
8
+ import { findMetaTypeByMetaTypeName } from "../metaTypes";
8
9
  import { unifyMetavariableIntrinsically } from "../process/unify";
9
10
  import { metavariableFromJSON, metavariableToMetavariableJSON } from "../utilities/json";
10
11
 
@@ -39,45 +40,48 @@ export default define(class Reference extends Element {
39
40
 
40
41
  matchMetavariableNode(metavariableNode) { return this.metavariable.matchNode(metavariableNode); }
41
42
 
42
- verify(context) {
43
- let verifies = false;
43
+ validate(context) {
44
+ let validate = false;
44
45
 
45
46
  const referenceString = this.getString(); ///
46
47
 
47
- context.trace(`Verifying the '${referenceString}' reference...`);
48
+ context.trace(`Validating the '${referenceString}' reference...`);
48
49
 
49
- if (!verifies) {
50
+ if (!validate) {
50
51
  const metavariableValidates = this.validateMetavariable(context);
51
52
 
52
- verifies = metavariableValidates; ///
53
+ validate = metavariableValidates; ///
53
54
  }
54
55
 
55
- if (!verifies) {
56
+ if (!validate) {
56
57
  const reference = this, ///
57
58
  labelPresent = context.isLabelPresentByReference(reference);
58
59
 
59
- verifies = labelPresent; ///
60
+ validate = labelPresent; ///
60
61
  }
61
62
 
62
- if (verifies) {
63
+ if (validate) {
63
64
  const reference = this; ///
64
65
 
65
66
  context.addReference(reference);
66
67
 
67
- context.debug(`...verified the '${referenceString}' reference.`);
68
+ context.debug(`...validated the '${referenceString}' reference.`);
68
69
  }
69
70
 
70
- return verifies;
71
+ return validate;
71
72
  }
72
73
 
73
74
  validateMetavariable(context) {
74
- let metavariableValidates;
75
+ let metavariableValidates = false;
75
76
 
76
- const referenceMetaType = referenceMetaTypeFromNothing(),
77
+ const metaTypeName = REFERENCE_META_TYPE_NAME,
78
+ referenceMetaType = findMetaTypeByMetaTypeName(metaTypeName),
77
79
  metaType = referenceMetaType, ///
78
80
  metavariableValidatesGivenMetaType = this.metavariable.validateGivenMetaType(metaType, context);
79
81
 
80
- metavariableValidates = metavariableValidatesGivenMetaType; ///
82
+ if (metavariableValidatesGivenMetaType) {
83
+ metavariableValidates = true;
84
+ }
81
85
 
82
86
  return metavariableValidates;
83
87
  }
@@ -139,27 +143,27 @@ export default define(class Reference extends Element {
139
143
  return metavariableUnifies;
140
144
  }
141
145
 
142
- unifyMetaLemmaMetatheorem(metaLemmaMetatheorem, context) {
143
- let metaLemmaMetatheoremUnifies;
146
+ unifyTopLevelMetaAssertion(topLevelMetaAssertion, context) {
147
+ let topLevelMetaAssertionUnifies;
144
148
 
145
149
  const reference = this, ///
146
150
  referenceString = reference.getString(),
147
- metaLemmaMetatheoremString = metaLemmaMetatheorem.getString();
151
+ topLevelMetaAssertionString = topLevelMetaAssertion.getString();
148
152
 
149
- context.trace(`Unifying the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem with the '${referenceString}' reference...`);
153
+ context.trace(`Unifying the '${topLevelMetaAssertionString}' top level meta-assertion with the '${referenceString}' reference...`);
150
154
 
151
155
  const { Substitutions } = elements,
152
- label = metaLemmaMetatheorem.getLabel(),
156
+ label = topLevelMetaAssertion.getLabel(),
153
157
  substitutions = Substitutions.fromNothing(),
154
158
  labelUnifies = this.unifyLabel(label, substitutions, context);
155
159
 
156
- metaLemmaMetatheoremUnifies = labelUnifies; ///
160
+ topLevelMetaAssertionUnifies = labelUnifies; ///
157
161
 
158
- if (metaLemmaMetatheoremUnifies) {
159
- context.trace(`...unified the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem with the '${referenceString}' reference.`);
162
+ if (topLevelMetaAssertionUnifies) {
163
+ context.trace(`...unified the '${topLevelMetaAssertionString}' top level meta-assertion with the '${referenceString}' reference.`);
160
164
  }
161
165
 
162
- return metaLemmaMetatheoremUnifies;
166
+ return topLevelMetaAssertionUnifies;
163
167
  }
164
168
 
165
169
  toJSON() {
@@ -4,7 +4,7 @@ import { arrayUtilities } from "necessary";
4
4
 
5
5
  import Element from "../element";
6
6
  import elements from "../elements";
7
- import LocalContext from "../context/local";
7
+ import ScopedContext from "../context/scoped";
8
8
 
9
9
  import { define } from "../elements";
10
10
  import { labelsFromJSON,
@@ -70,9 +70,9 @@ export default define(class Rule extends Element {
70
70
  const labelsVerify = this.verifyLabels();
71
71
 
72
72
  if (labelsVerify) {
73
- const localContext = LocalContext.fromNothing(context);
73
+ const scopedContext = ScopedContext.fromNothing(context);
74
74
 
75
- context = localContext; ///
75
+ context = scopedContext; ///
76
76
 
77
77
  const premisesVerify = this.verifyPremises(context);
78
78
 
@@ -165,68 +165,68 @@ export default define(class Rule extends Element {
165
165
  return statementUnifiesWithConclusion;
166
166
  }
167
167
 
168
- unifyStatementAndStepsOrSubproofs(statement, stepsOrSubproofs, context) {
169
- let statementAndStepsOrSubproofsUnify = false;
168
+ unifyStatementAndSubproofOrProofAssertions(statement, subproofOrProofAssertions, context) {
169
+ let statementAndSubproofOrProofAssertionsUnify = false;
170
170
 
171
171
  const { Substitutions } = elements,
172
172
  substitutions = Substitutions.fromNothing(),
173
173
  statementUnifiesWithConclusion = this.unifyStatementWithConclusion(statement, substitutions, context);
174
174
 
175
175
  if (statementUnifiesWithConclusion) {
176
- const stepsOrSubproofsUnifiesWithPremises = this.unifyStepsOrSubproofsWithPremises(stepsOrSubproofs, substitutions, context);
176
+ const subproofOrProofAssertionsUnifiesWithPremises = this.unifySubproofOrProofAssertionsWithPremises(subproofOrProofAssertions, substitutions, context);
177
177
 
178
- if (stepsOrSubproofsUnifiesWithPremises) {
178
+ if (subproofOrProofAssertionsUnifiesWithPremises) {
179
179
  const substitutionsResolved = substitutions.areResolved();
180
180
 
181
181
  if (substitutionsResolved) {
182
- statementAndStepsOrSubproofsUnify = true;
182
+ statementAndSubproofOrProofAssertionsUnify = true;
183
183
  }
184
184
  }
185
185
  }
186
186
 
187
- return statementAndStepsOrSubproofsUnify;
187
+ return statementAndSubproofOrProofAssertionsUnify;
188
188
  }
189
189
 
190
- unifyStepsOrSubproofsWithPremise(stepsOrSubproofs, premise, substitutions, context) {
191
- let stepsOrSubproofsUnifiesWithPremise = false;
190
+ unifySubproofOrProofAssertionsWithPremise(subproofOrProofAssertions, premise, substitutions, context) {
191
+ let subproofOrProofAssertionsUnifiesWithPremise = false;
192
192
 
193
- if (!stepsOrSubproofsUnifiesWithPremise) {
193
+ if (!subproofOrProofAssertionsUnifiesWithPremise) {
194
194
  const premiseUnifiesIndependently = premise.unifyIndependently(substitutions, context);
195
195
 
196
196
  if (premiseUnifiesIndependently) {
197
- stepsOrSubproofsUnifiesWithPremise = true;
197
+ subproofOrProofAssertionsUnifiesWithPremise = true;
198
198
  }
199
199
  }
200
200
 
201
- if (!stepsOrSubproofsUnifiesWithPremise) {
202
- const stepOrSubproof = extract(stepsOrSubproofs, (stepOrSubproof) => {
203
- const stepOrSubproofUnifies = premise.unifyStepOrSubproof(stepOrSubproof, substitutions, context);
201
+ if (!subproofOrProofAssertionsUnifiesWithPremise) {
202
+ const subproofOrProofAssertion = extract(subproofOrProofAssertions, (subproofOrProofAssertion) => {
203
+ const subproofOrProofAssertionUnifies = premise.unifySubproofOrProofAssertion(subproofOrProofAssertion, substitutions, context);
204
204
 
205
- if (stepOrSubproofUnifies) {
205
+ if (subproofOrProofAssertionUnifies) {
206
206
  return true;
207
207
  }
208
208
  }) || null;
209
209
 
210
- if (stepOrSubproof !== null) {
211
- stepsOrSubproofsUnifiesWithPremise = true;
210
+ if (subproofOrProofAssertion !== null) {
211
+ subproofOrProofAssertionsUnifiesWithPremise = true;
212
212
  }
213
213
  }
214
214
 
215
- return stepsOrSubproofsUnifiesWithPremise;
215
+ return subproofOrProofAssertionsUnifiesWithPremise;
216
216
  }
217
217
 
218
- unifyStepsOrSubproofsWithPremises(stepsOrSubproofs, substitutions, context) {
219
- stepsOrSubproofs = reverse(stepsOrSubproofs); ///
218
+ unifySubproofOrProofAssertionsWithPremises(subproofOrProofAssertions, substitutions, context) {
219
+ subproofOrProofAssertions = reverse(subproofOrProofAssertions); ///
220
220
 
221
- const stepsOrSubproofsUnifiesWithPremises = backwardsEvery(this.premises, (premise) => {
222
- const stepUnifiesWithPremise = this.unifyStepsOrSubproofsWithPremise(stepsOrSubproofs, premise, substitutions, context);
221
+ const subproofOrProofAssertionsUnifiesWithPremises = backwardsEvery(this.premises, (premise) => {
222
+ const stepUnifiesWithPremise = this.unifySubproofOrProofAssertionsWithPremise(subproofOrProofAssertions, premise, substitutions, context);
223
223
 
224
224
  if (stepUnifiesWithPremise) {
225
225
  return true;
226
226
  }
227
227
  });
228
228
 
229
- return stepsOrSubproofsUnifiesWithPremises;
229
+ return subproofOrProofAssertionsUnifiesWithPremises;
230
230
  }
231
231
 
232
232
  toJSON() {
@@ -45,11 +45,11 @@ export default define(class Section extends Element {
45
45
  const hypothesesVerify = this.verifyHypotheses();
46
46
 
47
47
  if (hypothesesVerify) {
48
- const axiomLemmaTheoremOrConjecture = (this.axiom || this.lemma || this.theorem || this.conjecture),
49
- axiomLemmaTheoremOrConjectureVerifies = axiomLemmaTheoremOrConjecture.verify(this.context);
48
+ const topLevelAssertion = (this.axiom || this.lemma || this.theorem || this.conjecture),
49
+ topLevelAssertionVerifies = topLevelAssertion.verify(this.context);
50
50
 
51
- if (axiomLemmaTheoremOrConjectureVerifies) {
52
- axiomLemmaTheoremOrConjecture.setHypotheses(this.hypotheses);
51
+ if (topLevelAssertionVerifies) {
52
+ topLevelAssertion.setHypotheses(this.hypotheses);
53
53
 
54
54
  verifies = true;
55
55
  }
@@ -18,15 +18,8 @@ export default define(class Statement extends Element {
18
18
  }
19
19
 
20
20
  getMetavariableName() {
21
- let metavariableName = null;
22
-
23
- const singular = this.isSingular();
24
-
25
- if (singular) {
26
- const node = this.getNode();
27
-
28
- metavariableName = node.getMetavariableName();
29
- }
21
+ const node = this.getNode(),
22
+ metavariableName = node.getMetavariableName();
30
23
 
31
24
  return metavariableName;
32
25
  }
@@ -254,19 +247,19 @@ export default define(class Statement extends Element {
254
247
  return unifiesIndependently;
255
248
  }
256
249
 
257
- compareStepsOrSubproofs(stepsOrSubproofs, context) {
258
- let comparesToStepsOrSubproofs;
250
+ compareSubproofOrProofAssertions(subproofOrProofAssertions, context) {
251
+ let comparesToSubproofOrProofAssertions;
259
252
 
260
- comparesToStepsOrSubproofs = backwardsSome(stepsOrSubproofs, (stepOrSubproof) => {
253
+ comparesToSubproofOrProofAssertions = backwardsSome(subproofOrProofAssertions, (subproofOrProofAssertion) => {
261
254
  const statement = this, ///
262
- stepOrSubproofComparesToStatement = stepOrSubproof.compareStatement(statement, context);
255
+ subproofOrProofAssertionComparesToStatement = subproofOrProofAssertion.compareStatement(statement, context);
263
256
 
264
- if (stepOrSubproofComparesToStatement) {
257
+ if (subproofOrProofAssertionComparesToStatement) {
265
258
  return true;
266
259
  }
267
260
  });
268
261
 
269
- return comparesToStepsOrSubproofs;
262
+ return comparesToSubproofOrProofAssertions;
270
263
  }
271
264
 
272
265
  toJSON() {