occam-verify-cli 1.0.448 → 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 (161) hide show
  1. package/lib/constants.js +1 -5
  2. package/lib/context/file.js +50 -78
  3. package/lib/context/fragment.js +77 -0
  4. package/lib/context/release.js +3 -3
  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/frame.js +40 -46
  16. package/lib/element/judgement.js +35 -56
  17. package/lib/element/metaType.js +5 -4
  18. package/lib/element/metavariable.js +6 -6
  19. package/lib/element/proof.js +4 -4
  20. package/lib/element/proofAssertion/premise.js +308 -0
  21. package/lib/element/proofAssertion/step.js +305 -0
  22. package/lib/element/proofAssertion/supposition.js +322 -0
  23. package/lib/element/proofAssertion.js +5 -9
  24. package/lib/element/reference.js +24 -23
  25. package/lib/element/rule.js +4 -4
  26. package/lib/element/section.js +4 -4
  27. package/lib/element/statement.js +2 -7
  28. package/lib/element/subproof.js +4 -4
  29. package/lib/element/substitution/frame.js +7 -7
  30. package/lib/element/substitution/statement.js +15 -39
  31. package/lib/element/substitution.js +5 -5
  32. package/lib/element/term.js +12 -10
  33. package/lib/element/topLevelAssertion/axiom.js +329 -0
  34. package/lib/element/{conjecture.js → topLevelAssertion/conjecture.js} +7 -7
  35. package/lib/element/{lemma.js → topLevelAssertion/lemma.js} +6 -6
  36. package/lib/element/{theorem.js → topLevelAssertion/theorem.js} +7 -7
  37. package/lib/element/topLevelAssertion.js +427 -0
  38. package/lib/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +7 -7
  39. package/lib/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +7 -7
  40. package/lib/element/topLevelMetaAssertion.js +289 -0
  41. package/lib/element/type.js +4 -4
  42. package/lib/element/variable.js +20 -20
  43. package/lib/metaTypes.js +18 -15
  44. package/lib/node/proofAssertion/premise.js +116 -0
  45. package/lib/node/proofAssertion/step.js +152 -0
  46. package/lib/node/proofAssertion/supposition.js +116 -0
  47. package/lib/node/{premise.js → proofAssertion.js} +11 -18
  48. package/lib/node/statement.js +2 -2
  49. package/lib/node/substitution/statement.js +2 -2
  50. package/lib/node/{axiom.js → topLevelAssertion/axiom.js} +7 -7
  51. package/lib/node/{conjecture.js → topLevelAssertion/conjecture.js} +7 -7
  52. package/lib/node/{lemma.js → topLevelAssertion/lemma.js} +7 -7
  53. package/lib/node/{theorem.js → topLevelAssertion/theorem.js} +7 -7
  54. package/lib/node/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +9 -9
  55. package/lib/node/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +7 -7
  56. package/lib/node/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +7 -7
  57. package/lib/node/{metaLemmaMetaTheorem.js → topLevelMetaAssertion.js} +9 -9
  58. package/lib/nonTerminalNodeMap.js +13 -13
  59. package/lib/preamble.js +10 -10
  60. package/lib/process/instantiate.js +6 -9
  61. package/lib/process/unify.js +7 -6
  62. package/lib/types.js +3 -3
  63. package/lib/utilities/bnf.js +5 -5
  64. package/lib/utilities/context.js +28 -0
  65. package/lib/utilities/element.js +101 -99
  66. package/lib/utilities/fragment.js +23 -0
  67. package/lib/utilities/instance.js +12 -34
  68. package/lib/utilities/json.js +3 -2
  69. package/lib/utilities/string.js +42 -21
  70. package/lib/utilities/unification.js +17 -17
  71. package/lib/utilities/validation.js +22 -25
  72. package/package.json +2 -2
  73. package/src/constants.js +0 -1
  74. package/src/context/file.js +48 -55
  75. package/src/context/fragment.js +38 -0
  76. package/src/context/release.js +4 -2
  77. package/src/context/{local.js → scoped.js} +8 -100
  78. package/src/context/{temporary.js → transient.js} +9 -131
  79. package/src/element/assumption.js +69 -85
  80. package/src/element/combinator/bracketed.js +0 -7
  81. package/src/element/conclusion.js +14 -10
  82. package/src/element/constructor/bracketed.js +0 -7
  83. package/src/element/declaration/combinator.js +0 -1
  84. package/src/element/declaration/metavariable.js +2 -2
  85. package/src/element/declaration/variable.js +5 -5
  86. package/src/element/deduction.js +22 -15
  87. package/src/element/frame.js +36 -48
  88. package/src/element/judgement.js +33 -58
  89. package/src/element/metaType.js +4 -4
  90. package/src/element/metavariable.js +8 -6
  91. package/src/element/proof.js +3 -3
  92. package/src/element/{premise.js → proofAssertion/premise.js} +23 -23
  93. package/src/element/{step.js → proofAssertion/step.js} +32 -40
  94. package/src/element/{supposition.js → proofAssertion/supposition.js} +24 -24
  95. package/src/element/proofAssertion.js +6 -13
  96. package/src/element/reference.js +23 -21
  97. package/src/element/rule.js +3 -3
  98. package/src/element/section.js +4 -4
  99. package/src/element/statement.js +2 -9
  100. package/src/element/subproof.js +3 -3
  101. package/src/element/substitution/frame.js +10 -13
  102. package/src/element/substitution/statement.js +20 -52
  103. package/src/element/substitution.js +3 -3
  104. package/src/element/term.js +10 -9
  105. package/src/element/{axiom.js → topLevelAssertion/axiom.js} +15 -15
  106. package/src/element/{conjecture.js → topLevelAssertion/conjecture.js} +4 -4
  107. package/src/element/{lemma.js → topLevelAssertion/lemma.js} +3 -3
  108. package/src/element/{theorem.js → topLevelAssertion/theorem.js} +4 -4
  109. package/src/element/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +9 -9
  110. package/src/element/{metaLemma.js → topLevelMetaAssertion/metaLemma.js} +4 -4
  111. package/src/element/{metatheorem.js → topLevelMetaAssertion/metatheorem.js} +4 -4
  112. package/src/element/{metaLemmaMetatheorem.js → topLevelMetaAssertion.js} +7 -7
  113. package/src/element/type.js +2 -4
  114. package/src/element/variable.js +17 -17
  115. package/src/metaTypes.js +25 -9
  116. package/src/node/proofAssertion/premise.js +16 -0
  117. package/src/node/{step.js → proofAssertion/step.js} +4 -18
  118. package/src/node/proofAssertion/supposition.js +16 -0
  119. package/src/node/proofAssertion.js +23 -0
  120. package/src/node/statement.js +1 -1
  121. package/src/node/substitution/statement.js +1 -1
  122. package/src/node/topLevelAssertion/axiom.js +13 -0
  123. package/src/node/topLevelAssertion/conjecture.js +13 -0
  124. package/src/node/topLevelAssertion/lemma.js +13 -0
  125. package/src/node/topLevelAssertion/theorem.js +13 -0
  126. package/src/node/{axiomLemmaTheoremConjecture.js → topLevelAssertion.js} +1 -1
  127. package/src/node/topLevelMetaAssertion/metaLemma.js +13 -0
  128. package/src/node/topLevelMetaAssertion/metatheorem.js +13 -0
  129. package/src/node/{metaLemmaMetaTheorem.js → topLevelMetaAssertion.js} +1 -1
  130. package/src/nonTerminalNodeMap.js +12 -12
  131. package/src/preamble.js +9 -9
  132. package/src/process/instantiate.js +31 -32
  133. package/src/process/unify.js +6 -5
  134. package/src/types.js +4 -2
  135. package/src/utilities/bnf.js +3 -2
  136. package/src/utilities/context.js +20 -0
  137. package/src/utilities/element.js +169 -162
  138. package/src/utilities/fragment.js +11 -0
  139. package/src/utilities/instance.js +19 -42
  140. package/src/utilities/json.js +3 -1
  141. package/src/utilities/string.js +53 -28
  142. package/src/utilities/unification.js +16 -16
  143. package/src/utilities/validation.js +26 -35
  144. package/lib/context/local.js +0 -605
  145. package/lib/context/temporary.js +0 -752
  146. package/lib/element/axiom.js +0 -329
  147. package/lib/element/axiomLemmaTheoremConjecture.js +0 -427
  148. package/lib/element/metaLemmaMetatheorem.js +0 -289
  149. package/lib/element/premise.js +0 -307
  150. package/lib/element/step.js +0 -311
  151. package/lib/element/supposition.js +0 -320
  152. package/lib/node/step.js +0 -166
  153. package/lib/node/supposition.js +0 -130
  154. package/src/node/axiom.js +0 -13
  155. package/src/node/conjecture.js +0 -13
  156. package/src/node/lemma.js +0 -13
  157. package/src/node/metaLemma.js +0 -13
  158. package/src/node/metatheorem.js +0 -13
  159. package/src/node/premise.js +0 -30
  160. package/src/node/supposition.js +0 -30
  161. package/src/node/theorem.js +0 -13
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
 
