occam-verify-cli 1.0.696 → 1.0.703
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/action/verify.js +3 -2
- package/lib/context/ephemeral.js +14 -5
- package/lib/context.js +9 -1
- package/lib/element/assertion/contained.js +6 -9
- package/lib/element/assertion/defined.js +6 -8
- package/lib/element/assertion/property.js +11 -5
- package/lib/element/assertion/satisfies.js +9 -3
- package/lib/element/assertion/subproof.js +4 -5
- package/lib/element/assertion/type.js +12 -7
- package/lib/element/assumption.js +22 -4
- package/lib/element/combinator.js +6 -6
- package/lib/element/conclusion.js +5 -5
- package/lib/element/constructor.js +17 -13
- package/lib/element/declaration/constructor.js +2 -2
- package/lib/element/declaration/simpleType.js +18 -4
- package/lib/element/deduction.js +5 -5
- package/lib/element/equality.js +26 -1
- package/lib/element/frame.js +14 -7
- package/lib/element/hypothesis.js +13 -6
- package/lib/element/judgement.js +69 -3
- package/lib/element/label.js +27 -22
- package/lib/element/metaType.js +1 -1
- package/lib/element/metavariable.js +4 -4
- package/lib/element/parameter.js +7 -7
- package/lib/element/procedureCall.js +7 -7
- package/lib/element/procedureReference.js +7 -6
- package/lib/element/proofAssertion/premise.js +6 -7
- package/lib/element/proofAssertion/supposition.js +6 -7
- package/lib/element/property.js +12 -4
- package/lib/element/propertyRelation.js +28 -6
- package/lib/element/reference.js +10 -6
- package/lib/element/rule.js +26 -16
- package/lib/element/signature.js +59 -19
- package/lib/element/statement.js +4 -2
- package/lib/element/substitution/frame.js +16 -7
- package/lib/element/substitution/reference.js +17 -8
- package/lib/element/substitution/statement.js +17 -8
- package/lib/element/substitution/term.js +17 -8
- package/lib/element/term.js +6 -4
- package/lib/element/topLevelAssertion.js +28 -17
- package/lib/element/topLevelMetaAssertion.js +7 -8
- package/lib/element/type.js +16 -7
- package/lib/element/typePrefix.js +13 -6
- package/lib/element/variable.js +8 -11
- package/lib/process/instantiate.js +81 -11
- package/lib/utilities/element.js +101 -7
- package/lib/utilities/json.js +22 -1
- package/package.json +1 -1
- package/src/action/verify.js +3 -1
- package/src/context/ephemeral.js +19 -4
- package/src/context.js +15 -1
- package/src/element/assertion/contained.js +8 -25
- package/src/element/assertion/defined.js +7 -14
- package/src/element/assertion/property.js +16 -5
- package/src/element/assertion/satisfies.js +14 -3
- package/src/element/assertion/subproof.js +3 -5
- package/src/element/assertion/type.js +16 -8
- package/src/element/assumption.js +37 -3
- package/src/element/combinator.js +6 -13
- package/src/element/conclusion.js +5 -7
- package/src/element/constructor.js +25 -16
- package/src/element/declaration/constructor.js +2 -1
- package/src/element/declaration/simpleType.js +30 -6
- package/src/element/deduction.js +7 -9
- package/src/element/equality.js +43 -0
- package/src/element/frame.js +21 -12
- package/src/element/hypothesis.js +19 -7
- package/src/element/judgement.js +45 -0
- package/src/element/label.js +35 -26
- package/src/element/metaType.js +1 -1
- package/src/element/metavariable.js +3 -6
- package/src/element/parameter.js +9 -12
- package/src/element/procedureCall.js +9 -12
- package/src/element/procedureReference.js +8 -8
- package/src/element/proofAssertion/premise.js +8 -14
- package/src/element/proofAssertion/supposition.js +6 -12
- package/src/element/property.js +20 -6
- package/src/element/propertyRelation.js +43 -6
- package/src/element/reference.js +16 -9
- package/src/element/rule.js +41 -24
- package/src/element/signature.js +87 -22
- package/src/element/statement.js +5 -2
- package/src/element/substitution/frame.js +26 -9
- package/src/element/substitution/reference.js +29 -11
- package/src/element/substitution/statement.js +27 -10
- package/src/element/substitution/term.js +27 -10
- package/src/element/term.js +7 -4
- package/src/element/topLevelAssertion.js +44 -25
- package/src/element/topLevelMetaAssertion.js +7 -8
- package/src/element/type.js +32 -15
- package/src/element/typePrefix.js +19 -7
- package/src/element/variable.js +9 -22
- package/src/process/instantiate.js +64 -10
- package/src/utilities/element.js +105 -10
- package/src/utilities/json.js +19 -1
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
import Assertion from "../assertion";
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
|
+
import { literally } from "../../utilities/context";
|
|
7
|
+
import { instantiateSatisfiesAssertion } from "../../process/instantiate";
|
|
8
|
+
import { signatureFromJSatisfiesAssertionNode, referenceFromJSatisfiesAssertionNode } from "../../utilities/element";
|
|
6
9
|
|
|
7
10
|
export default define(class SatisfiesAssertion extends Assertion {
|
|
8
11
|
constructor(context, string, node, signature, reference) {
|
|
@@ -155,8 +158,6 @@ export default define(class SatisfiesAssertion extends Assertion {
|
|
|
155
158
|
}
|
|
156
159
|
|
|
157
160
|
toJSON() {
|
|
158
|
-
debugger
|
|
159
|
-
|
|
160
161
|
const { name } = this.constructor,
|
|
161
162
|
string = this.getString(),
|
|
162
163
|
json = {
|
|
@@ -175,7 +176,17 @@ export default define(class SatisfiesAssertion extends Assertion {
|
|
|
175
176
|
const { name } = json;
|
|
176
177
|
|
|
177
178
|
if (this.name === name) {
|
|
178
|
-
|
|
179
|
+
literally((context) => {
|
|
180
|
+
const { string } = json,
|
|
181
|
+
definedAssertionNode = instantiateSatisfiesAssertion(string, context),
|
|
182
|
+
node = definedAssertionNode, ///
|
|
183
|
+
signature = signatureFromJSatisfiesAssertionNode(definedAssertionNode, context),
|
|
184
|
+
reference = referenceFromJSatisfiesAssertionNode(definedAssertionNode, context);
|
|
185
|
+
|
|
186
|
+
context = null;
|
|
187
|
+
|
|
188
|
+
satisfiesAssertion = new SatisfiesAssertion(context, string, node, signature, reference);
|
|
189
|
+
}, context);
|
|
179
190
|
}
|
|
180
191
|
|
|
181
192
|
return satisfiesAssertion;
|
|
@@ -7,7 +7,6 @@ import Assertion from "../assertion";
|
|
|
7
7
|
import { define } from "../../elements";
|
|
8
8
|
import { literally } from "../../utilities/context";
|
|
9
9
|
import { unifyStatement } from "../../process/unify";
|
|
10
|
-
import { statementsToStatementsJSON } from "../../utilities/json";
|
|
11
10
|
import { instantiateSubproofAssertion } from "../../process/instantiate";
|
|
12
11
|
|
|
13
12
|
const { match } = arrayUtilities;
|
|
@@ -116,13 +115,10 @@ export default define(class SubproofAssertion extends Assertion {
|
|
|
116
115
|
|
|
117
116
|
toJSON() {
|
|
118
117
|
const { name } = this.constructor,
|
|
119
|
-
statementJSON = statementsToStatementsJSON(this.statements),
|
|
120
|
-
statements = statementJSON, ///
|
|
121
118
|
string = this.getString(),
|
|
122
119
|
json = {
|
|
123
120
|
name,
|
|
124
|
-
string
|
|
125
|
-
statements
|
|
121
|
+
string
|
|
126
122
|
};
|
|
127
123
|
|
|
128
124
|
return json;
|
|
@@ -142,6 +138,8 @@ export default define(class SubproofAssertion extends Assertion {
|
|
|
142
138
|
statements = statementsFromSubproofAssertionNode(subproofAssertionNode, context),
|
|
143
139
|
node = subproofAssertionNode; ///
|
|
144
140
|
|
|
141
|
+
context = null;
|
|
142
|
+
|
|
145
143
|
subproorAssertion = new SubproofAssertion(context, string, node, statements);
|
|
146
144
|
}, context);
|
|
147
145
|
}
|
|
@@ -3,8 +3,11 @@
|
|
|
3
3
|
import Assertion from "../assertion";
|
|
4
4
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
|
+
import { literally } from "../../utilities/context";
|
|
7
|
+
import { typeFromJSON } from "../../utilities/json";
|
|
8
|
+
import { termFromTypeAssertionNode } from "../../utilities/element";
|
|
9
|
+
import { instantiateSubproofAssertion } from "../../process/instantiate";
|
|
6
10
|
import { variableAssignmentFromTypeAssertion } from "../../process/assign";
|
|
7
|
-
import {termToTermJSON} from "../../utilities/json";
|
|
8
11
|
|
|
9
12
|
export default define(class TypeAssertion extends Assertion {
|
|
10
13
|
constructor(context, string, node, term, type) {
|
|
@@ -190,18 +193,13 @@ export default define(class TypeAssertion extends Assertion {
|
|
|
190
193
|
}
|
|
191
194
|
|
|
192
195
|
toJSON() {
|
|
193
|
-
debugger
|
|
194
|
-
|
|
195
196
|
const { name } = this.constructor,
|
|
196
|
-
termJSON = termToTermJSON(this.term),
|
|
197
197
|
typeJSON = typeToTypeJSON(this.type),
|
|
198
|
-
term = termJSON, ///
|
|
199
198
|
type = typeJSON, ///
|
|
200
199
|
string = this.getString(),
|
|
201
200
|
json = {
|
|
202
|
-
string,
|
|
203
201
|
name,
|
|
204
|
-
|
|
202
|
+
string,
|
|
205
203
|
type
|
|
206
204
|
};
|
|
207
205
|
|
|
@@ -216,7 +214,17 @@ export default define(class TypeAssertion extends Assertion {
|
|
|
216
214
|
const { name } = json;
|
|
217
215
|
|
|
218
216
|
if (this.name === name) {
|
|
219
|
-
|
|
217
|
+
literally((context) => {
|
|
218
|
+
const { string } = json,
|
|
219
|
+
typeAssertionNode = instantiateSubproofAssertion(string, context),
|
|
220
|
+
term = termFromTypeAssertionNode(typeAssertionNode, context),
|
|
221
|
+
type = typeFromJSON(json, context),
|
|
222
|
+
node = typeAssertionNode; ///
|
|
223
|
+
|
|
224
|
+
context = null;
|
|
225
|
+
|
|
226
|
+
typeAssertion = new TypeAssertion(context, string, node, term, type);
|
|
227
|
+
}, context);
|
|
220
228
|
}
|
|
221
229
|
|
|
222
230
|
return typeAssertion;
|
|
@@ -3,8 +3,9 @@
|
|
|
3
3
|
import { Element } from "occam-languages";
|
|
4
4
|
|
|
5
5
|
import { define } from "../elements";
|
|
6
|
+
import { literally } from "../utilities/context";
|
|
7
|
+
import { instantiateAssumption } from "../process/instantiate";
|
|
6
8
|
import { unifyStatementIntrinsically } from "../process/unify";
|
|
7
|
-
import { referenceFromJSON, referenceToReferenceJSON } from "../utilities/json";
|
|
8
9
|
|
|
9
10
|
export default define(class Assumption extends Element {
|
|
10
11
|
constructor(context, string, node, reference, statement) {
|
|
@@ -319,12 +320,45 @@ export default define(class Assumption extends Element {
|
|
|
319
320
|
}
|
|
320
321
|
|
|
321
322
|
toJSON() {
|
|
322
|
-
|
|
323
|
+
const string = this.getString(),
|
|
324
|
+
json = {
|
|
325
|
+
string
|
|
326
|
+
};
|
|
327
|
+
|
|
328
|
+
return json;
|
|
323
329
|
}
|
|
324
330
|
|
|
325
331
|
static name = "Assumption";
|
|
326
332
|
|
|
327
333
|
static fromJSON(json, context) {
|
|
328
|
-
|
|
334
|
+
const assumption = literally((context) => {
|
|
335
|
+
const { string } = json,
|
|
336
|
+
assumptionNode = instantiateAssumption(string, context),
|
|
337
|
+
node = assumptionNode, ///
|
|
338
|
+
reference = referenceFromAssumptionNode(assumptionNode, context),
|
|
339
|
+
statement = statementFromAssumptionNode(assumptionNode, context);
|
|
340
|
+
|
|
341
|
+
context = null; ///
|
|
342
|
+
|
|
343
|
+
const assumption = new Assumption(context, string, node, reference, statement);
|
|
344
|
+
|
|
345
|
+
return assumption;
|
|
346
|
+
}, context);
|
|
347
|
+
|
|
348
|
+
return assumption;
|
|
329
349
|
}
|
|
330
350
|
});
|
|
351
|
+
|
|
352
|
+
function referenceFromAssumptionNode(assumptionNode, context) {
|
|
353
|
+
const metavariableNode = assumptionNode.getMetavariableNode(context),
|
|
354
|
+
reference = context.findReferenceByMetavariableNode(metavariableNode);
|
|
355
|
+
|
|
356
|
+
return reference;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
function statementFromAssumptionNode(assumptionNode, context) {
|
|
360
|
+
const statementNode = assumptionNode.getStatementNode(),
|
|
361
|
+
statement = context.findStatementByStatementNode(statementNode);
|
|
362
|
+
|
|
363
|
+
return statement;
|
|
364
|
+
}
|
|
@@ -5,18 +5,14 @@ import { Element } from "occam-languages";
|
|
|
5
5
|
import { define } from "../elements";
|
|
6
6
|
import { attempt, literally } from "../utilities/context";
|
|
7
7
|
import { instantiateCombinator } from "../process/instantiate";
|
|
8
|
+
import { ephemeralContextFromJSON } from "../utilities/json";
|
|
8
9
|
import { verifyStatementAsCombinator } from "../process/verify";
|
|
10
|
+
import { statementFromCombinatorNode } from "../utilities/element";
|
|
9
11
|
import { unifyStatementWithCombinator } from "../process/unify";
|
|
10
|
-
import {
|
|
11
|
-
statementFromJSON,
|
|
12
|
-
ephemeralContextFromJSON,
|
|
13
|
-
statementToStatementJSON,
|
|
14
|
-
procedureCallToProcedureCallJSON
|
|
15
|
-
} from "../utilities/json";
|
|
16
12
|
|
|
17
13
|
export default define(class Combinator extends Element {
|
|
18
14
|
constructor(context, string, node, statement) {
|
|
19
|
-
super(context, string, node)
|
|
15
|
+
super(context, string, node);
|
|
20
16
|
|
|
21
17
|
this.statement = statement;
|
|
22
18
|
}
|
|
@@ -93,13 +89,10 @@ export default define(class Combinator extends Element {
|
|
|
93
89
|
|
|
94
90
|
context = contextJSON; ///
|
|
95
91
|
|
|
96
|
-
const
|
|
97
|
-
statement = statementJSON, ///
|
|
98
|
-
string = this.getString(),
|
|
92
|
+
const string = this.getString(),
|
|
99
93
|
json = {
|
|
100
94
|
context,
|
|
101
|
-
string
|
|
102
|
-
statement
|
|
95
|
+
string
|
|
103
96
|
};
|
|
104
97
|
|
|
105
98
|
return json;
|
|
@@ -112,7 +105,7 @@ export default define(class Combinator extends Element {
|
|
|
112
105
|
const { string } = json,
|
|
113
106
|
combinatorNode = instantiateCombinator(string, context),
|
|
114
107
|
node = combinatorNode, ///
|
|
115
|
-
statement =
|
|
108
|
+
statement = statementFromCombinatorNode(combinatorNode, context),
|
|
116
109
|
ephemeralContext = ephemeralContextFromJSON(json, context);
|
|
117
110
|
|
|
118
111
|
context = ephemeralContext; ///
|
|
@@ -5,7 +5,8 @@ import { Element } from "occam-languages";
|
|
|
5
5
|
import { define } from "../elements";
|
|
6
6
|
import { attempt, literally } from "../utilities/context";
|
|
7
7
|
import { instantiateConclusion } from "../process/instantiate";
|
|
8
|
-
import {
|
|
8
|
+
import { statementFromConclusionNode } from "../utilities/element";
|
|
9
|
+
import { ephemeralContextFromJSON, statementToStatementJSON } from "../utilities/json";
|
|
9
10
|
|
|
10
11
|
export default define(class Conclusion extends Element {
|
|
11
12
|
constructor(context, string, node, statement) {
|
|
@@ -131,13 +132,10 @@ export default define(class Conclusion extends Element {
|
|
|
131
132
|
|
|
132
133
|
context = contextJSON; ///
|
|
133
134
|
|
|
134
|
-
const
|
|
135
|
-
statement = statementJSON, ///
|
|
136
|
-
string = this.getString(),
|
|
135
|
+
const string = this.getString(),
|
|
137
136
|
json = {
|
|
138
137
|
context,
|
|
139
|
-
string
|
|
140
|
-
statement
|
|
138
|
+
string
|
|
141
139
|
};
|
|
142
140
|
|
|
143
141
|
return json;
|
|
@@ -150,7 +148,7 @@ export default define(class Conclusion extends Element {
|
|
|
150
148
|
const { string } = json,
|
|
151
149
|
conclusionNode = instantiateConclusion(string, context),
|
|
152
150
|
node = conclusionNode, ///
|
|
153
|
-
statement =
|
|
151
|
+
statement = statementFromConclusionNode(conclusionNode, context),
|
|
154
152
|
ephemeralContext = ephemeralContextFromJSON(json, context);
|
|
155
153
|
|
|
156
154
|
context = ephemeralContext; ///
|
|
@@ -6,8 +6,9 @@ import { define } from "../elements";
|
|
|
6
6
|
import { attempt, literally } from "../utilities/context";
|
|
7
7
|
import { instantiateConstructor } from "../process/instantiate";
|
|
8
8
|
import { verifyTermAsConstructor } from "../process/verify";
|
|
9
|
+
import { termFromConstructorNode } from "../utilities/element";
|
|
9
10
|
import { unifyTermWithConstructor } from "../process/unify";
|
|
10
|
-
import {
|
|
11
|
+
import { termToTermJSON, ephemeralContextFromJSON } from "../utilities/json";
|
|
11
12
|
|
|
12
13
|
export default define(class Constructor extends Element {
|
|
13
14
|
constructor(context, string, node, term) {
|
|
@@ -29,20 +30,17 @@ export default define(class Constructor extends Element {
|
|
|
29
30
|
|
|
30
31
|
getType() { return this.term.getType(); }
|
|
31
32
|
|
|
32
|
-
getString() {
|
|
33
|
+
getString(includeType = true) {
|
|
33
34
|
let string;
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const termString = this.term.getString();
|
|
39
|
-
|
|
40
|
-
string = termString; ///
|
|
41
|
-
} else {
|
|
42
|
-
const typeString = type.getString(),
|
|
36
|
+
if (includeType) {
|
|
37
|
+
const type = this.getType(),
|
|
38
|
+
typeString = type.getString(),
|
|
43
39
|
termString = this.term.getString();
|
|
44
40
|
|
|
45
41
|
string = `${termString}.${typeString}`;
|
|
42
|
+
} else {
|
|
43
|
+
string = super.getString();
|
|
46
44
|
}
|
|
47
45
|
|
|
48
46
|
return string;
|
|
@@ -53,7 +51,8 @@ export default define(class Constructor extends Element {
|
|
|
53
51
|
verify(context) {
|
|
54
52
|
let verifies = false;
|
|
55
53
|
|
|
56
|
-
const
|
|
54
|
+
const includeType = false,
|
|
55
|
+
constructorString = this.getString(includeType);
|
|
57
56
|
|
|
58
57
|
context.trace(`Verifying the '${constructorString}' constructor...`);
|
|
59
58
|
|
|
@@ -113,12 +112,22 @@ export default define(class Constructor extends Element {
|
|
|
113
112
|
}
|
|
114
113
|
|
|
115
114
|
toJSON() {
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
let context;
|
|
116
|
+
|
|
117
|
+
context = this.getContext();
|
|
118
|
+
|
|
119
|
+
const contextJSON = context.toJSON();
|
|
120
|
+
|
|
121
|
+
context = contextJSON; ///
|
|
122
|
+
|
|
123
|
+
const includeType = false,
|
|
124
|
+
termJSON = termToTermJSON(this.term),
|
|
125
|
+
string = this.getString(includeType),
|
|
118
126
|
term = termJSON, ///
|
|
119
127
|
json = {
|
|
120
|
-
|
|
121
|
-
string
|
|
128
|
+
context,
|
|
129
|
+
string,
|
|
130
|
+
term
|
|
122
131
|
};
|
|
123
132
|
|
|
124
133
|
return json;
|
|
@@ -131,7 +140,7 @@ export default define(class Constructor extends Element {
|
|
|
131
140
|
const { string } = json,
|
|
132
141
|
constructorNode = instantiateConstructor(string, context),
|
|
133
142
|
node = constructorNode, ///
|
|
134
|
-
term =
|
|
143
|
+
term = termFromConstructorNode(constructorNode, context),
|
|
135
144
|
ephemeralContext = ephemeralContextFromJSON(json, context);
|
|
136
145
|
|
|
137
146
|
context = ephemeralContext; ///
|
|
@@ -104,7 +104,8 @@ export default define(class ConstructorDeclaration extends Declaration {
|
|
|
104
104
|
let constructorVerifies;
|
|
105
105
|
|
|
106
106
|
const context = this.getContext(),
|
|
107
|
-
|
|
107
|
+
includeType = false,
|
|
108
|
+
constructorString = this.constructor.getString(includeType),
|
|
108
109
|
constructorDeclarationString = this.getString(); ///
|
|
109
110
|
|
|
110
111
|
context.trace(`Verifying the '${constructorDeclarationString}' constructor declaration's '${constructorString}' constructor...`);
|
|
@@ -54,9 +54,13 @@ export default define(class SimpleTypeDeclaration extends Declaration {
|
|
|
54
54
|
const typePrefixVerifies = this.verifyTypePrefix();
|
|
55
55
|
|
|
56
56
|
if (typePrefixVerifies) {
|
|
57
|
-
|
|
57
|
+
const propertiesVerifies = this.verifyProperties();
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
if (propertiesVerifies) {
|
|
60
|
+
context.addType(this.type);
|
|
61
|
+
|
|
62
|
+
verifies = true;
|
|
63
|
+
}
|
|
60
64
|
}
|
|
61
65
|
}
|
|
62
66
|
}
|
|
@@ -163,7 +167,7 @@ export default define(class SimpleTypeDeclaration extends Declaration {
|
|
|
163
167
|
|
|
164
168
|
if (superTypesLength === 0) {
|
|
165
169
|
const baseType = baseTypeFromNothing(),
|
|
166
|
-
|
|
170
|
+
superTyupe = baseType; ///
|
|
167
171
|
|
|
168
172
|
superTypes.push(superTyupe);
|
|
169
173
|
}
|
|
@@ -182,8 +186,8 @@ export default define(class SimpleTypeDeclaration extends Declaration {
|
|
|
182
186
|
let typePrefixVerifies = false;
|
|
183
187
|
|
|
184
188
|
const context = this.getContext(),
|
|
185
|
-
|
|
186
|
-
|
|
189
|
+
typeString = this.type.getString(),
|
|
190
|
+
simpleTypeDeclarationString = this.getString(); ///;
|
|
187
191
|
|
|
188
192
|
context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration's '${typeString}' type's prefix...`);
|
|
189
193
|
|
|
@@ -192,7 +196,7 @@ export default define(class SimpleTypeDeclaration extends Declaration {
|
|
|
192
196
|
if (!typePrefixed) {
|
|
193
197
|
typePrefixVerifies = true;
|
|
194
198
|
} else {
|
|
195
|
-
context.debug(
|
|
199
|
+
context.debug(`The '${simpleTypeDeclarationString}' simple type declaration's '${typeString}' type is prefixed.`);
|
|
196
200
|
}
|
|
197
201
|
|
|
198
202
|
if (typePrefixVerifies) {
|
|
@@ -202,5 +206,25 @@ export default define(class SimpleTypeDeclaration extends Declaration {
|
|
|
202
206
|
return typePrefixVerifies;
|
|
203
207
|
}
|
|
204
208
|
|
|
209
|
+
verifyProperties() {
|
|
210
|
+
let propertiesVerify = true; ///
|
|
211
|
+
|
|
212
|
+
const context = this.getContext(),
|
|
213
|
+
typeString = this.type.getString(),
|
|
214
|
+
simpleTypeDeclarationString = this.getString(); ///;
|
|
215
|
+
|
|
216
|
+
context.trace(`Verifying the '${simpleTypeDeclarationString}' simple type declaration's '${typeString}' type's properties...`);
|
|
217
|
+
|
|
218
|
+
const properties = [];
|
|
219
|
+
|
|
220
|
+
this.type.setProperties(properties);
|
|
221
|
+
|
|
222
|
+
if (propertiesVerify) {
|
|
223
|
+
context.debug(`...verified the '${simpleTypeDeclarationString}' simple type declaration's '${typeString}' type's properties.`);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
return propertiesVerify;
|
|
227
|
+
}
|
|
228
|
+
|
|
205
229
|
static name = "SimpleTypeDeclaration";
|
|
206
230
|
});
|
package/src/element/deduction.js
CHANGED
|
@@ -5,7 +5,8 @@ import { Element } from "occam-languages";
|
|
|
5
5
|
import { define } from "../elements";
|
|
6
6
|
import { attempt, literally } from "../utilities/context";
|
|
7
7
|
import { instantiateDeduction } from "../process/instantiate";
|
|
8
|
-
import {
|
|
8
|
+
import { ephemeralContextFromJSON } from "../utilities/json";
|
|
9
|
+
import { statementFromDeductionNode } from "../utilities/element";
|
|
9
10
|
|
|
10
11
|
export default define(class Deduction extends Element {
|
|
11
12
|
constructor(context, string, node, statement) {
|
|
@@ -156,13 +157,10 @@ export default define(class Deduction extends Element {
|
|
|
156
157
|
|
|
157
158
|
context = contextJSON; ///
|
|
158
159
|
|
|
159
|
-
const
|
|
160
|
-
statement = statementJSON, ///
|
|
161
|
-
string = this.getString(),
|
|
160
|
+
const string = this.getString(),
|
|
162
161
|
json = {
|
|
163
162
|
context,
|
|
164
|
-
string
|
|
165
|
-
statement
|
|
163
|
+
string
|
|
166
164
|
};
|
|
167
165
|
|
|
168
166
|
return json;
|
|
@@ -173,9 +171,9 @@ export default define(class Deduction extends Element {
|
|
|
173
171
|
static fromJSON(json, context) {
|
|
174
172
|
const duduction = literally((context) => {
|
|
175
173
|
const { string } = json,
|
|
176
|
-
|
|
177
|
-
node =
|
|
178
|
-
statement =
|
|
174
|
+
deductionNode = instantiateDeduction(string, context),
|
|
175
|
+
node = deductionNode, ///
|
|
176
|
+
statement = statementFromDeductionNode(deductionNode, context),
|
|
179
177
|
ephemeralContext = ephemeralContextFromJSON(json, context);
|
|
180
178
|
|
|
181
179
|
context = ephemeralContext; ///
|
package/src/element/equality.js
CHANGED
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
import { Element } from "occam-languages";
|
|
4
4
|
|
|
5
5
|
import { define } from "../elements";
|
|
6
|
+
import { literally } from "../utilities/context";
|
|
6
7
|
import { equateTerms } from "../process/equate";
|
|
8
|
+
import { instantiateEquality } from "../process/instantiate";
|
|
7
9
|
import { equalityAssignmentFromEquality, leftVariableAssignmentFromEquality, rightVariableAssignmentFromEquality } from "../process/assign";
|
|
8
10
|
|
|
9
11
|
export default define(class Equality extends Element {
|
|
@@ -271,4 +273,45 @@ export default define(class Equality extends Element {
|
|
|
271
273
|
}
|
|
272
274
|
|
|
273
275
|
static name = "Equality";
|
|
276
|
+
|
|
277
|
+
toJSON() {
|
|
278
|
+
const string = this.getString(),
|
|
279
|
+
json = {
|
|
280
|
+
string
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
return json;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
static fromJSON(json, context) {
|
|
287
|
+
const equality = literally((context) => {
|
|
288
|
+
const { string } = json,
|
|
289
|
+
equalityNode = instantiateEquality(string, context),
|
|
290
|
+
node = equalityNode, ///
|
|
291
|
+
leftTerm = leftTermFromEqualityNode(equalityNode, context),
|
|
292
|
+
rightTerm = rightTermFromEqualityNode(equalityNode, context);
|
|
293
|
+
|
|
294
|
+
context = null;
|
|
295
|
+
|
|
296
|
+
const equality = new Equality(context, string, node, leftTerm, rightTerm);
|
|
297
|
+
|
|
298
|
+
return equality;
|
|
299
|
+
}, context);
|
|
300
|
+
|
|
301
|
+
return equality;
|
|
302
|
+
}
|
|
274
303
|
});
|
|
304
|
+
|
|
305
|
+
function leftTermFromEqualityNode(equalityNode, context) {
|
|
306
|
+
const leftTermNode = equalityNode.getLeftTermNode(),
|
|
307
|
+
leftTerm = context.findTermByTermNode(leftTermNode);
|
|
308
|
+
|
|
309
|
+
return leftTerm;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
function rightTermFromEqualityNode(equalityNode, context) {
|
|
313
|
+
const rightTermNode = equalityNode.getLeftTermNode(),
|
|
314
|
+
rightTerm = context.findTermByTermNode(rightTermNode);
|
|
315
|
+
|
|
316
|
+
return rightTerm;
|
|
317
|
+
}
|
package/src/element/frame.js
CHANGED
|
@@ -6,8 +6,8 @@ import { define } from "../elements";
|
|
|
6
6
|
import { literally } from "../utilities/context";
|
|
7
7
|
import { instantiateFrame } from "../process/instantiate";
|
|
8
8
|
import { FRAME_META_TYPE_NAME } from "../metaTypeNames";
|
|
9
|
+
import { metavariableFromFrameNode } from "../utilities/element";
|
|
9
10
|
import { assumptionsStringFromAssumptions } from "../utilities/string";
|
|
10
|
-
import { assumptionsFromJSON, metavariableFromJSON, assumptionsToAssumptionsJSON, metavariableToMetavariableJSON } from "../utilities/json";
|
|
11
11
|
|
|
12
12
|
export default define(class Frame extends Element {
|
|
13
13
|
constructor(context, string, node, assumptions, metavariable) {
|
|
@@ -348,15 +348,9 @@ export default define(class Frame extends Element {
|
|
|
348
348
|
}
|
|
349
349
|
|
|
350
350
|
toJSON() {
|
|
351
|
-
const
|
|
352
|
-
assumptionsJSON = assumptionsToAssumptionsJSON(this.assumptions),
|
|
353
|
-
metavariable = metavariableJSON, ///
|
|
354
|
-
assumptions = assumptionsJSON, ///
|
|
355
|
-
string = this.getString(),
|
|
351
|
+
const string = this.getString(),
|
|
356
352
|
json = {
|
|
357
|
-
string
|
|
358
|
-
assumptions,
|
|
359
|
-
metavariable
|
|
353
|
+
string
|
|
360
354
|
};
|
|
361
355
|
|
|
362
356
|
return json;
|
|
@@ -369,9 +363,12 @@ export default define(class Frame extends Element {
|
|
|
369
363
|
const { string } = json,
|
|
370
364
|
frameNode = instantiateFrame(string, context),
|
|
371
365
|
node = frameNode, ///
|
|
372
|
-
assumptions =
|
|
373
|
-
metavariable =
|
|
374
|
-
|
|
366
|
+
assumptions = assumptionsFromFrameNode(frameNode, context),
|
|
367
|
+
metavariable = metavariableFromFrameNode(frameNode, context);
|
|
368
|
+
|
|
369
|
+
context = null;
|
|
370
|
+
|
|
371
|
+
const frame = new Frame(context, string, node, assumptions, metavariable);
|
|
375
372
|
|
|
376
373
|
return frame;
|
|
377
374
|
}, context);
|
|
@@ -379,3 +376,15 @@ export default define(class Frame extends Element {
|
|
|
379
376
|
return frame;
|
|
380
377
|
}
|
|
381
378
|
});
|
|
379
|
+
|
|
380
|
+
function assumptionsFromFrameNode(frameNode, context) {
|
|
381
|
+
const assumptionNodes = frameNode.getAssumptionNodes(),
|
|
382
|
+
assumptions = assumptionNodes.map((assumptionNode) => {
|
|
383
|
+
const assumption = context.findAssumptionByAssumptionNode(assumptionNode);
|
|
384
|
+
|
|
385
|
+
return assumption;
|
|
386
|
+
});
|
|
387
|
+
|
|
388
|
+
return assumptions;
|
|
389
|
+
}
|
|
390
|
+
|
|
@@ -3,7 +3,9 @@
|
|
|
3
3
|
import { Element } from "occam-languages";
|
|
4
4
|
|
|
5
5
|
import { define } from "../elements";
|
|
6
|
-
import {
|
|
6
|
+
import {literally} from "../utilities/context";
|
|
7
|
+
import { instantiateHypothesis } from "../process/instantiate";
|
|
8
|
+
import { statementFromHypothesisNode } from "../utilities/element";
|
|
7
9
|
|
|
8
10
|
export default define(class Hypothesis extends Element {
|
|
9
11
|
constructor(context, string, node, statement) {
|
|
@@ -87,12 +89,9 @@ export default define(class Hypothesis extends Element {
|
|
|
87
89
|
}
|
|
88
90
|
|
|
89
91
|
toJSON() {
|
|
90
|
-
const
|
|
91
|
-
statement = statementJSON, ///
|
|
92
|
-
string = this.getString(),
|
|
92
|
+
const string = this.getString(),
|
|
93
93
|
json = {
|
|
94
|
-
string
|
|
95
|
-
statement
|
|
94
|
+
string
|
|
96
95
|
};
|
|
97
96
|
|
|
98
97
|
return json;
|
|
@@ -101,6 +100,19 @@ export default define(class Hypothesis extends Element {
|
|
|
101
100
|
static name = "Hypothesis";
|
|
102
101
|
|
|
103
102
|
static fromJSON(json, context) {
|
|
104
|
-
|
|
103
|
+
const hypothesis = literally((context) => {
|
|
104
|
+
const { string } = json,
|
|
105
|
+
hypothesisNode = instantiateHypothesis(string, context),
|
|
106
|
+
node = hypothesisNode, ///
|
|
107
|
+
statement = statementFromHypothesisNode(hypothesisNode, context);
|
|
108
|
+
|
|
109
|
+
context = null;
|
|
110
|
+
|
|
111
|
+
const hypothesis = new Hypothesis(context, string, node, statement);
|
|
112
|
+
|
|
113
|
+
return hypothesis;
|
|
114
|
+
}, context);
|
|
115
|
+
|
|
116
|
+
return hypothesis;
|
|
105
117
|
}
|
|
106
118
|
});
|