occam-verify-cli 1.0.824 → 1.0.826

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 (115) hide show
  1. package/lib/context/file/nominal.js +26 -22
  2. package/lib/element/assertion/contained.js +9 -5
  3. package/lib/element/assertion/property.js +9 -5
  4. package/lib/element/assertion/satisfies.js +9 -5
  5. package/lib/element/assertion/subproof.js +9 -5
  6. package/lib/element/assertion/type.js +9 -9
  7. package/lib/element/assertion.js +4 -3
  8. package/lib/element/assumption.js +7 -6
  9. package/lib/element/combinator.js +8 -7
  10. package/lib/element/conclusion.js +8 -7
  11. package/lib/element/constructor.js +7 -6
  12. package/lib/element/declaration/combinator.js +3 -3
  13. package/lib/element/declaration/complexType.js +3 -3
  14. package/lib/element/declaration/constructor.js +3 -3
  15. package/lib/element/declaration/metavariable.js +3 -3
  16. package/lib/element/declaration/simpleType.js +3 -3
  17. package/lib/element/declaration/typePrefix.js +3 -3
  18. package/lib/element/declaration/variable.js +3 -3
  19. package/lib/element/deduction.js +8 -7
  20. package/lib/element/derivation.js +10 -3
  21. package/lib/element/equality.js +8 -7
  22. package/lib/element/equivalence.js +10 -3
  23. package/lib/element/error.js +8 -1
  24. package/lib/element/frame.js +8 -7
  25. package/lib/element/hypothesis.js +8 -7
  26. package/lib/element/judgement.js +8 -7
  27. package/lib/element/label.js +8 -7
  28. package/lib/element/metaType.js +7 -6
  29. package/lib/element/metavariable.js +6 -5
  30. package/lib/element/parameter.js +8 -7
  31. package/lib/element/procedureCall.js +8 -7
  32. package/lib/element/procedureReference.js +8 -7
  33. package/lib/element/proof.js +10 -3
  34. package/lib/element/proofAssertion.js +3 -3
  35. package/lib/element/property.js +7 -6
  36. package/lib/element/propertyRelation.js +8 -7
  37. package/lib/element/reference.js +8 -7
  38. package/lib/element/rule.js +6 -6
  39. package/lib/element/section.js +10 -3
  40. package/lib/element/signature.js +7 -6
  41. package/lib/element/statement.js +6 -5
  42. package/lib/element/subDerivation.js +10 -3
  43. package/lib/element/subproof.js +10 -3
  44. package/lib/element/substitution/frame.js +5 -5
  45. package/lib/element/substitution/reference.js +5 -5
  46. package/lib/element/substitution/statement.js +5 -5
  47. package/lib/element/substitution/term.js +5 -5
  48. package/lib/element/substitution.js +6 -5
  49. package/lib/element/term.js +7 -6
  50. package/lib/element/topLevelAssertion.js +7 -5
  51. package/lib/element/topLevelMetaAssertion.js +7 -5
  52. package/lib/element/type.js +9 -8
  53. package/lib/element/typePrefix.js +8 -7
  54. package/lib/element/variable.js +7 -6
  55. package/lib/utilities/element.js +101 -113
  56. package/lib/utilities/json.js +89 -1
  57. package/package.json +4 -4
  58. package/src/context/file/nominal.js +39 -24
  59. package/src/element/assertion/contained.js +10 -4
  60. package/src/element/assertion/property.js +10 -4
  61. package/src/element/assertion/satisfies.js +10 -4
  62. package/src/element/assertion/subproof.js +10 -4
  63. package/src/element/assertion/type.js +13 -15
  64. package/src/element/assertion.js +3 -1
  65. package/src/element/assumption.js +7 -5
  66. package/src/element/combinator.js +7 -5
  67. package/src/element/conclusion.js +7 -5
  68. package/src/element/constructor.js +6 -4
  69. package/src/element/declaration/combinator.js +2 -2
  70. package/src/element/declaration/complexType.js +2 -2
  71. package/src/element/declaration/constructor.js +2 -2
  72. package/src/element/declaration/metavariable.js +2 -2
  73. package/src/element/declaration/simpleType.js +2 -2
  74. package/src/element/declaration/typePrefix.js +2 -2
  75. package/src/element/declaration/variable.js +2 -2
  76. package/src/element/deduction.js +7 -5
  77. package/src/element/derivation.js +13 -2
  78. package/src/element/equality.js +7 -5
  79. package/src/element/equivalence.js +13 -2
  80. package/src/element/error.js +11 -0
  81. package/src/element/frame.js +7 -5
  82. package/src/element/hypothesis.js +7 -5
  83. package/src/element/judgement.js +7 -5
  84. package/src/element/label.js +7 -5
  85. package/src/element/metaType.js +7 -4
  86. package/src/element/metavariable.js +6 -4
  87. package/src/element/parameter.js +7 -5
  88. package/src/element/procedureCall.js +7 -5
  89. package/src/element/procedureReference.js +7 -5
  90. package/src/element/proof.js +13 -2
  91. package/src/element/proofAssertion.js +2 -2
  92. package/src/element/property.js +6 -4
  93. package/src/element/propertyRelation.js +7 -5
  94. package/src/element/reference.js +7 -5
  95. package/src/element/rule.js +8 -8
  96. package/src/element/section.js +13 -2
  97. package/src/element/signature.js +7 -5
  98. package/src/element/statement.js +5 -3
  99. package/src/element/subDerivation.js +13 -2
  100. package/src/element/subproof.js +13 -2
  101. package/src/element/substitution/frame.js +4 -4
  102. package/src/element/substitution/reference.js +4 -4
  103. package/src/element/substitution/statement.js +4 -4
  104. package/src/element/substitution/term.js +4 -4
  105. package/src/element/substitution.js +5 -3
  106. package/src/element/term.js +6 -4
  107. package/src/element/topLevelAssertion.js +9 -4
  108. package/src/element/topLevelMetaAssertion.js +9 -4
  109. package/src/element/type.js +8 -5
  110. package/src/element/typePrefix.js +7 -5
  111. package/src/element/variable.js +6 -4
  112. package/src/utilities/element.js +195 -154
  113. package/src/utilities/json.js +104 -0
  114. package/lib/process/initialise.js +0 -57
  115. package/src/process/initialise.js +0 -72