3
- import elements from "../elements";
4
- import ProofAssertion from "./proofAssertion";
5
- import TemporaryContext from "../context/temporary";
3
+ import elements from "../../elements";
4
+ import ProofAssertion from "../proofAssertion";
5
+ import TransientContext from "../../context/transient";
6
6
 
7
- import { define } from "../elements";
8
- import { unifyStatements } from "../utilities/unification";
9
- import { propertyAssertionFromStatement } from "../utilities/statement";
7
+ import { define } from "../../elements";
8
+ import { unifyStatements } from "../../utilities/unification";
9
+ import { propertyAssertionFromStatement } from "../../utilities/statement";
10
10
 
11
11
  export default define(class Step extends ProofAssertion {
12
12
  constructor(context, string, node, statement, reference, satisfiesAssertion) {
@@ -59,9 +59,9 @@ export default define(class Step extends ProofAssertion {
59
59
  verify(substitutions, assignments, context) {
60
60
  let verifies = false;
61
61
 
62
- const temporaryContext = TemporaryContext.fromNothing(context);
62
+ const transientContext = TransientContext.fromNothing(context);
63
63
 
64
- context = temporaryContext; ///
64
+ context = transientContext; ///
65
65
 
66
66
  const node = this.getNode(),
67
67
  stepString = this.getString(); ///
@@ -73,9 +73,9 @@ export default define(class Step extends ProofAssertion {
73
73
  if (statement === null) {
74
74
  context.debug(`Unable to verify the '${stepString}' step because it is nonsense.`, node);
75
75
  } else {
76
- const referenceVerifies = this.verifyReference(context);
76
+ const referenceValidates = this.validateReference(context);
77
77
 
78
- if (referenceVerifies) {
78
+ if (referenceValidates) {
79
79
  const satisfiesAssertioVeriries = this.verifySatisfiesAssertion(context);
80
80
 
81
81
  if (satisfiesAssertioVeriries) {
@@ -92,12 +92,6 @@ export default define(class Step extends ProofAssertion {
92
92
  });
93
93
 
94
94
  if (statementUnifies) {
95
- const subproofOrProofAssertion = this; ///
96
-
97
- context.addSubproofOrProofAssertion(subproofOrProofAssertion);
98
-
99
- this.setContext(context);
100
-
101
95
  verifies = true;
102
96
  }
103
97
  }
@@ -106,52 +100,50 @@ export default define(class Step extends ProofAssertion {
106
100
  }
107
101
 
108
102
  if (verifies) {
103
+ this.setContext(context);
104
+
109
105
  context.debug(`...verified the '${stepString}' step.`, node);
110
106
  }
111
107
 
112
108
  return verifies;
113
109
  }
114
110
 
115
- verifyReference(context) {
116
- let referenceVeriries;
111
+ validateReference(context) {
112
+ let referenceValidates = true;
117
113
 
118
- const node = this.getNode(),
119
- stepString = this.getString(); ///
114
+ if (this.reference !== null) {
115
+ const node = this.getNode(),
116
+ stepString = this.getString();
120
117
 
121
- context.trace(`Verifying the '${stepString}' step's reference... `, node);
118
+ context.trace(`Validating the '${stepString}' step's reference... `, node);
122
119
 
123
- if (this.reference !== null) {
124
- referenceVeriries = this.reference.verify(context);
125
- } else {
126
- referenceVeriries = true;
127
- }
120
+ referenceValidates = this.reference.validate(context);
128
121
 
129
- if (referenceVeriries) {
130
- context.debug(`...verified the '${stepString}' step's reference. `, node);
122
+ if (referenceValidates) {
123
+ context.debug(`...validating the '${stepString}' step's reference. `, node);
124
+ }
131
125
  }
132
126
 
133
- return referenceVeriries;
127
+ return referenceValidates;
134
128
  }
135
129
 
136
130
  verifySatisfiesAssertion(context) {
137
- let satisfiesAssertionVerifies;
131
+ let satisfiesAssertionVerifies = true; ///
138
132
 
139
- const node = this.getNode(),
140
- stepString = this.getString(); ///
133
+ if (this.satisfiesAssertion !== null) {
134
+ const node = this.getNode(),
135
+ stepString = this.getString(); ///
141
136
 
142
- context.trace(`Verifying the '${stepString}' step's satisfies assertion... `, node);
137
+ context.trace(`Verifying the '${stepString}' step's satisfies assertion... `, node);
143
138
 
144
- if (this.satisfiesAssertion !== null) {
145
139
  const stated = true,
146
140
  assignments = null;
147
141
 
148
142
  satisfiesAssertionVerifies = this.satisfiesAssertion.validate(assignments, stated, context);
149
- } else {
150
- satisfiesAssertionVerifies = true;
151
- }
152
143
 
153
- if (satisfiesAssertionVerifies) {
154
- context.debug(`...verified the '${stepString}' step's satisfies assertion. `, node);
144
+ if (satisfiesAssertionVerifies) {
145
+ context.debug(`...verified the '${stepString}' step's satisfies assertion. `, node);
146
+ }
155
147
  }
156
148
 
157
149
  return satisfiesAssertionVerifies;
@@ -160,7 +152,7 @@ export default define(class Step extends ProofAssertion {
160
152
  unifyWithSatisfiesAssertion(satisfiesAssertion, context) {
161
153
  let unifiesWithSatisfiesAssertion = false;
162
154
 
163
- const stepString = this.string, ///
155
+ const stepString = this.getString(), ///
164
156
  satisfiesAssertionString = satisfiesAssertion.getString();
165
157
 
166
158
  context.trace(`Unifying the '${stepString}' step with the '${satisfiesAssertionString}' satisfies assertion...`, this.node);
@@ -1,15 +1,15 @@
1
1
  "use strict";
2
2
 
3
- import ProofAssertion from "./proofAssertion";
4
- import TemporaryContext from "../context/temporary";
5
- import assignAssignments from "../process/assign";
3
+ import ProofAssertion from "../proofAssertion";
4
+ import TransientContext from "../../context/transient";
5
+ import assignAssignments from "../../process/assign";
6
6
 
7
- import { define } from "../elements";
8
- import { termsFromJSON, framesFromJSON, statementFromJSON, procedureCallFromJSON, termsToTermsJSON, framesToFramesJSON, statementToStatementJSON, procedureCallToProcedureCallJSON } from "../utilities/json";
7
+ import { define } from "../../elements";
8
+ import { termsFromJSON, framesFromJSON, statementFromJSON, procedureCallFromJSON, termsToTermsJSON, framesToFramesJSON, statementToStatementJSON, procedureCallToProcedureCallJSON } from "../../utilities/json";
9
9
 
10
10
  export default define(class Supposition extends ProofAssertion {
11
11
  constructor(context, string, node, statement, procedureCall) {
12
- super(context, string, node);
12
+ super(context, string, node, statement);
13
13
 
14
14
  this.procedureCall = procedureCall;
15
15
  }
@@ -21,9 +21,9 @@ export default define(class Supposition extends ProofAssertion {
21
21
  verify(context) {
22
22
  let verifies = false;
23
23
 
24
- const temporaryContext = TemporaryContext.fromNothing(context);
24
+ const transientContext = TransientContext.fromNothing(context);
25
25
 
26
- context = temporaryContext; ///
26
+ context = transientContext; ///
27
27
 
28
28
  const node = this.getNode(),
29
29
  suppositionString = this.getString(); ///
@@ -76,10 +76,9 @@ export default define(class Supposition extends ProofAssertion {
76
76
  unifyIndependently(substitutions, context) {
77
77
  let unifiesIndependently = false;
78
78
 
79
- const node = this.getNode(),
80
- suppositionString = this.getString();
79
+ const suppositionString = this.getString();
81
80
 
82
- context.trace(`Unifying the '${suppositionString}' supposition independently...`, node);
81
+ context.trace(`Unifying the '${suppositionString}' supposition independently...`);
83
82
 
84
83
  const specificContext = context; ///
85
84
 
@@ -108,7 +107,7 @@ export default define(class Supposition extends ProofAssertion {
108
107
  }
109
108
 
110
109
  if (unifiesIndependently) {
111
- context.debug(`...unified the '${suppositionString}' supposition independenly.`, node);
110
+ context.debug(`...unified the '${suppositionString}' supposition independenly.`);
112
111
  }
113
112
 
114
113
  return unifiesIndependently;
@@ -155,34 +154,35 @@ export default define(class Supposition extends ProofAssertion {
155
154
  }
156
155
 
157
156
  unifyProofAssertion(proofAssertion, substitutions, context) {
158
- let stepUnifies = false;
157
+ let proofAssertionUnifies = false;
159
158
 
160
- const node = this.getNode(),
161
- suppositionString = this.getString(),
159
+ const suppositionString = this.getString(),
162
160
  proofAssertionString = proofAssertion.getString();
163
161
 
164
- context.trace(`Unifying the '${proofAssertionString}' proof assertion with the '${suppositionString}' supposition...`, node);
165
-
166
- const specificContext = context; ///
162
+ context.trace(`Unifying the '${proofAssertionString}' proof assertion with the '${suppositionString}' supposition...`);
167
163
 
168
164
  context = this.getContext();
169
165
 
170
166
  const generalContext = context; ///
171
167
 
168
+ context = proofAssertion.getContext();
169
+
170
+ const specificContext = context; ///
171
+
172
172
  context = specificContext; ///
173
173
 
174
174
  const statement = proofAssertion.getStatement(),
175
175
  statementUnifies = this.unifyStatement(statement, substitutions, generalContext, specificContext);
176
176
 
177
177
  if (statementUnifies) {
178
- stepUnifies = true;
178
+ proofAssertionUnifies = true;
179
179
  }
180
180
 
181
- if (stepUnifies) {
182
- context.debug(`...unified the '${proofAssertionString}' proof assertion with the '${suppositionString}' supposition.`, node);
181
+ if (proofAssertionUnifies) {
182
+ context.debug(`...unified the '${proofAssertionString}' proof assertion with the '${suppositionString}' supposition.`);
183
183
  }
184
184
 
185
- return stepUnifies;
185
+ return proofAssertionUnifies;
186
186
  }
187
187
 
188
188
  unifySubproof(subproof, substitutions, context) {
@@ -287,7 +287,7 @@ export default define(class Supposition extends ProofAssertion {
287
287
  frames = framesFromJSON(json, context),
288
288
  statement = statementFromJSON(json, context),
289
289
  procedureCall = procedureCallFromJSON(json, context),
290
- temporaryContext = TemporaryContext.fromTermsAndFrames(terms, frames, context);
290
+ transientContext = TransientContext.fromTermsAndFrames(terms, frames, context);
291
291
 
292
292
  let string;
293
293
 
@@ -301,7 +301,7 @@ export default define(class Supposition extends ProofAssertion {
301
301
 
302
302
  const node = null;
303
303
 
304
- context = temporaryContext; ///
304
+ context = transientContext; ///
305
305
 
306
306
  const supposition = new Supposition(context, string, node, statement, procedureCall);
307
307
 
@@ -46,28 +46,21 @@ export default class ProofAssertion extends Element {
46
46
  return comparesToStatement;
47
47
  }
48
48
 
49
- unifyStatement(statement, substitutions, context) {
49
+ unifyStatement(statement, substitutions, generalContext, specificContext) {
50
50
  let statementUnifies = false;
51
51
 
52
52
  if (this.statement !== null) {
53
53
  const node = this.getNode(),
54
- premiseString = this.getString(), ///
55
- statementString = statement.getString();
54
+ context = specificContext, ///
55
+ statementString = statement.getString(),
56
+ proorAssertionString = this.getString(); ///
56
57
 
57
- context.trace(`Unifying the '${statementString}' statement with the '${premiseString}' premise...`, node);
58
-
59
- const specificContext = context; ///
60
-
61
- context = this.getContext(); ///
62
-
63
- const generalContext = context; ///
64
-
65
- context = specificContext; ///
58
+ context.trace(`Unifying the '${statementString}' statement with the '${proorAssertionString}' proof assertion...`, node);
66
59
 
67
60
  statementUnifies = this.statement.unifyStatement(statement, substitutions, generalContext, specificContext);
68
61
 
69
62
  if (statementUnifies) {
70
- context.debug(`...unified the '${statementString}' statement with the '${premiseString}' premise.`, node);
63
+ context.debug(`...unified the '${statementString}' statement with the '${proorAssertionString}' proof assertion.`, node);
71
64
  }
72
65
  }
73
66
 
@@ -4,7 +4,8 @@ import Element from "../element";
4
4
  import elements from "../elements";
5
5
 
6
6
  import { define } from "../elements";
7
- import { referenceMetaTypeFromNothing } from "../metaTypes";
7
+ import { REFERENCE_META_TYPE_NAME } from "../metaTypeNames";
8
+ import { findMetaTypeByMetaTypeName } from "../metaTypes";
8
9
  import { unifyMetavariableIntrinsically } from "../process/unify";
9
10
  import { metavariableFromJSON, metavariableToMetavariableJSON } from "../utilities/json";
10
11
 
@@ -39,41 +40,42 @@ export default define(class Reference extends Element {
39
40
 
40
41
  matchMetavariableNode(metavariableNode) { return this.metavariable.matchNode(metavariableNode); }
41
42
 
42
- verify(context) {
43
- let verifies = false;
43
+ validate(context) {
44
+ let validate = false;
44
45
 
45
46
  const referenceString = this.getString(); ///
46
47
 
47
- context.trace(`Verifying the '${referenceString}' reference...`);
48
+ context.trace(`Validating the '${referenceString}' reference...`);
48
49
 
49
- if (!verifies) {
50
+ if (!validate) {
50
51
  const metavariableValidates = this.validateMetavariable(context);
51
52
 
52
- verifies = metavariableValidates; ///
53
+ validate = metavariableValidates; ///
53
54
  }
54
55
 
55
- if (!verifies) {
56
+ if (!validate) {
56
57
  const reference = this, ///
57
58
  labelPresent = context.isLabelPresentByReference(reference);
58
59
 
59
- verifies = labelPresent; ///
60
+ validate = labelPresent; ///
60
61
  }
61
62
 
62
- if (verifies) {
63
+ if (validate) {
63
64
  const reference = this; ///
64
65
 
65
66
  context.addReference(reference);
66
67
 
67
- context.debug(`...verified the '${referenceString}' reference.`);
68
+ context.debug(`...validated the '${referenceString}' reference.`);
68
69
  }
69
70
 
70
- return verifies;
71
+ return validate;
71
72
  }
72
73
 
73
74
  validateMetavariable(context) {
74
75
  let metavariableValidates = false;
75
76
 
76
- const referenceMetaType = referenceMetaTypeFromNothing(),
77
+ const metaTypeName = REFERENCE_META_TYPE_NAME,
78
+ referenceMetaType = findMetaTypeByMetaTypeName(metaTypeName),
77
79
  metaType = referenceMetaType, ///
78
80
  metavariableValidatesGivenMetaType = this.metavariable.validateGivenMetaType(metaType, context);
79
81
 
@@ -141,27 +143,27 @@ export default define(class Reference extends Element {
141
143
  return metavariableUnifies;
142
144
  }
143
145
 
144
- unifyMetaLemmaMetatheorem(metaLemmaMetatheorem, context) {
145
- let metaLemmaMetatheoremUnifies;
146
+ unifyTopLevelMetaAssertion(topLevelMetaAssertion, context) {
147
+ let topLevelMetaAssertionUnifies;
146
148
 
147
149
  const reference = this, ///
148
150
  referenceString = reference.getString(),
149
- metaLemmaMetatheoremString = metaLemmaMetatheorem.getString();
151
+ topLevelMetaAssertionString = topLevelMetaAssertion.getString();
150
152
 
151
- context.trace(`Unifying the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem with the '${referenceString}' reference...`);
153
+ context.trace(`Unifying the '${topLevelMetaAssertionString}' top level meta-assertion with the '${referenceString}' reference...`);
152
154
 
153
155
  const { Substitutions } = elements,
154
- label = metaLemmaMetatheorem.getLabel(),
156
+ label = topLevelMetaAssertion.getLabel(),
155
157
  substitutions = Substitutions.fromNothing(),
156
158
  labelUnifies = this.unifyLabel(label, substitutions, context);
157
159
 
158
- metaLemmaMetatheoremUnifies = labelUnifies; ///
160
+ topLevelMetaAssertionUnifies = labelUnifies; ///
159
161
 
160
- if (metaLemmaMetatheoremUnifies) {
161
- context.trace(`...unified the '${metaLemmaMetatheoremString}' meta-lemma or metatheorem with the '${referenceString}' reference.`);
162
+ if (topLevelMetaAssertionUnifies) {
163
+ context.trace(`...unified the '${topLevelMetaAssertionString}' top level meta-assertion with the '${referenceString}' reference.`);
162
164
  }
163
165
 
164
- return metaLemmaMetatheoremUnifies;
166
+ return topLevelMetaAssertionUnifies;
165
167
  }
166
168
 
167
169
  toJSON() {
@@ -4,7 +4,7 @@ import { arrayUtilities } from "necessary";
4
4
 
5
5
  import Element from "../element";
6
6
  import elements from "../elements";
7
- import LocalContext from "../context/local";
7
+ import ScopedContext from "../context/scoped";
8
8
 
9
9
  import { define } from "../elements";
10
10
  import { labelsFromJSON,
@@ -70,9 +70,9 @@ export default define(class Rule extends Element {
70
70
  const labelsVerify = this.verifyLabels();
71
71
 
72
72
  if (labelsVerify) {
73
- const localContext = LocalContext.fromNothing(context);
73
+ const scopedContext = ScopedContext.fromNothing(context);
74
74
 
75
- context = localContext; ///
75
+ context = scopedContext; ///
76
76
 
77
77
  const premisesVerify = this.verifyPremises(context);
78
78
 
@@ -45,11 +45,11 @@ export default define(class Section extends Element {
45
45
  const hypothesesVerify = this.verifyHypotheses();
46
46
 
47
47
  if (hypothesesVerify) {
48
- const axiomLemmaTheoremOrConjecture = (this.axiom || this.lemma || this.theorem || this.conjecture),
49
- axiomLemmaTheoremOrConjectureVerifies = axiomLemmaTheoremOrConjecture.verify(this.context);
48
+ const topLevelAssertion = (this.axiom || this.lemma || this.theorem || this.conjecture),
49
+ topLevelAssertionVerifies = topLevelAssertion.verify(this.context);
50
50
 
51
- if (axiomLemmaTheoremOrConjectureVerifies) {
52
- axiomLemmaTheoremOrConjecture.setHypotheses(this.hypotheses);
51
+ if (topLevelAssertionVerifies) {
52
+ topLevelAssertion.setHypotheses(this.hypotheses);
53
53
 
54
54
  verifies = true;
55
55
  }
@@ -18,15 +18,8 @@ export default define(class Statement extends Element {
18
18
  }
19
19
 
20
20
  getMetavariableName() {
21
- let metavariableName = null;
22
-
23
- const singular = this.isSingular();
24
-
25
- if (singular) {
26
- const node = this.getNode();
27
-
28
- metavariableName = node.getMetavariableName();
29
- }
21
+ const node = this.getNode(),
22
+ metavariableName = node.getMetavariableName();
30
23
 
31
24
  return metavariableName;
32
25
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  import Element from "../element";
4
4
  import elements from "../elements";
5
- import LocalContext from "../context/local";
5
+ import ScopedContext from "../context/scoped";
6
6
 
7
7
  import { define } from "../elements";
8
8
 
@@ -49,9 +49,9 @@ export default define(class Subproof extends Element {
49
49
  verify(substitutions, assignments, context) {
50
50
  let verifies = false;
51
51
 
52
- const localContext = LocalContext.fromNothing(context); ///
52
+ const scopedContext = ScopedContext.fromNothing(context); ///
53
53
 
54
- context = localContext; ///
54
+ context = scopedContext; ///
55
55
 
56
56
  const suppositionsVerify = this.suppositions.every((supposition) => {
57
57
  const suppositionVerifies = supposition.verify(context);
@@ -3,7 +3,9 @@
3
3
  import Substitution from "../substitution";
4
4
 
5
5
  import { define } from "../../elements";
6
+ import { withinFragment } from "../../utilities/fragment";
6
7
  import { instantiateFrameSubstitution } from "../../process/instantiate";
8
+ import { frameSubstitutionStringFromFrameAndMetavariable } from "../../utilities/string";
7
9
  import { frameSubstitutionFromFrameSubstitutionNode, frameSubstitutionFromStatementNode } from "../../utilities/element";
8
10
 
9
11
  export default define(class FrameSubstitution extends Substitution {
@@ -86,18 +88,13 @@ export default define(class FrameSubstitution extends Substitution {
86
88
  }
87
89
 
88
90
  static fromFrameAndMetavariable(frame, metavariable, context) {
89
- const string = stringFromFrameAndMetavariable(frame, metavariable),
90
- frameSubstitutionNode = instantiateFrameSubstitution(string, context),
91
- frameSubstitution = frameSubstitutionFromFrameSubstitutionNode(frameSubstitutionNode, context);
92
-
93
- return frameSubstitution;
91
+ return withinFragment((context) => {
92
+ const frameAndMetavariableString = frameSubstitutionStringFromFrameAndMetavariable(frame, metavariable),
93
+ string = frameAndMetavariableString, ///
94
+ frameSubstitutionNode = instantiateFrameSubstitution(string, context),
95
+ frameSubstitution = frameSubstitutionFromFrameSubstitutionNode(frameSubstitutionNode, context);
96
+
97
+ return frameSubstitution;
98
+ }, context);
94
99
  }
95
100
  });
96
-
97
- function stringFromFrameAndMetavariable(frame, metavariable) {
98
- const frameString = frame.getString(),
99
- metavariableString = metavariable.getString(),
100
- string = `[${frameString} for [${metavariableString}]]`;
101
-
102
- return string;
103
- }
@@ -4,11 +4,13 @@ import elements from "../../elements";
4
4
  import Substitution from "../substitution";
5
5
 
6
6
  import { define } from "../../elements";
7
+ import { withinFragment } from "../../utilities/fragment";
7
8
  import { unifySubstitution } from "../../process/unify";
8
9
  import { stripBracketsFromStatement } from "../../utilities/brackets";
9
10
  import { instantiateStatementSubstitution } from "../../process/instantiate";
10
11
  import { statementSubstitutionFromStatementSubstitutionNode } from "../../utilities/element";
11
12
  import { statementFromJSON, statementToStatementJSON, metavariableFromJSON, metavariableToMetavariableJSON } from "../../utilities/json";
13
+ import { statementSubstitutionStringFromStatementAndMetavariable, statementSubstitutionStringFromStatementMetavariableAndSubstitution } from "../../utilities/string";
12
14
 
13
15
  export default define(class StatementSubstitution extends Substitution {
14
16
  constructor(context, string, node, resolved, statement, metavariable, substitution) {
@@ -73,12 +75,13 @@ export default define(class StatementSubstitution extends Substitution {
73
75
  return substitutionEqualToSubstitution;
74
76
  }
75
77
 
76
- isStatementEqualToStatement(statement, context) {
78
+ compareStatesment(statement, context) {
77
79
  statement = stripBracketsFromStatement(statement, context); ///
78
80
 
79
- const statementEqualToStatement = this.statement.isEqualTo(statement);
81
+ const statementEqualToStatement = this.statement.isEqualTo(statement),
82
+ comparesToStatement = statementEqualToStatement; ///
80
83
 
81
- return statementEqualToStatement;
84
+ return comparesToStatement;
82
85
  }
83
86
 
84
87
  isSimple() {
@@ -214,18 +217,14 @@ export default define(class StatementSubstitution extends Substitution {
214
217
  static fromStatementAndMetavariable(statement, metavariable, context) {
215
218
  statement = stripBracketsFromStatement(statement, context); ///
216
219
 
217
- const string = stringFromStatementAndMetavariable(statement, metavariable),
218
- statementSubstitutionNode = instantiateStatementSubstitution(string, context);
220
+ const statementSubstitution = withinFragment((context) => {
221
+ const statementSubstitutionString = statementSubstitutionStringFromStatementAndMetavariable(statement, metavariable, context),
222
+ string = statementSubstitutionString, ///
223
+ statementSubstitutionNode = instantiateStatementSubstitution(string, context),
224
+ statementSubstitution = statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, context)
219
225
 
220
- context = {
221
- nodeAsString: () => string
222
- };
223
-
224
- const statementSubstitution = statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, context);
225
-
226
- statementSubstitution.setStatement(statement);
227
-
228
- statementSubstitution.setMetavariable(metavariable);
226
+ return statementSubstitution;
227
+ }, context);
229
228
 
230
229
  return statementSubstitution;
231
230
  }
@@ -233,46 +232,15 @@ export default define(class StatementSubstitution extends Substitution {
233
232
  static fromStatementMetavariableAndSubstitution(statement, metavariable, substitution, context) {
234
233
  statement = stripBracketsFromStatement(statement, context); ///
235
234
 
236
- const string = stringFromStatementMetavariableAndSubstitution(statement, metavariable, substitution, context),
237
- statementSubstitutionNode = instantiateStatementSubstitution(string, context);
238
-
239
- context = {
240
- nodeAsString: () => string
241
- };
235
+ const statementSubstitution = withinFragment((context) => {
236
+ const statementSubstitutionString = statementSubstitutionStringFromStatementMetavariableAndSubstitution(statement, metavariable, substitution),
237
+ string = statementSubstitutionString, ///
238
+ statementSubstitutionNode = instantiateStatementSubstitution(string, context),
239
+ statementSubstitution = statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, context)
242
240
 
243
- const statementSubstitution = statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, context);
244
-
245
- statementSubstitution.setStatement(statement);
246
-
247
- statementSubstitution.setMetavariable(metavariable);
248
-
249
- statementSubstitution.setSubstitution(substitution);
241
+ return statementSubstitution;
242
+ }, context);
250
243
 
251
244
  return statementSubstitution;
252
245
  }
253
246
  });
254
-
255
- function stringFromStatementAndMetavariable(statement, metavariable) {
256
- const statementString = statement.getString(),
257
- metavariableString = metavariable.getString(),
258
- string = `[${statementString} for ${metavariableString}]`;
259
-
260
- return string;
261
- }
262
-
263
- function stringFromStatementMetavariableAndSubstitution(statement, metavariable, substitution) {
264
- let string;
265
-
266
- const statementString = statement.getString(),
267
- metavariableString = metavariable.getString();
268
-
269
- if (substitution === null) {
270
- string = `[${statementString} for ${metavariableString}]`;
271
- } else {
272
- const substitutionString = substitution.getString();
273
-
274
- string = `[${statementString} for ${metavariableString}${substitutionString}]`;
275
- }
276
-
277
- return string;
278
- }
@@ -92,10 +92,10 @@ export default class Substitution extends Element {
92
92
  return referenceEqualToReference;
93
93
  }
94
94
 
95
- isStatementEqualToStatement(statement, context) {
96
- const statementEqualToStatement = false;
95
+ compareStatement(statement, context) {
96
+ const comparesToStatement = false;
97
97
 
98
- return statementEqualToStatement;
98
+ return comparesToStatement;
99
99
  }
100
100
 
101
101
  isMetavariableEqualToMetavariable(metavariable) {