occam-verify-cli 1.0.230 → 1.0.234

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 (121) hide show
  1. package/lib/assignment/variable.js +4 -2
  2. package/lib/context/file.js +5 -5
  3. package/lib/context/local.js +19 -14
  4. package/lib/dom/axiom.js +36 -27
  5. package/lib/dom/combinator.js +5 -5
  6. package/lib/dom/conclusion.js +5 -5
  7. package/lib/dom/conjecture.js +9 -9
  8. package/lib/dom/constructor.js +5 -5
  9. package/lib/dom/declaration/combinator.js +14 -14
  10. package/lib/dom/declaration/complexType.js +35 -35
  11. package/lib/dom/declaration/constructor.js +19 -19
  12. package/lib/dom/declaration/metavariable.js +22 -22
  13. package/lib/dom/declaration/simpleType.js +23 -23
  14. package/lib/dom/declaration/variable.js +20 -20
  15. package/lib/dom/declaration.js +4 -2
  16. package/lib/dom/deduction.js +5 -5
  17. package/lib/dom/derivation.js +5 -5
  18. package/lib/dom/error.js +9 -9
  19. package/lib/dom/hypothesis.js +184 -0
  20. package/lib/dom/label.js +18 -24
  21. package/lib/dom/lemma.js +7 -7
  22. package/lib/dom/metaLemma.js +9 -9
  23. package/lib/dom/metaType.js +4 -10
  24. package/lib/dom/metatheorem.js +9 -9
  25. package/lib/dom/metavariable.js +7 -8
  26. package/lib/dom/parameter.js +2 -2
  27. package/lib/dom/premise.js +5 -5
  28. package/lib/dom/procedureCall.js +3 -3
  29. package/lib/dom/proof.js +3 -3
  30. package/lib/dom/property.js +9 -9
  31. package/lib/dom/reference.js +23 -22
  32. package/lib/dom/rule.js +24 -24
  33. package/lib/dom/section.js +248 -0
  34. package/lib/dom/signature.js +5 -5
  35. package/lib/dom/statement.js +25 -20
  36. package/lib/dom/step.js +3 -3
  37. package/lib/dom/subDerivation.js +5 -5
  38. package/lib/dom/subproof.js +7 -7
  39. package/lib/dom/substitution/statement.js +3 -3
  40. package/lib/dom/supposition.js +5 -5
  41. package/lib/dom/term.js +5 -6
  42. package/lib/dom/theorem.js +9 -9
  43. package/lib/dom/topLevelAssertion.js +123 -31
  44. package/lib/dom/topLevelMetaAssertion.js +13 -13
  45. package/lib/dom/type.js +21 -21
  46. package/lib/dom/variable.js +9 -15
  47. package/lib/index.js +3 -1
  48. package/lib/mixins/step/unify.js +11 -11
  49. package/lib/mixins/term/verify.js +6 -6
  50. package/lib/node/hypothesis.js +123 -0
  51. package/lib/node/section.js +144 -0
  52. package/lib/nonTerminalNodeMap.js +5 -3
  53. package/lib/ruleNames.js +9 -1
  54. package/lib/utilities/context.js +1 -1
  55. package/lib/utilities/json.js +82 -59
  56. package/lib/utilities/releaseContext.js +3 -3
  57. package/lib/utilities/subproof.js +10 -10
  58. package/lib/verifier/combinator.js +9 -10
  59. package/lib/verifier/constructor.js +10 -11
  60. package/lib/verifier/topLevel.js +38 -31
  61. package/package.json +2 -2
  62. package/src/assignment/variable.js +6 -4
  63. package/src/context/file.js +3 -3
  64. package/src/context/local.js +6 -14
  65. package/src/dom/axiom.js +47 -42
  66. package/src/dom/combinator.js +4 -4
  67. package/src/dom/conclusion.js +5 -5
  68. package/src/dom/conjecture.js +8 -8
  69. package/src/dom/constructor.js +4 -4
  70. package/src/dom/declaration/combinator.js +14 -14
  71. package/src/dom/declaration/complexType.js +35 -35
  72. package/src/dom/declaration/constructor.js +20 -20
  73. package/src/dom/declaration/metavariable.js +22 -22
  74. package/src/dom/declaration/simpleType.js +22 -22
  75. package/src/dom/declaration/variable.js +21 -21
  76. package/src/dom/declaration.js +5 -3
  77. package/src/dom/deduction.js +5 -5
  78. package/src/dom/derivation.js +5 -5
  79. package/src/dom/error.js +8 -8
  80. package/src/dom/hypothesis.js +119 -0
  81. package/src/dom/label.js +17 -19
  82. package/src/dom/lemma.js +8 -8
  83. package/src/dom/metaLemma.js +8 -8
  84. package/src/dom/metaType.js +2 -6
  85. package/src/dom/metatheorem.js +8 -8
  86. package/src/dom/metavariable.js +9 -12
  87. package/src/dom/parameter.js +1 -1
  88. package/src/dom/premise.js +8 -8
  89. package/src/dom/procedureCall.js +3 -3
  90. package/src/dom/proof.js +2 -2
  91. package/src/dom/property.js +8 -8
  92. package/src/dom/reference.js +23 -27
  93. package/src/dom/rule.js +29 -29
  94. package/src/dom/section.js +197 -0
  95. package/src/dom/signature.js +4 -5
  96. package/src/dom/statement.js +24 -32
  97. package/src/dom/step.js +4 -4
  98. package/src/dom/subDerivation.js +5 -5
  99. package/src/dom/subproof.js +8 -8
  100. package/src/dom/substitution/statement.js +5 -5
  101. package/src/dom/supposition.js +7 -7
  102. package/src/dom/term.js +3 -8
  103. package/src/dom/theorem.js +7 -7
  104. package/src/dom/topLevelAssertion.js +113 -40
  105. package/src/dom/topLevelMetaAssertion.js +19 -19
  106. package/src/dom/type.js +22 -22
  107. package/src/dom/variable.js +8 -11
  108. package/src/index.js +2 -0
  109. package/src/mixins/step/unify.js +10 -10
  110. package/src/mixins/term/verify.js +4 -5
  111. package/src/node/hypothesis.js +23 -0
  112. package/src/node/section.js +44 -0
  113. package/src/nonTerminalNodeMap.js +7 -1
  114. package/src/ruleNames.js +2 -0
  115. package/src/utilities/context.js +2 -2
  116. package/src/utilities/json.js +86 -58
  117. package/src/utilities/releaseContext.js +2 -2
  118. package/src/utilities/subproof.js +10 -10
  119. package/src/verifier/combinator.js +6 -11
  120. package/src/verifier/constructor.js +9 -12
  121. package/src/verifier/topLevel.js +42 -30
