occam-verify-cli 1.0.825 → 1.0.827

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 (129) hide show
  1. package/lib/element/assertion/contained.js +9 -5
  2. package/lib/element/assertion/property.js +9 -5
  3. package/lib/element/assertion/satisfies.js +9 -5
  4. package/lib/element/assertion/subproof.js +9 -5
  5. package/lib/element/assertion/type.js +9 -9
  6. package/lib/element/assertion.js +4 -3
  7. package/lib/element/assumption.js +7 -6
  8. package/lib/element/combinator.js +8 -7
  9. package/lib/element/conclusion.js +8 -7
  10. package/lib/element/constructor.js +7 -6
  11. package/lib/element/declaration/combinator.js +7 -8
  12. package/lib/element/declaration/complexType.js +25 -26
  13. package/lib/element/declaration/constructor.js +10 -11
  14. package/lib/element/declaration/metavariable.js +10 -11
  15. package/lib/element/declaration/simpleType.js +19 -20
  16. package/lib/element/declaration/typePrefix.js +7 -8
  17. package/lib/element/declaration/variable.js +10 -11
  18. package/lib/element/deduction.js +8 -7
  19. package/lib/element/derivation.js +10 -3
  20. package/lib/element/equality.js +8 -7
  21. package/lib/element/equivalence.js +10 -3
  22. package/lib/element/error.js +10 -3
  23. package/lib/element/frame.js +8 -7
  24. package/lib/element/hypothesis.js +8 -7
  25. package/lib/element/judgement.js +8 -7
  26. package/lib/element/label.js +8 -7
  27. package/lib/element/metaType.js +7 -6
  28. package/lib/element/metavariable.js +6 -5
  29. package/lib/element/parameter.js +8 -7
  30. package/lib/element/procedureCall.js +8 -7
  31. package/lib/element/procedureReference.js +8 -7
  32. package/lib/element/proof.js +10 -3
  33. package/lib/element/proofAssertion/premise.js +5 -5
  34. package/lib/element/proofAssertion/step.js +3 -3
  35. package/lib/element/proofAssertion/supposition.js +5 -5
  36. package/lib/element/proofAssertion.js +3 -3
  37. package/lib/element/property.js +7 -6
  38. package/lib/element/propertyRelation.js +8 -7
  39. package/lib/element/reference.js +8 -7
  40. package/lib/element/rule.js +13 -13
  41. package/lib/element/section.js +12 -5
  42. package/lib/element/signature.js +7 -6
  43. package/lib/element/statement.js +6 -5
  44. package/lib/element/subDerivation.js +10 -3
  45. package/lib/element/subproof.js +10 -3
  46. package/lib/element/substitution/frame.js +5 -5
  47. package/lib/element/substitution/reference.js +5 -5
  48. package/lib/element/substitution/statement.js +5 -5
  49. package/lib/element/substitution/term.js +5 -5
  50. package/lib/element/substitution.js +6 -5
  51. package/lib/element/term.js +7 -6
  52. package/lib/element/topLevelAssertion/axiom.js +3 -4
  53. package/lib/element/topLevelAssertion/conjecture.js +3 -4
  54. package/lib/element/topLevelAssertion/lemma.js +3 -4
  55. package/lib/element/topLevelAssertion/theorem.js +3 -4
  56. package/lib/element/topLevelAssertion.js +9 -7
  57. package/lib/element/topLevelMetaAssertion/metaLemma.js +3 -4
  58. package/lib/element/topLevelMetaAssertion/metatheorem.js +3 -4
  59. package/lib/element/topLevelMetaAssertion.js +12 -10
  60. package/lib/element/type.js +9 -8
  61. package/lib/element/typePrefix.js +8 -7
  62. package/lib/element/variable.js +7 -6
  63. package/lib/process/verify.js +17 -17
  64. package/lib/utilities/element.js +127 -93
  65. package/package.json +4 -4
  66. package/src/element/assertion/contained.js +10 -4
  67. package/src/element/assertion/property.js +10 -4
  68. package/src/element/assertion/satisfies.js +10 -4
  69. package/src/element/assertion/subproof.js +10 -4
  70. package/src/element/assertion/type.js +13 -15
  71. package/src/element/assertion.js +3 -1
  72. package/src/element/assumption.js +7 -5
  73. package/src/element/combinator.js +7 -5
  74. package/src/element/conclusion.js +7 -5
  75. package/src/element/constructor.js +6 -4
  76. package/src/element/declaration/combinator.js +6 -9
  77. package/src/element/declaration/complexType.js +24 -33
  78. package/src/element/declaration/constructor.js +9 -13
  79. package/src/element/declaration/metavariable.js +9 -13
  80. package/src/element/declaration/simpleType.js +19 -26
  81. package/src/element/declaration/typePrefix.js +6 -9
  82. package/src/element/declaration/variable.js +9 -13
  83. package/src/element/deduction.js +7 -5
  84. package/src/element/derivation.js +13 -2
  85. package/src/element/equality.js +7 -5
  86. package/src/element/equivalence.js +13 -2
  87. package/src/element/error.js +13 -3
  88. package/src/element/frame.js +7 -5
  89. package/src/element/hypothesis.js +7 -5
  90. package/src/element/judgement.js +7 -5
  91. package/src/element/label.js +7 -5
  92. package/src/element/metaType.js +7 -4
  93. package/src/element/metavariable.js +6 -4
  94. package/src/element/parameter.js +7 -5
  95. package/src/element/procedureCall.js +7 -5
  96. package/src/element/procedureReference.js +7 -5
  97. package/src/element/proof.js +13 -2
  98. package/src/element/proofAssertion/premise.js +4 -4
  99. package/src/element/proofAssertion/step.js +2 -2
  100. package/src/element/proofAssertion/supposition.js +4 -4
  101. package/src/element/proofAssertion.js +2 -2
  102. package/src/element/property.js +6 -4
  103. package/src/element/propertyRelation.js +7 -5
  104. package/src/element/reference.js +7 -5
  105. package/src/element/rule.js +15 -17
  106. package/src/element/section.js +15 -5
  107. package/src/element/signature.js +7 -5
  108. package/src/element/statement.js +5 -3
  109. package/src/element/subDerivation.js +13 -2
  110. package/src/element/subproof.js +13 -2
  111. package/src/element/substitution/frame.js +4 -4
  112. package/src/element/substitution/reference.js +4 -4
  113. package/src/element/substitution/statement.js +4 -4
  114. package/src/element/substitution/term.js +4 -4
  115. package/src/element/substitution.js +5 -3
  116. package/src/element/term.js +6 -4
  117. package/src/element/topLevelAssertion/axiom.js +2 -4
  118. package/src/element/topLevelAssertion/conjecture.js +2 -4
  119. package/src/element/topLevelAssertion/lemma.js +2 -4
  120. package/src/element/topLevelAssertion/theorem.js +2 -4
  121. package/src/element/topLevelAssertion.js +11 -7
  122. package/src/element/topLevelMetaAssertion/metaLemma.js +2 -4
  123. package/src/element/topLevelMetaAssertion/metatheorem.js +2 -4
  124. package/src/element/topLevelMetaAssertion.js +14 -11
  125. package/src/element/type.js +8 -5
  126. package/src/element/typePrefix.js +7 -5
  127. package/src/element/variable.js +6 -4
  128. package/src/process/verify.js +16 -16
  129. package/src/utilities/element.js +194 -84
