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.
- 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 +7 -8
- package/lib/element/declaration/complexType.js +25 -26
- package/lib/element/declaration/constructor.js +10 -11
- package/lib/element/declaration/metavariable.js +10 -11
- package/lib/element/declaration/simpleType.js +19 -20
- package/lib/element/declaration/typePrefix.js +7 -8
- package/lib/element/declaration/variable.js +10 -11
- 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 +10 -3
- 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/premise.js +5 -5
- package/lib/element/proofAssertion/step.js +3 -3
- package/lib/element/proofAssertion/supposition.js +5 -5
- 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 +13 -13
- package/lib/element/section.js +12 -5
- 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/axiom.js +3 -4
- package/lib/element/topLevelAssertion/conjecture.js +3 -4
- package/lib/element/topLevelAssertion/lemma.js +3 -4
- package/lib/element/topLevelAssertion/theorem.js +3 -4
- package/lib/element/topLevelAssertion.js +9 -7
- package/lib/element/topLevelMetaAssertion/metaLemma.js +3 -4
- package/lib/element/topLevelMetaAssertion/metatheorem.js +3 -4
- package/lib/element/topLevelMetaAssertion.js +12 -10
- package/lib/element/type.js +9 -8
- package/lib/element/typePrefix.js +8 -7
- package/lib/element/variable.js +7 -6
- package/lib/process/verify.js +17 -17
- package/lib/utilities/element.js +127 -93
- 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 +6 -9
- package/src/element/declaration/complexType.js +24 -33
- package/src/element/declaration/constructor.js +9 -13
- package/src/element/declaration/metavariable.js +9 -13
- package/src/element/declaration/simpleType.js +19 -26
- package/src/element/declaration/typePrefix.js +6 -9
- package/src/element/declaration/variable.js +9 -13
- 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 +13 -3
- 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/premise.js +4 -4
- package/src/element/proofAssertion/step.js +2 -2
- package/src/element/proofAssertion/supposition.js +4 -4
- 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 +15 -17
- package/src/element/section.js +15 -5
- 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/axiom.js +2 -4
- package/src/element/topLevelAssertion/conjecture.js +2 -4
- package/src/element/topLevelAssertion/lemma.js +2 -4
- package/src/element/topLevelAssertion/theorem.js +2 -4
- package/src/element/topLevelAssertion.js +11 -7
- package/src/element/topLevelMetaAssertion/metaLemma.js +2 -4
- package/src/element/topLevelMetaAssertion/metatheorem.js +2 -4
- package/src/element/topLevelMetaAssertion.js +14 -11
- package/src/element/type.js +8 -5
- package/src/element/typePrefix.js +7 -5
- package/src/element/variable.js +6 -4
- package/src/process/verify.js +16 -16
- package/src/utilities/element.js +194 -84
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
|
});
|
|
@@ -8,8 +8,8 @@ import { procedureCallFromPremiseNode } from "../../utilities/element";
|
|
|
8
8
|
import { join, declare, attempt, reconcile, serialise, unserialise, instantiate } from "../../utilities/context";
|
|
9
9
|
|
|
10
10
|
export default define(class Premise extends ProofAssertion {
|
|
11
|
-
constructor(context, string, node, statement, procedureCall) {
|
|
12
|
-
super(context, string, node, statement);
|
|
11
|
+
constructor(context, string, node, lineIndex, statement, procedureCall) {
|
|
12
|
+
super(context, string, node, lineIndex, statement);
|
|
13
13
|
|
|
14
14
|
this.procedureCall = procedureCall;
|
|
15
15
|
}
|
|
@@ -305,13 +305,13 @@ export default define(class Premise extends ProofAssertion {
|
|
|
305
305
|
|
|
306
306
|
unserialise((json, context) => {
|
|
307
307
|
instantiate((context) => {
|
|
308
|
-
const { string } = json,
|
|
308
|
+
const { string, lineIndex } = json,
|
|
309
309
|
premiseNode = instantiatePremise(string, context),
|
|
310
310
|
node = premiseNode, ///
|
|
311
311
|
statement = statementFromPremiseNode(premiseNode, context),
|
|
312
312
|
procedureCall = procedureCallFromPremiseNode(premiseNode, context);
|
|
313
313
|
|
|
314
|
-
premise = new Premise(context, string, node, statement, procedureCall);
|
|
314
|
+
premise = new Premise(context, string, node, lineIndex, statement, procedureCall);
|
|
315
315
|
}, context);
|
|
316
316
|
}, json, context);
|
|
317
317
|
|
|
@@ -14,8 +14,8 @@ const { asyncSome } = asynchronousUtilities,
|
|
|
14
14
|
{ backwardsSome } = arrayUtilities;
|
|
15
15
|
|
|
16
16
|
export default define(class Step extends ProofAssertion {
|
|
17
|
-
constructor(context, string, node, statement, reference, satisfiesAssertion) {
|
|
18
|
-
super(context, string, node, statement);
|
|
17
|
+
constructor(context, string, node, lineIndex, statement, reference, satisfiesAssertion) {
|
|
18
|
+
super(context, string, node, lineIndex, statement);
|
|
19
19
|
|
|
20
20
|
this.reference = reference;
|
|
21
21
|
this.satisfiesAssertion = satisfiesAssertion;
|
|
@@ -8,8 +8,8 @@ import { procedureCallFromSuppositionNode } from "../../utilities/element";
|
|
|
8
8
|
import { join, declare, attempt, reconcile, serialise, unserialise, instantiate } from "../../utilities/context";
|
|
9
9
|
|
|
10
10
|
export default define(class Supposition extends ProofAssertion {
|
|
11
|
-
constructor(context, string, node, statement, procedureCall) {
|
|
12
|
-
super(context, string, node, statement);
|
|
11
|
+
constructor(context, string, node, lineIndex, statement, procedureCall) {
|
|
12
|
+
super(context, string, node, lineIndex, statement);
|
|
13
13
|
|
|
14
14
|
this.procedureCall = procedureCall;
|
|
15
15
|
}
|
|
@@ -327,13 +327,13 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
327
327
|
|
|
328
328
|
unserialise((json, context) => {
|
|
329
329
|
instantiate((context) => {
|
|
330
|
-
const { string } = json,
|
|
330
|
+
const { string, lineIndex } = json,
|
|
331
331
|
suppositionNode = instantiateSupposition(string, context),
|
|
332
332
|
node = suppositionNode, ///
|
|
333
333
|
statement = statementFromSuppositionNode(suppositionNode, context),
|
|
334
334
|
procedureCall = procedureCallFromSuppositionNode(suppositionNode, context);
|
|
335
335
|
|
|
336
|
-
supposition = new Supposition(context, string, node, statement, procedureCall);
|
|
336
|
+
supposition = new Supposition(context, string, node, lineIndex, statement, procedureCall);
|
|
337
337
|
}, context);
|
|
338
338
|
}, json, context);
|
|
339
339
|
|
|
@@ -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;
|
|
@@ -55,11 +55,9 @@ export default define(class Rule extends Element {
|
|
|
55
55
|
return metavariableNodeMatches;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
async verify() {
|
|
58
|
+
async verify(context) {
|
|
59
59
|
let verifies = false;
|
|
60
60
|
|
|
61
|
-
const context = this.getContext();
|
|
62
|
-
|
|
63
61
|
await this.break(context);
|
|
64
62
|
|
|
65
63
|
const ruleString = this.getString(); ///
|
|
@@ -67,7 +65,7 @@ export default define(class Rule extends Element {
|
|
|
67
65
|
context.trace(`Verifying the '${ruleString}' rule...`);
|
|
68
66
|
|
|
69
67
|
await enclose(async (context) => {
|
|
70
|
-
const labelsVerify = this.verifyLabels();
|
|
68
|
+
const labelsVerify = this.verifyLabels(context);
|
|
71
69
|
|
|
72
70
|
if (labelsVerify) {
|
|
73
71
|
const premisesVerify = await this.verifyPremises(context);
|
|
@@ -97,11 +95,10 @@ export default define(class Rule extends Element {
|
|
|
97
95
|
return verifies;
|
|
98
96
|
}
|
|
99
97
|
|
|
100
|
-
verifyLabel(label) {
|
|
98
|
+
verifyLabel(context, label) {
|
|
101
99
|
let labelVerifies;
|
|
102
100
|
|
|
103
|
-
const
|
|
104
|
-
ruleString = this.getString(), ///
|
|
101
|
+
const ruleString = this.getString(), ///
|
|
105
102
|
labelString = label.getString();
|
|
106
103
|
|
|
107
104
|
context.trace(`Verifying the '${ruleString}' rule's '${labelString}' label...`);
|
|
@@ -115,16 +112,15 @@ export default define(class Rule extends Element {
|
|
|
115
112
|
return labelVerifies;
|
|
116
113
|
}
|
|
117
114
|
|
|
118
|
-
verifyLabels() {
|
|
115
|
+
verifyLabels(context) {
|
|
119
116
|
let labelsVerify;
|
|
120
117
|
|
|
121
|
-
const
|
|
122
|
-
ruleString = this.getString(); ///
|
|
118
|
+
const ruleString = this.getString(); ///
|
|
123
119
|
|
|
124
120
|
context.trace(`Verifying the '${ruleString}' rule's labels...`);
|
|
125
121
|
|
|
126
122
|
labelsVerify = this.labels.every((label) => {
|
|
127
|
-
const labelVerifies = this.verifyLabel(label);
|
|
123
|
+
const labelVerifies = this.verifyLabel(context, label);
|
|
128
124
|
|
|
129
125
|
if (labelVerifies) {
|
|
130
126
|
return true;
|
|
@@ -320,12 +316,14 @@ export default define(class Rule extends Element {
|
|
|
320
316
|
const labelsJSON = labelsToLabelsJSON(this.labels),
|
|
321
317
|
premisesJSON = premisesToPremisesJSON(this.premises),
|
|
322
318
|
conclusionJSON = conclusionToConclusionJSON(this.conclusion),
|
|
319
|
+
string = this.getString(),
|
|
320
|
+
lineIndex = this.getLineIndex(),
|
|
323
321
|
labels = labelsJSON, ///
|
|
324
322
|
premises = premisesJSON, ///
|
|
325
323
|
conclusion = conclusionJSON, ///
|
|
326
|
-
string = this.getString(),
|
|
327
324
|
json = {
|
|
328
325
|
string,
|
|
326
|
+
lineIndex,
|
|
329
327
|
labels,
|
|
330
328
|
premises,
|
|
331
329
|
conclusion
|
|
@@ -337,13 +335,13 @@ export default define(class Rule extends Element {
|
|
|
337
335
|
static name = "Rule";
|
|
338
336
|
|
|
339
337
|
static fromJSON(json, context) {
|
|
340
|
-
const
|
|
338
|
+
const { string, lineIndex } = json,
|
|
339
|
+
node = null,
|
|
341
340
|
proof = null,
|
|
342
|
-
string = null,
|
|
343
341
|
labels = labelsFromJSON(json, context),
|
|
344
342
|
premises = premisesFromJSON(json, context),
|
|
345
343
|
conclusion = conclusionFromJSON(json, context),
|
|
346
|
-
rule = new Rule(context, string, node, proof, labels, premises, conclusion);
|
|
344
|
+
rule = new Rule(context, string, node, lineIndex, proof, labels, premises, conclusion);
|
|
347
345
|
|
|
348
346
|
return rule;
|
|
349
347
|
}
|
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;
|
|
@@ -42,11 +42,10 @@ export default define(class Section extends Element {
|
|
|
42
42
|
return sectionNode;
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
async verify() {
|
|
45
|
+
async verify(context) {
|
|
46
46
|
let verifies = false;
|
|
47
47
|
|
|
48
|
-
const
|
|
49
|
-
sectionString = this.getString(); ///
|
|
48
|
+
const sectionString = this.getString(); ///
|
|
50
49
|
|
|
51
50
|
context.trace(`Verifying the '${sectionString}' section...`);
|
|
52
51
|
|
|
@@ -82,5 +81,16 @@ export default define(class Section extends Element {
|
|
|
82
81
|
return hypothesesVerify;
|
|
83
82
|
}
|
|
84
83
|
|
|
84
|
+
toJSON() {
|
|
85
|
+
const string = this.getString(),
|
|
86
|
+
lineIndex = this.getLineIndex(),
|
|
87
|
+
json = {
|
|
88
|
+
string,
|
|
89
|
+
lineIndex
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
return json;
|
|
93
|
+
}
|
|
94
|
+
|
|
85
95
|
static name = "Section";
|
|
86
96
|
});
|
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);
|