occam-verify-cli 1.0.281 → 1.0.285

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 (65) hide show
  1. package/lib/context/file.js +51 -9
  2. package/lib/context/local.js +11 -6
  3. package/lib/context/release.js +11 -11
  4. package/lib/dom/axiom.js +18 -18
  5. package/lib/dom/conclusion.js +16 -9
  6. package/lib/dom/conjecture.js +4 -4
  7. package/lib/dom/constructor/bracketed.js +3 -3
  8. package/lib/dom/constructor.js +3 -3
  9. package/lib/dom/declaration/combinator.js +14 -7
  10. package/lib/dom/declaration/complexType.js +28 -21
  11. package/lib/dom/declaration/constructor.js +18 -11
  12. package/lib/dom/declaration/metavariable.js +19 -12
  13. package/lib/dom/declaration/simpleType.js +21 -14
  14. package/lib/dom/declaration/variable.js +19 -12
  15. package/lib/dom/deduction.js +18 -11
  16. package/lib/dom/error.js +11 -4
  17. package/lib/dom/hypothesis.js +16 -9
  18. package/lib/dom/lemma.js +4 -4
  19. package/lib/dom/metaLemma.js +4 -4
  20. package/lib/dom/metatheorem.js +4 -4
  21. package/lib/dom/premise.js +18 -11
  22. package/lib/dom/procedureCall.js +17 -10
  23. package/lib/dom/rule.js +14 -7
  24. package/lib/dom/section.js +12 -5
  25. package/lib/dom/statement.js +15 -15
  26. package/lib/dom/step.js +18 -11
  27. package/lib/dom/subproof.js +11 -10
  28. package/lib/dom/supposition.js +20 -13
  29. package/lib/dom/theorem.js +4 -4
  30. package/lib/dom/topLevelAssertion.js +13 -6
  31. package/lib/dom/topLevelMetaAssertion.js +11 -4
  32. package/lib/log.js +25 -10
  33. package/package.json +1 -1
  34. package/src/context/file.js +68 -9
  35. package/src/context/local.js +5 -5
  36. package/src/context/release.js +5 -5
  37. package/src/dom/axiom.js +23 -18
  38. package/src/dom/conclusion.js +14 -8
  39. package/src/dom/conjecture.js +4 -3
  40. package/src/dom/constructor/bracketed.js +2 -2
  41. package/src/dom/constructor.js +2 -2
  42. package/src/dom/declaration/combinator.js +11 -6
  43. package/src/dom/declaration/complexType.js +26 -20
  44. package/src/dom/declaration/constructor.js +16 -11
  45. package/src/dom/declaration/metavariable.js +17 -11
  46. package/src/dom/declaration/simpleType.js +19 -13
  47. package/src/dom/declaration/variable.js +17 -12
  48. package/src/dom/deduction.js +16 -10
  49. package/src/dom/error.js +8 -3
  50. package/src/dom/hypothesis.js +14 -8
  51. package/src/dom/lemma.js +5 -4
  52. package/src/dom/metaLemma.js +4 -3
  53. package/src/dom/metatheorem.js +4 -3
  54. package/src/dom/premise.js +16 -10
  55. package/src/dom/procedureCall.js +16 -9
  56. package/src/dom/rule.js +14 -7
  57. package/src/dom/section.js +10 -4
  58. package/src/dom/statement.js +14 -14
  59. package/src/dom/step.js +16 -10
  60. package/src/dom/subproof.js +8 -6
  61. package/src/dom/supposition.js +18 -12
  62. package/src/dom/theorem.js +4 -3
  63. package/src/dom/topLevelAssertion.js +11 -5
  64. package/src/dom/topLevelMetaAssertion.js +9 -3
  65. package/src/log.js +29 -16
