occam-verify-cli 1.0.825 → 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.
- package/lib/element/assertion/contained.js +9 -5
- package/lib/element/assertion/property.js +9 -5
- package/lib/element/assertion/satisfies.js +9 -5
- package/lib/element/assertion/subproof.js +9 -5
- package/lib/element/assertion/type.js +9 -9
- package/lib/element/assertion.js +4 -3
- package/lib/element/assumption.js +7 -6
- package/lib/element/combinator.js +8 -7
- package/lib/element/conclusion.js +8 -7
- package/lib/element/constructor.js +7 -6
- package/lib/element/declaration/combinator.js +3 -3
- package/lib/element/declaration/complexType.js +3 -3
- package/lib/element/declaration/constructor.js +3 -3
- package/lib/element/declaration/metavariable.js +3 -3
- package/lib/element/declaration/simpleType.js +3 -3
- package/lib/element/declaration/typePrefix.js +3 -3
- package/lib/element/declaration/variable.js +3 -3
- package/lib/element/deduction.js +8 -7
- package/lib/element/derivation.js +10 -3
- package/lib/element/equality.js +8 -7
- package/lib/element/equivalence.js +10 -3
- package/lib/element/error.js +8 -1
- package/lib/element/frame.js +8 -7
- package/lib/element/hypothesis.js +8 -7
- package/lib/element/judgement.js +8 -7
- package/lib/element/label.js +8 -7
- package/lib/element/metaType.js +7 -6
- package/lib/element/metavariable.js +6 -5
- package/lib/element/parameter.js +8 -7
- package/lib/element/procedureCall.js +8 -7
- package/lib/element/procedureReference.js +8 -7
- package/lib/element/proof.js +10 -3
- package/lib/element/proofAssertion.js +3 -3
- package/lib/element/property.js +7 -6
- package/lib/element/propertyRelation.js +8 -7
- package/lib/element/reference.js +8 -7
- package/lib/element/rule.js +6 -5
- package/lib/element/section.js +10 -3
- package/lib/element/signature.js +7 -6
- package/lib/element/statement.js +6 -5
- package/lib/element/subDerivation.js +10 -3
- package/lib/element/subproof.js +10 -3
- package/lib/element/substitution/frame.js +5 -5
- package/lib/element/substitution/reference.js +5 -5
- package/lib/element/substitution/statement.js +5 -5
- package/lib/element/substitution/term.js +5 -5
- package/lib/element/substitution.js +6 -5
- package/lib/element/term.js +7 -6
- package/lib/element/topLevelAssertion.js +7 -5
- package/lib/element/topLevelMetaAssertion.js +7 -5
- package/lib/element/type.js +9 -8
- package/lib/element/typePrefix.js +8 -7
- package/lib/element/variable.js +7 -6
- package/lib/utilities/element.js +101 -109
- package/package.json +4 -4
- package/src/element/assertion/contained.js +10 -4
- package/src/element/assertion/property.js +10 -4
- package/src/element/assertion/satisfies.js +10 -4
- package/src/element/assertion/subproof.js +10 -4
- package/src/element/assertion/type.js +13 -15
- package/src/element/assertion.js +3 -1
- package/src/element/assumption.js +7 -5
- package/src/element/combinator.js +7 -5
- package/src/element/conclusion.js +7 -5
- package/src/element/constructor.js +6 -4
- package/src/element/declaration/combinator.js +2 -2
- package/src/element/declaration/complexType.js +2 -2
- package/src/element/declaration/constructor.js +2 -2
- package/src/element/declaration/metavariable.js +2 -2
- package/src/element/declaration/simpleType.js +2 -2
- package/src/element/declaration/typePrefix.js +2 -2
- package/src/element/declaration/variable.js +2 -2
- package/src/element/deduction.js +7 -5
- package/src/element/derivation.js +13 -2
- package/src/element/equality.js +7 -5
- package/src/element/equivalence.js +13 -2
- package/src/element/error.js +11 -0
- package/src/element/frame.js +7 -5
- package/src/element/hypothesis.js +7 -5
- package/src/element/judgement.js +7 -5
- package/src/element/label.js +7 -5
- package/src/element/metaType.js +7 -4
- package/src/element/metavariable.js +6 -4
- package/src/element/parameter.js +7 -5
- package/src/element/procedureCall.js +7 -5
- package/src/element/procedureReference.js +7 -5
- package/src/element/proof.js +13 -2
- package/src/element/proofAssertion.js +2 -2
- package/src/element/property.js +6 -4
- package/src/element/propertyRelation.js +7 -5
- package/src/element/reference.js +7 -5
- package/src/element/rule.js +8 -6
- package/src/element/section.js +13 -2
- package/src/element/signature.js +7 -5
- package/src/element/statement.js +5 -3
- package/src/element/subDerivation.js +13 -2
- package/src/element/subproof.js +13 -2
- package/src/element/substitution/frame.js +4 -4
- package/src/element/substitution/reference.js +4 -4
- package/src/element/substitution/statement.js +4 -4
- package/src/element/substitution/term.js +4 -4
- package/src/element/substitution.js +5 -3
- package/src/element/term.js +6 -4
- package/src/element/topLevelAssertion.js +9 -4
- package/src/element/topLevelMetaAssertion.js +9 -4
- package/src/element/type.js +8 -5
- package/src/element/typePrefix.js +7 -5
- package/src/element/variable.js +6 -4
- package/src/utilities/element.js +193 -146
package/src/element/frame.js
CHANGED
|
@@ -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);
|
package/src/element/judgement.js
CHANGED
|
@@ -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);
|
package/src/element/label.js
CHANGED
|
@@ -9,8 +9,8 @@ import { metavariableFromLabelNode } from "../utilities/element";
|
|
|
9
9
|
import { ablate, attempt, serialise, unserialise, instantiate } from "../utilities/context";
|
|
10
10
|
|
|
11
11
|
export default define(class Label extends Element {
|
|
12
|
-
constructor(context, string, node, metavariable) {
|
|
13
|
-
super(context, string, node);
|
|
12
|
+
constructor(context, string, node, lineIndex, metavariable) {
|
|
13
|
+
super(context, string, node, lineIndex);
|
|
14
14
|
|
|
15
15
|
this.metavariable = metavariable;
|
|
16
16
|
}
|
|
@@ -131,9 +131,11 @@ export default define(class Label extends Element {
|
|
|
131
131
|
|
|
132
132
|
return serialise((context) => {
|
|
133
133
|
const string = this.getString(),
|
|
134
|
+
lineIndex = this.getLineIndex(),
|
|
134
135
|
json = {
|
|
135
136
|
context,
|
|
136
|
-
string
|
|
137
|
+
string,
|
|
138
|
+
lineIndex
|
|
137
139
|
};
|
|
138
140
|
|
|
139
141
|
return json;
|
|
@@ -147,12 +149,12 @@ export default define(class Label extends Element {
|
|
|
147
149
|
|
|
148
150
|
unserialise((json, context) => {
|
|
149
151
|
instantiate((context) => {
|
|
150
|
-
const { string } = json,
|
|
152
|
+
const { string, lineIndex } = json,
|
|
151
153
|
labelNode = instantiateLabel(string, context),
|
|
152
154
|
node = labelNode, ///
|
|
153
155
|
metavariable = metavariableFromLabelNode(labelNode, context);
|
|
154
156
|
|
|
155
|
-
label = new Label(context, string, node, metavariable);
|
|
157
|
+
label = new Label(context, string, node, lineIndex, metavariable);
|
|
156
158
|
}, context);
|
|
157
159
|
}, json, context);
|
|
158
160
|
|
package/src/element/metaType.js
CHANGED
|
@@ -5,8 +5,8 @@ import { Element } from "occam-languages";
|
|
|
5
5
|
import { define } from "../elements";
|
|
6
6
|
|
|
7
7
|
export default define(class MetaType extends Element {
|
|
8
|
-
constructor(context, string, node, name) {
|
|
9
|
-
super(context, string, node);
|
|
8
|
+
constructor(context, string, node, lineIndex, name) {
|
|
9
|
+
super(context, string, node, lineIndex);
|
|
10
10
|
|
|
11
11
|
this.name = name;
|
|
12
12
|
}
|
|
@@ -36,8 +36,10 @@ export default define(class MetaType extends Element {
|
|
|
36
36
|
|
|
37
37
|
toJSON() {
|
|
38
38
|
const string = this.getString(),
|
|
39
|
+
lineIndex = this.getLineIndex(),
|
|
39
40
|
json = {
|
|
40
|
-
string
|
|
41
|
+
string,
|
|
42
|
+
lineIndex
|
|
41
43
|
};
|
|
42
44
|
|
|
43
45
|
return json;
|
|
@@ -56,7 +58,8 @@ export default define(class MetaType extends Element {
|
|
|
56
58
|
static fromName(name, context) {
|
|
57
59
|
const string = name, ///
|
|
58
60
|
node = null,
|
|
59
|
-
|
|
61
|
+
lineIndex = null,
|
|
62
|
+
metaType = new MetaType(context, string, node, lineIndex, name);
|
|
60
63
|
|
|
61
64
|
return metaType;
|
|
62
65
|
}
|
|
@@ -13,8 +13,8 @@ import { unifyMetavariable, unifyMetavariableIntrinsically } from "../process/un
|
|
|
13
13
|
import { nameFromMetavariableNode, termFromMetavariableNode, typeFromMetavariableNode, metavariableFromStatementNode } from "../utilities/element";
|
|
14
14
|
|
|
15
15
|
export default define(class Metavariable extends Element {
|
|
16
|
-
constructor(context, string, node, name, term, type, metaType) {
|
|
17
|
-
super(context, string, node);
|
|
16
|
+
constructor(context, string, node, lineIndex, name, term, type, metaType) {
|
|
17
|
+
super(context, string, node, lineIndex);
|
|
18
18
|
|
|
19
19
|
this.name = name;
|
|
20
20
|
this.term = term;
|
|
@@ -638,8 +638,10 @@ export default define(class Metavariable extends Element {
|
|
|
638
638
|
const metaTypeJSON = metaTypeToMetaTypeJSON(this.metaType),
|
|
639
639
|
metaType = metaTypeJSON, ///
|
|
640
640
|
string = this.getString(), ///
|
|
641
|
+
lineIndex = this.getLineIndex(),
|
|
641
642
|
json = {
|
|
642
643
|
string,
|
|
644
|
+
lineIndex,
|
|
643
645
|
metaType
|
|
644
646
|
};
|
|
645
647
|
|
|
@@ -650,14 +652,14 @@ export default define(class Metavariable extends Element {
|
|
|
650
652
|
|
|
651
653
|
static fromJSON(json, context) {
|
|
652
654
|
return instantiate((context) => {
|
|
653
|
-
const { string } = json,
|
|
655
|
+
const { string, lineIndex } = json,
|
|
654
656
|
metavariableNode = instantiateMetavariable(string, context),
|
|
655
657
|
node = metavariableNode, ///
|
|
656
658
|
name = nameFromMetavariableNode(metavariableNode, context),
|
|
657
659
|
term = termFromMetavariableNode(metavariableNode, context),
|
|
658
660
|
type = typeFromMetavariableNode(metavariableNode, context),
|
|
659
661
|
metaType = metaTypeFromJSON(json, context),
|
|
660
|
-
metavariable = new Metavariable(context, string, node, name, term, type, metaType);
|
|
662
|
+
metavariable = new Metavariable(context, string, node, lineIndex, name, term, type, metaType);
|
|
661
663
|
|
|
662
664
|
return metavariable;
|
|
663
665
|
}, context);
|
package/src/element/parameter.js
CHANGED
|
@@ -8,8 +8,8 @@ import { instantiateParameter } from "../process/instantiate";
|
|
|
8
8
|
import { nameFromParaneterNode, identifierFromParameterNode } from "../utilities/element";
|
|
9
9
|
|
|
10
10
|
export default define(class Parameter extends Element {
|
|
11
|
-
constructor(context, string, node, name, identifier) {
|
|
12
|
-
super(context, string, node,
|
|
11
|
+
constructor(context, string, node, lineIndex, name, identifier) {
|
|
12
|
+
super(context, string, node, lineIndex);
|
|
13
13
|
|
|
14
14
|
this.name = name;
|
|
15
15
|
this.identifier = identifier;
|
|
@@ -51,8 +51,10 @@ export default define(class Parameter extends Element {
|
|
|
51
51
|
|
|
52
52
|
toJSON() {
|
|
53
53
|
const string = this.getString(),
|
|
54
|
+
lineIndex = this.getLineIndex(),
|
|
54
55
|
json = {
|
|
55
|
-
string
|
|
56
|
+
string,
|
|
57
|
+
lineIndex
|
|
56
58
|
};
|
|
57
59
|
|
|
58
60
|
return json;
|
|
@@ -62,7 +64,7 @@ export default define(class Parameter extends Element {
|
|
|
62
64
|
|
|
63
65
|
static fromJSON(json, context) {
|
|
64
66
|
return instantiate((context) => {
|
|
65
|
-
const { string } = json,
|
|
67
|
+
const { string, lineIndex } = json,
|
|
66
68
|
parameterNode = instantiateParameter(string, context),
|
|
67
69
|
node = parameterNode, ///
|
|
68
70
|
name = nameFromParaneterNode(parameterNode, context),
|
|
@@ -70,7 +72,7 @@ export default define(class Parameter extends Element {
|
|
|
70
72
|
|
|
71
73
|
context = null;
|
|
72
74
|
|
|
73
|
-
const parameter = new Parameter(context, string, node, name, identifier);
|
|
75
|
+
const parameter = new Parameter(context, string, node, lineIndex, name, identifier);
|
|
74
76
|
|
|
75
77
|
return parameter;
|
|
76
78
|
}, context);
|
|
@@ -11,8 +11,8 @@ import { parametersFromProcedureCallNode, procedureReferenceFromProcedureCallNod
|
|
|
11
11
|
const { termsFromPrimitives } = termsUtilities;
|
|
12
12
|
|
|
13
13
|
export default define(class ProcedureCall extends Element {
|
|
14
|
-
constructor(context, string, node, parameters, procedureReference) {
|
|
15
|
-
super(context, string, node);
|
|
14
|
+
constructor(context, string, node, lineIndex, parameters, procedureReference) {
|
|
15
|
+
super(context, string, node, lineIndex);
|
|
16
16
|
|
|
17
17
|
this.parameters = parameters;
|
|
18
18
|
this.procedureReference = procedureReference;
|
|
@@ -120,8 +120,10 @@ export default define(class ProcedureCall extends Element {
|
|
|
120
120
|
|
|
121
121
|
toJSON() {
|
|
122
122
|
const string = this.getString(),
|
|
123
|
+
lineIndex = this.getLineIndex(),
|
|
123
124
|
json = {
|
|
124
|
-
string
|
|
125
|
+
string,
|
|
126
|
+
lineIndex
|
|
125
127
|
};
|
|
126
128
|
|
|
127
129
|
return json;
|
|
@@ -131,7 +133,7 @@ export default define(class ProcedureCall extends Element {
|
|
|
131
133
|
|
|
132
134
|
static fromJSON(json, context) {
|
|
133
135
|
return instantiate((context) => {
|
|
134
|
-
const { string } = json,
|
|
136
|
+
const { string, lineIndex } = json,
|
|
135
137
|
procedureCallNode = instantiateProcedureCall(string, context),
|
|
136
138
|
node = procedureCallNode, ///
|
|
137
139
|
parameters = parametersFromProcedureCallNode(json, context),
|
|
@@ -139,7 +141,7 @@ export default define(class ProcedureCall extends Element {
|
|
|
139
141
|
|
|
140
142
|
context = null;
|
|
141
143
|
|
|
142
|
-
const procedureCall = new ProcedureCall(context, string, node, parameters, procedureReference);
|
|
144
|
+
const procedureCall = new ProcedureCall(context, string, node, lineIndex, parameters, procedureReference);
|
|
143
145
|
|
|
144
146
|
return procedureCall;
|
|
145
147
|
}, context);
|
|
@@ -8,8 +8,8 @@ import { instantiateProcedureReference } from "../process/instantiate";
|
|
|
8
8
|
import { nameFromProcedureReferenceNode } from "../utilities/element";
|
|
9
9
|
|
|
10
10
|
export default define(class ProcedureReference extends Element {
|
|
11
|
-
constructor(context, string, node, name) {
|
|
12
|
-
super(context, string, node);
|
|
11
|
+
constructor(context, string, node, lineIndex, name) {
|
|
12
|
+
super(context, string, node, lineIndex);
|
|
13
13
|
|
|
14
14
|
this.name = name;
|
|
15
15
|
}
|
|
@@ -33,8 +33,10 @@ export default define(class ProcedureReference extends Element {
|
|
|
33
33
|
|
|
34
34
|
toJSON() {
|
|
35
35
|
const string = this.getString(),
|
|
36
|
+
lineIndex = this.getLineIndex(),
|
|
36
37
|
json = {
|
|
37
|
-
string
|
|
38
|
+
string,
|
|
39
|
+
lineIndex
|
|
38
40
|
};
|
|
39
41
|
|
|
40
42
|
return json;
|
|
@@ -44,14 +46,14 @@ export default define(class ProcedureReference extends Element {
|
|
|
44
46
|
|
|
45
47
|
static fromJSON(json, context) {
|
|
46
48
|
return instantiate((context) => {
|
|
47
|
-
const { string } = json,
|
|
49
|
+
const { string, lineIndex } = json,
|
|
48
50
|
procedureReferenceNode = instantiateProcedureReference(string, context),
|
|
49
51
|
node = procedureReferenceNode, ///
|
|
50
52
|
name = nameFromProcedureReferenceNode(procedureReferenceNode, context);
|
|
51
53
|
|
|
52
54
|
context = null;
|
|
53
55
|
|
|
54
|
-
const procedureReference = new ProcedureReference(context, string, node, name);
|
|
56
|
+
const procedureReference = new ProcedureReference(context, string, node, lineIndex, name);
|
|
55
57
|
|
|
56
58
|
return procedureReference;
|
|
57
59
|
}, context);
|
package/src/element/proof.js
CHANGED
|
@@ -6,8 +6,8 @@ import { define } from "../elements";
|
|
|
6
6
|
import { enclose } from "../utilities/context";
|
|
7
7
|
|
|
8
8
|
export default define(class Proof extends Element {
|
|
9
|
-
constructor(context, string, node, derivation) {
|
|
10
|
-
super(context, string, node);
|
|
9
|
+
constructor(context, string, node, lineIndex, derivation) {
|
|
10
|
+
super(context, string, node, lineIndex);
|
|
11
11
|
|
|
12
12
|
this.derivation = derivation;
|
|
13
13
|
}
|
|
@@ -57,5 +57,16 @@ export default define(class Proof extends Element {
|
|
|
57
57
|
return verifies;
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
toJSON() {
|
|
61
|
+
const string = this.getString(),
|
|
62
|
+
lineIndex = this.getLineIndex(),
|
|
63
|
+
json = {
|
|
64
|
+
string,
|
|
65
|
+
lineIndex
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
return json;
|
|
69
|
+
}
|
|
70
|
+
|
|
60
71
|
static name = "Proof";
|
|
61
72
|
});
|
|
@@ -5,8 +5,8 @@ import { Element } from "occam-languages";
|
|
|
5
5
|
import { equateStatements } from "../process/equate";
|
|
6
6
|
|
|
7
7
|
export default class ProofAssertion extends Element {
|
|
8
|
-
constructor(context, string, node, statement) {
|
|
9
|
-
super(context, string, node);
|
|
8
|
+
constructor(context, string, node, lineIndex, statement) {
|
|
9
|
+
super(context, string, node, lineIndex);
|
|
10
10
|
|
|
11
11
|
this.statement = statement;
|
|
12
12
|
}
|
package/src/element/property.js
CHANGED
|
@@ -9,8 +9,8 @@ import { nameFromPropertyNode } from "../utilities/element";
|
|
|
9
9
|
import { nominalTypeNameFromJSON, nominalTypeNameToNominalTypeNameJSON } from "../utilities/json";
|
|
10
10
|
|
|
11
11
|
export default define(class Property extends Element {
|
|
12
|
-
constructor(context, string, node, name, nominalTypeName) {
|
|
13
|
-
super(context, string, node);
|
|
12
|
+
constructor(context, string, node, lineIndex, name, nominalTypeName) {
|
|
13
|
+
super(context, string, node, lineIndex);
|
|
14
14
|
|
|
15
15
|
this.name = name;
|
|
16
16
|
this.nominalTypeName = nominalTypeName;
|
|
@@ -47,8 +47,10 @@ export default define(class Property extends Element {
|
|
|
47
47
|
const nominalTypeNameJSON = nominalTypeNameToNominalTypeNameJSON(this.nominalTypeName),
|
|
48
48
|
nominalTypeName = nominalTypeNameJSON, ///
|
|
49
49
|
string = this.getString(),
|
|
50
|
+
lineIndex = this.getLineIndex(),
|
|
50
51
|
json = {
|
|
51
52
|
string,
|
|
53
|
+
lineIndex,
|
|
52
54
|
nominalTypeName
|
|
53
55
|
};
|
|
54
56
|
|
|
@@ -59,7 +61,7 @@ export default define(class Property extends Element {
|
|
|
59
61
|
|
|
60
62
|
static fromJSON(json, context) {
|
|
61
63
|
return instantiate((context) => {
|
|
62
|
-
const { string } = json,
|
|
64
|
+
const { string, lineIndex } = json,
|
|
63
65
|
propertyNode = instantiateProperty(string, context),
|
|
64
66
|
node = propertyNode, ///
|
|
65
67
|
name = nameFromPropertyNode(propertyNode, context),
|
|
@@ -67,7 +69,7 @@ export default define(class Property extends Element {
|
|
|
67
69
|
|
|
68
70
|
context = null;
|
|
69
71
|
|
|
70
|
-
const property = new Property(context, string, node, name, nominalTypeName);
|
|
72
|
+
const property = new Property(context, string, node, lineIndex, name, nominalTypeName);
|
|
71
73
|
|
|
72
74
|
return property;
|
|
73
75
|
}, context);
|
|
@@ -8,8 +8,8 @@ import { instantiatePropertyRelation } from "../process/instantiate";
|
|
|
8
8
|
import { propertyFromPropertyRelationNode } from "../utilities/element";
|
|
9
9
|
|
|
10
10
|
export default define(class PropertyRelation extends Element {
|
|
11
|
-
constructor(context, string, node, term, property) {
|
|
12
|
-
super(context, string, node);
|
|
11
|
+
constructor(context, string, node, lineIndex, term, property) {
|
|
12
|
+
super(context, string, node, lineIndex);
|
|
13
13
|
|
|
14
14
|
this.term = term;
|
|
15
15
|
this.property = property;
|
|
@@ -116,8 +116,10 @@ export default define(class PropertyRelation extends Element {
|
|
|
116
116
|
|
|
117
117
|
toJSON() {
|
|
118
118
|
const string = this.getString(),
|
|
119
|
+
lineIndex = this.getLineIndex(),
|
|
119
120
|
json = {
|
|
120
|
-
string
|
|
121
|
+
string,
|
|
122
|
+
lineIndex
|
|
121
123
|
};
|
|
122
124
|
|
|
123
125
|
return json;
|
|
@@ -125,7 +127,7 @@ export default define(class PropertyRelation extends Element {
|
|
|
125
127
|
|
|
126
128
|
static fromJSON(json, context) {
|
|
127
129
|
return instantiate((context) => {
|
|
128
|
-
const { string } = json,
|
|
130
|
+
const { string, lineIndex } = json,
|
|
129
131
|
propertyRelationNode = instantiatePropertyRelation(string, context),
|
|
130
132
|
node = propertyRelationNode, ///
|
|
131
133
|
term = termFromPropertyRelationNode(propertyRelationNode, context),
|
|
@@ -133,7 +135,7 @@ export default define(class PropertyRelation extends Element {
|
|
|
133
135
|
|
|
134
136
|
context = null;
|
|
135
137
|
|
|
136
|
-
const propertyRelation = new PropertyRelation(context, string, node, term, property);
|
|
138
|
+
const propertyRelation = new PropertyRelation(context, string, node, lineIndex, term, property);
|
|
137
139
|
|
|
138
140
|
return propertyRelation;
|
|
139
141
|
}, context);
|
package/src/element/reference.js
CHANGED
|
@@ -10,8 +10,8 @@ import { ablate, attempt, serialise, reconcile, unserialise, instantiate } from
|
|
|
10
10
|
import { metavariableFromReferenceNode, topLevelMetaAssertionFromReferenceNode } from "../utilities/element";
|
|
11
11
|
|
|
12
12
|
export default define(class Reference extends Element {
|
|
13
|
-
constructor(context, string, node, metavariable, topLevelMetaAssertion) {
|
|
14
|
-
super(context, string, node);
|
|
13
|
+
constructor(context, string, node, lineIndex, metavariable, topLevelMetaAssertion) {
|
|
14
|
+
super(context, string, node, lineIndex);
|
|
15
15
|
|
|
16
16
|
this.metavariable = metavariable;
|
|
17
17
|
this.topLevelMetaAssertion = topLevelMetaAssertion;
|
|
@@ -318,9 +318,11 @@ export default define(class Reference extends Element {
|
|
|
318
318
|
|
|
319
319
|
return serialise((context) => {
|
|
320
320
|
const string = this.getString(),
|
|
321
|
+
lineIndex = this.getLineIndex(),
|
|
321
322
|
json = {
|
|
322
323
|
context,
|
|
323
|
-
string
|
|
324
|
+
string,
|
|
325
|
+
lineIndex
|
|
324
326
|
};
|
|
325
327
|
|
|
326
328
|
return json;
|
|
@@ -334,13 +336,13 @@ export default define(class Reference extends Element {
|
|
|
334
336
|
|
|
335
337
|
unserialise((json, context) => {
|
|
336
338
|
instantiate((context) => {
|
|
337
|
-
const { string } = json,
|
|
339
|
+
const { string, lineIndex } = json,
|
|
338
340
|
referenceNode = instantiateReference(string, context),
|
|
339
341
|
node = referenceNode, ///
|
|
340
342
|
metavariable = metavariableFromReferenceNode(referenceNode, context),
|
|
341
343
|
topLevelMetaAssertion = topLevelMetaAssertionFromReferenceNode(referenceNode, context);
|
|
342
344
|
|
|
343
|
-
reference = new Reference(context, string, node, metavariable, topLevelMetaAssertion);
|
|
345
|
+
reference = new Reference(context, string, node, lineIndex, metavariable, topLevelMetaAssertion);
|
|
344
346
|
}, context);
|
|
345
347
|
}, json, context);
|
|
346
348
|
|
package/src/element/rule.js
CHANGED
|
@@ -11,8 +11,8 @@ const { reverse } = arrayUtilities,
|
|
|
11
11
|
{ asyncExtract, asyncForwardsEvery, asyncBackwardsEvery } = asynchronousUtilities;
|
|
12
12
|
|
|
13
13
|
export default define(class Rule extends Element {
|
|
14
|
-
constructor(context, string, node, proof, labels, premises, conclusion) {
|
|
15
|
-
super(context, string, node);
|
|
14
|
+
constructor(context, string, node, lineIndex, proof, labels, premises, conclusion) {
|
|
15
|
+
super(context, string, node, lineIndex);
|
|
16
16
|
|
|
17
17
|
this.proof = proof;
|
|
18
18
|
this.labels = labels;
|
|
@@ -320,12 +320,14 @@ export default define(class Rule extends Element {
|
|
|
320
320
|
const labelsJSON = labelsToLabelsJSON(this.labels),
|
|
321
321
|
premisesJSON = premisesToPremisesJSON(this.premises),
|
|
322
322
|
conclusionJSON = conclusionToConclusionJSON(this.conclusion),
|
|
323
|
+
string = this.getString(),
|
|
324
|
+
lineIndex = this.getLineIndex(),
|
|
323
325
|
labels = labelsJSON, ///
|
|
324
326
|
premises = premisesJSON, ///
|
|
325
327
|
conclusion = conclusionJSON, ///
|
|
326
|
-
string = this.getString(),
|
|
327
328
|
json = {
|
|
328
329
|
string,
|
|
330
|
+
lineIndex,
|
|
329
331
|
labels,
|
|
330
332
|
premises,
|
|
331
333
|
conclusion
|
|
@@ -337,13 +339,13 @@ export default define(class Rule extends Element {
|
|
|
337
339
|
static name = "Rule";
|
|
338
340
|
|
|
339
341
|
static fromJSON(json, context) {
|
|
340
|
-
const
|
|
342
|
+
const { string, lineIndex } = json,
|
|
343
|
+
node = null,
|
|
341
344
|
proof = null,
|
|
342
|
-
string = null,
|
|
343
345
|
labels = labelsFromJSON(json, context),
|
|
344
346
|
premises = premisesFromJSON(json, context),
|
|
345
347
|
conclusion = conclusionFromJSON(json, context),
|
|
346
|
-
rule = new Rule(context, string, node, proof, labels, premises, conclusion);
|
|
348
|
+
rule = new Rule(context, string, node, lineIndex, proof, labels, premises, conclusion);
|
|
347
349
|
|
|
348
350
|
return rule;
|
|
349
351
|
}
|
package/src/element/section.js
CHANGED
|
@@ -5,8 +5,8 @@ import { Element } from "occam-languages";
|
|
|
5
5
|
import { define } from "../elements";
|
|
6
6
|
|
|
7
7
|
export default define(class Section extends Element {
|
|
8
|
-
constructor(context, string, node, hypotheses, axiom, lemma, theorem, conjecture) {
|
|
9
|
-
super(context, string, node);
|
|
8
|
+
constructor(context, string, node, lineIndex, hypotheses, axiom, lemma, theorem, conjecture) {
|
|
9
|
+
super(context, string, node, lineIndex);
|
|
10
10
|
|
|
11
11
|
this.hypotheses = hypotheses;
|
|
12
12
|
this.axiom = axiom;
|
|
@@ -82,5 +82,16 @@ export default define(class Section extends Element {
|
|
|
82
82
|
return hypothesesVerify;
|
|
83
83
|
}
|
|
84
84
|
|
|
85
|
+
toJSON() {
|
|
86
|
+
const string = this.getString(),
|
|
87
|
+
lineIndex = this.getLineIndex(),
|
|
88
|
+
json = {
|
|
89
|
+
string,
|
|
90
|
+
lineIndex
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
return json;
|
|
94
|
+
}
|
|
95
|
+
|
|
85
96
|
static name = "Section";
|
|
86
97
|
});
|
package/src/element/signature.js
CHANGED
|
@@ -13,8 +13,8 @@ import { termsFromSignatureNode } from "../utilities/element";
|
|
|
13
13
|
const { match, compare, correlate } = arrayUtilities;
|
|
14
14
|
|
|
15
15
|
export default define(class Signature extends Element {
|
|
16
|
-
constructor(context, string, node, terms) {
|
|
17
|
-
super(context, string, node);
|
|
16
|
+
constructor(context, string, node, lineIndex, terms) {
|
|
17
|
+
super(context, string, node, lineIndex);
|
|
18
18
|
|
|
19
19
|
this.terms = terms;
|
|
20
20
|
}
|
|
@@ -218,8 +218,10 @@ export default define(class Signature extends Element {
|
|
|
218
218
|
|
|
219
219
|
toJSON() {
|
|
220
220
|
const string = this.getString(),
|
|
221
|
+
lineIndex = this.getLineIndex(),
|
|
221
222
|
json = {
|
|
222
|
-
string
|
|
223
|
+
string,
|
|
224
|
+
lineIndex
|
|
223
225
|
};
|
|
224
226
|
|
|
225
227
|
return json;
|
|
@@ -229,11 +231,11 @@ export default define(class Signature extends Element {
|
|
|
229
231
|
|
|
230
232
|
static fromJSON(json, context) {
|
|
231
233
|
return instantiate((context) => {
|
|
232
|
-
const { string } = json,
|
|
234
|
+
const { string, lineIndex } = json,
|
|
233
235
|
signatureNode = instantiateSignature(string, context),
|
|
234
236
|
node = signatureNode, ///
|
|
235
237
|
terms = termsFromSignatureNode(signatureNode, context),
|
|
236
|
-
signature = new Signature(context, string, node, terms);
|
|
238
|
+
signature = new Signature(context, string, node, lineIndex, terms);
|
|
237
239
|
|
|
238
240
|
return signature;
|
|
239
241
|
}, context);
|
package/src/element/statement.js
CHANGED
|
@@ -372,8 +372,10 @@ export default define(class Statement extends Element {
|
|
|
372
372
|
|
|
373
373
|
toJSON() {
|
|
374
374
|
const string = this.getString(),
|
|
375
|
+
lineIndex = this.getLineIndex(),
|
|
375
376
|
json = {
|
|
376
|
-
string
|
|
377
|
+
string,
|
|
378
|
+
lineIndex
|
|
377
379
|
};
|
|
378
380
|
|
|
379
381
|
return json;
|
|
@@ -383,13 +385,13 @@ export default define(class Statement extends Element {
|
|
|
383
385
|
|
|
384
386
|
static fromJSON(json, context) {
|
|
385
387
|
return instantiate((context) => {
|
|
386
|
-
const { string } = json,
|
|
388
|
+
const { string, lineIndex } = json,
|
|
387
389
|
statementNode = instantiateStatement(string, context),
|
|
388
390
|
node = statementNode; ///
|
|
389
391
|
|
|
390
392
|
context = null;
|
|
391
393
|
|
|
392
|
-
const statement = new Statement(context, string, node);
|
|
394
|
+
const statement = new Statement(context, string, node, lineIndex);
|
|
393
395
|
|
|
394
396
|
return statement;
|
|
395
397
|
}, context);
|