occam-verify-cli 1.0.448 → 1.0.472

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/lib/constants.js +13 -5
  2. package/lib/context/ephemeral.js +270 -0
  3. package/lib/context/file.js +136 -128
  4. package/lib/context/liminal.js +120 -0
  5. package/lib/context/literal.js +92 -0
  6. package/lib/context/nominal.js +15 -1
  7. package/lib/context/release.js +68 -9
  8. package/lib/context/scoped.js +322 -0
  9. package/lib/context/synthetic.js +133 -0
  10. package/lib/element/assertion/contained.js +66 -66
  11. package/lib/element/assertion/defined.js +32 -32
  12. package/lib/element/assertion/property.js +39 -39
  13. package/lib/element/assertion/satisfies.js +22 -22
  14. package/lib/element/assumption.js +71 -87
  15. package/lib/element/combinator/bracketed.js +1 -10
  16. package/lib/element/conclusion.js +19 -15
  17. package/lib/element/constructor/bracketed.js +1 -10
  18. package/lib/element/constructor.js +2 -2
  19. package/lib/element/declaration/combinator.js +1 -2
  20. package/lib/element/declaration/metavariable.js +3 -3
  21. package/lib/element/declaration/variable.js +3 -3
  22. package/lib/element/deduction.js +26 -20
  23. package/lib/element/derivation.js +3 -3
  24. package/lib/element/equality.js +5 -5
  25. package/lib/element/equivalence.js +112 -107
  26. package/lib/element/equivalences.js +24 -10
  27. package/lib/element/error.js +3 -3
  28. package/lib/element/frame.js +73 -62
  29. package/lib/element/hypothesis.js +2 -2
  30. package/lib/element/judgement.js +40 -60
  31. package/lib/element/metaType.js +4 -4
  32. package/lib/element/metavariable.js +49 -38
  33. package/lib/element/parameter.js +13 -5
  34. package/lib/element/procedureCall.js +16 -16
  35. package/lib/element/proof.js +14 -13
  36. package/lib/element/proofAssertion/premise.js +319 -0
  37. package/lib/element/proofAssertion/step.js +309 -0
  38. package/lib/element/proofAssertion/supposition.js +333 -0
  39. package/lib/element/proofAssertion.js +20 -10
  40. package/lib/element/propertyRelation.js +2 -2
  41. package/lib/element/reference.js +72 -30
  42. package/lib/element/rule.js +26 -28
  43. package/lib/element/section.js +5 -5
  44. package/lib/element/signature.js +9 -6
  45. package/lib/element/statement.js +44 -36
  46. package/lib/element/subproof.js +18 -17
  47. package/lib/element/substitution/frame.js +86 -49
  48. package/lib/element/substitution/reference.js +101 -19
  49. package/lib/element/substitution/statement.js +128 -105
  50. package/lib/element/substitution/term.js +93 -57
  51. package/lib/element/substitution.js +20 -69
  52. package/lib/element/substitutions.js +49 -34
  53. package/lib/element/term.js +41 -30
  54. package/lib/element/topLevelAssertion/axiom.js +331 -0
  55. package/lib/element/{conjecture.js → topLevelAssertion/conjecture.js} +10 -10
  56. package/lib/element/{lemma.js → topLevelAssertion/lemma.js} +9 -9
  57. package/lib/element/{theorem.js → topLevelAssertion/theorem.js} +8 -8
  58. package/lib/element/topLevelAssertion.js +434 -0
  59. package/lib/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +8 -8
  60. package/lib/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +8 -8
  61. package/lib/element/topLevelMetaAssertion.js +293 -0
  62. package/lib/element/type.js +4 -4
  63. package/lib/element/variable.js +48 -40
  64. package/lib/index.js +3 -3
  65. package/lib/main.js +3 -3
  66. package/lib/metaTypes.js +18 -15
  67. package/lib/node/frame.js +2 -2
  68. package/lib/node/metavariable.js +4 -4
  69. package/lib/node/parameter.js +28 -7
  70. package/lib/node/proofAssertion/premise.js +116 -0
  71. package/lib/node/proofAssertion/step.js +152 -0
  72. package/lib/node/proofAssertion/supposition.js +116 -0
  73. package/lib/node/{premise.js → proofAssertion.js} +11 -18
  74. package/lib/node/statement.js +2 -2
  75. package/lib/node/substitution/frame.js +9 -31
  76. package/lib/node/substitution/reference.js +137 -0
  77. package/lib/node/substitution/statement.js +9 -31
  78. package/lib/node/substitution/term.js +9 -23
  79. package/lib/node/{axiom.js → topLevelAssertion/axiom.js} +7 -7
  80. package/lib/node/{conjecture.js → topLevelAssertion/conjecture.js} +7 -7
  81. package/lib/node/{lemma.js → topLevelAssertion/lemma.js} +7 -7
  82. package/lib/node/{theorem.js → topLevelAssertion/theorem.js} +7 -7
  83. package/lib/node/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +9 -9
  84. package/lib/node/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +7 -7
  85. package/lib/node/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +7 -7
  86. package/lib/node/{metaLemmaMetaTheorem.js → topLevelMetaAssertion.js} +9 -9
  87. package/lib/nonTerminalNodeMap.js +15 -14
  88. package/lib/preamble.js +10 -10
  89. package/lib/process/instantiate.js +6 -21
  90. package/lib/process/unify.js +11 -10
  91. package/lib/tokenTypes.js +22 -0
  92. package/lib/types.js +3 -3
  93. package/lib/utilities/bnf.js +5 -5
  94. package/lib/utilities/context.js +63 -0
  95. package/lib/utilities/element.js +235 -408
  96. package/lib/utilities/instance.js +12 -34
  97. package/lib/utilities/json.js +3 -2
  98. package/lib/utilities/string.js +56 -21
  99. package/lib/utilities/unification.js +38 -32
  100. package/lib/utilities/validation.js +47 -50
  101. package/package.json +2 -2
  102. package/src/constants.js +12 -1
  103. package/src/context/ephemeral.js +257 -0
  104. package/src/context/file.js +108 -116
  105. package/src/context/liminal.js +67 -0
  106. package/src/context/literal.js +51 -0
  107. package/src/context/nominal.js +12 -0
  108. package/src/context/release.js +48 -8
  109. package/src/context/{local.js → scoped.js} +43 -125
  110. package/src/context/synthetic.js +60 -0
  111. package/src/element/assertion/contained.js +49 -47
  112. package/src/element/assertion/defined.js +29 -27
  113. package/src/element/assertion/property.js +35 -35
  114. package/src/element/assertion/satisfies.js +19 -18
  115. package/src/element/assumption.js +71 -93
  116. package/src/element/combinator/bracketed.js +0 -7
  117. package/src/element/conclusion.js +25 -24
  118. package/src/element/constructor/bracketed.js +0 -7
  119. package/src/element/constructor.js +1 -1
  120. package/src/element/declaration/combinator.js +0 -1
  121. package/src/element/declaration/metavariable.js +2 -2
  122. package/src/element/declaration/variable.js +5 -5
  123. package/src/element/deduction.js +33 -31
  124. package/src/element/derivation.js +2 -2
  125. package/src/element/equality.js +4 -4
  126. package/src/element/equivalence.js +115 -135
  127. package/src/element/equivalences.js +9 -7
  128. package/src/element/error.js +4 -2
  129. package/src/element/frame.js +80 -65
  130. package/src/element/hypothesis.js +1 -1
  131. package/src/element/judgement.js +42 -62
  132. package/src/element/metaType.js +3 -4
  133. package/src/element/metavariable.js +59 -56
  134. package/src/element/parameter.js +10 -5
  135. package/src/element/procedureCall.js +20 -18
  136. package/src/element/proof.js +14 -16
  137. package/src/element/{premise.js → proofAssertion/premise.js} +57 -53
  138. package/src/element/{step.js → proofAssertion/step.js} +59 -62
  139. package/src/element/{supposition.js → proofAssertion/supposition.js} +67 -56
  140. package/src/element/proofAssertion.js +24 -13
  141. package/src/element/propertyRelation.js +1 -1
  142. package/src/element/reference.js +87 -37
  143. package/src/element/rule.js +31 -37
  144. package/src/element/section.js +5 -5
  145. package/src/element/signature.js +8 -8
  146. package/src/element/statement.js +52 -48
  147. package/src/element/subproof.js +16 -18
  148. package/src/element/substitution/frame.js +104 -50
  149. package/src/element/substitution/reference.js +120 -20
  150. package/src/element/substitution/statement.js +169 -130
  151. package/src/element/substitution/term.js +104 -63
  152. package/src/element/substitution.js +16 -58
  153. package/src/element/substitutions.js +43 -41
  154. package/src/element/term.js +47 -41
  155. package/src/element/{axiom.js → topLevelAssertion/axiom.js} +22 -20
  156. package/src/element/{conjecture.js → topLevelAssertion/conjecture.js} +5 -6
  157. package/src/element/{lemma.js → topLevelAssertion/lemma.js} +5 -6
  158. package/src/element/{theorem.js → topLevelAssertion/theorem.js} +5 -5
  159. package/src/element/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +37 -33
  160. package/src/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +5 -6
  161. package/src/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +5 -6
  162. package/src/element/{metaLemmaMetatheorem.js → topLevelMetaAssertion.js} +19 -17
  163. package/src/element/type.js +2 -4
  164. package/src/element/variable.js +47 -48
  165. package/src/index.js +2 -1
  166. package/src/main.js +2 -1
  167. package/src/metaTypes.js +25 -9
  168. package/src/node/frame.js +1 -1
  169. package/src/node/metavariable.js +3 -3
  170. package/src/node/parameter.js +32 -5
  171. package/src/node/proofAssertion/premise.js +16 -0
  172. package/src/node/{step.js → proofAssertion/step.js} +4 -18
  173. package/src/node/proofAssertion/supposition.js +16 -0
  174. package/src/node/proofAssertion.js +23 -0
  175. package/src/node/statement.js +1 -1
  176. package/src/node/substitution/frame.js +6 -32
  177. package/src/node/substitution/reference.js +38 -0
  178. package/src/node/substitution/statement.js +6 -32
  179. package/src/node/substitution/term.js +6 -22
  180. package/src/node/topLevelAssertion/axiom.js +13 -0
  181. package/src/node/topLevelAssertion/conjecture.js +13 -0
  182. package/src/node/topLevelAssertion/lemma.js +13 -0
  183. package/src/node/topLevelAssertion/theorem.js +13 -0
  184. package/src/node/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +1 -1
  185. package/src/node/topLevelMetaAssertion/metaLemma.js +13 -0
  186. package/src/node/topLevelMetaAssertion/metatheorem.js +13 -0
  187. package/src/node/{metaLemmaMetaTheorem.js → topLevelMetaAssertion.js} +1 -1
  188. package/src/nonTerminalNodeMap.js +15 -12
  189. package/src/preamble.js +9 -9
  190. package/src/process/instantiate.js +27 -36
  191. package/src/process/unify.js +10 -9
  192. package/src/tokenTypes.js +4 -0
  193. package/src/types.js +4 -2
  194. package/src/utilities/bnf.js +3 -2
  195. package/src/utilities/context.js +46 -0
  196. package/src/utilities/element.js +302 -509
  197. package/src/utilities/instance.js +19 -42
  198. package/src/utilities/json.js +3 -1
  199. package/src/utilities/string.js +69 -28
  200. package/src/utilities/unification.js +41 -38
  201. package/src/utilities/validation.js +66 -75
  202. package/lib/context/local.js +0 -605
  203. package/lib/context/temporary.js +0 -752
  204. package/lib/element/axiom.js +0 -329
  205. package/lib/element/axiomLemmaTheoremConjecture.js +0 -427
  206. package/lib/element/metaLemmaMetatheorem.js +0 -289
  207. package/lib/element/premise.js +0 -307
  208. package/lib/element/step.js +0 -311
  209. package/lib/element/supposition.js +0 -320
  210. package/lib/log.js +0 -150
  211. package/lib/node/step.js +0 -166
  212. package/lib/node/supposition.js +0 -130
  213. package/src/context/temporary.js +0 -476
  214. package/src/log.js +0 -118
  215. package/src/node/axiom.js +0 -13
  216. package/src/node/conjecture.js +0 -13
  217. package/src/node/lemma.js +0 -13
  218. package/src/node/metaLemma.js +0 -13
  219. package/src/node/metatheorem.js +0 -13
  220. package/src/node/premise.js +0 -30
  221. package/src/node/supposition.js +0 -30
  222. package/src/node/theorem.js +0 -13
