occam-verify-cli 1.0.457 → 1.0.473

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 (161) hide show
  1. package/lib/constants.js +13 -1
  2. package/lib/context/ephemeral.js +270 -0
  3. package/lib/context/file.js +102 -66
  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 +66 -7
  8. package/lib/context/scoped.js +48 -40
  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 +5 -8
  15. package/lib/element/conclusion.js +14 -13
  16. package/lib/element/constructor.js +2 -2
  17. package/lib/element/deduction.js +14 -13
  18. package/lib/element/derivation.js +3 -3
  19. package/lib/element/equality.js +5 -5
  20. package/lib/element/equivalence.js +112 -107
  21. package/lib/element/equivalences.js +24 -10
  22. package/lib/element/error.js +3 -3
  23. package/lib/element/frame.js +38 -21
  24. package/lib/element/hypothesis.js +2 -2
  25. package/lib/element/judgement.js +6 -5
  26. package/lib/element/metaType.js +1 -2
  27. package/lib/element/metavariable.js +46 -35
  28. package/lib/element/parameter.js +13 -5
  29. package/lib/element/procedureCall.js +16 -16
  30. package/lib/element/proof.js +14 -13
  31. package/lib/element/proofAssertion/premise.js +41 -30
  32. package/lib/element/proofAssertion/step.js +39 -35
  33. package/lib/element/proofAssertion/supposition.js +43 -32
  34. package/lib/element/proofAssertion.js +19 -5
  35. package/lib/element/propertyRelation.js +2 -2
  36. package/lib/element/reference.js +50 -9
  37. package/lib/element/rule.js +26 -28
  38. package/lib/element/section.js +2 -2
  39. package/lib/element/signature.js +9 -6
  40. package/lib/element/statement.js +44 -31
  41. package/lib/element/subproof.js +18 -17
  42. package/lib/element/substitution/frame.js +83 -46
  43. package/lib/element/substitution/reference.js +101 -19
  44. package/lib/element/substitution/statement.js +122 -75
  45. package/lib/element/substitution/term.js +93 -57
  46. package/lib/element/substitution.js +20 -69
  47. package/lib/element/substitutions.js +49 -34
  48. package/lib/element/term.js +30 -21
  49. package/lib/element/topLevelAssertion/axiom.js +8 -6
  50. package/lib/element/topLevelAssertion/conjecture.js +4 -4
  51. package/lib/element/topLevelAssertion/lemma.js +4 -4
  52. package/lib/element/topLevelAssertion/theorem.js +2 -2
  53. package/lib/element/topLevelAssertion.js +30 -23
  54. package/lib/element/topLevelMetaAssertion/metaLemma.js +2 -2
  55. package/lib/element/topLevelMetaAssertion/metatheorem.js +2 -2
  56. package/lib/element/topLevelMetaAssertion.js +16 -12
  57. package/lib/element/variable.js +30 -22
  58. package/lib/index.js +3 -3
  59. package/lib/main.js +3 -3
  60. package/lib/node/frame.js +2 -2
  61. package/lib/node/metavariable.js +4 -4
  62. package/lib/node/parameter.js +28 -7
  63. package/lib/node/substitution/frame.js +9 -31
  64. package/lib/node/substitution/reference.js +137 -0
  65. package/lib/node/substitution/statement.js +9 -31
  66. package/lib/node/substitution/term.js +9 -23
  67. package/lib/nonTerminalNodeMap.js +3 -2
  68. package/lib/process/instantiate.js +2 -14
  69. package/lib/process/unify.js +5 -5
  70. package/lib/tokenTypes.js +22 -0
  71. package/lib/utilities/context.js +54 -19
  72. package/lib/utilities/element.js +161 -336
  73. package/lib/utilities/instance.js +4 -4
  74. package/lib/utilities/string.js +18 -4
  75. package/lib/utilities/unification.js +24 -18
  76. package/lib/utilities/validation.js +31 -31
  77. package/package.json +2 -2
  78. package/src/constants.js +12 -0
  79. package/src/context/{transient.js → ephemeral.js} +15 -112
  80. package/src/context/file.js +66 -67
  81. package/src/context/liminal.js +67 -0
  82. package/src/context/{fragment.js → literal.js} +17 -4
  83. package/src/context/nominal.js +12 -0
  84. package/src/context/release.js +44 -6
  85. package/src/context/scoped.js +41 -31
  86. package/src/context/synthetic.js +60 -0
  87. package/src/element/assertion/contained.js +49 -47
  88. package/src/element/assertion/defined.js +29 -27
  89. package/src/element/assertion/property.js +35 -35
  90. package/src/element/assertion/satisfies.js +19 -18
  91. package/src/element/assumption.js +4 -10
  92. package/src/element/conclusion.js +16 -19
  93. package/src/element/constructor.js +1 -1
  94. package/src/element/deduction.js +16 -21
  95. package/src/element/derivation.js +2 -2
  96. package/src/element/equality.js +4 -4
  97. package/src/element/equivalence.js +115 -135
  98. package/src/element/equivalences.js +9 -7
  99. package/src/element/error.js +4 -2
  100. package/src/element/frame.js +50 -23
  101. package/src/element/hypothesis.js +1 -1
  102. package/src/element/judgement.js +9 -4
  103. package/src/element/metaType.js +0 -1
  104. package/src/element/metavariable.js +54 -53
  105. package/src/element/parameter.js +10 -5
  106. package/src/element/procedureCall.js +20 -18
  107. package/src/element/proof.js +14 -16
  108. package/src/element/proofAssertion/premise.js +46 -42
  109. package/src/element/proofAssertion/step.js +45 -40
  110. package/src/element/proofAssertion/supposition.js +56 -45
  111. package/src/element/proofAssertion.js +23 -5
  112. package/src/element/propertyRelation.js +1 -1
  113. package/src/element/reference.js +64 -16
  114. package/src/element/rule.js +31 -37
  115. package/src/element/section.js +1 -1
  116. package/src/element/signature.js +8 -8
  117. package/src/element/statement.js +51 -40
  118. package/src/element/subproof.js +16 -18
  119. package/src/element/substitution/frame.js +99 -42
  120. package/src/element/substitution/reference.js +120 -20
  121. package/src/element/substitution/statement.js +160 -89
  122. package/src/element/substitution/term.js +104 -63
  123. package/src/element/substitution.js +16 -58
  124. package/src/element/substitutions.js +43 -41
  125. package/src/element/term.js +37 -32
  126. package/src/element/topLevelAssertion/axiom.js +8 -6
  127. package/src/element/topLevelAssertion/conjecture.js +1 -2
  128. package/src/element/topLevelAssertion/lemma.js +2 -3
  129. package/src/element/topLevelAssertion/theorem.js +1 -1
  130. package/src/element/topLevelAssertion.js +31 -27
  131. package/src/element/topLevelMetaAssertion/metaLemma.js +1 -2
  132. package/src/element/topLevelMetaAssertion/metatheorem.js +1 -2
  133. package/src/element/topLevelMetaAssertion.js +15 -13
  134. package/src/element/variable.js +30 -31
  135. package/src/index.js +2 -1
  136. package/src/main.js +2 -1
  137. package/src/node/frame.js +1 -1
  138. package/src/node/metavariable.js +3 -3
  139. package/src/node/parameter.js +32 -5
  140. package/src/node/substitution/frame.js +6 -32
  141. package/src/node/substitution/reference.js +38 -0
  142. package/src/node/substitution/statement.js +6 -32
  143. package/src/node/substitution/term.js +6 -22
  144. package/src/nonTerminalNodeMap.js +3 -0
  145. package/src/process/instantiate.js +0 -8
  146. package/src/process/unify.js +4 -4
  147. package/src/tokenTypes.js +4 -0
  148. package/src/utilities/context.js +43 -17
  149. package/src/utilities/element.js +187 -401
  150. package/src/utilities/instance.js +3 -3
  151. package/src/utilities/string.js +21 -5
  152. package/src/utilities/unification.js +26 -23
  153. package/src/utilities/validation.js +47 -47
  154. package/lib/context/fragment.js +0 -77
  155. package/lib/context/transient.js +0 -371
  156. package/lib/log.js +0 -150
  157. package/lib/utilities/fragment.js +0 -23
  158. package/lib/utilities/node.js +0 -71
  159. package/src/log.js +0 -118
  160. package/src/utilities/fragment.js +0 -11
  161. package/src/utilities/node.js +0 -85
