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
@@ -150,21 +150,40 @@ export function rulsStringFromLabelsPremisesAndConclusion(labels, premises, conc
150
150
  conclusionString = conclusion.getString(),
151
151
  labelsString = labelsStringFromLabels(labels),
152
152
  ruleString = (premisesString !== null) ?
153
- `${labelsString} :: [${premisesString}] ... ${conclusionString}` :
153
+ `${labelsString} :: [${premisesString}]...${conclusionString}` :
154
154
  `${labelsString} :: ${conclusionString}`;
155
155
 
156
156
  return ruleString;
157
157
  }
158
158
 
159
+ export function sectionStringFromHypothesesTopLevelAssertion(hypotheses, axiom, lemma, theorem, conjecture, context) {
160
+ const topLevelAssertion = (axiom || lemma || theorem || conjecture),
161
+ topLevelAssertionString = topLevelAssertion.getString(),
162
+ hypothesesString = hypothesesStringFromHypotheses(hypotheses, context),
163
+ sectionString = (topLevelAssertionString !== null) ?
164
+ `[${hypothesesString}]::: ${topLevelAssertionString}` :
165
+ `[${hypothesesString}]::: `;
166
+
167
+ return sectionString;
168
+ }
169
+
159
170
  export function subproofStringFromSuppositionsAndSubDerivation(suppositions, subDerivation) {
160
- const lastStep = subDerivation.getLastStep(),
161
- lastStepString = lastStep.getString(),
171
+ const lastProofAssertion = subDerivation.getLastProofAssertion(),
162
172
  suppositionsString = suppositionsStringFromSuppositions(suppositions),
163
- subproofString = `[${suppositionsString}] ... ${lastStepString}`;
173
+ lastProofAssertionString = lastProofAssertion.getString(),
174
+ subproofString = `[${suppositionsString}]...${lastProofAssertionString}`;
164
175
 
165
176
  return subproofString;
166
177
  }
167
178
 
