occam-verify-cli 1.0.714 → 1.0.718
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/context/file/nominal.js +3 -3
- package/lib/context.js +10 -8
- package/lib/element/assertion/contained.js +1 -8
- package/lib/element/assertion/defined.js +1 -8
- package/lib/element/assertion/property.js +1 -8
- package/lib/element/assertion/satisfies.js +1 -8
- package/lib/element/assertion/subproof.js +1 -8
- package/lib/element/assertion.js +8 -1
- package/lib/element/declaration/metavariable.js +16 -16
- package/lib/element/frame.js +39 -36
- package/lib/element/metavariable.js +4 -4
- package/lib/element/reference.js +2 -2
- package/lib/element/statement.js +1 -1
- package/lib/element/substitution/frame.js +1 -8
- package/lib/element/substitution/reference.js +1 -8
- package/lib/element/substitution/statement.js +1 -8
- package/lib/element/substitution/term.js +1 -8
- package/lib/element/substitution.js +8 -1
- package/lib/utilities/element.js +23 -3
- package/package.json +1 -1
- package/src/context/file/nominal.js +2 -3
- package/src/context.js +14 -10
- package/src/element/assertion/contained.js +0 -11
- package/src/element/assertion/defined.js +0 -11
- package/src/element/assertion/property.js +0 -11
- package/src/element/assertion/satisfies.js +0 -11
- package/src/element/assertion/subproof.js +0 -11
- package/src/element/assertion.js +11 -0
- package/src/element/declaration/metavariable.js +17 -17
- package/src/element/frame.js +58 -51
- package/src/element/metavariable.js +3 -3
- package/src/element/reference.js +1 -1
- package/src/element/statement.js +1 -1
- package/src/element/substitution/frame.js +0 -11
- package/src/element/substitution/reference.js +0 -11
- package/src/element/substitution/statement.js +0 -11
- package/src/element/substitution/term.js +0 -11
- package/src/element/substitution.js +11 -0
- package/src/utilities/element.js +28 -3
package/package.json
CHANGED
|
@@ -362,13 +362,12 @@ export default class NominalFileContext extends FileContext {
|
|
|
362
362
|
this.trace(`Added the '${metavariableString}' metavariable to the '${filePath}' file context.`)
|
|
363
363
|
}
|
|
364
364
|
|
|
365
|
-
findMetavariable(metavariable) {
|
|
365
|
+
findMetavariable(metavariable, context) {
|
|
366
366
|
const metavariables = this.getMetavariables(),
|
|
367
367
|
specificMetavariable = metavariable; ///
|
|
368
368
|
|
|
369
369
|
metavariable = metavariables.find((metavariable) => {
|
|
370
|
-
const
|
|
371
|
-
generalMetavariable = metavariable, ///
|
|
370
|
+
const generalMetavariable = metavariable, ///
|
|
372
371
|
metavariableUnifies = generalMetavariable.unifyMetavariable(specificMetavariable, context);
|
|
373
372
|
|
|
374
373
|
if (metavariableUnifies) {
|
package/src/context.js
CHANGED
|
@@ -108,14 +108,6 @@ export default class Context extends ContextBase {
|
|
|
108
108
|
return subproofOrProofAssertions;
|
|
109
109
|
}
|
|
110
110
|
|
|
111
|
-
findMetavariable(metavariable) {
|
|
112
|
-
const context = this.getContext();
|
|
113
|
-
|
|
114
|
-
metavariable = context.findMetavariable(metavariable); ///
|
|
115
|
-
|
|
116
|
-
return metavariable;
|
|
117
|
-
}
|
|
118
|
-
|
|
119
111
|
findRuleByReference(reference) {
|
|
120
112
|
const context = this.getContext(),
|
|
121
113
|
rule = context.findRuleByReference(reference);
|
|
@@ -144,6 +136,18 @@ export default class Context extends ContextBase {
|
|
|
144
136
|
return metaType;
|
|
145
137
|
}
|
|
146
138
|
|
|
139
|
+
findMetavariable(metavariable, context) {
|
|
140
|
+
const childContext = context; ///
|
|
141
|
+
|
|
142
|
+
context = this.getContext();
|
|
143
|
+
|
|
144
|
+
const parentContext = context; ///
|
|
145
|
+
|
|
146
|
+
metavariable = parentContext.findMetavariable(metavariable, childContext); ///
|
|
147
|
+
|
|
148
|
+
return metavariable;
|
|
149
|
+
}
|
|
150
|
+
|
|
147
151
|
findTermByTermNode(termNode) {
|
|
148
152
|
const context = this.getContext(),
|
|
149
153
|
term = context.findTermByTermNode(termNode);
|
|
@@ -271,8 +275,8 @@ export default class Context extends ContextBase {
|
|
|
271
275
|
return procedure;
|
|
272
276
|
}
|
|
273
277
|
|
|
274
|
-
isMetavariablePresent(metavariable) {
|
|
275
|
-
metavariable = this.findMetavariable(metavariable);
|
|
278
|
+
isMetavariablePresent(metavariable, context) {
|
|
279
|
+
metavariable = this.findMetavariable(metavariable, context); ///
|
|
276
280
|
|
|
277
281
|
const metavariablePresent = (metavariable !== null);
|
|
278
282
|
|
|
@@ -239,17 +239,6 @@ export default define(class ContainedAssertion extends Assertion {
|
|
|
239
239
|
return unifiesIndependently;
|
|
240
240
|
}
|
|
241
241
|
|
|
242
|
-
toJSON() {
|
|
243
|
-
const { name } = this.constructor,
|
|
244
|
-
string = this.getString(),
|
|
245
|
-
json = {
|
|
246
|
-
name,
|
|
247
|
-
string
|
|
248
|
-
};
|
|
249
|
-
|
|
250
|
-
return json;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
242
|
static name = "ContainedAssertion";
|
|
254
243
|
|
|
255
244
|
static fromJSON(json, context) {
|
|
@@ -208,17 +208,6 @@ export default define(class DefinedAssertion extends Assertion {
|
|
|
208
208
|
return unifiesIndependently;
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
-
toJSON() {
|
|
212
|
-
const { name } = this.constructor,
|
|
213
|
-
string = this.getString(),
|
|
214
|
-
json = {
|
|
215
|
-
name,
|
|
216
|
-
string
|
|
217
|
-
};
|
|
218
|
-
|
|
219
|
-
return json;
|
|
220
|
-
}
|
|
221
|
-
|
|
222
211
|
static name = "DefinedAssertion";
|
|
223
212
|
|
|
224
213
|
static fromJSON(json, context) {
|
|
@@ -200,17 +200,6 @@ export default define(class PropertyAssertion extends Assertion {
|
|
|
200
200
|
context.addAssignment(assignment);
|
|
201
201
|
}
|
|
202
202
|
|
|
203
|
-
toJSON() {
|
|
204
|
-
const { name } = this.constructor,
|
|
205
|
-
string = this.getString(),
|
|
206
|
-
json = {
|
|
207
|
-
name,
|
|
208
|
-
string
|
|
209
|
-
};
|
|
210
|
-
|
|
211
|
-
return json;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
203
|
static name = "PropertyAssertion";
|
|
215
204
|
|
|
216
205
|
static fromJSON(json, context) {
|
|
@@ -157,17 +157,6 @@ export default define(class SatisfiesAssertion extends Assertion {
|
|
|
157
157
|
return statementUnifies;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
toJSON() {
|
|
161
|
-
const { name } = this.constructor,
|
|
162
|
-
string = this.getString(),
|
|
163
|
-
json = {
|
|
164
|
-
name,
|
|
165
|
-
string
|
|
166
|
-
};
|
|
167
|
-
|
|
168
|
-
return json;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
160
|
static name = "SatisfiesAssertion";
|
|
172
161
|
|
|
173
162
|
static fromJSON(json, context) {
|
|
@@ -113,17 +113,6 @@ export default define(class SubproofAssertion extends Assertion {
|
|
|
113
113
|
return subproofUnifies;
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
toJSON() {
|
|
117
|
-
const { name } = this.constructor,
|
|
118
|
-
string = this.getString(),
|
|
119
|
-
json = {
|
|
120
|
-
name,
|
|
121
|
-
string
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
return json;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
116
|
static name = "SubproofAssertion";
|
|
128
117
|
|
|
129
118
|
static fromJSON(json, context) {
|
package/src/element/assertion.js
CHANGED
|
@@ -34,9 +34,15 @@ export default define(class MetavariableDeclaration extends Declaration {
|
|
|
34
34
|
const metavariableVerifies = this.verifyMetavariable();
|
|
35
35
|
|
|
36
36
|
if (metavariableVerifies) {
|
|
37
|
-
|
|
37
|
+
const metavariableTypeVerified = this.verifyMetavariableType();
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
if (metavariableTypeVerified) {
|
|
40
|
+
this.metavariable.setMetaType(this.metaType);
|
|
41
|
+
|
|
42
|
+
context.addMetavariable(this.metavariable);
|
|
43
|
+
|
|
44
|
+
verifies = true;
|
|
45
|
+
}
|
|
40
46
|
}
|
|
41
47
|
|
|
42
48
|
if (verifies) {
|
|
@@ -58,23 +64,17 @@ export default define(class MetavariableDeclaration extends Declaration {
|
|
|
58
64
|
const metavariableNode = this.metavariable.getNode(), ///
|
|
59
65
|
termNode = metavariableNode.getTermNode();
|
|
60
66
|
|
|
61
|
-
if (termNode
|
|
62
|
-
context.debug(`A term was found in the '${metavariableString}' metavariable when a type should have been present.`);
|
|
63
|
-
} else {
|
|
67
|
+
if (termNode === null) {
|
|
64
68
|
const metavariableName = this.metavariable.getName(),
|
|
65
69
|
metavariablePresent = context.isMetavariablePresentByMetavariableName(metavariableName);
|
|
66
70
|
|
|
67
|
-
if (metavariablePresent) {
|
|
68
|
-
|
|
71
|
+
if (!metavariablePresent) {
|
|
72
|
+
metavariableVerifies = true;
|
|
69
73
|
} else {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
if (metavariableTypeVerified) {
|
|
73
|
-
this.metavariable.setMetaType(this.metaType);
|
|
74
|
-
|
|
75
|
-
metavariableVerifies = true;
|
|
76
|
-
}
|
|
74
|
+
context.debug(`The '${metavariableName}' metavariable is already present.`);
|
|
77
75
|
}
|
|
76
|
+
} else {
|
|
77
|
+
context.debug(`A term was found in the '${metavariableString}' metavariable when a type should have been present.`);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
if (metavariableVerifies) {
|
|
@@ -101,12 +101,12 @@ export default define(class MetavariableDeclaration extends Declaration {
|
|
|
101
101
|
const nominalTypeName = metavariableType.getNominalTypeName(),
|
|
102
102
|
type = context.findTypeByNominalTypeName(nominalTypeName);
|
|
103
103
|
|
|
104
|
-
if (type
|
|
105
|
-
context.debug(`The '${metavariableTypeString}' type is not present.`);
|
|
106
|
-
} else {
|
|
104
|
+
if (type === null) {
|
|
107
105
|
this.metavariable.setType(type);
|
|
108
106
|
|
|
109
107
|
metavariableTypeVerified = true;
|
|
108
|
+
} else {
|
|
109
|
+
context.debug(`The '${metavariableTypeString}' type is not present.`);
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
if (metavariableTypeVerified) {
|
package/src/element/frame.js
CHANGED
|
@@ -6,23 +6,23 @@ 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 {
|
|
9
|
+
import { referenceFromFrameNode } 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,
|
|
13
|
+
constructor(context, string, node, reference, assumptions) {
|
|
14
14
|
super(context, string, node);
|
|
15
15
|
|
|
16
|
+
this.reference = reference;
|
|
16
17
|
this.assumptions = assumptions;
|
|
17
|
-
this.metavariable = metavariable;
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
getAssumptions() {
|
|
21
21
|
return this.assumptions;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
return this.
|
|
24
|
+
getReference() {
|
|
25
|
+
return this.reference;
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
getFrameNode() {
|
|
@@ -34,16 +34,28 @@ export default define(class Frame extends Element {
|
|
|
34
34
|
|
|
35
35
|
getMetavariableName() {
|
|
36
36
|
const frameNode = this.getFrameNode(),
|
|
37
|
-
|
|
37
|
+
referenceName = frameNode.getMetavariableName();
|
|
38
38
|
|
|
39
|
-
return
|
|
39
|
+
return referenceName;
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
getMetavariableNode() {
|
|
43
43
|
const frameNode = this.getFrameNode(),
|
|
44
|
-
|
|
44
|
+
referenceNode = frameNode.getMetavariableNode();
|
|
45
45
|
|
|
46
|
-
return
|
|
46
|
+
return referenceNode;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
getMetavariable() {
|
|
50
|
+
let metavariable = null;
|
|
51
|
+
|
|
52
|
+
const singular = this.isSingular();
|
|
53
|
+
|
|
54
|
+
if (singular) {
|
|
55
|
+
metavariable = this.reference.getMetavariable();
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
return metavariable;
|
|
47
59
|
}
|
|
48
60
|
|
|
49
61
|
matchFrameNode(frameNode) {
|
|
@@ -184,10 +196,10 @@ export default define(class Frame extends Element {
|
|
|
184
196
|
} else {
|
|
185
197
|
let validates = false;
|
|
186
198
|
|
|
187
|
-
const
|
|
188
|
-
|
|
199
|
+
const referenceValidates = this.validateReference(stated, context),
|
|
200
|
+
assumptionsValidate = this.validateAssumptions(stated, context);
|
|
189
201
|
|
|
190
|
-
if (
|
|
202
|
+
if (referenceValidates && assumptionsValidate) {
|
|
191
203
|
let validatesWhenStated = false,
|
|
192
204
|
validatesWhenDerived = false;
|
|
193
205
|
|
|
@@ -252,6 +264,36 @@ export default define(class Frame extends Element {
|
|
|
252
264
|
return validatesWhenDerived;
|
|
253
265
|
}
|
|
254
266
|
|
|
267
|
+
validateReference(stated, context) {
|
|
268
|
+
let referenceValidates = false;
|
|
269
|
+
|
|
270
|
+
const singular = this.isSingular();
|
|
271
|
+
|
|
272
|
+
if (singular) {
|
|
273
|
+
const frameString = this.getString(), ///
|
|
274
|
+
referenceString = this.reference.getString();
|
|
275
|
+
|
|
276
|
+
context.trace(`Validating the '${frameString}' frame's '${referenceString}' reference...`);
|
|
277
|
+
|
|
278
|
+
const metavariable = this.getMetavariable(),
|
|
279
|
+
metaTypeName = FRAME_META_TYPE_NAME,
|
|
280
|
+
frameMetaType = context.findMetaTypeByMetaTypeName(metaTypeName),
|
|
281
|
+
validatesGivenMetaType = metavariable.validateGivenMetaType(frameMetaType, context);
|
|
282
|
+
|
|
283
|
+
if (validatesGivenMetaType) {
|
|
284
|
+
referenceValidates = true;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
if (referenceValidates) {
|
|
288
|
+
context.debug(`...validated the '${frameString}' frame's '${referenceString}' reference.`);
|
|
289
|
+
}
|
|
290
|
+
} else {
|
|
291
|
+
referenceValidates = true;
|
|
292
|
+
}
|
|
293
|
+
|
|
294
|
+
return referenceValidates;
|
|
295
|
+
}
|
|
296
|
+
|
|
255
297
|
validateAssumption(assumption, context) {
|
|
256
298
|
let assumptionValidates;
|
|
257
299
|
|
|
@@ -306,41 +348,6 @@ export default define(class Frame extends Element {
|
|
|
306
348
|
return assumptionsValidate;
|
|
307
349
|
}
|
|
308
350
|
|
|
309
|
-
validateMetavariable(stated, context) {
|
|
310
|
-
let metavariableValidates = false;
|
|
311
|
-
|
|
312
|
-
const singular = this.isSingular();
|
|
313
|
-
|
|
314
|
-
if (singular) {
|
|
315
|
-
const frameString = this.getString(), ///
|
|
316
|
-
metavraibleString = this.metavariable.getString();
|
|
317
|
-
|
|
318
|
-
context.trace(`Validating the '${frameString}' frame's '${metavraibleString}' metavariable...`);
|
|
319
|
-
|
|
320
|
-
const metavariablePresent = context.isMetavariablePresent(this.metavariable);
|
|
321
|
-
|
|
322
|
-
if (metavariablePresent) {
|
|
323
|
-
const metaTypeName = FRAME_META_TYPE_NAME,
|
|
324
|
-
frameMetaType = context.findMetaTypeByMetaTypeName(metaTypeName),
|
|
325
|
-
metavariableValidateGivenMetaType = this.metavariable.validateGivenMetaType(frameMetaType, context);
|
|
326
|
-
|
|
327
|
-
if (metavariableValidateGivenMetaType) {
|
|
328
|
-
metavariableValidates = true;
|
|
329
|
-
}
|
|
330
|
-
} else {
|
|
331
|
-
context.debug(`The '${frameString}' frame's '${metavraibleString}' metavariable is not present.`);
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
if (metavariableValidates) {
|
|
335
|
-
context.debug(`...validated the '${frameString}' frame's '${metavraibleString}' metavariable.`);
|
|
336
|
-
}
|
|
337
|
-
} else {
|
|
338
|
-
metavariableValidates = true;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
return metavariableValidates;
|
|
342
|
-
}
|
|
343
|
-
|
|
344
351
|
validateGivenMetaType(metaType, stated, context) {
|
|
345
352
|
let validatesGivenMetaType = false;
|
|
346
353
|
|
|
@@ -381,13 +388,13 @@ export default define(class Frame extends Element {
|
|
|
381
388
|
const frame = literally((context) => {
|
|
382
389
|
const { string } = json,
|
|
383
390
|
frameNode = instantiateFrame(string, context),
|
|
384
|
-
node = frameNode,
|
|
385
|
-
|
|
386
|
-
|
|
391
|
+
node = frameNode, ///
|
|
392
|
+
reference = referenceFromFrameNode(frameNode, context),
|
|
393
|
+
assumptions = assumptionsFromFrameNode(frameNode, context);
|
|
387
394
|
|
|
388
395
|
context = null;
|
|
389
396
|
|
|
390
|
-
const frame = new Frame(context, string, node, assumptions,
|
|
397
|
+
const frame = new Frame(context, string, node, assumptions, reference);
|
|
391
398
|
|
|
392
399
|
return frame;
|
|
393
400
|
}, context);
|
|
@@ -93,14 +93,14 @@ export default define(class Metavariable extends Element {
|
|
|
93
93
|
context.trace(`Validating the '${metavariableString}' metavariable...`);
|
|
94
94
|
|
|
95
95
|
const metavariable = this, ///
|
|
96
|
-
metavariablePresent = context.isMetavariablePresent(metavariable);
|
|
96
|
+
metavariablePresent = context.isMetavariablePresent(metavariable, context);
|
|
97
97
|
|
|
98
98
|
if (metavariablePresent) {
|
|
99
99
|
validates = true;
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
if (validates) {
|
|
103
|
-
context.debug(`...
|
|
103
|
+
context.debug(`...validated the '${metavariableString}' metavariable.`);
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
return validates;
|
|
@@ -116,7 +116,7 @@ export default define(class Metavariable extends Element {
|
|
|
116
116
|
|
|
117
117
|
let metavariable = this; ///
|
|
118
118
|
|
|
119
|
-
metavariable = context.findMetavariable(metavariable);
|
|
119
|
+
metavariable = context.findMetavariable(metavariable, context);
|
|
120
120
|
|
|
121
121
|
if (metavariable !== null) {
|
|
122
122
|
const metavariableMetaTypeEqualToMetaType = metavariable.isMetaTypeEqualTo(metaType);
|
package/src/element/reference.js
CHANGED
|
@@ -165,7 +165,7 @@ export default define(class Reference extends Element {
|
|
|
165
165
|
const metaTypeName = REFERENCE_META_TYPE_NAME,
|
|
166
166
|
referenceMetaType = context.findMetaTypeByMetaTypeName(metaTypeName),
|
|
167
167
|
metaType = referenceMetaType, ///
|
|
168
|
-
metavariable = context.findMetavariable(this.metavariable);
|
|
168
|
+
metavariable = context.findMetavariable(this.metavariable, context);
|
|
169
169
|
|
|
170
170
|
if (metavariable !== null) {
|
|
171
171
|
const metavariableValidatesGivenMetaType = metavariable.validateGivenMetaType(metaType, context);
|
package/src/element/statement.js
CHANGED
|
@@ -170,17 +170,6 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
170
170
|
return replacementFrameValidates;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
toJSON() {
|
|
174
|
-
const { name } = this.constructor,
|
|
175
|
-
string = this.getString(),
|
|
176
|
-
json = {
|
|
177
|
-
name,
|
|
178
|
-
string
|
|
179
|
-
};
|
|
180
|
-
|
|
181
|
-
return json;
|
|
182
|
-
}
|
|
183
|
-
|
|
184
173
|
static name = "FrameSubstitution";
|
|
185
174
|
|
|
186
175
|
static fromJSON(json, context) {
|
|
@@ -164,17 +164,6 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
164
164
|
return replacementReferenceValidates;
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
-
toJSON() {
|
|
168
|
-
const { name } = this.constructor,
|
|
169
|
-
string = this.getString(),
|
|
170
|
-
json = {
|
|
171
|
-
name,
|
|
172
|
-
string
|
|
173
|
-
};
|
|
174
|
-
|
|
175
|
-
return json;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
167
|
static name = "ReferenceSubstitution";
|
|
179
168
|
|
|
180
169
|
static fromJSON(json, context) {
|
|
@@ -319,17 +319,6 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
319
319
|
}
|
|
320
320
|
}
|
|
321
321
|
|
|
322
|
-
toJSON() {
|
|
323
|
-
const { name } = this.constructor,
|
|
324
|
-
string = this.getString(),
|
|
325
|
-
json = {
|
|
326
|
-
name,
|
|
327
|
-
string
|
|
328
|
-
};
|
|
329
|
-
|
|
330
|
-
return json;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
322
|
static name = "StatementSubstitution";
|
|
334
323
|
|
|
335
324
|
static fromJSON(json, context) {
|
|
@@ -179,17 +179,6 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
179
179
|
return replacementTermValidates;
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
-
toJSON() {
|
|
183
|
-
const { name } = this.constructor,
|
|
184
|
-
string = this.getString(),
|
|
185
|
-
json = {
|
|
186
|
-
name,
|
|
187
|
-
string
|
|
188
|
-
};
|
|
189
|
-
|
|
190
|
-
return json;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
182
|
static name = "TermSubstitution";
|
|
194
183
|
|
|
195
184
|
static fromJSON(json, context) {
|
|
@@ -165,4 +165,15 @@ export default class Substitution extends Element {
|
|
|
165
165
|
|
|
166
166
|
return resolved;
|
|
167
167
|
}
|
|
168
|
+
|
|
169
|
+
toJSON() {
|
|
170
|
+
const { name } = this.constructor,
|
|
171
|
+
string = this.getString(),
|
|
172
|
+
json = {
|
|
173
|
+
name,
|
|
174
|
+
string
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
return json;
|
|
178
|
+
}
|
|
168
179
|
}
|
package/src/utilities/element.js
CHANGED
|
@@ -123,12 +123,12 @@ export function frameFromFrameNode(frameNode, context) {
|
|
|
123
123
|
const { Frame } = elements,
|
|
124
124
|
node = frameNode, ///
|
|
125
125
|
string = context.nodeAsString(node),
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
reference = referenceFromFrameNode(frameNode, context),
|
|
127
|
+
assumptions = assumptionsFromFrameNode(frameNode, context);
|
|
128
128
|
|
|
129
129
|
context = null;
|
|
130
130
|
|
|
131
|
-
const frame = new Frame(context, string, node,
|
|
131
|
+
const frame = new Frame(context, string, node, reference, assumptions);
|
|
132
132
|
|
|
133
133
|
return frame;
|
|
134
134
|
}
|
|
@@ -532,6 +532,19 @@ export function metatheoremFromMetatheoremNode(metatheoremNode, context) {
|
|
|
532
532
|
return metatheorem;
|
|
533
533
|
}
|
|
534
534
|
|
|
535
|
+
export function referencesFromMetavariableNode(metavariableNode, context) {
|
|
536
|
+
const { Reference } = elements,
|
|
537
|
+
node = metavariableNode, ///
|
|
538
|
+
string = context.nodeAsString(node),
|
|
539
|
+
metavariable = metavariableFromMetavariableNode(metavariableNode, context);
|
|
540
|
+
|
|
541
|
+
context = null;
|
|
542
|
+
|
|
543
|
+
const reference = new Reference(context, string, node, metavariable);
|
|
544
|
+
|
|
545
|
+
return reference
|
|
546
|
+
}
|
|
547
|
+
|
|
535
548
|
export function metavariableFromMetavariableNode(metavariableNode, context) {
|
|
536
549
|
const { Metavariable } = elements,
|
|
537
550
|
node = metavariableNode, ///
|
|
@@ -953,6 +966,18 @@ export function conclusionFromRuleNode(ruleNode, context) {
|
|
|
953
966
|
return conclusion;
|
|
954
967
|
}
|
|
955
968
|
|
|
969
|
+
export function referenceFromFrameNode(frameNode, context) {
|
|
970
|
+
let reference = null;
|
|
971
|
+
|
|
972
|
+
const metavariableNode = frameNode.getMetavariableNode();
|
|
973
|
+
|
|
974
|
+
if (metavariableNode !== null) {
|
|
975
|
+
reference = referencesFromMetavariableNode(metavariableNode, context);
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
return reference;
|
|
979
|
+
}
|
|
980
|
+
|
|
956
981
|
export function theoremFromSectionNode(sectionNode, context) {
|
|
957
982
|
let theorem = null;
|
|
958
983
|
|