@@ -8,10 +8,11 @@ export default domAssigned(class Theorem extends TopLevelAssertion {
8
8
  verify() {
9
9
  let verifies;
10
10
 
11
- const context = this.getContext(),
11
+ const node = this.getNode(),
12
+ context = this.getContext(),
12
13
  theoremString = this.string; ///
13
14
 
14
- context.trace(`Verifying the '${theoremString}' theorem...`);
15
+ context.trace(`Verifying the '${theoremString}' theorem...`, node);
15
16
 
16
17
  verifies = super.verify();
17
18
 
@@ -20,7 +21,7 @@ export default domAssigned(class Theorem extends TopLevelAssertion {
20
21
 
21
22
  context.addTheorem(theorem);
22
23
 
23
- context.debug(`...verified the '${theoremString}' theorem.`);
24
+ context.debug(`...verified the '${theoremString}' theorem.`, node);
24
25
  }
25
26
 
26
27
  return verifies;
@@ -20,8 +20,9 @@ import { labelsFromJSON,
20
20
  const { extract, reverse, correlate, backwardsEvery } = arrayUtilities;
21
21
 
22
22
  export default class TopLevelAssertion {
23
- constructor(context, string, labels, suppositions, deduction, proof, signature, hypotheses) {
23
+ constructor(context, node, string, labels, suppositions, deduction, proof, signature, hypotheses) {
24
24
  this.context = context;
25
+ this.node = node;
25
26
  this.string = string;
26
27
  this.labels = labels;
27
28
  this.suppositions = suppositions;
@@ -35,6 +36,10 @@ export default class TopLevelAssertion {
35
36
  return this.context;
36
37
  }
37
38
 
39
+ getNode() {
40
+ return this.node;
41
+ }
42
+
38
43
  getString() {
39
44
  return this.string;
40
45
  }
@@ -199,7 +204,7 @@ export default class TopLevelAssertion {
199
204
  const steps = context.getSteps(),
200
205
  topLevelAssertionString = this.string; ///
201
206
 
202
- context.trace(`Correlating the hypotheses of the '${topLevelAssertionString}' axiom, lemma, theorem or conjecture...`);
207
+ context.trace(`Correlating the hypotheses of the '${topLevelAssertionString}' axiom, lemma, theorem or conjecture...`, this.node);
203
208
 
204
209
  hypothesesCorrelate = correlate(this.hypotheses, steps, (hypothesis, step) => {
205
210
  const hypothesesEqualToStep = hypothesis.isEqualToStep(step, context);
@@ -210,7 +215,7 @@ export default class TopLevelAssertion {
210
215
  });
211
216
 
212
217
  if (hypothesesCorrelate) {
213
- context.debug(`...correlated the hypotheses of the '${topLevelAssertionString}' axiom, lemma, theorem or conjecture.`);
218
+ context.debug(`...correlated the hypotheses of the '${topLevelAssertionString}' axiom, lemma, theorem or conjecture.`, this.node);
214
219
  }
215
220
  } else {
216
221
  hypothesesCorrelate = true
@@ -324,9 +329,10 @@ export default class TopLevelAssertion {
324
329
  suppositions = suppositionsFromJSON(json, context),
325
330
  signature = signatureFromJSON(json, context),
326
331
  hypotheses = hypothesesFromJSON(json, context),
332
+ node = null,
327
333
  proof = null,
328
334
  string = stringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction),
329
- topLevelAssertion = new Class(context, string, labels, suppositions, deduction, proof, signature, hypotheses);
335
+ topLevelAssertion = new Class(context, node, string, labels, suppositions, deduction, proof, signature, hypotheses);
330
336
 
331
337
  return topLevelAssertion;
332
338
  }
@@ -345,7 +351,7 @@ export default class TopLevelAssertion {
345
351
  signature = signatureFromSignatureNode(signatureNode, context),
346
352
  hypotheses = [],
347
353
  string = stringFromLabelsSuppositionsAndDeduction(labels, suppositions, deduction),
348
- topLevelAssertion = new Class(context, string, labels, suppositions, deduction, proof, signature, hypotheses);
354
+ topLevelAssertion = new Class(context, node, string, labels, suppositions, deduction, proof, signature, hypotheses);
349
355
 
350
356
  return topLevelAssertion;
351
357
  }
@@ -15,8 +15,9 @@ import { labelFromJSON,
15
15
  substitutionsToSubstitutionsJSON } from "../utilities/json";
16
16
 
17
17
  export default class TopLevelMetaAssertion {
18
- constructor(context, string, label, suppositions, deduction, proof, substitutions) {
18
+ constructor(context, node, string, label, suppositions, deduction, proof, substitutions) {
19
19
  this.context = context;
20
+ this.node = node;
20
21
  this.string = string;
21
22
  this.label = label;
22
23
  this.suppositions = suppositions;
@@ -29,6 +30,10 @@ export default class TopLevelMetaAssertion {
29
30
  return this.context;
30
31
  }
31
32
 
33
+ getNode() {
34
+ return this.node;
35
+ }
36
+
32
37
  getString() {
33
38
  return this.string;
34
39
  }
@@ -155,9 +160,10 @@ export default class TopLevelMetaAssertion {
155
160
  deduction = deductionFromJSON(json, context),
156
161
  suppositions = suppositionsFromJSON(json, context),
157
162
  substitutions = substitutionsFromJSON(json, context),
163
+ node = null,
158
164
  proof = null,
159
165
  string = stringFromLabelASuppositionsAndDeduction(label, suppositions, deduction),
160
- topLevelMetaAssertion = new Class(context, string, label, suppositions, deduction, proof, substitutions);
166
+ topLevelMetaAssertion = new Class(context, node, string, label, suppositions, deduction, proof, substitutions);
161
167
 
162
168
  return topLevelMetaAssertion;
163
169
  }
@@ -174,7 +180,7 @@ export default class TopLevelMetaAssertion {
174
180
  suppositions = suppositionsFromSuppositionNodes(suppositionNodes, context),
175
181
  substitutions = Substitutions.fromNothing(),
176
182
  string = stringFromLabelASuppositionsAndDeduction(label, suppositions, deduction),
177
- topLevelMetaAssertion = new Class(context, string, label, suppositions, deduction, proof, substitutions);
183
+ topLevelMetaAssertion = new Class(context, node, string, label, suppositions, deduction, proof, substitutions);
178
184
 
179
185
  return topLevelMetaAssertion;
180
186
  }
package/src/log.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
 
3
3
  import { levels } from "necessary";
4
+ import {EMPTY_STRING} from "./constants";
4
5
 
5
6
  const { TRACE_LEVEL, DEBUG_LEVEL, INFO_LEVEL, WARNING_LEVEL, ERROR_LEVEL } = levels;
6
7
 
@@ -23,37 +24,37 @@ export default class Log {
23
24
  return this.follow;
24
25
  }
25
26
 
26
- trace(message, filePath) {
27
+ trace(message, filePath, lineIndex = null) {
27
28
  const level = TRACE_LEVEL;
28
29
 
29
- this.write(level, message, filePath);
30
+ this.write(level, message, filePath, lineIndex);
30
31
  }
31
32
 
32
- debug(message, filePath) {
33
+ debug(message, filePath, lineIndex = null) {
33
34
  const level = DEBUG_LEVEL;
34
35
 
35
- this.write(level, message, filePath);
36
+ this.write(level, message, filePath, lineIndex);
36
37
  }
37
38
 
38
- info(message, filePath) {
39
+ info(message, filePath, lineIndex = null) {
39
40
  const level = INFO_LEVEL;
40
41
 
41
- this.write(level, message, filePath);
42
+ this.write(level, message, filePath, lineIndex);
42
43
  }
43
44
 
44
- warning(message, filePath) {
45
+ warning(message, filePath, lineIndex = null) {
45
46
  const level = WARNING_LEVEL;
46
47
 
47
- this.write(level, message, filePath);
48
+ this.write(level, message, filePath, lineIndex);
48
49
  }
49
50
 
50
- error(message, filePath) {
51
+ error(message, filePath, lineIndex = null) {
51
52
  const level = ERROR_LEVEL;
52
53
 
53
- this.write(level, message, filePath);
54
+ this.write(level, message, filePath, lineIndex);
54
55
  }
55
56
 
56
- write(level, message, filePath) {
57
+ write(level, message, filePath, lineIndex) {
57
58
  const levels = [
58
59
  TRACE_LEVEL,
59
60
  DEBUG_LEVEL,
@@ -68,7 +69,7 @@ export default class Log {
68
69
  return;
69
70
  }
70
71
 
71
- message = formatMessage(level, message, filePath); ///
72
+ message = formatMessage(level, message, filePath, lineIndex); ///
72
73
 
73
74
  this.follow ?
74
75
  console.log(message) :
@@ -94,12 +95,24 @@ export default class Log {
94
95
  }
95
96
  }
96
97
 
97
- function formatMessage(level, message, filePath = null) {
98
+ function formatMessage(level, message, filePath = null, lineIndex = null) {
99
+ let formattedMessage = EMPTY_STRING;
100
+
98
101
  const upperCaseLevel = level.toUpperCase();
99
102
 
100
- message = (filePath !== null) ?
101
- `${upperCaseLevel}: ${filePath} - ${message}`:
102
- `${upperCaseLevel}: ${message}`;
103
+ formattedMessage += `${upperCaseLevel}:`;
104
+
105
+ if (filePath !== null) {
106
+ formattedMessage += ` ${filePath}`;
107
+ }
108
+
109
+ if (lineIndex !== null) {
110
+ formattedMessage += ` [${lineIndex}]`;
111
+ }
112
+
113
+ formattedMessage += ` - ${message}`;
114
+
115
+ message = formattedMessage; ///
103
116
 
104
117
  return message;
105
118
  }