179
+ export function frameSubstitutionStringFromFrameAndMetavariable(frame, metavariable) {
180
+ const frameString = frame.getString(),
181
+ metavariableString = metavariable.getString(),
182
+ string = `[${frameString} for [${metavariableString}]]`;
183
+
184
+ return string;
185
+ }
186
+
168
187
  export function typeStringFromTypeNameTypePrefixNameAndSuperTypes(typeName, typePrefixName, superTypes) {
169
188
  let typeString;
170
189
 
@@ -189,44 +208,50 @@ export function procedureCallStringFromProcedureReferenceAndParameters(procedure
189
208
  return procedureCallString;
190
209
  }
191
210
 
192
- export function sectionStringFromHypothesesAxiomLemmaTheoremAndConjecture(hypotheses, axiom, lemma, theorem, conjecture, context) {
193
- const axiomLemmaTheoremOrConjecture = (axiom || lemma || theorem || conjecture),
194
- axiomLemmaTheoremOrConjectureString = axiomLemmaTheoremOrConjecture.getString(),
195
- hypothesesString = hypothesesStringFromHypotheses(hypotheses, context),
196
- sectionString = (axiomLemmaTheoremOrConjectureString !== null) ?
197
- `[${hypothesesString}]::: ${axiomLemmaTheoremOrConjectureString}` :
198
- `[${hypothesesString}]::: `;
211
+ export function statementSubstitutionStringFromStatementAndMetavariable(statement, metavariable) {
212
+ const statementString = statement.getString(),
213
+ metavariableString = metavariable.getString(),
214
+ statementSubstitutionString = `[${statementString} for ${metavariableString}]`;
199
215
 
200
- return sectionString;
216
+ return statementSubstitutionString;
201
217
  }
202
218
 
203
- export function metaLemmaMetatheoremStringFromLabelSuppositionsAndDeduction(label, suppositions, deduction) {
204
- const suppositionsString = suppositionsStringFromSuppositions(suppositions),
205
- deductionString = deduction.getString(),
206
- labelString = label.getString(),
207
- metaLemmaMetatheoremString = (suppositionsString !== null) ?
208
- `${labelString} :: [${suppositionsString}] ... ${deductionString}` :
209
- `${labelString} :: ${deductionString}`;
210
-
211
- return metaLemmaMetatheoremString;
212
- }
213
-
214
- export function axiomLemmaTheoremConjectureStringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction) {
215
- let axiomLemmaTheoremConjectureString;
219
+ export function topLevelAssertionStringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction) {
220
+ let topLevelAssertionString;
216
221
 
217
222
  const suppositionsString = suppositionsStringFromSuppositions(suppositions),
218
223
  deductionString = deduction.getString(),
219
224
  labelsString = labelsStringFromLabels(labels);
220
225
 
221
226
  if (labelsString !== null) {
222
- axiomLemmaTheoremConjectureString = (suppositionsString !== null) ?
223
- `${labelsString} :: [${suppositionsString}] ... ${deductionString}` :
224
- `${labelsString} :: ${deductionString}`;
227
+ topLevelAssertionString = (suppositionsString !== null) ?
228
+ `${labelsString} :: [${suppositionsString}]...${deductionString}` :
229
+ `${labelsString} :: ${deductionString}`;
225
230
  } else {
226
- axiomLemmaTheoremConjectureString = (suppositionsString !== null) ?
227
- `[${suppositionsString}] ... ${deductionString}` :
228
- deductionString;
231
+ topLevelAssertionString = (suppositionsString !== null) ?
232
+ `[${suppositionsString}]...${deductionString}` :
233
+ deductionString;
229
234
  }
230
235
 
231
- return axiomLemmaTheoremConjectureString;
236
+ return topLevelAssertionString;
237
+ }
238
+
239
+ export function topLevelMetaAssertionStringFromLabelSuppositionsAndDeduction(label, suppositions, deduction) {
240
+ const suppositionsString = suppositionsStringFromSuppositions(suppositions),
241
+ deductionString = deduction.getString(),
242
+ labelString = label.getString(),
243
+ topLevelMetaAssertionString = (suppositionsString !== null) ?
244
+ `${labelString} :: [${suppositionsString}]...${deductionString}` :
245
+ `${labelString} :: ${deductionString}`;
246
+
247
+ return topLevelMetaAssertionString;
248
+ }
249
+
250
+ export function statementSubstitutionStringFromStatementMetavariableAndSubstitution(statement, metavariable, substitution) {
251
+ const statementString = statement.getString(),
252
+ metavariableString = metavariable.getString(),
253
+ substitutionString = substitution.getString(),
254
+ statementSubstitutionString = `[${statementString} for ${metavariableString}${substitutionString}]`;
255
+
256
+ return statementSubstitutionString;
232
257
  }
@@ -24,10 +24,10 @@ function unifyStatementWithRule(statement, reference, satisfiesAssertion, substi
24
24
 
25
25
  context.trace(`Unifying the '${statementString}' statement with the '${ruleString}' rule...`);
26
26
 
27
- const stepsOrSubproofs = context.getStepsOrSubproofs(),
28
- statementAndStepsUnify = rule.unifyStatementAndStepsOrSubproofs(statement, stepsOrSubproofs, context);
27
+ const subproofOrProofAssertions = context.getSubproofOrProofAssertions(),
28
+ statementAndSubproofOrProofAssertionsUnify = rule.unifyStatementAndSubproofOrProofAssertions(statement, subproofOrProofAssertions, context);
29
29
 
30
- if (statementAndStepsUnify) {
30
+ if (statementAndSubproofOrProofAssertionsUnify) {
31
31
  statementUnifiesWithRule = true;
32
32
  }
33
33
 
@@ -44,14 +44,14 @@ function unifyStatementWithReference(statement, reference, satisfiesAssertion, s
44
44
  let statementUnifiesWithReference = false;
45
45
 
46
46
  if (reference !== null) {
47
- const metavariableVerifies = reference.verifyMetavariable(context);
47
+ const statementString = statement.getString(),
48
+ referenceString = reference.getString();
48
49
 
49
- if (metavariableVerifies) {
50
- const statementString = statement.getString(),
51
- referenceString = reference.getString();
50
+ context.trace(`Unifying the '${statementString}' statement with the '${referenceString}' reference...`);
52
51
 
53
- context.trace(`Unifying the '${statementString}' statement with the '${referenceString}' reference...`);
52
+ const metavariableValidates = reference.validateMetavariable(context);
54
53
 
54
+ if (metavariableValidates) {
55
55
  const { StatementSubstitution } = elements,
56
56
  metavariable = reference.getMetavariable(),
57
57
  statementSubstitution = StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context),
@@ -60,10 +60,10 @@ function unifyStatementWithReference(statement, reference, satisfiesAssertion, s
60
60
  substitutions.addSubstitution(substitution, context);
61
61
 
62
62
  statementUnifiesWithReference = true;
63
+ }
63
64
 
64
- if (statementUnifiesWithReference) {
65
- context.debug(`...unified the '${statementString}' statement with the '${referenceString}' reference.`);
66
- }
65
+ if (statementUnifiesWithReference) {
66
+ context.debug(`...unified the '${statementString}' statement with the '${referenceString}' reference.`);
67
67
  }
68
68
  }
69
69
 
@@ -86,9 +86,9 @@ function unifyStatementAsSatisfiesAssertion(statement, reference, satisfiesAsser
86
86
  satisfiesAssertion.verifySignature(assignments, stated, context);
87
87
 
88
88
  if (reference === null) {
89
- const stepsOrSubproofs = context.getStepsOrSubproofs();
89
+ const subproofOrProofAssertions = context.getSubproofOrProofAssertions();
90
90
 
91
- statementUnifiesAsSatisfiesAssertion = backwardsSome(stepsOrSubproofs, (stepsOrSubproof) => {
91
+ statementUnifiesAsSatisfiesAssertion = backwardsSome(subproofOrProofAssertions, (stepsOrSubproof) => {
92
92
  const stepOrSubProofUnifiesWIthSatisfiesAssertion = stepsOrSubproof.unifyWithSatisfiesAssertion(satisfiesAssertion, context);
93
93
 
94
94
  if (stepOrSubProofUnifiesWIthSatisfiesAssertion) {
@@ -96,9 +96,9 @@ function unifyStatementAsSatisfiesAssertion(statement, reference, satisfiesAsser
96
96
  }
97
97
  });
98
98
  } else {
99
- const axiomLemmaTheoremOrConjecture = context.findAxiomLemmaTheoremOrConjectureByReference(reference);
99
+ const topLevelAssertion = context.findTopLevelAssertionByReference(reference);
100
100
 
101
- if (axiomLemmaTheoremOrConjecture !== null) {
101
+ if (topLevelAssertion !== null) {
102
102
  reference = satisfiesAssertion.getReference();
103
103
 
104
104
  const axiom = context.findAxiomByReference(reference);
@@ -109,9 +109,9 @@ function unifyStatementAsSatisfiesAssertion(statement, reference, satisfiesAsser
109
109
  if (satisfiable) {
110
110
  const { Substitutions } = elements,
111
111
  substitutions = Substitutions.fromNothing(),
112
- axiomLemmaTheoremOrConjectureUnifies = axiom.unifyAxiomLemmaTheoremOrConjecture(axiomLemmaTheoremOrConjecture, substitutions, context);
112
+ topLevelAssertionUnifies = axiom.unifyTopLevelAssertion(topLevelAssertion, substitutions, context);
113
113
 
114
- if (axiomLemmaTheoremOrConjectureUnifies) {
114
+ if (topLevelAssertionUnifies) {
115
115
  const substitutionsCorrelates = satisfiesAssertion.correlateSubstitutions(substitutions, context);
116
116
 
117
117
  if (substitutionsCorrelates) {
@@ -135,27 +135,27 @@ function unifyStatementAsSatisfiesAssertion(statement, reference, satisfiesAsser
135
135
  return statementUnifiesAsSatisfiesAssertion;
136
136
  }
137
137
 
138
- function unifyStatementWithAxiomLemmaTheoremOrConjecture(statement, reference, satisfiesAssertion, substitutions, context) {
139
- let statementUnifiesWithAxiomLemmaTheoremOrConjecture = false;
138
+ function unifyStatementWithTopLevelAssertion(statement, reference, satisfiesAssertion, substitutions, context) {
139
+ let statementUnifiesWithTopLevelAssertion = false;
140
140
 
141
141
  if (reference !== null) {
142
142
  const { Substitutions } = elements,
143
- axiomLemmaTheoremOrConjecture = context.findAxiomLemmaTheoremOrConjectureByReference(reference),
143
+ topLevelAssertion = context.findTopLevelAssertionByReference(reference),
144
144
  generalSubstitutions = substitutions; ///
145
145
 
146
- if (axiomLemmaTheoremOrConjecture !== null) {
146
+ if (topLevelAssertion !== null) {
147
147
  const statementString = statement.getString(),
148
- axiomLemmaTheoremOrConjectureString = reference.getString();
148
+ topLevelAssertionString = reference.getString();
149
149
 
150
- context.trace(`Unifying the '${statementString}' statement with the '${axiomLemmaTheoremOrConjectureString}' axiom, lemma, theorem or conjecture...`);
150
+ context.trace(`Unifying the '${statementString}' statement with the '${topLevelAssertionString}' top level assertion...`);
151
151
 
152
- const stepsOrSubproofs = context.getStepsOrSubproofs();
152
+ const subproofOrProofAssertions = context.getSubproofOrProofAssertions();
153
153
 
154
154
  substitutions = Substitutions.fromNothing();
155
155
 
156
- const statementAndStepsUnify = axiomLemmaTheoremOrConjecture.unifyStatementAndStepsOrSubproofs(statement, stepsOrSubproofs, substitutions, context);
156
+ const statementAndSubproofOrProofAssertionsUnify = topLevelAssertion.unifyStatementAndSubproofOrProofAssertions(statement, subproofOrProofAssertions, substitutions, context);
157
157
 
158
- if (statementAndStepsUnify) {
158
+ if (statementAndSubproofOrProofAssertionsUnify) {
159
159
  const { StatementSubstitution } = elements,
160
160
  metavariable = reference.getMetavariable(),
161
161
  statementSubstitution = StatementSubstitution.fromStatementAndMetavariable(statement, metavariable, context),
@@ -165,16 +165,16 @@ function unifyStatementWithAxiomLemmaTheoremOrConjecture(statement, reference, s
165
165
 
166
166
  substitutions.addSubstitution(substitution, context);
167
167
 
168
- statementUnifiesWithAxiomLemmaTheoremOrConjecture = true;
168
+ statementUnifiesWithTopLevelAssertion = true;
169
169
  }
170
170
 
171
- if (statementUnifiesWithAxiomLemmaTheoremOrConjecture) {
172
- context.debug(`...unified the '${statementString}' statement with the '${axiomLemmaTheoremOrConjectureString}' axiom, lemma, theorem or conjecture.`);
171
+ if (statementUnifiesWithTopLevelAssertion) {
172
+ context.debug(`...unified the '${statementString}' statement with the '${topLevelAssertionString}' top level assertion.`);
173
173
  }
174
174
  }
175
175
  }
176
176
 
177
- return statementUnifiesWithAxiomLemmaTheoremOrConjecture;
177
+ return statementUnifiesWithTopLevelAssertion;
178
178
  }
179
179
 
180
180
  function unifyStatementAEquality(statement, reference, satisfiesAssertion, substitutions, context) {
@@ -292,8 +292,8 @@ function unifyStatementWithSatisfiesAssertion(statement, reference, satisfiesAss
292
292
 
293
293
  context.trace(`Unifying the '${statementString}' statememnt with the '${satisfiesAssertionString}' satisfies assertion...`);
294
294
 
295
- const stepsOrSubproofs = context.getStepsOrSubproofs(),
296
- statementUnifies = satisfiesAssertion.unifyStatementAndStepsOrSubproofs(statement, stepsOrSubproofs, context);
295
+ const subproofOrProofAssertions = context.getSubproofOrProofAssertions(),
296
+ statementUnifies = satisfiesAssertion.unifyStatementAndSubproofOrProofAssertions(statement, subproofOrProofAssertions, context);
297
297
 
298
298
  if (statementUnifies) {
299
299
  statementUnifiesWithSatisfiesAssertion = true;
@@ -307,23 +307,23 @@ function unifyStatementWithSatisfiesAssertion(statement, reference, satisfiesAss
307
307
  return statementUnifiesWithSatisfiesAssertion;
308
308
  }
309
309
 
310
- function compareStatementWithStepsOrSubproofs(statement, reference, satisfiesAssertion, substitutions, context) {
310
+ function compareStatementWithSubproofOrProofAssertions(statement, reference, satisfiesAssertion, substitutions, context) {
311
311
  let statementEquatesWithStepOrSubproofs = false;
312
312
 
313
313
  if (reference === null) {
314
314
  const statementString = statement.getString();
315
315
 
316
- context.trace(`Comparing the '${statementString}' statement with the steps or subproofs...`);
316
+ context.trace(`Comparing the '${statementString}' statement with the subproofs or proof asssertions...`);
317
317
 
318
- const stepsOrSubproofs = context.getStepsOrSubproofs(),
319
- statementUnifiesWithSteps = statement.compareStepsOrSubproofs(stepsOrSubproofs, context);
318
+ const subproofOrProofAssertions = context.getSubproofOrProofAssertions(),
319
+ statementUnifiesWithSteps = statement.compareSubproofOrProofAssertions(subproofOrProofAssertions, context);
320
320
 
321
321
  if (statementUnifiesWithSteps) {
322
322
  statementEquatesWithStepOrSubproofs = true;
323
323
  }
324
324
 
325
325
  if (statementEquatesWithStepOrSubproofs) {
326
- context.debug(`...compared the '${statementString}' statement with the steps or subproofs.`);
326
+ context.debug(`...compared the '${statementString}' statement with the subproofs or proof asssertions.`);
327
327
  }
328
328
  }
329
329
 
@@ -334,11 +334,11 @@ export const unifyStatements = [
334
334
  unifyStatementWithRule,
335
335
  unifyStatementWithReference,
336
336
  unifyStatementAsSatisfiesAssertion,
337
- unifyStatementWithAxiomLemmaTheoremOrConjecture,
337
+ unifyStatementWithTopLevelAssertion,
338
338
  unifyStatementAEquality,
339
339
  unifyStatementAsJudgement,
340
340
  unifyStatementAsTypeAssertion,
341
341
  unifyStatementAsPropertyAssertion,
342
342
  unifyStatementWithSatisfiesAssertion,
343
- compareStatementWithStepsOrSubproofs
343
+ compareStatementWithSubproofOrProofAssertions
344
344
  ];
@@ -2,9 +2,9 @@
2
2
 
3
3
  import elements from "../elements";
4
4
 
5
+ import { bracketedConstructorFromNothing, bracketedCombinatorFromNothing } from "../utilities/instance";
5
6
  import { equalityFromStatement,
6
7
  judgementFromStatement,
7
- metavariableFromStatement,
8
8
  typeAssertionFromStatement,
9
9
  definedAssertionFromStatement,
10
10
  propertyAssertionFromStatement,
@@ -15,8 +15,7 @@ import { equalityFromStatement,
15
15
  function unifyTermWithBracketedConstructor(term, context, validateAhead) {
16
16
  let termUnifiesWithBracketedConstructor;
17
17
 
18
- const { BracketedConstructor } = elements,
19
- bracketedConstructor = BracketedConstructor.fromNothing();
18
+ const bracketedConstructor = bracketedConstructorFromNothing();
20
19
 
21
20
  termUnifiesWithBracketedConstructor = bracketedConstructor.unifyTerm(term, context, validateAhead);
22
21
 
@@ -42,40 +41,31 @@ function unifyTermWithConstructors(term, context, validateAhead) {
42
41
  function validateTermAsVariable(term, context, validateAhead) {
43
42
  let termValidatesAsVariable = false;
44
43
 
45
- const { Variable } = elements,
46
- termNode = term.getNode(),
47
- singularVariableNode = termNode.getSingularVariableNode();
44
+ const termNode = term.getNode(),
45
+ variableNode = termNode.getVariableNode();
48
46
 
49
- if (singularVariableNode !== null) {
50
- let variable;
47
+ if (variableNode !== null) {
48
+ const termString = term.getString();
51
49
 
52
- const termString = term.getString(),
53
- variableNode = singularVariableNode; ///
50
+ context.trace(`Validating the '${termString}' term as a variable...`);
54
51
 
55
- variable = Variable.fromVariableNode(variableNode, context);
56
-
57
- context.trace(`Verifying the '${termString}' term as a variable...`);
58
-
59
- const variableValidates = variable.validate(context);
60
-
61
- if (variableValidates) {
62
- let verifiesAhead;
63
-
64
- const variableIdentifier = variable.getIdentifier();
65
-
66
- variable = context.findVariableByVariableIdentifier(variableIdentifier);
52
+ const variableIdentifier = variableNode.getVariableIdentifier(),
53
+ variable = context.findVariableByVariableIdentifier(variableIdentifier);
67
54
 
55
+ if (variable !== null) {
68
56
  const type = variable.getType();
69
57
 
70
58
  term.setType(type);
71
59
 
72
- verifiesAhead = validateAhead();
60
+ const verifiesAhead = validateAhead();
73
61
 
74
- termValidatesAsVariable = verifiesAhead; ///
62
+ if (verifiesAhead) {
63
+ termValidatesAsVariable = true;
64
+ }
75
65
  }
76
66
 
77
67
  if (termValidatesAsVariable) {
78
- context.debug(`...verified the '${termString}' term as a variable.`);
68
+ context.debug(`...validated the '${termString}' term as a variable.`);
79
69
  }
80
70
  }
81
71
 
@@ -85,16 +75,20 @@ function validateTermAsVariable(term, context, validateAhead) {
85
75
  function validateStatementAsMetavariableAndSubstitution(statement, assignments, stated, context) {
86
76
  let statementValidatesAsMetavariableAndSubstitution = false;
87
77
 
88
- const metavariable = metavariableFromStatement(statement, context);
78
+ const statementNode = statement.getNode(),
79
+ metavariableNode = statementNode.getMetavariableNode();
89
80
 
90
- if (metavariable !== null) {
81
+ if (metavariableNode !== null) {
91
82
  const statementString = statement.getString();
92
83
 
93
84
  context.trace(`Validating the '${statementString}' statement as a metavariable and substitution...`);
94
85
 
95
- const metavariableValidates = metavariable.validate(context);
86
+ const metavariableName = metavariableNode.getMetavariableName(),
87
+ metavariable = context.findMetavariableByMetavariableName(metavariableName);
88
+
89
+ if (metavariable !== null) {
90
+ statementValidatesAsMetavariableAndSubstitution = true;
96
91
 
97
- if (metavariableValidates) {
98
92
  const { TermSubstitution, FrameSubstitution } = elements,
99
93
  frameSubstitution = FrameSubstitution.fromStatement(statement, context),
100
94
  termSubstitution = TermSubstitution.fromStatement(statement, context),
@@ -103,11 +97,9 @@ function validateStatementAsMetavariableAndSubstitution(statement, assignments,
103
97
  if (substitution !== null) {
104
98
  const substitutionValidates = substitution.validate(context);
105
99
 
106
- if (substitutionValidates) {
107
- statementValidatesAsMetavariableAndSubstitution = true;
100
+ if (!substitutionValidates) {
101
+ statementValidatesAsMetavariableAndSubstitution = false;
108
102
  }
109
- } else {
110
- statementValidatesAsMetavariableAndSubstitution = true;
111
103
  }
112
104
  }
113
105
 
@@ -124,8 +116,7 @@ function unifyStatementWithBracketedCombinator(statement, assignments, stated, c
124
116
 
125
117
  assignments = null; ///
126
118
 
127
- const { BracketedCombinator } = elements,
128
- bracketedCombinator = BracketedCombinator.fromNothing(),
119
+ const bracketedCombinator = bracketedCombinatorFromNothing(),
129
120
  statementUnifiesWithBracketedCombinator = bracketedCombinator.unifyStatement(statement, assignments, stated, context);
130
121
 
131
122
  return statementUnifiesWithBracketedCombinator;