@@ -25,7 +25,7 @@ export default class ProofAssertion extends Element {
25
25
  let comparesToStatement = false;
26
26
 
27
27
  const statementString = statement.getString(),
28
- proofAssertionString = this.getString();
28
+ proofAssertionString = this.getString(); ///
29
29
 
30
30
  context.trace(`Comparing the '${statementString}' statement to the '${proofAssertionString}' proof assertion...`);
31
31
 
@@ -46,28 +46,39 @@ export default class ProofAssertion extends Element {
46
46
  return comparesToStatement;
47
47
  }
48
48
 
49
- unifyStatement(statement, substitutions, context) {
50
- let statementUnifies = false;
49
+ validateStatement(assignments, context) {
50
+ let statementValidates;
51
51
 
52
- if (this.statement !== null) {
53
- const node = this.getNode(),
54
- premiseString = this.getString(), ///
55
- statementString = statement.getString();
52
+ const statementString = this.statement.getString(),
53
+ proofAssertionString = this.getString(); ///
56
54
 
57
- context.trace(`Unifying the '${statementString}' statement with the '${premiseString}' premise...`, node);
55
+ context.trace(`Validating the '${proofAssertionString}' proof assertion's '${statementString}' statement... `);
58
56
 
59
- const specificContext = context; ///
57
+ const stated = this.isStated();
60
58
 
61
- context = this.getContext(); ///
59
+ statementValidates = this.statement.validate(assignments, stated, context);
62
60
 
63
- const generalContext = context; ///
61
+ if (statementValidates) {
62
+ context.debug(`...validated the '${proofAssertionString}' proof assertion's '${statementString}' reference. `);
63
+ }
64
+
65
+ return statementValidates;
66
+ }
67
+
68
+ unifyStatement(statement, substitutions, generalContext, specificContext) {
69
+ let statementUnifies = false;
70
+
71
+ if (this.statement !== null) {
72
+ const context = specificContext, ///
73
+ statementString = statement.getString(),
74
+ proorAssertionString = this.getString(); ///
64
75
 
65
- context = specificContext; ///
76
+ context.trace(`Unifying the '${statementString}' statement with the '${proorAssertionString}' proof assertion...`);
66
77
 
67
78
  statementUnifies = this.statement.unifyStatement(statement, substitutions, generalContext, specificContext);
68
79
 
69
80
  if (statementUnifies) {
70
- context.debug(`...unified the '${statementString}' statement with the '${premiseString}' premise.`, node);
81
+ context.debug(`...unified the '${statementString}' statement with the '${proorAssertionString}' proof assertion.`);
71
82
  }
72
83
  }
73
84
 
@@ -23,7 +23,7 @@ export default define(class PropertyRelation extends Element {
23
23
  verify(context) {
24
24
  let verifies = false;
25
25
 
26
- const propertyRelationString = this.string; ///
26
+ const propertyRelationString = this.getString(); ///
27
27
 
28
28
  context.trace(`Verifying the '${propertyRelationString}' property relation...`);
29
29
 
@@ -4,7 +4,9 @@ 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 { attempt } from "../utilities/context";
8
+ import { REFERENCE_META_TYPE_NAME } from "../metaTypeNames";
9
+ import { findMetaTypeByMetaTypeName } from "../metaTypes";
8
10
  import { unifyMetavariableIntrinsically } from "../process/unify";
9
11
  import { metavariableFromJSON, metavariableToMetavariableJSON } from "../utilities/json";
10
12
 
@@ -35,45 +37,62 @@ export default define(class Reference extends Element {
35
37
 
36
38
  isMetavariableEqualToMetavariable(metavariable) { return this.metavariable.isEqualTo(metavariable); }
37
39
 
40
+ compareParameter(parameter) {
41
+ let comparesToParamter = false;
42
+
43
+ const parameterName = parameter.getName();
44
+
45
+ if (parameterName !== null) {
46
+ const metavariableName = this.getMetavariableName();
47
+
48
+ if (parameterName === metavariableName) {
49
+ comparesToParamter = true;
50
+ }
51
+ }
52
+
53
+ return comparesToParamter;
54
+ }
55
+
38
56
  compareMetavariableName(metavariableName) { return this.metavariable.compareMetavariableName(metavariableName); }
39
57
 
40
58
  matchMetavariableNode(metavariableNode) { return this.metavariable.matchNode(metavariableNode); }
41
59
 
42
- verify(context) {
43
- let verifies = false;
60
+ validate(context) {
61
+ let validate = false;
44
62
 
45
63
  const referenceString = this.getString(); ///
46
64
 
47
- context.trace(`Verifying the '${referenceString}' reference...`);
65
+ context.trace(`Validating the '${referenceString}' reference...`);
48
66
 
49
- if (!verifies) {
67
+ if (!validate) {
50
68
  const metavariableValidates = this.validateMetavariable(context);
51
69
 
52
- verifies = metavariableValidates; ///
70
+ validate = metavariableValidates; ///
53
71
  }
54
72
 
55
- if (!verifies) {
73
+ if (!validate) {
56
74
  const reference = this, ///
57
75
  labelPresent = context.isLabelPresentByReference(reference);
58
76
 
59
- verifies = labelPresent; ///
77
+ validate = labelPresent; ///
60
78
  }
61
79
 
62
- if (verifies) {
80
+ if (validate) {
63
81
  const reference = this; ///
64
82
 
65
83
  context.addReference(reference);
66
84
 
67
- context.debug(`...verified the '${referenceString}' reference.`);
85
+ context.debug(`...validated the '${referenceString}' reference.`);
68
86
  }
69
87
 
70
- return verifies;
88
+ return validate;
71
89
  }
72
90
 
73
91
  validateMetavariable(context) {
74
92
  let metavariableValidates = false;
75
93
 
76
- const referenceMetaType = referenceMetaTypeFromNothing(),
94
+ const metaTypeName = REFERENCE_META_TYPE_NAME,
95
+ referenceMetaType = findMetaTypeByMetaTypeName(metaTypeName),
77
96
  metaType = referenceMetaType, ///
78
97
  metavariableValidatesGivenMetaType = this.metavariable.validateGivenMetaType(metaType, context);
79
98
 
@@ -84,12 +103,34 @@ export default define(class Reference extends Element {
84
103
  return metavariableValidates;
85
104
  }
86
105
 
87
- unifyLabel(label, substitutions, context) {
106
+ validateAsMetavariable(context) {
107
+ let validatesAsMetavariable = false;
108
+
109
+ const referenceString = this.getString();
110
+
111
+ context.trace(`Validating the '${referenceString}' reference as a metavaraible...`);
112
+
113
+ const metavariable = this.getMetavariable(),
114
+ metavariableName = metavariable.getName(),
115
+ metavariablePresent = context.isMetavariablePresentByMetavariableName(metavariableName);
116
+
117
+ if (metavariablePresent) {
118
+ validatesAsMetavariable = true;
119
+ }
120
+
121
+ if (validatesAsMetavariable) {
122
+ context.debug(`...validated the '${referenceString}' reference as a metavaraible.`);
123
+ }
124
+
125
+ return validatesAsMetavariable;
126
+ }
127
+
128
+ unifyLabel(label, context) {
88
129
  let labelUnifies;
89
130
 
90
131
  const specificContext = context; ///
91
132
 
92
- context = label.getContext();
133
+ context = this.getContext();
93
134
 
94
135
  const generalContext = context; ///
95
136
 
@@ -104,7 +145,7 @@ export default define(class Reference extends Element {
104
145
  const labelMetavariable = label.getMetavariable(),
105
146
  generalMetavariable = this.metavariable, ///
106
147
  specificMetavariable = labelMetavariable, ///
107
- metavariableUnifiesIntrinsically = unifyMetavariableIntrinsically(generalMetavariable, specificMetavariable, substitutions, generalContext, specificContext);
148
+ metavariableUnifiesIntrinsically = unifyMetavariableIntrinsically(generalMetavariable, specificMetavariable, generalContext, specificContext);
108
149
 
109
150
  labelUnifies = metavariableUnifiesIntrinsically; ///
110
151
 
@@ -116,23 +157,32 @@ export default define(class Reference extends Element {
116
157
  }
117
158
 
118
159
  unifyMetavariable(metavariable, context) {
119
- let metavariableUnifies;
160
+ let metavariableUnifies = false;
120
161
 
121
- const reference = this, ///
122
- metavariableString = metavariable.getString(),
123
- referenceString = reference.getString();
162
+ const specificContext = context; ///
163
+
164
+ context = this.getContext();
165
+
166
+ const generalContext = context; ///
167
+
168
+ context = specificContext; ///
169
+
170
+ const referenceString = this.getString(), ///
171
+ metavariableString = metavariable.getString();
124
172
 
125
173
  context.trace(`Unifying the '${metavariableString}' metavariable with the '${referenceString}' reference...`);
126
174
 
127
- const { Substitutions } = elements,
128
- substitutions = Substitutions.fromNothing(),
129
- generalContext = context, ///
130
- specificContext = context, ///
131
- generalMetavariable = this.metavariable, ///
132
- specificMetavariable = metavariable, ///
133
- metavariableUnifiesIntrinsically = unifyMetavariableIntrinsically(generalMetavariable, specificMetavariable, substitutions, generalContext, specificContext);
175
+ const metavariableUnifiesIntrinsically = attempt((specificContext) => {
176
+ const generalMetavariable = this.metavariable, ///
177
+ specificMetavariable = metavariable, ///
178
+ metavariableUnifiesIntrinsically = unifyMetavariableIntrinsically(generalMetavariable, specificMetavariable, generalContext, specificContext);
179
+
180
+ return metavariableUnifiesIntrinsically;
181
+ }, specificContext);
134
182
 
135
- metavariableUnifies = metavariableUnifiesIntrinsically; ///
183
+ if (metavariableUnifiesIntrinsically) {
184
+ metavariableUnifies = true;
185
+ }
136
186
 
137
187
  if (metavariableUnifies) {
138
188
  context.debug(`...unified the '${metavariableString}' metavariable with the '${referenceString}' reference.`);
@@ -141,27 +191,27 @@ export default define(class Reference extends Element {
141
191
  return metavariableUnifies;
142
192
  }
143
193
 
144
- unifyMetaLemmaMetatheorem(metaLemmaMetatheorem, context) {
145
- let metaLemmaMetatheoremUnifies;
194
+ unifyTopLevelMetaAssertion(topLevelMetaAssertion, context) {
195
+ let topLevelMetaAssertionUnifies;
146
196
 
147
197
  const reference = this, ///
148
198
  referenceString = reference.getString(),
149
- metaLemmaMetatheoremString = metaLemmaMetatheorem.getString();
199
+ topLevelMetaAssertionString = topLevelMetaAssertion.getString();
150
200
 
151
- context.trace(`Unifying the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem with the '${referenceString}' reference...`);
201
+ context.trace(`Unifying the '${topLevelMetaAssertionString}' top level meta-assertion with the '${referenceString}' reference...`);
152
202
 
153
203
  const { Substitutions } = elements,
154
- label = metaLemmaMetatheorem.getLabel(),
155
- substitutions = Substitutions.fromNothing(),
204
+ label = topLevelMetaAssertion.getLabel(),
205
+ substitutions = Substitutions.fromNothing(context),
156
206
  labelUnifies = this.unifyLabel(label, substitutions, context);
157
207
 
158
- metaLemmaMetatheoremUnifies = labelUnifies; ///
208
+ topLevelMetaAssertionUnifies = labelUnifies; ///
159
209
 
160
- if (metaLemmaMetatheoremUnifies) {
161
- context.trace(`...unified the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem with the '${referenceString}' reference.`);
210
+ if (topLevelMetaAssertionUnifies) {
211
+ context.trace(`...unified the '${topLevelMetaAssertionString}' top level meta-assertion with the '${referenceString}' reference.`);
162
212
  }
163
213
 
164
- return metaLemmaMetatheoremUnifies;
214
+ return topLevelMetaAssertionUnifies;
165
215
  }
166
216
 
167
217
  toJSON() {
@@ -4,8 +4,8 @@ import { arrayUtilities } from "necessary";
4
4
 
5
5
  import Element from "../element";
6
6
  import elements from "../elements";
7
- import LocalContext from "../context/local";
8
7
 
8
+ import { scope } from "../utilities/context";
9
9
  import { define } from "../elements";
10
10
  import { labelsFromJSON,
11
11
  premisesFromJSON,
@@ -57,44 +57,38 @@ export default define(class Rule extends Element {
57
57
  verify() {
58
58
  let verifies = false;
59
59
 
60
- let context;
61
-
62
- const node = this.getNode();
63
-
64
- context = this.getContext();
65
-
66
- const ruleString = this.getString(); ///
60
+ const node = this.getNode(),
61
+ context = this.getContext(),
62
+ ruleString = this.getString(); ///
67
63
 
68
64
  context.trace(`Verifying the '${ruleString}' rule...`, node);
69
65
 
70
- const labelsVerify = this.verifyLabels();
71
-
72
- if (labelsVerify) {
73
- const localContext = LocalContext.fromNothing(context);
74
-
75
- context = localContext; ///
76
-
77
- const premisesVerify = this.verifyPremises(context);
78
-
79
- if (premisesVerify) {
80
- const conclusionVerifies = this.verifyConclusion(context);
66
+ scope((context) => {
67
+ const labelsVerify = this.verifyLabels();
81
68
 
82
- if (conclusionVerifies) {
83
- const proofVerifies = this.verifyProof(context);
69
+ if (labelsVerify) {
70
+ const premisesVerify = this.verifyPremises(context);
84
71
 
85
- if (proofVerifies) {
86
- const rule = this, ///
87
- context = this.getContext();
72
+ if (premisesVerify) {
73
+ const conclusionVerifies = this.verifyConclusion(context);
88
74
 
89
- context.addRule(rule);
75
+ if (conclusionVerifies) {
76
+ const proofVerifies = this.verifyProof(context);
90
77
 
91
- verifies = true;
78
+ if (proofVerifies) {
79
+ verifies = true;
80
+ }
92
81
  }
93
82
  }
94
83
  }
95
- }
84
+
85
+ }, context);
96
86
 
97
87
  if (verifies) {
88
+ const rule = this; ///
89
+
90
+ context.addRule(rule);
91
+
98
92
  context.debug(`...verified the '${ruleString}' rule.`, node);
99
93
  }
100
94
 
@@ -145,7 +139,7 @@ export default define(class Rule extends Element {
145
139
  proofVerifies = true;
146
140
  } else {
147
141
  const { Substitutions } = elements,
148
- substitutions = Substitutions.fromNothing();
142
+ substitutions = Substitutions.fromNothing(context);
149
143
 
150
144
  proofVerifies = this.proof.verify(substitutions, this.conclusion, context);
151
145
  }
@@ -169,7 +163,7 @@ export default define(class Rule extends Element {
169
163
  let statementAndSubproofOrProofAssertionsUnify = false;
170
164
 
171
165
  const { Substitutions } = elements,
172
- substitutions = Substitutions.fromNothing(),
166
+ substitutions = Substitutions.fromNothing(context),
173
167
  statementUnifiesWithConclusion = this.unifyStatementWithConclusion(statement, substitutions, context);
174
168
 
175
169
  if (statementUnifiesWithConclusion) {
@@ -190,14 +184,6 @@ export default define(class Rule extends Element {
190
184
  unifySubproofOrProofAssertionsWithPremise(subproofOrProofAssertions, premise, substitutions, context) {
191
185
  let subproofOrProofAssertionsUnifiesWithPremise = false;
192
186
 
193
- if (!subproofOrProofAssertionsUnifiesWithPremise) {
194
- const premiseUnifiesIndependently = premise.unifyIndependently(substitutions, context);
195
-
196
- if (premiseUnifiesIndependently) {
197
- subproofOrProofAssertionsUnifiesWithPremise = true;
198
- }
199
- }
200
-
201
187
  if (!subproofOrProofAssertionsUnifiesWithPremise) {
202
188
  const subproofOrProofAssertion = extract(subproofOrProofAssertions, (subproofOrProofAssertion) => {
203
189
  const subproofOrProofAssertionUnifies = premise.unifySubproofOrProofAssertion(subproofOrProofAssertion, substitutions, context);
@@ -212,6 +198,14 @@ export default define(class Rule extends Element {
212
198
  }
213
199
  }
214
200
 
201
+ if (!subproofOrProofAssertionsUnifiesWithPremise) {
202
+ const premiseUnifiesIndependently = premise.unifyIndependently(substitutions, context);
203
+
204
+ if (premiseUnifiesIndependently) {
205
+ subproofOrProofAssertionsUnifiesWithPremise = true;
206
+ }
207
+ }
208
+
215
209
  return subproofOrProofAssertionsUnifiesWithPremise;
216
210
  }
217
211
 
@@ -38,18 +38,18 @@ export default define(class Section extends Element {
38
38
  verify() {
39
39
  let verifies = false;
40
40
 
41
- const sectionString = this.string; ///
41
+ const sectionString = this.getString(); ///
42
42
 
43
43
  this.context.trace(`Verifying the '${sectionString}' section...`, this.node);
44
44
 
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
  }
@@ -6,6 +6,7 @@ import Element from "../element";
6
6
  import elements from "../elements";
7
7
 
8
8
  import { define } from "../elements";
9
+ import { synthetically } from "../utilities/context";
9
10
  import { signatureStringFromTerms } from "../utilities/string";
10
11
  import { termsFromJSON, termsToTermsJSON } from "../utilities/json";
11
12
 
@@ -25,7 +26,7 @@ export default define(class Signature extends Element {
25
26
  verify(context) {
26
27
  let verifies;
27
28
 
28
- const signatureString = this.string; ///
29
+ const signatureString = this.getString(); ///
29
30
 
30
31
  context.trace(`Verifying the '${signatureString}' signature...`);
31
32
 
@@ -64,12 +65,11 @@ export default define(class Signature extends Element {
64
65
  termTypeEqualToOrSubTypeOfVariableType = termType.isEqualToOrSubTypeOf(variableType);
65
66
 
66
67
  if (termTypeEqualToOrSubTypeOfVariableType) {
67
- const { TermSubstitution } = elements,
68
- context = specificContext, ///
69
- termSubstitution = TermSubstitution.fromTernAndVariable(term, variable, context),
70
- substitution = termSubstitution; ///
68
+ synthetically((context) => {
69
+ const { TermSubstitution } = elements;
71
70
 
72
- substitutions.addSubstitution(substitution, context);
71
+ TermSubstitution.fromTermAndVariable(term, variable, context);
72
+ });
73
73
 
74
74
  return true;
75
75
  }
@@ -83,7 +83,7 @@ export default define(class Signature extends Element {
83
83
  compareSubstitutions(substitutions, context) {
84
84
  let substitutionsCompares = false;
85
85
 
86
- const signatureString = this.string, ///
86
+ const signatureString = this.getString(), ///
87
87
  substitutionsString = substitutions.asString();
88
88
 
89
89
  context.trace(`Comparing the '${substitutionsString}' substitutions against the '${signatureString}' signature...`);
@@ -112,7 +112,7 @@ export default define(class Signature extends Element {
112
112
  correlateSubstitutions(substitutions, context) {
113
113
  let substitutionsCorrelates = false;
114
114
 
115
- const signatureString = this.string, ///
115
+ const signatureString = this.getString(), ///
116
116
  substitutionsString = substitutions.asString();
117
117
 
118
118
  context.trace(`Correlating the '${substitutionsString}' substitutions against the '${signatureString}' signature...`);