@@ -13,8 +13,8 @@ import { termFromContainedAssertionNode,
13
13
  containedAssertionFromStatementNode } from "../../utilities/element";
14
14
 
15
15
  export default define(class ContainedAssertion extends Assertion {
16
- constructor(context, string, node, term, frame, negated, statement) {
17
- super(context, string, node);
16
+ constructor(context, string, node, lineIndex, term, frame, negated, statement) {
17
+ super(context, string, node, lineIndex);
18
18
 
19
19
  this.term = term;
20
20
  this.frame = frame;
@@ -243,6 +243,12 @@ export default define(class ContainedAssertion extends Assertion {
243
243
  return unifiesIndependently;
244
244
  }
245
245
 
246
+ toJSON() {
247
+ const json = super.toJSON();
248
+
249
+ return json;
250
+ }
251
+
246
252
  static name = "ContainedAssertion";
247
253
 
248
254
  static fromJSON(json, context) {
@@ -252,7 +258,7 @@ export default define(class ContainedAssertion extends Assertion {
252
258
 
253
259
  if (this.name === name) {
254
260
  instantiate((context) => {
255
- const { string } = json,
261
+ const { string, lineIndex } = json,
256
262
  containedAssertionNode = instantiateContainedAssertion(string, context),
257
263
  node = containedAssertionNode, ///
258
264
  term = termFromContainedAssertionNode(containedAssertionNode, context),
@@ -262,7 +268,7 @@ export default define(class ContainedAssertion extends Assertion {
262
268
 
263
269
  context = null;
264
270
 
265
- containedAssertion = new ContainedAssertion(context, string, node, term, frame, negated, statement);
271
+ containedAssertion = new ContainedAssertion(context, string, node, lineIndex, term, frame, negated, statement);
266
272
  }, context);
267
273
  }
268
274
 
@@ -9,8 +9,8 @@ import { variableAssignmentFromPrepertyAssertion } from "../../process/assign";
9
9
  import { termFromPropertyAssertionNode, propertyAssertionFromStatementNode, propertyRelationFromPropertyAssertionNode } from "../../utilities/element";
10
10
 
11
11
  export default define(class PropertyAssertion extends Assertion {
12
- constructor(context, string, node, term, propertyRelation) {
13
- super(context, string, node);
12
+ constructor(context, string, node, lineIndex, term, propertyRelation) {
13
+ super(context, string, node, lineIndex);
14
14
 
15
15
  this.term = term;
16
16
  this.propertyRelation = propertyRelation;
@@ -203,6 +203,12 @@ export default define(class PropertyAssertion extends Assertion {
203
203
  context.addAssignment(variableAssigment);
204
204
  }
205
205
 
206
+ toJSON() {
207
+ const json = super.toJSON();
208
+
209
+ return json;
210
+ }
211
+
206
212
  static name = "PropertyAssertion";
207
213
 
208
214
  static fromJSON(json, context) {
@@ -212,7 +218,7 @@ export default define(class PropertyAssertion extends Assertion {
212
218
 
213
219
  if (this.name === name) {
214
220
  instantiate((context) => {
215
- const { string } = json,
221
+ const { string, lineIndex } = json,
216
222
  propertyAssertionNode = instantiatePropertyAssertion(string, context),
217
223
  node = propertyAssertionNode, ///
218
224
  term = termFromPropertyAssertionNode(propertyAssertionNode, context),
@@ -220,7 +226,7 @@ export default define(class PropertyAssertion extends Assertion {
220
226
 
221
227
  context = null;
222
228
 
223
- propertyAssertion = new PropertyAssertion(context, string, node, term, propertyRelation);
229
+ propertyAssertion = new PropertyAssertion(context, string, node, lineIndex, term, propertyRelation);
224
230
  }, context);
225
231
  }
226
232
 
@@ -8,8 +8,8 @@ import { instantiateSatisfiesAssertion } from "../../process/instantiate";
8
8
  import { signatureFromJSatisfiesAssertionNode, referenceFromJSatisfiesAssertionNode, satisfiesAssertionFromStatementNode } from "../../utilities/element";
9
9
 
10
10
  export default define(class SatisfiesAssertion extends Assertion {
11
- constructor(context, string, node, signature, reference) {
12
- super(context, string, node);
11
+ constructor(context, string, node, lineIndex, signature, reference) {
12
+ super(context, string, node, lineIndex);
13
13
 
14
14
  this.signature = signature;
15
15
  this.reference = reference;
@@ -157,6 +157,12 @@ export default define(class SatisfiesAssertion extends Assertion {
157
157
  return stepAndSubproofOrProofAssertionsUnify;
158
158
  }
159
159
 
160
+ toJSON() {
161
+ const json = super.toJSON();
162
+
163
+ return json;
164
+ }
165
+
160
166
  static name = "SatisfiesAssertion";
161
167
 
162
168
  static fromJSON(json, context) {
@@ -165,7 +171,7 @@ export default define(class SatisfiesAssertion extends Assertion {
165
171
  const { name } = json;
166
172
 
167
173
  if (this.name === name) {
168
- instantiate((context) => {const { string } = json,
174
+ instantiate((context) => {const { string, lineIndex } = json,
169
175
  definedAssertionNode = instantiateSatisfiesAssertion(string, context),
170
176
  node = definedAssertionNode, ///
171
177
  signature = signatureFromJSatisfiesAssertionNode(definedAssertionNode, context),
@@ -173,7 +179,7 @@ export default define(class SatisfiesAssertion extends Assertion {
173
179
 
174
180
  context = null;
175
181
 
176
- satisfiesAssertion = new SatisfiesAssertion(context, string, node, signature, reference);
182
+ satisfiesAssertion = new SatisfiesAssertion(context, string, node, lineIndex, signature, reference);
177
183
  }, context);
178
184
  }
179
185
 
@@ -13,8 +13,8 @@ import { subproofAssertionFromStatementNode } from "../../utilities/element";
13
13
  const { last, front, backwardsEvery } = arrayUtilities;
14
14
 
15
15
  export default define(class SubproofAssertion extends Assertion {
16
- constructor(context, string, node, statements) {
17
- super(context, string, node);
16
+ constructor(context, string, node, lineIndex, statements) {
17
+ super(context, string, node, lineIndex);
18
18
 
19
19
  this.statements = statements;
20
20
  }
@@ -289,6 +289,12 @@ export default define(class SubproofAssertion extends Assertion {
289
289
  return topLevelMetaAssertionUnifies;
290
290
  }
291
291
 
292
+ toJSON() {
293
+ const json = super.toJSON();
294
+
295
+ return json;
296
+ }
297
+
292
298
  static name = "SubproofAssertion";
293
299
 
294
300
  static fromJSON(json, context) {
@@ -298,14 +304,14 @@ export default define(class SubproofAssertion extends Assertion {
298
304
 
299
305
  if (this.name === name) {
300
306
  instantiate((context) => {
301
- const { string } = json,
307
+ const { string, lineIndex } = json,
302
308
  subproofAssertionNode = instantiateSubproofAssertion(string, context),
303
309
  statements = statementsFromSubproofAssertionNode(subproofAssertionNode, context),
304
310
  node = subproofAssertionNode; ///
305
311
 
306
312
  context = null;
307
313
 
308
- subproorAssertion = new SubproofAssertion(context, string, node, statements);
314
+ subproorAssertion = new SubproofAssertion(context, string, node, lineIndex, statements);
309
315
  }, context);
310
316
  }
311
317
 
@@ -10,8 +10,8 @@ import { variableAssignmentFromTypeAssertion } from "../../process/assign";
10
10
  import { termFromTypeAssertionNode, typeAssertionFromStatementNode } from "../../utilities/element";
11
11
 
12
12
  export default define(class TypeAssertion extends Assertion {
13
- constructor(context, string, node, term, type) {
14
- super(context, string, node);
13
+ constructor(context, string, node, lineIndex, term, type) {
14
+ super(context, string, node, lineIndex);
15
15
 
16
16
  this.term = term;
17
17
  this.type = type;
@@ -193,17 +193,15 @@ export default define(class TypeAssertion extends Assertion {
193
193
  }
194
194
 
195
195
  toJSON() {
196
- const { name } = this.constructor,
197
- typeJSON = typeToTypeJSON(this.type),
198
- type = typeJSON, ///
199
- string = this.getString(),
200
- json = {
201
- name,
202
- string,
203
- type
204
- };
205
-
206
- return json;
196
+ const json = super.toJSON();
197
+
198
+ const typeJSON = typeToTypeJSON(this.type),
199
+ type = typeJSON; ///
200
+
201
+ return {
202
+ ...json,
203
+ type
204
+ };
207
205
  }
208
206
 
209
207
  static name = "TypeAssertion";
@@ -215,7 +213,7 @@ export default define(class TypeAssertion extends Assertion {
215
213
 
216
214
  if (this.name === name) {
217
215
  instantiate((context) => {
218
- const { string } = json,
216
+ const { string, lineIndex } = json,
219
217
  typeAssertionNode = instantiateTypeAssertion(string, context),
220
218
  term = termFromTypeAssertionNode(typeAssertionNode, context),
221
219
  type = typeFromJSON(json, context),
@@ -223,7 +221,7 @@ export default define(class TypeAssertion extends Assertion {
223
221
 
224
222
  context = null;
225
223
 
226
- typeAssertion = new TypeAssertion(context, string, node, term, type);
224
+ typeAssertion = new TypeAssertion(context, string, node, lineIndex, term, type);
227
225
  }, context);
228
226
  }
229
227
 
@@ -37,9 +37,11 @@ export default class Assertion extends Element {
37
37
  toJSON() {
38
38
  const { name } = this.constructor,
39
39
  string = this.getString(),
40
+ lineIndex = this.getLineIndex(),
40
41
  json = {
41
42
  name,
42
- string
43
+ string,
44
+ lineIndex
43
45
  };
44
46
 
45
47
  return json;
@@ -8,8 +8,8 @@ import { instantiateAssumption } from "../process/instantiate";
8
8
  import { join, reconcile, instantiate } from "../utilities/context";
9
9
 
10
10
  export default define(class Assumption extends Element {
11
- constructor(context, string, node, reference, statement) {
12
- super(context, string, node);
11
+ constructor(context, string, node, lineIndex, reference, statement) {
12
+ super(context, string, node, lineIndex);
13
13
 
14
14
  this.reference = reference;
15
15
  this.statement = statement;
@@ -269,8 +269,10 @@ export default define(class Assumption extends Element {
269
269
 
270
270
  toJSON() {
271
271
  const string = this.getString(),
272
+ lineIndex = this.getLineIndex(),
272
273
  json = {
273
- string
274
+ string,
275
+ lineIndex
274
276
  };
275
277
 
276
278
  return json;
@@ -280,12 +282,12 @@ export default define(class Assumption extends Element {
280
282
 
281
283
  static fromJSON(json, context) {
282
284
  const assumption = instantiate((context) => {
283
- const { string } = json,
285
+ const { string, lineIndex } = json,
284
286
  assumptionNode = instantiateAssumption(string, context),
285
287
  node = assumptionNode, ///
286
288
  reference = referenceFromAssumptionNode(assumptionNode, context),
287
289
  statement = statementFromAssumptionNode(assumptionNode, context),
288
- assumption = new Assumption(context, string, node, reference, statement);
290
+ assumption = new Assumption(context, string, node, lineIndex, reference, statement);
289
291
 
290
292
  return assumption;
291
293
  }, context);
@@ -10,8 +10,8 @@ import { validateStatementAsCombinator } from "../process/validate";
10
10
  import { attempt, serialise, unserialise, instantiate } from "../utilities/context";
11
11
 
12
12
  export default define(class Combinator extends Element {
13
- constructor(context, string, node, statement) {
14
- super(context, string, node);
13
+ constructor(context, string, node, lineIndex, statement) {
14
+ super(context, string, node, lineIndex);
15
15
 
16
16
  this.statement = statement;
17
17
  }
@@ -107,9 +107,11 @@ export default define(class Combinator extends Element {
107
107
 
108
108
  return serialise((context) => {
109
109
  const string = this.getString(),
110
+ lineIndex = this.getLineIndex(),
110
111
  json = {
111
112
  context,
112
- string
113
+ string,
114
+ lineIndex
113
115
  };
114
116
 
115
117
  return json;
@@ -123,12 +125,12 @@ export default define(class Combinator extends Element {
123
125
 
124
126
  unserialise((json, context) => {
125
127
  instantiate((context) => {
126
- const { string } = json,
128
+ const { string, lineIndex } = json,
127
129
  combinatorNode = instantiateCombinator(string, context),
128
130
  node = combinatorNode, ///
129
131
  statement = statementFromCombinatorNode(combinatorNode, context);
130
132
 
131
- combinator = new Combinator(context, string, node, statement);
133
+ combinator = new Combinator(context, string, node, lineIndex, statement);
132
134
  }, context);
133
135
  }, json, context);
134
136
 
@@ -7,8 +7,8 @@ import { instantiateConclusion } from "../process/instantiate";
7
7
  import { declare, attempt, descend, serialise, unserialise, instantiate } from "../utilities/context";
8
8
 
9
9
  export default define(class Conclusion extends Element {
10
- constructor(context, string, node, statement) {
11
- super(context, string, node);
10
+ constructor(context, string, node, lineIndex, statement) {
11
+ super(context, string, node, lineIndex);
12
12
 
13
13
  this.statement = statement;
14
14
  }
@@ -136,9 +136,11 @@ export default define(class Conclusion extends Element {
136
136
 
137
137
  return serialise((context) => {
138
138
  const string = this.getString(),
139
+ lineIndex = this.getLineIndex(),
139
140
  json = {
140
141
  context,
141
- string
142
+ string,
143
+ lineIndex
142
144
  };
143
145
 
144
146
  return json;
@@ -152,12 +154,12 @@ export default define(class Conclusion extends Element {
152
154
 
153
155
  unserialise((json, context) => {
154
156
  instantiate((context) => {
155
- const { string } = json,
157
+ const { string, lineIndex } = json,
156
158
  conclusionNode = instantiateConclusion(string, context),
157
159
  node = conclusionNode, ///
158
160
  statement = statementFromConclusionNode(conclusionNode, context);
159
161
 
160
- conclusion = new Conclusion(context, string, node, statement);
162
+ conclusion = new Conclusion(context, string, node, lineIndex, statement);
161
163
  }, context);
162
164
  }, json, context);
163
165
 
@@ -11,8 +11,8 @@ import { typeFromJSON, typeToTypeJSON } from "../utilities/json";
11
11
  import { attempt, serialise, unserialise, instantiate } from "../utilities/context";
12
12
 
13
13
  export default define(class Constructor extends Element {
14
- constructor(context, string, node, term, type) {
15
- super(context, string, node, type);
14
+ constructor(context, string, node, lineIndex, term, type) {
15
+ super(context, string, node, lineIndex);
16
16
 
17
17
  this.term = term;
18
18
  this.type = type;
@@ -151,10 +151,12 @@ export default define(class Constructor extends Element {
151
151
  const includeType = false,
152
152
  typeJSON = typeToTypeJSON(this.type),
153
153
  string = this.getString(includeType),
154
+ lineIndex = this.getLineIndex(),
154
155
  type = typeJSON, ///
155
156
  json = {
156
157
  context,
157
158
  string,
159
+ lineIndex,
158
160
  type
159
161
  };
160
162
 
@@ -169,13 +171,13 @@ export default define(class Constructor extends Element {
169
171
 
170
172
  unserialise((json, context) => {
171
173
  instantiate((context) => {
172
- const { string } = json,
174
+ const { string, lineIndex } = json,
173
175
  constructorNode = instantiateConstructor(string, context),
174
176
  node = constructorNode, ///
175
177
  term = termFromConstructorNode(constructorNode, context),
176
178
  type = typeFromJSON(json, context);
177
179
 
178
- constructor = new Constructor(context, string, node, term, type);
180
+ constructor = new Constructor(context, string, node, lineIndex, term, type);
179
181
  }, context);
180
182
  }, json, context);
181
183
 
@@ -5,8 +5,8 @@ import Declaration from "../declaration";
5
5
  import { define } from "../../elements";
6
6
 
7
7
  export default define(class CombinatorDeclaration extends Declaration {
8
- constructor(context, string, node, combinator) {
9
- super(context, string, node);
8
+ constructor(context, string, node, lineIndex, combinator) {
9
+ super(context, string, node, lineIndex);
10
10
 
11
11
  this.combinator = combinator;
12
12
  }
@@ -5,8 +5,8 @@ import Declaration from "../declaration";
5
5
  import { define } from "../../elements";
6
6
 
7
7
  export default define(class ComplexTypeDeclaration extends Declaration {
8
- constructor(context, string, node, type, superTypes) {
9
- super(context, string, node);
8
+ constructor(context, string, node, lineIndex, type, superTypes) {
9
+ super(context, string, node, lineIndex);
10
10
 
11
11
  this.type = type;
12
12
  this.superTypes = superTypes;
@@ -5,8 +5,8 @@ import Declaration from "../declaration";
5
5
  import { define } from "../../elements";
6
6
 
7
7
  export default define(class ConstructorDeclaration extends Declaration {
8
- constructor(context, string, node, type, provisional, constructor) {
9
- super(context, string, node);
8
+ constructor(context, string, node, lineIndex, type, provisional, constructor) {
9
+ super(context, string, node, lineIndex);
10
10
 
11
11
  this.type = type;
12
12
  this.provisional = provisional;
@@ -5,8 +5,8 @@ import Declaration from "../declaration";
5
5
  import { define } from "../../elements";
6
6
 
7
7
  export default define(class MetavariableDeclaration extends Declaration {
8
- constructor(context, string, node, metaType, metavariable) {
9
- super(context, string, node);
8
+ constructor(context, string, node, lineIndex, metaType, metavariable) {
9
+ super(context, string, node, lineIndex);
10
10
 
11
11
  this.metaType = metaType;
12
12
  this.metavariable = metavariable;
@@ -7,8 +7,8 @@ import { superTypesStringFromSuperTypes } from "../../utilities/string";
7
7
  import {baseTypeFromNothing} from "../../utilities/type";
8
8
 
9
9
  export default define(class SimpleTypeDeclaration extends Declaration {
10
- constructor(context, string, node, type, superTypes, provisional) {
11
- super(context, string, node);
10
+ constructor(context, string, node, lineIndex, type, superTypes, provisional) {
11
+ super(context, string, node, lineIndex);
12
12
 
13
13
  this.type = type;
14
14
  this.superTypes = superTypes;
@@ -5,8 +5,8 @@ import Declaration from "../declaration";
5
5
  import { define } from "../../elements";
6
6
 
7
7
  export default define(class TypePrefixDeclaration extends Declaration {
8
- constructor(context, string, node, typePrefix) {
9
- super(context, string, node);
8
+ constructor(context, string, node, lineIndex, typePrefix) {
9
+ super(context, string, node, lineIndex);
10
10
 
11
11
  this.typePrefix = typePrefix;
12
12
  }
@@ -5,8 +5,8 @@ import Declaration from "../declaration";
5
5
  import { define } from "../../elements";
6
6
 
7
7
  export default define(class VariableDeclaration extends Declaration {
8
- constructor(context, string, node, type, variable, provisional) {
9
- super(context, string, node);
8
+ constructor(context, string, node, lineIndex, type, variable, provisional) {
9
+ super(context, string, node, lineIndex);
10
10
 
11
11
  this.type = type;
12
12
  this.variable = variable;
@@ -7,8 +7,8 @@ import { instantiateDeduction } from "../process/instantiate";
7
7
  import { declare, attempt, descend, serialise, unserialise, instantiate } from "../utilities/context";
8
8
 
9
9
  export default define(class Deduction extends Element {
10
- constructor(context, string, node, statement) {
11
- super(context, string, node);
10
+ constructor(context, string, node, lineIndex, statement) {
11
+ super(context, string, node, lineIndex);
12
12
 
13
13
  this.statement = statement;
14
14
  }
@@ -161,9 +161,11 @@ export default define(class Deduction extends Element {
161
161
 
162
162
  return serialise((context) => {
163
163
  const string = this.getString(),
164
+ lineIndex = this.getLineIndex(),
164
165
  json = {
165
166
  context,
166
- string
167
+ string,
168
+ lineIndex
167
169
  };
168
170
 
169
171
  return json;
@@ -177,12 +179,12 @@ export default define(class Deduction extends Element {
177
179
 
178
180
  unserialise((json, context) => {
179
181
  instantiate((context) => {
180
- const { string } = json,
182
+ const { string, lineIndex } = json,
181
183
  deductionNode = instantiateDeduction(string, context),
182
184
  node = deductionNode, ///
183
185
  statement = statementFromDeductionNode(deductionNode, context);
184
186
 
185
- deduction = new Deduction(context, string, node, statement);
187
+ deduction = new Deduction(context, string, node, lineIndex, statement);
186
188
  }, context);
187
189
  }, json, context);
188
190
 
@@ -9,8 +9,8 @@ const { last } = arrayUtilities,
9
9
  { asyncEvery } = asynchronousUtilities;
10
10
 
11
11
  export default define(class Derivation extends Element {
12
- constructor(context, string, node, subproofOrProofAssertions) {
13
- super(context, string, node);
12
+ constructor(context, string, node, lineIndex, subproofOrProofAssertions) {
13
+ super(context, string, node, lineIndex);
14
14
 
15
15
  this.subproofOrProofAssertions = subproofOrProofAssertions;
16
16
  }
@@ -52,6 +52,17 @@ export default define(class Derivation extends Element {
52
52
  return verifies;
53
53
  }
54
54
 
55
+ toJSON() {
56
+ const string = this.getString(),
57
+ lineIndex = this.getLineIndex(),
58
+ json = {
59
+ string,
60
+ lineIndex
61
+ };
62
+
63
+ return json;
64
+ }
65
+
55
66
  static name = "Derivation";
56
67
  });
57
68
 
@@ -10,8 +10,8 @@ import { equalityFromStatementNode } from "../utilities/element";
10
10
  import { equalityAssignmentFromEquality, leftVariableAssignmentFromEquality, rightVariableAssignmentFromEquality } from "../process/assign";
11
11
 
12
12
  export default define(class Equality extends Element {
13
- constructor(context, string, node, leftTerm, rightTerm) {
14
- super(context, string, node);
13
+ constructor(context, string, node, lineIndex, leftTerm, rightTerm) {
14
+ super(context, string, node, lineIndex);
15
15
 
16
16
  this.leftTerm = leftTerm;
17
17
  this.rightTerm = rightTerm;
@@ -263,8 +263,10 @@ export default define(class Equality extends Element {
263
263
 
264
264
  toJSON() {
265
265
  const string = this.getString(),
266
+ lineIndex = this.getLineIndex(),
266
267
  json = {
267
- string
268
+ string,
269
+ lineIndex
268
270
  };
269
271
 
270
272
  return json;
@@ -272,7 +274,7 @@ export default define(class Equality extends Element {
272
274
 
273
275
  static fromJSON(json, context) {
274
276
  return instantiate((context) => {
275
- const { string } = json,
277
+ const { string, lineIndex } = json,
276
278
  equalityNode = instantiateEquality(string, context),
277
279
  node = equalityNode, ///
278
280
  leftTerm = leftTermFromEqualityNode(equalityNode, context),
@@ -280,7 +282,7 @@ export default define(class Equality extends Element {
280
282
 
281
283
  context = null;
282
284
 
283
- const equality = new Equality(context, string, node, leftTerm, rightTerm);
285
+ const equality = new Equality(context, string, node, lineIndex, leftTerm, rightTerm);
284
286
 
285
287
  return equality;
286
288
  }, context);
@@ -13,8 +13,8 @@ import { equivalenceFromEquivalenceNode } from "../utilities/element";
13
13
  const { compress } = arrayUtilities;
14
14
 
15
15
  export default define(class Equivalence extends Element {
16
- constructor(context, string, node, type, terms) {
17
- super(context, string, node);
16
+ constructor(context, string, node, lineIndex, type, terms) {
17
+ super(context, string, node, lineIndex);
18
18
 
19
19
  this.type = type;
20
20
  this.terms = terms;
@@ -231,6 +231,17 @@ export default define(class Equivalence extends Element {
231
231
  return equivalence;
232
232
  }
233
233
 
234
+ toJSON() {
235
+ const string = this.getString(),
236
+ lineIndex = this.getLineIndex(),
237
+ json = {
238
+ string,
239
+ lineIndex
240
+ };
241
+
242
+ return json;
243
+ }
244
+
234
245
  static name = "Equivalence";
235
246
 
236
247
  static fromEquality(equality, context) {
@@ -23,5 +23,16 @@ export default define(class Error extends Element {
23
23
  return verifies;
24
24
  }
25
25
 
26
+ toJSON() {
27
+ const string = this.getString(),
28
+ lineIndex = this.getLineIndex(),
29
+ json = {
30
+ string,
31
+ lineIndex
32
+ };
33
+
34
+ return json;
35
+ }
36
+
26
37
  static name = "Error";
27
38
  });