@@ -200,9 +200,9 @@ export default domAssigned(class Premise {
200
200
 
201
201
  static name = "Premise";
202
202
 
203
- static fromJSON(json, fileContext) {
204
- const statement = statementFromJSON(json, fileContext),
205
- procedureCall = procedureCallFromJSON(json, fileContext);
203
+ static fromJSON(json, context) {
204
+ const statement = statementFromJSON(json, context),
205
+ procedureCall = procedureCallFromJSON(json, context);
206
206
 
207
207
  let string;
208
208
 
@@ -219,12 +219,12 @@ export default domAssigned(class Premise {
219
219
  return premise;
220
220
  }
221
221
 
222
- static fromPremiseNode(premiseNode, fileContext) {
222
+ static fromPremiseNode(premiseNode, context) {
223
223
  const { Statement, ProcedureCall } = dom,
224
- node = premiseNode,
225
- string = fileContext.nodeAsString(node),
226
- statement = Statement.fromPremiseNode(premiseNode, fileContext),
227
- procedureCall = ProcedureCall.fromPremiseNode(premiseNode, fileContext),
224
+ node = premiseNode, ///
225
+ string = context.nodeAsString(node),
226
+ statement = Statement.fromPremiseNode(premiseNode, context),
227
+ procedureCall = ProcedureCall.fromPremiseNode(premiseNode, context),
228
228
  premise = new Premise(string, statement, procedureCall);
229
229
 
230
230
  return premise
@@ -109,9 +109,9 @@ export default domAssigned(class ProcedureCall {
109
109
 
110
110
  static name = "ProcedureCall";
111
111
 
112
- static fromJSON(json, fileContext) {
113
- const reference = referenceFromJSON(json, fileContext),
114
- parameters = parametersFromJSON(json, fileContext),
112
+ static fromJSON(json, context) {
113
+ const reference = referenceFromJSON(json, context),
114
+ parameters = parametersFromJSON(json, context),
115
115
  string = stringFromReferenceAndParameters(reference, parameters),
116
116
  procedureCall = new ProcedureCall(string, reference, parameters);
117
117
 
package/src/dom/proof.js CHANGED
@@ -52,13 +52,13 @@ export default domAssigned(class Proof {
52
52
 
53
53
  static name = "Proof";
54
54
 
55
- static fromProofNode(proofNode, fileContext) {
55
+ static fromProofNode(proofNode, context) {
56
56
  let proof = null;
57
57
 
58
58
  if (proofNode !== null) {
59
59
  const { Derivation } = dom,
60
60
  derivationNode = proofNode.getDerivationNode(),
61
- derivation = Derivation.fromDerivationNode(derivationNode, fileContext);
61
+ derivation = Derivation.fromDerivationNode(derivationNode, context);
62
62
 
63
63
  proof = new Proof(derivation);
64
64
  }
@@ -50,29 +50,29 @@ export default domAssigned(class Property {
50
50
 
51
51
  static name = "Property";
52
52
 
53
- static fromJSON(json, fileContext) {
53
+ static fromJSON(json, context) {
54
54
  const { name } = json,
55
- type = typeFromJSON(json, fileContext),
55
+ type = typeFromJSON(json, context),
56
56
  string = name, ///
57
57
  property = new Property(string, name, type);
58
58
 
59
59
  return property;
60
60
  }
61
61
 
62
- static fromPropertyNode(propertyNode, fileContext) {
63
- const property = propertyFromPropertyNode(propertyNode, fileContext)
62
+ static fromPropertyNode(propertyNode, context) {
63
+ const property = propertyFromPropertyNode(propertyNode, context)
64
64
 
65
65
  return property;
66
66
  }
67
67
 
68
- static fromPropertyRelationNode(propertyRelationNode, fileContext) {
68
+ static fromPropertyRelationNode(propertyRelationNode, context) {
69
69
  const propertyNode = propertyRelationNode.getPropertyNode(),
70
- property = propertyFromPropertyNode(propertyNode, fileContext);
70
+ property = propertyFromPropertyNode(propertyNode, context);
71
71
 
72
72
  return property;
73
73
  }
74
74
 
75
- static fromPropertyDeclarationNode(propertyDeclarationNode, fileContext) {
75
+ static fromPropertyDeclarationNode(propertyDeclarationNode, context) {
76
76
  const { Type } = dom,
77
77
  type = Type.fromPropertyDeclarationNode(propertyDeclarationNode),
78
78
  propertyName = propertyDeclarationNode.getPropertyName(),
@@ -84,7 +84,7 @@ export default domAssigned(class Property {
84
84
  }
85
85
  });
86
86
 
87
- function propertyFromPropertyNode(propertyNode, fileContext) {
87
+ function propertyFromPropertyNode(propertyNode, context) {
88
88
  const { Property } = dom,
89
89
  propertyName = propertyNode.getPropertyName(),
90
90
  name = propertyName, ///
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
 
3
3
  import dom from "../dom";
4
- import LocalContext from "../context/local";
5
4
  import Substitutions from "../substitutions";
6
5
 
7
6
  import { domAssigned } from "../dom";
@@ -90,9 +89,11 @@ export default domAssigned(class Reference {
90
89
 
91
90
  context.trace(`Unifying the '${labelString}' label with the '${referenceString}' reference...`);
92
91
 
93
- const fileContext = label.getFileContext(),
94
- generalContext = context, ///
95
- specificContext = fileContext, ///
92
+ const generalContext = context; ///
93
+
94
+ context = label.getContext();
95
+
96
+ const specificContext = context, ///
96
97
  labelMetavariable = label.getMetavariable(),
97
98
  generalMetavariable = this.metavariable, ///
98
99
  specificMetavariable = labelMetavariable, ///
@@ -116,10 +117,9 @@ export default domAssigned(class Reference {
116
117
 
117
118
  context.trace(`Unifying the '${metavariableString}' metavariable with the '${referenceString}' reference...`);
118
119
 
119
- const fileContext = context.getFileContext(),
120
- substitutions = Substitutions.fromNothing(),
120
+ const substitutions = Substitutions.fromNothing(),
121
121
  generalContext = context, ///
122
- specificContext = fileContext, ///
122
+ specificContext = context, ///
123
123
  generalMetavariable = this.metavariable, ///
124
124
  specificMetavariable = metavariable, ///
125
125
  metavariableUnifiesIntrinsically = unifyMetavariableIntrinsically(generalMetavariable, specificMetavariable, substitutions, generalContext, specificContext);
@@ -167,78 +167,74 @@ export default domAssigned(class Reference {
167
167
 
168
168
  static name = "Reference";
169
169
 
170
- static fromJSON(json, fileContext) {
171
- const metavariable = metavariableFromJSON(json, fileContext),
170
+ static fromJSON(json, context) {
171
+ const metavariable = metavariableFromJSON(json, context),
172
172
  reference = new Reference(metavariable);
173
173
 
174
174
  return reference;
175
175
  }
176
176
 
177
- static fromStepNode(stepNode, fileContext) {
177
+ static fromStepNode(stepNode, context) {
178
178
  let reference = null;
179
179
 
180
180
  const referenceNode = stepNode.getReferenceNode();
181
181
 
182
182
  if (referenceNode !== null) {
183
- reference = referenceFromReferenceNode(referenceNode, fileContext);
183
+ reference = referenceFromReferenceNode(referenceNode, context);
184
184
  }
185
185
 
186
186
  return reference;
187
187
  }
188
188
 
189
- static fromReferenceNode(referenceNode, fileContext) {
190
- const reference = referenceFromReferenceNode(referenceNode, fileContext);
189
+ static fromReferenceNode(referenceNode, context) {
190
+ const reference = referenceFromReferenceNode(referenceNode, context);
191
191
 
192
192
  return reference;
193
193
  }
194
194
 
195
- static fromDeclarationNode(declarationNode, fileContext) {
195
+ static fromDeclarationNode(declarationNode, context) {
196
196
  const metavariableNode = declarationNode.getMetavariableNode(),
197
- reference = referenceFromMetavariableNode(metavariableNode, fileContext);
197
+ reference = referenceFromMetavariableNode(metavariableNode, context);
198
198
 
199
199
  return reference;
200
200
  }
201
201
 
202
- static fromMetavariableNode(metavariableNode, fileContext) {
203
- const reference = referenceFromMetavariableNode(metavariableNode, fileContext);
202
+ static fromMetavariableNode(metavariableNode, context) {
203
+ const reference = referenceFromMetavariableNode(metavariableNode, context);
204
204
 
205
205
  return reference;
206
206
  }
207
207
 
208
- static fromProcedureCallNode(procedureCallNode, fileContext) {
208
+ static fromProcedureCallNode(procedureCallNode, context) {
209
209
  let reference = null;
210
210
 
211
211
  const referenceNode = procedureCallNode.getReferenceNode();
212
212
 
213
213
  if (referenceNode !== null) {
214
- reference = referenceFromReferenceNode(referenceNode, fileContext);
214
+ reference = referenceFromReferenceNode(referenceNode, context);
215
215
  }
216
216
 
217
217
  return reference;
218
218
  }
219
219
 
220
- static fromSatisfiesAssertionNode(satisfiesAssertionNode, fileContext) {
220
+ static fromSatisfiesAssertionNode(satisfiesAssertionNode, context) {
221
221
  const metavariableNode = satisfiesAssertionNode.getMetavariableNode(),
222
- reference = referenceFromMetavariableNode(metavariableNode, fileContext);
222
+ reference = referenceFromMetavariableNode(metavariableNode, context);
223
223
 
224
224
  return reference;
225
225
  }
226
226
  });
227
227
 
228
- function referenceFromReferenceNode(referenceNode, fileContext) {
228
+ function referenceFromReferenceNode(referenceNode, context) {
229
229
  const { Reference, Metavariable } = dom,
230
- localContext = LocalContext.fromFileContext(fileContext),
231
- context = localContext, ///
232
230
  metavariable = Metavariable.fromReferenceNode(referenceNode, context),
233
231
  reference = new Reference(metavariable);
234
232
 
235
233
  return reference;
236
234
  }
237
235
 
238
- function referenceFromMetavariableNode(metavariableNode, fileContext) {
236
+ function referenceFromMetavariableNode(metavariableNode, context) {
239
237
  const { Reference, Metavariable } = dom,
240
- localContext = LocalContext.fromFileContext(fileContext),
241
- context = localContext, ///
242
238
  metavariable = Metavariable.fromMetavariableNode(metavariableNode, context),
243
239
  reference = new Reference(metavariable);
244
240
 
package/src/dom/rule.js CHANGED
@@ -18,8 +18,8 @@ import { labelsFromJSON,
18
18
  const { reverse, extract, backwardsEvery } = arrayUtilities;
19
19
 
20
20
  export default domAssigned(class Rule {
21
- constructor(fileContext, string, labels, premises, conclusion, proof) {
22
- this.fileContext = fileContext;
21
+ constructor(context, string, labels, premises, conclusion, proof) {
22
+ this.context = context;
23
23
  this.string = string;
24
24
  this.labels = labels;
25
25
  this.premises = premises;
@@ -27,8 +27,8 @@ export default domAssigned(class Rule {
27
27
  this.proof = proof;
28
28
  }
29
29
 
30
- getFileContext() {
31
- return this.fileContext;
30
+ getContext() {
31
+ return this.context;
32
32
  }
33
33
 
34
34
  getString() {
@@ -66,8 +66,7 @@ export default domAssigned(class Rule {
66
66
  unifyStatementAndStepsOrSubproofs(statement, stepsOrSubproofs, context) {
67
67
  let statementAndStepsOrSubproofsUnify = false;
68
68
 
69
- const localContext = LocalContext.fromFileContext(this.fileContext),
70
- generalContext = localContext, ///
69
+ const generalContext = this.context, ///
71
70
  specificContext = context; ///
72
71
 
73
72
  const substitutions = Substitutions.fromNothing(),
@@ -148,12 +147,13 @@ export default domAssigned(class Rule {
148
147
 
149
148
  const ruleString = this.string; ///
150
149
 
151
- this.fileContext.trace(`Verifying the '${ruleString}' rule...`);
150
+ this.context.trace(`Verifying the '${ruleString}' rule...`);
152
151
 
153
152
  const labelsVerify = this.verifyLabels();
154
153
 
155
154
  if (labelsVerify) {
156
- const context = LocalContext.fromFileContext(this.fileContext),
155
+ const localContext = LocalContext.fromContext(this.context),
156
+ context = localContext, ///
157
157
  premisesVerify = this.verifyPremises(context);
158
158
 
159
159
  if (premisesVerify) {
@@ -165,7 +165,7 @@ export default domAssigned(class Rule {
165
165
  if (proofVerifies) {
166
166
  const rule = this; ///
167
167
 
168
- this.fileContext.addRule(rule);
168
+ this.context.addRule(rule);
169
169
 
170
170
  verifies = true;
171
171
  }
@@ -174,7 +174,7 @@ export default domAssigned(class Rule {
174
174
  }
175
175
 
176
176
  if (verifies) {
177
- this.fileContext.debug(`...verified the '${ruleString}' rule.`);
177
+ this.context.debug(`...verified the '${ruleString}' rule.`);
178
178
  }
179
179
 
180
180
  return verifies;
@@ -249,45 +249,45 @@ export default domAssigned(class Rule {
249
249
 
250
250
  static name = "Rule";
251
251
 
252
- static fromJSON(json, fileContext) {
252
+ static fromJSON(json, context) {
253
253
  let rule;
254
254
 
255
255
  const proof = null,
256
- labels = labelsFromJSON(json, fileContext),
257
- premises = premisesFromJSON(json, fileContext),
258
- conclusion = conclusionFromJSON(json, fileContext),
256
+ labels = labelsFromJSON(json, context),
257
+ premises = premisesFromJSON(json, context),
258
+ conclusion = conclusionFromJSON(json, context),
259
259
  string = stringFromLabelsPremisesAndConclusion(labels, premises, conclusion);
260
260
 
261
- rule = new Rule(fileContext, string, labels, premises, conclusion, proof);
261
+ rule = new Rule(context, string, labels, premises, conclusion, proof);
262
262
 
263
263
  return rule;
264
264
  }
265
265
 
266
- static fromRuleNode(ruleNode, fileContext) {
267
- const proof = proofFromRuleNode(ruleNode, fileContext),
268
- labels = labelsFromRuleNode(ruleNode, fileContext),
269
- premises = premisesFromRuleNode(ruleNode, fileContext),
270
- conclusion = conclusionFromRuleNode(ruleNode, fileContext),
266
+ static fromRuleNode(ruleNode, context) {
267
+ const proof = proofFromRuleNode(ruleNode, context),
268
+ labels = labelsFromRuleNode(ruleNode, context),
269
+ premises = premisesFromRuleNode(ruleNode, context),
270
+ conclusion = conclusionFromRuleNode(ruleNode, context),
271
271
  string = stringFromLabelsPremisesAndConclusion(labels, premises, conclusion),
272
- rule = new Rule(fileContext, string, labels, premises, conclusion, proof);
272
+ rule = new Rule(context, string, labels, premises, conclusion, proof);
273
273
 
274
274
  return rule;
275
275
  }
276
276
  });
277
277
 
278
- function proofFromRuleNode(ruleNode, fileContext) {
278
+ function proofFromRuleNode(ruleNode, context) {
279
279
  const { Proof } = dom,
280
280
  proofNode = ruleNode.getProofNode(),
281
- proof = Proof.fromProofNode(proofNode, fileContext);
281
+ proof = Proof.fromProofNode(proofNode, context);
282
282
 
283
283
  return proof;
284
284
  }
285
285
 
286
- function labelsFromRuleNode(ruleNode, fileContext) {
286
+ function labelsFromRuleNode(ruleNode, context) {
287
287
  const { Label } = dom,
288
288
  labelNodes = ruleNode.getLabelNodes(),
289
289
  labels = labelNodes.map((labelNode) => {
290
- const label = Label.fromLabelNode(labelNode, fileContext);
290
+ const label = Label.fromLabelNode(labelNode, context);
291
291
 
292
292
  return label;
293
293
  });
@@ -295,11 +295,11 @@ function labelsFromRuleNode(ruleNode, fileContext) {
295
295
  return labels;
296
296
  }
297
297
 
298
- function premisesFromRuleNode(ruleNode, fileContext) {
298
+ function premisesFromRuleNode(ruleNode, context) {
299
299
  const { Premise } = dom,
300
300
  premiseNodes = ruleNode.getPremiseNodes(),
301
301
  premises = premiseNodes.map((premiseNode) => {
302
- const premise = Premise.fromPremiseNode(premiseNode, fileContext);
302
+ const premise = Premise.fromPremiseNode(premiseNode, context);
303
303
 
304
304
  return premise;
305
305
  });
@@ -307,10 +307,10 @@ function premisesFromRuleNode(ruleNode, fileContext) {
307
307
  return premises;
308
308
  }
309
309
 
310
- function conclusionFromRuleNode(ruleNode, fileContext) {
310
+ function conclusionFromRuleNode(ruleNode, context) {
311
311
  const { Conclusion } = dom,
312
312
  conclusionNode = ruleNode.getConclusionNode(),
313
- conclusion = Conclusion.fromConclusionNode(conclusionNode, fileContext);
313
+ conclusion = Conclusion.fromConclusionNode(conclusionNode, context);
314
314
 
315
315
  return conclusion;
316
316
  }
@@ -0,0 +1,197 @@
1
+ "use strict";
2
+
3
+ import dom from "../dom";
4
+ import LocalContext from "../context/local";
5
+
6
+ import { domAssigned } from "../dom";
7
+
8
+ export default domAssigned(class Section {
9
+ constructor(context, string, hypotheses, axiom, lemma, theorem, conjecture) {
10
+ this.context = context;
11
+ this.string = string;
12
+ this.hypotheses = hypotheses;
13
+ this.axiom = axiom;
14
+ this.lemma = lemma;
15
+ this.theorem = theorem;
16
+ this.conjecture = conjecture;
17
+ }
18
+
19
+ getContext() {
20
+ return this.context;
21
+ }
22
+
23
+ getString() {
24
+ return this.string;
25
+ }
26
+
27
+ getHypotheses() {
28
+ return this.hypotheses;
29
+ }
30
+
31
+ getAxiom() {
32
+ return this.axiom;
33
+ }
34
+
35
+ getLemma() {
36
+ return this.lemma;
37
+ }
38
+
39
+ getTheorem() {
40
+ return this.theorem;
41
+ }
42
+
43
+ getConjecture() {
44
+ return this.conjecture;
45
+ }
46
+
47
+ verify() {
48
+ let verifies = false;
49
+
50
+ const sectionString = this.string; ///
51
+
52
+ this.context.trace(`Verifying the '${sectionString}' section...`);
53
+
54
+ const hypothesesVerify = this.verifyHypotheses();
55
+
56
+ if (hypothesesVerify) {
57
+ const axiomLemmaTheoremOrConjecture = (this.axiom || this.lemma || this.theorem || this.conjecture),
58
+ axiomLemmaTheoremOrConjectureVerifies = axiomLemmaTheoremOrConjecture.verify(this.context);
59
+
60
+ if (axiomLemmaTheoremOrConjectureVerifies) {
61
+ axiomLemmaTheoremOrConjecture.setHypotheses(this.hypotheses);
62
+
63
+ verifies = true;
64
+ }
65
+ }
66
+
67
+ if (verifies) {
68
+ this.context.debug(`...verified the '${sectionString}' section.`);
69
+ }
70
+
71
+ return verifies;
72
+ }
73
+
74
+ verifyHypotheses() {
75
+ const hypothesesVerify = this.hypotheses.every((hypothesis) => {
76
+ const hypothesisVerifies = hypothesis.verify(this.context);
77
+
78
+ if (hypothesisVerifies) {
79
+ return true;
80
+ }
81
+ });
82
+
83
+ return hypothesesVerify;
84
+ }
85
+
86
+ static name = "Section";
87
+
88
+ static fromSectionNode(sectionNode, context) {
89
+ const localContext = LocalContext.fromContext(context);
90
+
91
+ context = localContext; ///
92
+
93
+ const hypothesisNodes = sectionNode.getHypothesisNodes(),
94
+ hypotheses = hypothesesFromHypothesisNodes(hypothesisNodes, context),
95
+ axiom = axiomFroSectionNode(sectionNode, context),
96
+ lemma = lemmaFroSectionNode(sectionNode, context),
97
+ theorem = theoremFroSectionNode(sectionNode, context),
98
+ conjecture = conjectureFroSectionNode(sectionNode, context),
99
+ string = stringFromHypothesesAxiomLemmaTheoremAndConjecture(hypotheses, axiom, lemma, theorem, conjecture, context),
100
+ section = new Section(context, string, hypotheses, axiom, lemma, theorem, conjecture);
101
+
102
+ return section;
103
+ }
104
+ });
105
+
106
+ function axiomFroSectionNode(sectionNode, context) {
107
+ let axiom = null;
108
+
109
+ const axiomNode = sectionNode.getAxiomNode();
110
+
111
+ if (axiomNode !== null) {
112
+ const { Axiom } = dom;
113
+
114
+ axiom = Axiom.fromAxiomNode(axiomNode, context);
115
+ }
116
+
117
+ return axiom;
118
+ }
119
+
120
+ function lemmaFroSectionNode(sectionNode, context) {
121
+ let lemma = null;
122
+
123
+ const lemmaNode = sectionNode.getLemmaNode();
124
+
125
+ if (lemmaNode !== null) {
126
+ const { Lemma } = dom;
127
+
128
+ lemma = Lemma.fromLemmaNode(lemmaNode, context);
129
+ }
130
+
131
+ return lemma;
132
+ }
133
+
134
+ function theoremFroSectionNode(sectionNode, context) {
135
+ let theorem = null;
136
+
137
+ const theoremNode = sectionNode.getTheoremNode();
138
+
139
+ if (theoremNode !== null) {
140
+ const { Theorem } = dom;
141
+
142
+ theorem = Theorem.fromTheoremNode(theoremNode, context);
143
+ }
144
+
145
+ return theorem;
146
+ }
147
+
148
+ function conjectureFroSectionNode(sectionNode, context) {
149
+ let conjecture = null;
150
+
151
+ const conjectureNode = sectionNode.getConjectureNode();
152
+
153
+ if (conjectureNode !== null) {
154
+ const { Conjecture } = dom;
155
+
156
+ conjecture = Conjecture.fromConjectureNode(conjectureNode, context);
157
+ }
158
+
159
+ return conjecture;
160
+ }
161
+
162
+ function hypothesesFromHypothesisNodes(hypothesisNodes, context) {
163
+ const hypotheses = hypothesisNodes.map((hypothesisNode) => {
164
+ const { Hypothesis } = dom,
165
+ hypothesis = Hypothesis.fromHypothesisNode(hypothesisNode, context);
166
+
167
+ return hypothesis;
168
+ });
169
+
170
+ return hypotheses;
171
+ }
172
+
173
+ function hypothesesStringFromHypotheses(hypotheses, context) {
174
+ const hypothesesString = hypotheses.reduce((hypothesesString, hypothesis) => {
175
+ const hypothesisString = hypothesis.getString();
176
+
177
+ hypothesesString = (hypothesesString !== null) ?
178
+ `${hypothesesString}, ${hypothesisString}` :
179
+ hypothesisString; ///
180
+
181
+ return hypothesesString;
182
+ }, null);
183
+
184
+ return hypothesesString;
185
+ }
186
+
187
+ function stringFromHypothesesAxiomLemmaTheoremAndConjecture(hypotheses, axiom, lemma, theorem, conjecture, context) {
188
+ const axiomLemmaTheoremOrConjecture = (axiom || lemma || theorem || conjecture),
189
+ axiomLemmaTheoremOrConjectureString = axiomLemmaTheoremOrConjecture.getString(),
190
+ hypothesesString = hypothesesStringFromHypotheses(hypotheses, context),
191
+ string = (axiomLemmaTheoremOrConjectureString !== null) ?
192
+ `[${hypothesesString}]::: ${axiomLemmaTheoremOrConjectureString}` :
193
+ `[${hypothesesString}]::: `;
194
+
195
+
196
+ return string;
197
+ }
@@ -63,7 +63,6 @@ export default domAssigned(class Signature {
63
63
  let context,
64
64
  term;
65
65
 
66
-
67
66
  context = generalContext; ///
68
67
 
69
68
  term = termB; ///
@@ -157,17 +156,17 @@ export default domAssigned(class Signature {
157
156
 
158
157
  static name = "Signature";
159
158
 
160
- static fromJSON(json, fileContext) {
161
- const terms = termsFromJSON(json, fileContext),
159
+ static fromJSON(json, context) {
160
+ const terms = termsFromJSON(json, context),
162
161
  string = stringFromTerms(terms),
163
162
  signature = new Signature(string, terms);
164
163
 
165
164
  return signature;
166
165
  }
167
166
 
168
- static fromSignatureNode(signatureNode, fileContext) {
167
+ static fromSignatureNode(signatureNode, context) {
169
168
  const termNodes = signatureNode.getTermNodes(),
170
- terms = termsFromTermNodes(termNodes, fileContext),
169
+ terms = termsFromTermNodes(termNodes, context),
171
170
  string = stringFromTerms(terms),
172
171
  signature = new Signature(string, terms);
173
172