@@ -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;
@@ -32,21 +32,19 @@ export default define(class ConstructorDeclaration extends Declaration {
32
32
  return constructorDeclarationNode;
33
33
  }
34
34
 
35
- async verify() {
35
+ async verify(context) {
36
36
  let verifies = false;
37
37
 
38
- const context = this.getContext();
39
-
40
38
  await this.break(context);
41
39
 
42
40
  const constructorDeclarationString = this.getString(); ///
43
41
 
44
42
  context.trace(`Verifying the '${constructorDeclarationString}' constructor declaration...`);
45
43
 
46
- const typeVerified = this.verifyType();
44
+ const typeVerified = this.verifyType(context);
47
45
 
48
46
  if (typeVerified) {
49
- const constructorValidates = this.validateConstructor();
47
+ const constructorValidates = this.validateConstructor(context);
50
48
 
51
49
  if (constructorValidates) {
52
50
  this.constructor.setType(this.type);
@@ -64,11 +62,10 @@ export default define(class ConstructorDeclaration extends Declaration {
64
62
  return verifies;
65
63
  }
66
64
 
67
- verifyType() {
65
+ verifyType(context) {
68
66
  let typeVerifies = false;
69
67
 
70
- const context = this.getContext(),
71
- typeString = this.type.getString(),
68
+ const typeString = this.type.getString(),
72
69
  constructorDeclarationString = this.getString(); ///
73
70
 
74
71
  context.trace(`Verifying the '${constructorDeclarationString}' constructor declaration's '${typeString}' type...`);
@@ -100,11 +97,10 @@ export default define(class ConstructorDeclaration extends Declaration {
100
97
  return typeVerifies;
101
98
  }
102
99
 
103
- validateConstructor() {
100
+ validateConstructor(context) {
104
101
  let constructorValidates;
105
102
 
106
- const context = this.getContext(),
107
- includeType = false,
103
+ const includeType = false,
108
104
  constructorString = this.constructor.getString(includeType),
109
105
  constructorDeclarationString = this.getString(); ///
110
106
 
@@ -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;
@@ -20,21 +20,19 @@ export default define(class MetavariableDeclaration extends Declaration {
20
20
  return this.metavariable;
21
21
  }
22
22
 
23
- async verify() {
23
+ async verify(context) {
24
24
  let verifies;
25
25
 
26
- const context = this.getContext();
27
-
28
26
  await this.break(context);
29
27
 
30
28
  const metavariableDeclarationString = this.getString(); ///
31
29
 
32
30
  context.trace(`Verifying the '${metavariableDeclarationString}' metavariable declaration...`);
33
31
 
34
- const metavariableVerifies = this.verifyMetavariable();
32
+ const metavariableVerifies = this.verifyMetavariable(context);
35
33
 
36
34
  if (metavariableVerifies) {
37
- const metaTypeVerifies = this.verifyMetaType();
35
+ const metaTypeVerifies = this.verifyMetaType(context);
38
36
 
39
37
  if (metaTypeVerifies) {
40
38
  const declaredMetavariable = this.metavariable; ///
@@ -52,11 +50,10 @@ export default define(class MetavariableDeclaration extends Declaration {
52
50
  return verifies;
53
51
  }
54
52
 
55
- verifyMetaType() {
53
+ verifyMetaType(context) {
56
54
  let metaTypeVerifies = true;
57
55
 
58
- const context = this.getContext(),
59
- metaTypeString = this.metaType.getString(),
56
+ const metaTypeString = this.metaType.getString(),
60
57
  metaTypeDeclarationString = this.getString(); ///
61
58
 
62
59
  context.trace(`Verifying the '${metaTypeDeclarationString}' metavariable declaration's '${metaTypeString}' metaType...`);
@@ -70,11 +67,10 @@ export default define(class MetavariableDeclaration extends Declaration {
70
67
  return metaTypeVerifies;
71
68
  }
72
69
 
73
- verifyMetavariable() {
70
+ verifyMetavariable(context) {
74
71
  let metavariableVerifies = false;
75
72
 
76
- const context = this.getContext(),
77
- metavariableString = this.metavariable.getString(),
73
+ const metavariableString = this.metavariable.getString(),
78
74
  metavariableDeclarationString = this.getString(); ///
79
75
 
80
76
  context.trace(`Verifying the '${metavariableDeclarationString}' metavariable declaration's '${metavariableString}' 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;
@@ -34,27 +34,25 @@ export default define(class SimpleTypeDeclaration extends Declaration {
34
34
  return simpleTypeDeclarationNode;
35
35
  }
36
36
 
37
- async verify() {
37
+ async verify(context) {
38
38
  let verifies = false;
39
39
 
40
- const context = this.getContext();
41
-
42
40
  await this.break(context);
43
41
 
44
42
  const simpleTypeDeclarationString = this.getString(); ///
45
43
 
46
44
  context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration...`);
47
45
 
48
- const typeVerifies = this.verifyType();
46
+ const typeVerifies = this.verifyType(context);
49
47
 
50
48
  if (typeVerifies) {
51
- const superTypesVerify = this.verifySuperTypes();
49
+ const superTypesVerify = this.verifySuperTypes(context);
52
50
 
53
51
  if (superTypesVerify) {
54
- const typePrefixVerifies = this.verifyTypePrefix();
52
+ const typePrefixVerifies = this.verifyTypePrefix(context);
55
53
 
56
54
  if (typePrefixVerifies) {
57
- const propertiesVerifies = this.verifyProperties();
55
+ const propertiesVerifies = this.verifyProperties(context);
58
56
 
59
57
  if (propertiesVerifies) {
60
58
  context.addType(this.type);
@@ -72,11 +70,10 @@ export default define(class SimpleTypeDeclaration extends Declaration {
72
70
  return verifies;
73
71
  }
74
72
 
75
- verifyType() {
73
+ verifyType(context) {
76
74
  let typeVerifies = false;
77
75
 
78
- const context = this.getContext(),
79
- typeString = this.type.getString(),
76
+ const typeString = this.type.getString(),
80
77
  simpleTypeDeclarationString = this.getString(); ///
81
78
 
82
79
  context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration's '${typeString}' type...`);
@@ -107,11 +104,10 @@ export default define(class SimpleTypeDeclaration extends Declaration {
107
104
  return typeVerifies;
108
105
  }
109
106
 
110
- verifySuperType(superType, superTypes) {
107
+ verifySuperType(context, superType, superTypes) {
111
108
  let superTypeVerifies = false;
112
109
 
113
- const context = this.getContext(),
114
- superTypeString = superType.getString(),
110
+ const superTypeString = superType.getString(),
115
111
  simpleTypeDeclarationString = this.getString(); ///;
116
112
 
117
113
  context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration's '${superTypeString}' super-type...`);
@@ -141,11 +137,10 @@ export default define(class SimpleTypeDeclaration extends Declaration {
141
137
  return superTypeVerifies;
142
138
  }
143
139
 
144
- verifySuperTypes() {
140
+ verifySuperTypes(context) {
145
141
  let superTypesVerify;
146
142
 
147
- const context = this.getContext(),
148
- superTypes = [],
143
+ const superTypes = [],
149
144
  superTypesString = superTypesStringFromSuperTypes(this.superTypes),
150
145
  simpleTypeDeclarationString = this.getString(); ///;
151
146
 
@@ -154,7 +149,7 @@ export default define(class SimpleTypeDeclaration extends Declaration {
154
149
  context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration's super-types...`);
155
150
 
156
151
  superTypesVerify = this.superTypes.every((superType) => {
157
- const superTypeVerifies = this.verifySuperType(superType, superTypes);
152
+ const superTypeVerifies = this.verifySuperType(context, superType, superTypes);
158
153
 
159
154
  if (superTypeVerifies) {
160
155
  return true;
@@ -181,12 +176,11 @@ export default define(class SimpleTypeDeclaration extends Declaration {
181
176
  return superTypesVerify;
182
177
  }
183
178
 
184
- verifyTypePrefix() {
179
+ verifyTypePrefix(context) {
185
180
  let typePrefixVerifies = false;
186
181
 
187
- const context = this.getContext(),
188
- typeString = this.type.getString(),
189
- simpleTypeDeclarationString = this.getString(); ///;
182
+ const typeString = this.type.getString(),
183
+ simpleTypeDeclarationString = this.getString(); ///;
190
184
 
191
185
  context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration's '${typeString}' type's prefix...`);
192
186
 
@@ -205,11 +199,10 @@ export default define(class SimpleTypeDeclaration extends Declaration {
205
199
  return typePrefixVerifies;
206
200
  }
207
201
 
208
- verifyProperties() {
202
+ verifyProperties(context) {
209
203
  let propertiesVerify = true; ///
210
204
 
211
- const context = this.getContext(),
212
- typeString = this.type.getString(),
205
+ const typeString = this.type.getString(),
213
206
  simpleTypeDeclarationString = this.getString(); ///;
214
207
 
215
208
  context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration's '${typeString}' type's properties...`);
@@ -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
  }
@@ -22,11 +22,9 @@ export default define(class TypePrefixDeclaration extends Declaration {
22
22
  return typePrefixDeclarationNode;
23
23
  }
24
24
 
25
- async verify() {
25
+ async verify(context) {
26
26
  let verifies = false;
27
27
 
28
- const context = this.getContext();
29
-
30
28
  await this.break(context);
31
29
 
32
30
  const typePrefixDeclarationString = this.getString(); ///
@@ -37,7 +35,7 @@ export default define(class TypePrefixDeclaration extends Declaration {
37
35
  typesLength = types.length;
38
36
 
39
37
  if (typesLength === 0) {
40
- const typePrefixVerifies = this.verifyTypePrefix();
38
+ const typePrefixVerifies = this.verifyTypePrefix(context);
41
39
 
42
40
  if (typePrefixVerifies) {
43
41
  context.addTypePrefix(this.typePrefix);
@@ -55,11 +53,10 @@ export default define(class TypePrefixDeclaration extends Declaration {
55
53
  return verifies;
56
54
  }
57
55
 
58
- verifyTypePrefix() {
56
+ verifyTypePrefix(context) {
59
57
  let typePrefixVerifies = false;
60
58
 
61
- const context = this.getContext(),
62
- typePrefixString = this.typePrefix.getString();
59
+ const typePrefixString = this.typePrefix.getString();
63
60
 
64
61
  context.trace(`Verifying the '${typePrefixString}' type prefix...`);
65
62
 
@@ -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;
@@ -32,21 +32,19 @@ export default define(class VariableDeclaration extends Declaration {
32
32
  return variableDeclarationNode;
33
33
  }
34
34
 
35
- async verify() {
35
+ async verify(context) {
36
36
  let verifies = false;
37
37
 
38
- const context = this.getContext();
39
-
40
38
  await this.break(context);
41
39
 
42
40
  const variableDeclarationString = this.getString(); ///
43
41
 
44
42
  context.trace(`Verifying the '${variableDeclarationString}' variable declaration...`);
45
43
 
46
- const typeVerifies = this.verifyType();
44
+ const typeVerifies = this.verifyType(context);
47
45
 
48
46
  if (typeVerifies) {
49
- const variableVerifies = this.verifyVariable();
47
+ const variableVerifies = this.verifyVariable(context);
50
48
 
51
49
  if (variableVerifies) {
52
50
  const declaredVariable = this.variable;
@@ -64,11 +62,10 @@ export default define(class VariableDeclaration extends Declaration {
64
62
  return verifies;
65
63
  }
66
64
 
67
- verifyType() {
65
+ verifyType(context) {
68
66
  let typeVerifies = false;
69
67
 
70
- const context = this.getContext(),
71
- typeString = this.type.getString(),
68
+ const typeString = this.type.getString(),
72
69
  variableDeclarationString = this.getString(); ///
73
70
 
74
71
  context.trace(`Verifying the '${variableDeclarationString}' variable declaration's '${typeString}' type...`);
@@ -100,11 +97,10 @@ export default define(class VariableDeclaration extends Declaration {
100
97
  return typeVerifies;
101
98
  }
102
99
 
103
- verifyVariable() {
100
+ verifyVariable(context) {
104
101
  let variableVerifies = false;
105
102
 
106
- const context = this.getContext(),
107
- variableString = this.variable.getString(),
103
+ const variableString = this.variable.getString(),
108
104
  variableDeclarationString = this.getString(); ///
109
105
 
110
106
  context.trace(`Verifying the '${variableDeclarationString}' variable declaration's '${variableString}' 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) {
@@ -12,16 +12,26 @@ export default define(class Error extends Element {
12
12
  return errorNode;
13
13
  }
14
14
 
15
- async verify() {
15
+ async verify(context) {
16
16
  let verifies = false;
17
17
 
18
- const context = this.getContext(),
19
- errorString = this.getString(); ///
18
+ const errorString = this.getString(); ///
20
19
 
21
20
  context.warning(`The '${errorString}' error cannot be verified.`);
22
21
 
23
22
  return verifies;
24
23
  }
25
24
 
25
+ toJSON() {
26
+ const string = this.getString(),
27
+ lineIndex = this.getLineIndex(),
28
+ json = {
29
+ string,
30
+ lineIndex
31
+ };
32
+
33
+ return json;
34
+ }
35
+
26
36
  static name = "Error";
27
37
  });
@@ -10,8 +10,8 @@ import { metavariableFromFrameNode } from "../utilities/element";
10
10
  import { assumptionsStringFromAssumptions } from "../utilities/string";
11
11
 
12
12
  export default define(class Frame extends Element {
13
- constructor(context, string, node, assumptions, metavariable) {
14
- super(context, string, node);
13
+ constructor(context, string, node, lineIndex, assumptions, metavariable) {
14
+ super(context, string, node, lineIndex);
15
15
 
16
16
  this.assumptions = assumptions;
17
17
  this.metavariable = metavariable;
@@ -286,8 +286,10 @@ export default define(class Frame extends Element {
286
286
 
287
287
  toJSON() {
288
288
  const string = this.getString(),
289
+ lineIndex = this.getLineIndex(),
289
290
  json = {
290
- string
291
+ string,
292
+ lineIndex
291
293
  };
292
294
 
293
295
  return json;
@@ -297,7 +299,7 @@ export default define(class Frame extends Element {
297
299
 
298
300
  static fromJSON(json, context) {
299
301
  return instantiate((context) => {
300
- const { string } = json,
302
+ const { string, lineIndex } = json,
301
303
  frameNode = instantiateFrame(string, context),
302
304
  node = frameNode, ///
303
305
  assumptions = assumptionsFromFrameNode(frameNode, context),
@@ -305,7 +307,7 @@ export default define(class Frame extends Element {
305
307
 
306
308
  context = null;
307
309
 
308
- const frame = new Frame(context, string, node, assumptions, metavariable);
310
+ const frame = new Frame(context, string, node, lineIndex, assumptions, metavariable);
309
311
 
310
312
  return frame;
311
313
  }, context);
@@ -8,8 +8,8 @@ import { instantiateHypothesis } from "../process/instantiate";
8
8
  import { statementFromHypothesisNode } from "../utilities/element";
9
9
 
10
10
  export default define(class Hypothesis extends Element {
11
- constructor(context, string, node, statement) {
12
- super(context, string, node);
11
+ constructor(context, string, node, lineIndex, statement) {
12
+ super(context, string, node, lineIndex);
13
13
 
14
14
  this.statement = statement;
15
15
  }
@@ -91,8 +91,10 @@ export default define(class Hypothesis extends Element {
91
91
 
92
92
  toJSON() {
93
93
  const string = this.getString(),
94
+ lineIndex = this.getLineIndex(),
94
95
  json = {
95
- string
96
+ string,
97
+ lineIndex
96
98
  };
97
99
 
98
100
  return json;
@@ -102,14 +104,14 @@ export default define(class Hypothesis extends Element {
102
104
 
103
105
  static fromJSON(json, context) {
104
106
  return instantiate((context) => {
105
- const { string } = json,
107
+ const { string, lineIndex } = json,
106
108
  hypothesisNode = instantiateHypothesis(string, context),
107
109
  node = hypothesisNode, ///
108
110
  statement = statementFromHypothesisNode(hypothesisNode, context);
109
111
 
110
112
  context = null;
111
113
 
112
- const hypothesis = new Hypothesis(context, string, node, statement);
114
+ const hypothesis = new Hypothesis(context, string, node, lineIndex, statement);
113
115
 
114
116
  return hypothesis;
115
117
  }, context);
@@ -9,8 +9,8 @@ import { judgementFromStatementNode } from "../utilities/element";
9
9
  import { judgementAssignmentFromJudgement } from "../process/assign";
10
10
 
11
11
  export default define(class Judgement extends Element {
12
- constructor(context, string, node, frame, assumption) {
13
- super(context, string, node);
12
+ constructor(context, string, node, lineIndex, frame, assumption) {
13
+ super(context, string, node, lineIndex);
14
14
 
15
15
  this.frame = frame;
16
16
  this.assumption = assumption;
@@ -243,8 +243,10 @@ export default define(class Judgement extends Element {
243
243
 
244
244
  toJSON() {
245
245
  const string = this.getString(),
246
+ lineIndex = this.getLineIndex(),
246
247
  json = {
247
- string
248
+ string,
249
+ lineIndex
248
250
  };
249
251
 
250
252
  return json;
@@ -254,7 +256,7 @@ export default define(class Judgement extends Element {
254
256
 
255
257
  static fromJSON(json, context) {
256
258
  return instantiate((context) => {
257
- const { string } = json,
259
+ const { string, lineIndex } = json,
258
260
  judgementNode = instantiateJudgement(string, context),
259
261
  node = judgementNode, ///
260
262
  frame = frameFromJudgementNode(judgementNode, context),
@@ -262,7 +264,7 @@ export default define(class Judgement extends Element {
262
264
 
263
265
  context = null;
264
266
 
265
- const judgement = new Judgement(context, string, node, frame, assumption);
267
+ const judgement = new Judgement(context, string, node, lineIndex, frame, assumption);
266
268
 
267
269
  return judgement;
268
270
  }, context);