@@ -4,6 +4,7 @@ import Element from "../element";
4
4
  import elements from "../elements";
5
5
 
6
6
  import { define } from "../elements";
7
+ import { attempt } from "../utilities/context";
7
8
  import { REFERENCE_META_TYPE_NAME } from "../metaTypeNames";
8
9
  import { findMetaTypeByMetaTypeName } from "../metaTypes";
9
10
  import { unifyMetavariableIntrinsically } from "../process/unify";
@@ -36,6 +37,22 @@ export default define(class Reference extends Element {
36
37
 
37
38
  isMetavariableEqualToMetavariable(metavariable) { return this.metavariable.isEqualTo(metavariable); }
38
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
+
39
56
  compareMetavariableName(metavariableName) { return this.metavariable.compareMetavariableName(metavariableName); }
40
57
 
41
58
  matchMetavariableNode(metavariableNode) { return this.metavariable.matchNode(metavariableNode); }
@@ -86,12 +103,34 @@ export default define(class Reference extends Element {
86
103
  return metavariableValidates;
87
104
  }
88
105
 
89
- 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) {
90
129
  let labelUnifies;
91
130
 
92
131
  const specificContext = context; ///
93
132
 
94
- context = label.getContext();
133
+ context = this.getContext();
95
134
 
96
135
  const generalContext = context; ///
97
136
 
@@ -106,7 +145,7 @@ export default define(class Reference extends Element {
106
145
  const labelMetavariable = label.getMetavariable(),
107
146
  generalMetavariable = this.metavariable, ///
108
147
  specificMetavariable = labelMetavariable, ///
109
- metavariableUnifiesIntrinsically = unifyMetavariableIntrinsically(generalMetavariable, specificMetavariable, substitutions, generalContext, specificContext);
148
+ metavariableUnifiesIntrinsically = unifyMetavariableIntrinsically(generalMetavariable, specificMetavariable, generalContext, specificContext);
110
149
 
111
150
  labelUnifies = metavariableUnifiesIntrinsically; ///
112
151
 
@@ -118,23 +157,32 @@ export default define(class Reference extends Element {
118
157
  }
119
158
 
120
159
  unifyMetavariable(metavariable, context) {
121
- let metavariableUnifies;
160
+ let metavariableUnifies = false;
122
161
 
123
- const reference = this, ///
124
- metavariableString = metavariable.getString(),
125
- 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();
126
172
 
127
173
  context.trace(`Unifying the '${metavariableString}' metavariable with the '${referenceString}' reference...`);
128
174
 
129
- const { Substitutions } = elements,
130
- substitutions = Substitutions.fromNothing(),
131
- generalContext = context, ///
132
- specificContext = context, ///
133
- generalMetavariable = this.metavariable, ///
134
- specificMetavariable = metavariable, ///
135
- 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);
136
182
 
137
- metavariableUnifies = metavariableUnifiesIntrinsically; ///
183
+ if (metavariableUnifiesIntrinsically) {
184
+ metavariableUnifies = true;
185
+ }
138
186
 
139
187
  if (metavariableUnifies) {
140
188
  context.debug(`...unified the '${metavariableString}' metavariable with the '${referenceString}' reference.`);
@@ -154,7 +202,7 @@ export default define(class Reference extends Element {
154
202
 
155
203
  const { Substitutions } = elements,
156
204
  label = topLevelMetaAssertion.getLabel(),
157
- substitutions = Substitutions.fromNothing(),
205
+ substitutions = Substitutions.fromNothing(context),
158
206
  labelUnifies = this.unifyLabel(label, substitutions, context);
159
207
 
160
208
  topLevelMetaAssertionUnifies = labelUnifies; ///
@@ -4,8 +4,8 @@ import { arrayUtilities } from "necessary";
4
4
 
5
5
  import Element from "../element";
6
6
  import elements from "../elements";
7
- import ScopedContext from "../context/scoped";
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 scopedContext = ScopedContext.fromNothing(context);
74
-
75
- context = scopedContext; ///
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,7 +38,7 @@ 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
 
@@ -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...`);
@@ -7,7 +7,6 @@ import Element from "../element";
7
7
  import { define } from "../elements";
8
8
  import { unifyStatement } from "../process/unify";
9
9
  import { validateStatements } from "../utilities/validation";
10
- import { instantiateStatement } from "../process/instantiate";
11
10
  import { STATEMENT_META_TYPE_NAME } from "../metaTypeNames";
12
11
 
13
12
  const { match, backwardsSome } = arrayUtilities;
@@ -17,18 +16,18 @@ export default define(class Statement extends Element {
17
16
  super(context, string, node);
18
17
  }
19
18
 
20
- getMetavariableName() {
19
+ isSingular() {
21
20
  const node = this.getNode(),
22
- metavariableName = node.getMetavariableName();
21
+ singular = node.isSingular();
23
22
 
24
- return metavariableName;
23
+ return singular;
25
24
  }
26
25
 
27
- isSingular() {
26
+ getMetavariableName() {
28
27
  const node = this.getNode(),
29
- singular = node.isSingular();
28
+ metavariableName = node.getMetavariableName();
30
29
 
31
- return singular;
30
+ return metavariableName;
32
31
  }
33
32
 
34
33
  isTermContained(term, context) {
@@ -38,7 +37,7 @@ export default define(class Statement extends Element {
38
37
  termString = term.getString(),
39
38
  statementString = this.getString(); ///
40
39
 
41
- context.trace(`Is the '${termString}' term contained in the '${statementString}' statement...`, node);
40
+ context.trace(`Is the '${termString}' term contained in the '${statementString}' statement...`);
42
41
 
43
42
  const statementNode = node, ///
44
43
  statementNodeTermNodes = statementNode.getTermNodes();
@@ -52,7 +51,7 @@ export default define(class Statement extends Element {
52
51
  });
53
52
 
54
53
  if (termContained) {
55
- context.debug(`...the '${termString}' term is contained in the '${statementString}' statement.`, node);
54
+ context.debug(`...the '${termString}' term is contained in the '${statementString}' statement.`);
56
55
  }
57
56
 
58
57
  return termContained;
@@ -61,13 +60,13 @@ export default define(class Statement extends Element {
61
60
  isFrameContained(frame, context) {
62
61
  let frameContained;
63
62
 
64
- const node = this.getNode(),
65
- frameString = frame.getString(),
63
+ const frameString = frame.getString(),
66
64
  statementString = this.getString(); ///
67
65
 
68
- context.trace(`Is the '${frameString}' frame contained in the '${statementString}' statement...`, node);
66
+ context.trace(`Is the '${frameString}' frame contained in the '${statementString}' statement...`);
69
67
 
70
- const statementNode = node,
68
+ const node = this.getNode(),
69
+ statementNode = node, ///
71
70
  statementNodeFrameNodes = statementNode.getFrameNodes();
72
71
 
73
72
  frameContained = statementNodeFrameNodes.some((statementNodeFrameNode) => { ///
@@ -79,7 +78,7 @@ export default define(class Statement extends Element {
79
78
  });
80
79
 
81
80
  if (frameContained) {
82
- context.debug(`...the '${frameString}' frame is contained in the '${statementString}' statement.`, node);
81
+ context.debug(`...the '${frameString}' frame is contained in the '${statementString}' statement.`);
83
82
  }
84
83
 
85
84
  return frameContained;
@@ -107,13 +106,32 @@ export default define(class Statement extends Element {
107
106
  return metavariableEqualToMetavariable;
108
107
  }
109
108
 
109
+ compareParameter(parameter) {
110
+ let comparesToParamter = false;
111
+
112
+ const singular = this.isSingular();
113
+
114
+ if (singular) {
115
+ const parameterName = parameter.getName();
116
+
117
+ if (parameterName !== null) {
118
+ const metavariableName = this.getMetavariableName();
119
+
120
+ if (parameterName === metavariableName) {
121
+ comparesToParamter = true;
122
+ }
123
+ }
124
+ }
125
+
126
+ return comparesToParamter;
127
+ }
128
+
110
129
  validate(assignments, stated, context) {
111
130
  let validates;
112
131
 
113
- const node = this.getNode(),
114
- statementString = this.getString(); ///
132
+ const statementString = this.getString(); ///
115
133
 
116
- context.trace(`Validating the '${statementString}' statement...`, node);
134
+ context.trace(`Validating the '${statementString}' statement...`);
117
135
 
118
136
  validates = validateStatements.some((validateStatement) => {
119
137
  const statement = this, ///
@@ -129,7 +147,7 @@ export default define(class Statement extends Element {
129
147
 
130
148
  context.addStatement(statement);
131
149
 
132
- context.debug(`...validated the '${statementString}' statement.`, node);
150
+ context.debug(`...validated the '${statementString}' statement.`);
133
151
  }
134
152
 
135
153
  return validates;
@@ -138,11 +156,10 @@ export default define(class Statement extends Element {
138
156
  validateGivenMetaType(metaType, assignments, stated, context) {
139
157
  let validatesGivenMetaType = false;
140
158
 
141
- const node = this.getNode(),
142
- metaTypeString = metaType.getString(),
159
+ const metaTypeString = metaType.getString(),
143
160
  statementString = this.getString(); ///
144
161
 
145
- context.trace(`Validating the '${statementString}' statement given the '${metaTypeString}' meta-type...`, node);
162
+ context.trace(`Validating the '${statementString}' statement given the '${metaTypeString}' meta-type...`);
146
163
 
147
164
  const metaTypeName = metaType.getName();
148
165
 
@@ -153,7 +170,7 @@ export default define(class Statement extends Element {
153
170
  }
154
171
 
155
172
  if (validatesGivenMetaType) {
156
- context.debug(`...validated the '${statementString}' statement given the '${metaTypeString}' meta-type.`, node);
173
+ context.debug(`...validated the '${statementString}' statement given the '${metaTypeString}' meta-type.`);
157
174
  }
158
175
 
159
176
  return validatesGivenMetaType;
@@ -163,13 +180,13 @@ export default define(class Statement extends Element {
163
180
  let subproofUnifies = false;
164
181
 
165
182
  const node = this.getNode(),
166
- context = specificContext, ///
167
- statementNode = node,
183
+ statementNode = node, ///
168
184
  subproofAssertionNode = statementNode.getSubproofAssertionNode(),
169
185
  assertionNode = subproofAssertionNode; ///
170
186
 
171
187
  if (assertionNode !== null) {
172
- const assertion = generalContext.findAssertionByAssertionNode(assertionNode),
188
+ const context = generalContext, ///
189
+ assertion = context.findAssertionByAssertionNode(assertionNode),
173
190
  subproofAssertion = assertion; ///
174
191
 
175
192
  const subproofString = subproof.getString(),
@@ -201,17 +218,18 @@ export default define(class Statement extends Element {
201
218
  unifyStatement(statement, substitutions, generalContext, specificContext) {
202
219
  let statementUnifies;
203
220
 
204
- const generalStatement = this, ///
221
+ const context = specificContext, ///
222
+ generalStatement = this, ///
205
223
  specificStatement = statement, ///
206
224
  generalStatementString = generalStatement.getString(),
207
225
  specificStatementString = specificStatement.getString();
208
226
 
209
- specificContext.trace(`Unifying the '${specificStatementString}' statement with the '${generalStatementString}' statement...`);
227
+ context.trace(`Unifying the '${specificStatementString}' statement with the '${generalStatementString}' statement...`);
210
228
 
211
229
  statementUnifies = unifyStatement(generalStatement, specificStatement, substitutions, generalContext, specificContext);
212
230
 
213
231
  if (statementUnifies) {
214
- specificContext.debug(`...unified the '${specificStatementString}' statement with the '${generalStatementString}' statement.`);
232
+ context.debug(`...unified the '${specificStatementString}' statement with the '${generalStatementString}' statement.`);
215
233
  }
216
234
 
217
235
  return statementUnifies;
@@ -231,8 +249,9 @@ export default define(class Statement extends Element {
231
249
  containedAssertionNode = statementNode.getContainedAssertionNode();
232
250
 
233
251
  if ((definedAssertionNode !== null) || (containedAssertionNode !== null)) {
234
- const assertionNode = (definedAssertionNode || containedAssertionNode),
235
- assertion = generalContext.findAssertionByAssertionNode(assertionNode),
252
+ const context = generalContext, ///
253
+ assertionNode = (definedAssertionNode || containedAssertionNode),
254
+ assertion = context.findAssertionByAssertionNode(assertionNode),
236
255
  assertionUnifiesIndependently = assertion.unifyIndependently(substitutions, generalContext, specificContext);
237
256
 
238
257
  if (assertionUnifiesIndependently) {
@@ -263,7 +282,7 @@ export default define(class Statement extends Element {
263
282
  }
264
283
 
265
284
  toJSON() {
266
- const string = this.getString(),
285
+ const string = this.getString(), ///
267
286
  json = {
268
287
  string
269
288
  };
@@ -274,14 +293,6 @@ export default define(class Statement extends Element {
274
293
  static name = "Statement";
275
294
 
276
295
  static fromJSON(json, context) {
277
- const { string } = json,
278
- statmentNode = instantiateStatement(string, context),
279
- node = statmentNode; ///,
280
-
281
- context = null;
282
-
283
- const statement = new Statement(context, string, node);
284
-
285
- return statement;
296
+ ///
286
297
  }
287
298
  });
@@ -2,8 +2,8 @@
2
2
 
3
3
  import Element from "../element";
4
4
  import elements from "../elements";
5
- import ScopedContext from "../context/scoped";
6
5
 
6
+ import { scope } from "../utilities/context";
7
7
  import { define } from "../elements";
8
8
 
9
9
  export default define(class Subproof extends Element {
@@ -49,25 +49,23 @@ export default define(class Subproof extends Element {
49
49
  verify(substitutions, assignments, context) {
50
50
  let verifies = false;
51
51
 
52
- const scopedContext = ScopedContext.fromNothing(context); ///
52
+ scope(() => {
53
+ const suppositionsVerify = this.suppositions.every((supposition) => {
54
+ const suppositionVerifies = supposition.verify(context);
53
55
 
54
- context = scopedContext; ///
55
-
56
- const suppositionsVerify = this.suppositions.every((supposition) => {
57
- const suppositionVerifies = supposition.verify(context);
58
-
59
- if (suppositionVerifies) {
60
- return true;
61
- }
62
- });
56
+ if (suppositionVerifies) {
57
+ return true;
58
+ }
59
+ });
63
60
 
64
- if (suppositionsVerify) {
65
- const subDerivationVerifies = this.subDerivation.verify(substitutions, context);
61
+ if (suppositionsVerify) {
62
+ const subDerivationVerifies = this.subDerivation.verify(substitutions, context);
66
63
 
67
- if (subDerivationVerifies) {
68
- verifies = true;
64
+ if (subDerivationVerifies) {
65
+ verifies = true;
66
+ }
69
67
  }
70
- }
68
+ }, context);
71
69
 
72
70
  return verifies;
73
71
  }
@@ -81,7 +79,7 @@ export default define(class Subproof extends Element {
81
79
  unifyWithSatisfiesAssertion(satisfiesAssertion, context) {
82
80
  let unifiesWithSatisfiesAssertion = false;
83
81
 
84
- const subproofString = this.string, ///
82
+ const subproofString = this.getString(), ///
85
83
  satisfiesAssertionString = satisfiesAssertion.getString();
86
84
 
87
85
  context.trace(`Unifying the '${subproofString}' subproof with the '${satisfiesAssertionString}' satisfies assertion...`)
@@ -95,7 +93,7 @@ export default define(class Subproof extends Element {
95
93
  if (axiomSatisfiable) {
96
94
  const { Substitutions } = elements,
97
95
  subproof = this, ///
98
- substitutions = Substitutions.fromNothing(),
96
+ substitutions = Substitutions.fromNothing(context),
99
97
  statementUnifies = axiom.unifySubproof(subproof, substitutions, context);
100
98
 
101
99
  if (statementUnifies) {