occam-verify-cli 1.0.956 → 1.0.973
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/bounded.js +11 -7
- package/lib/context.js +17 -5
- package/lib/element/assertion/signature.js +17 -19
- package/lib/element/assertion/subproof.js +36 -39
- package/lib/element/assertion/type.js +20 -1
- package/lib/element/assumption/metaLevel.js +18 -17
- package/lib/element/assumption.js +52 -3
- package/lib/element/combinator.js +10 -12
- package/lib/element/conclusion.js +33 -33
- package/lib/element/constructor.js +7 -11
- package/lib/element/deduction.js +33 -33
- package/lib/element/equivalence.js +11 -7
- package/lib/element/hypothesis.js +45 -19
- package/lib/element/judgement.js +1 -1
- package/lib/element/label.js +9 -11
- package/lib/element/proofAssertion/premise.js +98 -87
- package/lib/element/proofAssertion/step.js +27 -27
- package/lib/element/proofAssertion/supposition.js +99 -88
- package/lib/element/proofAssertion.js +3 -3
- package/lib/element/reference.js +30 -38
- package/lib/element/signature.js +38 -47
- package/lib/element/statement.js +18 -58
- package/lib/element/substitution/frame.js +34 -42
- package/lib/element/substitution/reference.js +12 -13
- package/lib/element/substitution/statement.js +26 -31
- package/lib/element/substitution/term.js +32 -37
- package/lib/element/term.js +2 -2
- package/lib/element/topLevelAssertion/axiom.js +33 -34
- package/lib/element/topLevelAssertion.js +30 -7
- package/lib/element/topLevelMetaAssertion.js +2 -2
- package/lib/process/discharge.js +38 -0
- package/lib/process/unification.js +228 -0
- package/lib/process/unify.js +9 -5
- package/lib/process/validation.js +291 -0
- package/lib/utilities/context.js +69 -105
- package/lib/utilities/element.js +2 -4
- package/lib/utilities/string.js +4 -4
- package/package.json +1 -1
- package/src/context/bounded.js +19 -7
- package/src/context.js +26 -6
- package/src/element/assertion/signature.js +21 -26
- package/src/element/assertion/subproof.js +43 -45
- package/src/element/assertion/type.js +30 -1
- package/src/element/assumption/metaLevel.js +26 -22
- package/src/element/assumption.js +80 -2
- package/src/element/combinator.js +11 -14
- package/src/element/conclusion.js +38 -37
- package/src/element/constructor.js +8 -13
- package/src/element/deduction.js +38 -37
- package/src/element/equivalence.js +17 -13
- package/src/element/hypothesis.js +59 -19
- package/src/element/judgement.js +1 -1
- package/src/element/label.js +10 -12
- package/src/element/proofAssertion/premise.js +123 -107
- package/src/element/proofAssertion/step.js +29 -29
- package/src/element/proofAssertion/supposition.js +124 -108
- package/src/element/proofAssertion.js +2 -2
- package/src/element/reference.js +36 -47
- package/src/element/signature.js +42 -53
- package/src/element/statement.js +18 -89
- package/src/element/substitution/frame.js +45 -58
- package/src/element/substitution/reference.js +13 -16
- package/src/element/substitution/statement.js +27 -34
- package/src/element/substitution/term.js +37 -46
- package/src/element/term.js +1 -1
- package/src/element/topLevelAssertion/axiom.js +43 -45
- package/src/element/topLevelAssertion.js +42 -6
- package/src/element/topLevelMetaAssertion.js +2 -2
- package/src/process/discharge.js +33 -0
- package/src/{utilities → process}/unification.js +21 -27
- package/src/process/unify.js +9 -5
- package/src/{utilities → process}/validation.js +2 -2
- package/src/utilities/context.js +77 -128
- package/src/utilities/element.js +2 -5
- package/src/utilities/string.js +6 -6
- package/lib/context/ephemeral.js +0 -28
- package/lib/context/synoptic.js +0 -255
- package/lib/utilities/unification.js +0 -233
- package/lib/utilities/validation.js +0 -291
- package/src/context/ephemeral.js +0 -17
- package/src/context/synoptic.js +0 -361
|
@@ -6,7 +6,7 @@ import { define } from "../../elements";
|
|
|
6
6
|
import { instantiateSupposition} from "../../process/instantiate";
|
|
7
7
|
import { procedureCallFromSuppositionNode } from "../../utilities/element";
|
|
8
8
|
import { breakPointFromJSON, breakPointToBreakPointJSON } from "../../utilities/breakPoint";
|
|
9
|
-
import {
|
|
9
|
+
import { declare, attempt, reconcile, serialise, unserialise, instantiate } from "../../utilities/context";
|
|
10
10
|
|
|
11
11
|
export default define(class Supposition extends ProofAssertion {
|
|
12
12
|
constructor(context, string, node, breakPoint, statement, procedureCall) {
|
|
@@ -26,6 +26,31 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
26
26
|
return suppositionNode;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
+
getStatementNode() {
|
|
30
|
+
const suppositionNode = this.getSuppositionNode(),
|
|
31
|
+
statementNode = suppositionNode.getStatementNode();
|
|
32
|
+
|
|
33
|
+
return statementNode;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
findSubproofAssertion() {
|
|
37
|
+
let subproofAssertion = null;
|
|
38
|
+
|
|
39
|
+
const statementNode = this.getStatementNode();
|
|
40
|
+
|
|
41
|
+
if (statementNode !== null) {
|
|
42
|
+
const subproofAssertionNode = statementNode.getSubproofAssertionNode();
|
|
43
|
+
|
|
44
|
+
if (subproofAssertionNode !== null) {
|
|
45
|
+
const context = this.getContext();
|
|
46
|
+
|
|
47
|
+
subproofAssertion = context.findAssertionByAssertionNode(subproofAssertionNode);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
return subproofAssertion;
|
|
52
|
+
}
|
|
53
|
+
|
|
29
54
|
async verify(context) {
|
|
30
55
|
let verifies = false;
|
|
31
56
|
|
|
@@ -39,11 +64,13 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
39
64
|
procedureCall = this.getProcedureCall();
|
|
40
65
|
|
|
41
66
|
if ((statement !== null) || (procedureCall !== null)) {
|
|
42
|
-
|
|
67
|
+
declare((context) => {
|
|
68
|
+
const validates = this.validate(context);
|
|
43
69
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
70
|
+
if (validates) {
|
|
71
|
+
verifies = true;
|
|
72
|
+
}
|
|
73
|
+
}, context);
|
|
47
74
|
} else {
|
|
48
75
|
context.debug(`Unable to validate the '${suppositionString}' supposition because it is nonsense.`);
|
|
49
76
|
}
|
|
@@ -58,31 +85,29 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
58
85
|
|
|
59
86
|
context.trace(`Validatting the '${suppositionString}' supposition...`);
|
|
60
87
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
procedureCall = this.getProcedureCall();
|
|
88
|
+
attempt((context) => {
|
|
89
|
+
const statement = this.getStatement(),
|
|
90
|
+
procedureCall = this.getProcedureCall();
|
|
65
91
|
|
|
66
|
-
|
|
67
|
-
|
|
92
|
+
if (statement !== null) {
|
|
93
|
+
const statementValidates = this.validateStatement(context);
|
|
68
94
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
}
|
|
95
|
+
if (statementValidates) {
|
|
96
|
+
validates = true;
|
|
72
97
|
}
|
|
98
|
+
}
|
|
73
99
|
|
|
74
|
-
|
|
75
|
-
|
|
100
|
+
if (procedureCall !== null) {
|
|
101
|
+
const procedureCallValidates = this.validateProcedureCall(context);
|
|
76
102
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}
|
|
103
|
+
if (procedureCallValidates) {
|
|
104
|
+
validates = true;
|
|
80
105
|
}
|
|
106
|
+
}
|
|
81
107
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
}, context);
|
|
108
|
+
if (validates) {
|
|
109
|
+
this.commit(context);
|
|
110
|
+
}
|
|
86
111
|
}, context);
|
|
87
112
|
|
|
88
113
|
if (validates) {
|
|
@@ -166,77 +191,60 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
166
191
|
|
|
167
192
|
context.trace(`Unifying the '${suppositionString}' supposition independently...`);
|
|
168
193
|
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
if (statement !== null) {
|
|
173
|
-
const specificContext = context; ///
|
|
174
|
-
|
|
175
|
-
context = this.getContext();
|
|
194
|
+
await reconcile(async (context) => {
|
|
195
|
+
const statement = this.getStatement(),
|
|
196
|
+
procedureCall = this.getProcedureCall();
|
|
176
197
|
|
|
177
|
-
|
|
198
|
+
if (statement !== null) {
|
|
199
|
+
const suppositionContext = this.getContext(),
|
|
200
|
+
generalContext = suppositionContext, ///
|
|
201
|
+
specificContext = context, ///
|
|
202
|
+
statementUnifiesIndependently = statement.unifyIndependently(generalContext, specificContext);
|
|
178
203
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
if (statementUnifiesIndependently) {
|
|
184
|
-
unifiesIndependently = true;
|
|
204
|
+
if (statementUnifiesIndependently) {
|
|
205
|
+
unifiesIndependently = true;
|
|
206
|
+
}
|
|
185
207
|
}
|
|
186
|
-
}
|
|
187
208
|
|
|
188
|
-
|
|
189
|
-
|
|
209
|
+
if (procedureCall !== null) {
|
|
210
|
+
const procedureCallResolvedIndependently = await procedureCall.unifyIndependently(context);
|
|
190
211
|
|
|
191
|
-
|
|
192
|
-
|
|
212
|
+
if (procedureCallResolvedIndependently) {
|
|
213
|
+
unifiesIndependently = true;
|
|
214
|
+
}
|
|
193
215
|
}
|
|
194
|
-
}
|
|
216
|
+
}, context);
|
|
195
217
|
|
|
196
218
|
if (unifiesIndependently) {
|
|
197
|
-
context.debug(`...unified the '${suppositionString}' supposition
|
|
219
|
+
context.debug(`...unified the '${suppositionString}' supposition independently.`);
|
|
198
220
|
}
|
|
199
221
|
|
|
200
222
|
return unifiesIndependently;
|
|
201
223
|
}
|
|
202
224
|
|
|
203
|
-
|
|
204
|
-
let
|
|
225
|
+
unifySubproof(subproof, context) {
|
|
226
|
+
let subproofUnifies = false;
|
|
205
227
|
|
|
206
228
|
const suppositionString = this.getString(), ///
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
context.trace(`Unifying the '${subproofOrProofAssertionString}' subproof or proof assertion with the '${suppositionString}' supposition...`);
|
|
229
|
+
subproofString = subproof.getString();
|
|
210
230
|
|
|
211
|
-
|
|
212
|
-
proofAssertion = subproofOrProofAssertionProofAssertion ?
|
|
213
|
-
subproofOrProofAssertion :
|
|
214
|
-
null,
|
|
215
|
-
subproof = subproofOrProofAssertionProofAssertion ?
|
|
216
|
-
null :
|
|
217
|
-
subproofOrProofAssertion;
|
|
218
|
-
|
|
219
|
-
if (proofAssertion !== null) {
|
|
220
|
-
const proofAssertionUnifies = this.unifyProofAssertion(proofAssertion, context);
|
|
231
|
+
context.trace(`Unifying the '${subproofString}' subproof with the '${suppositionString}' supposition...`);
|
|
221
232
|
|
|
222
|
-
|
|
223
|
-
subproofOrProofAssertionUnifies = true;
|
|
224
|
-
}
|
|
225
|
-
}
|
|
233
|
+
const subproofAssertion = this.findSubproofAssertion();
|
|
226
234
|
|
|
227
|
-
if (
|
|
228
|
-
const
|
|
235
|
+
if (subproofAssertion !== null) {
|
|
236
|
+
const suppositionContext = this.getContext(),
|
|
237
|
+
generalContext = suppositionContext, ///
|
|
238
|
+
spsecfiicContext = context; ///
|
|
229
239
|
|
|
230
|
-
|
|
231
|
-
subproofOrProofAssertionUnifies = true;
|
|
232
|
-
}
|
|
240
|
+
subproofUnifies = subproofAssertion.unifySubproof(subproof, generalContext, spsecfiicContext);
|
|
233
241
|
}
|
|
234
242
|
|
|
235
|
-
if (
|
|
236
|
-
context.debug(`...unified the '${
|
|
243
|
+
if (subproofUnifies) {
|
|
244
|
+
context.debug(`...unified the '${subproofString}' subproof with the '${suppositionString}' supposition.`);
|
|
237
245
|
}
|
|
238
246
|
|
|
239
|
-
return
|
|
247
|
+
return subproofUnifies;
|
|
240
248
|
}
|
|
241
249
|
|
|
242
250
|
unifyProofAssertion(proofAssertion, context) {
|
|
@@ -248,22 +256,20 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
248
256
|
context.trace(`Unifying the '${proofAssertionString}' proof assertion with the '${suppositionString}' supposition...`);
|
|
249
257
|
|
|
250
258
|
const proofAssertionContext = proofAssertion.getContext(),
|
|
251
|
-
suppositionContext = this.getContext(),
|
|
259
|
+
suppositionContext = this.getContext(), ///
|
|
252
260
|
generalContext = suppositionContext, ///
|
|
253
|
-
specificContext = proofAssertionContext;
|
|
261
|
+
specificContext = proofAssertionContext; ///
|
|
254
262
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
statementUnifies = this.unifyStatement(statement, generalContext, specificContext);
|
|
263
|
+
reconcile((specificContext) => {
|
|
264
|
+
const statement = proofAssertion.getStatement(),
|
|
265
|
+
statementUnifies = this.unifyStatement(statement, generalContext, specificContext);
|
|
259
266
|
|
|
260
|
-
|
|
261
|
-
|
|
267
|
+
if (statementUnifies) {
|
|
268
|
+
specificContext.commit(context);
|
|
262
269
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
}, specificContext, context);
|
|
270
|
+
proofAssertionUnifies = true;
|
|
271
|
+
}
|
|
272
|
+
}, specificContext);
|
|
267
273
|
|
|
268
274
|
if (proofAssertionUnifies) {
|
|
269
275
|
context.debug(`...unified the '${proofAssertionString}' proof assertion with the '${suppositionString}' supposition.`);
|
|
@@ -272,39 +278,49 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
272
278
|
return proofAssertionUnifies;
|
|
273
279
|
}
|
|
274
280
|
|
|
275
|
-
|
|
276
|
-
let
|
|
277
|
-
|
|
278
|
-
const subproofString = subproof.getString(),
|
|
279
|
-
suppositionString = this.getString();
|
|
281
|
+
unifySubproofOrProofAssertion(subproofOrProofAssertion, context) {
|
|
282
|
+
let subproofOrProofAssertionUnifies;
|
|
280
283
|
|
|
281
|
-
|
|
284
|
+
const suppositionString = this.getString(), ///
|
|
285
|
+
subproofOrProofAssertionString = subproofOrProofAssertion.getString();
|
|
282
286
|
|
|
283
|
-
|
|
287
|
+
context.trace(`Unifying the '${subproofOrProofAssertionString}' subproof or proof assertion with the '${suppositionString}' supposition...`);
|
|
284
288
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
289
|
+
const subproofOrProofAssertionProofAssertion = subproofOrProofAssertion.isProofAssertion(),
|
|
290
|
+
proofAssertion = subproofOrProofAssertionProofAssertion ?
|
|
291
|
+
subproofOrProofAssertion :
|
|
292
|
+
null,
|
|
293
|
+
subproof = subproofOrProofAssertionProofAssertion ?
|
|
294
|
+
null :
|
|
295
|
+
subproofOrProofAssertion;
|
|
288
296
|
|
|
289
|
-
|
|
290
|
-
|
|
297
|
+
reconcile((context) => {
|
|
298
|
+
if (proofAssertion !== null) {
|
|
299
|
+
const proofAssertionUnifies = this.unifyProofAssertion(proofAssertion, context);
|
|
291
300
|
|
|
292
|
-
|
|
301
|
+
if (proofAssertionUnifies) {
|
|
302
|
+
subproofOrProofAssertionUnifies = true;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
293
305
|
|
|
294
|
-
|
|
295
|
-
|
|
306
|
+
if (subproof !== null) {
|
|
307
|
+
const subproofUnifies = this.unifySubproof(subproof, context);
|
|
296
308
|
|
|
297
|
-
|
|
309
|
+
if (subproofUnifies) {
|
|
310
|
+
subproofOrProofAssertionUnifies = true;
|
|
311
|
+
}
|
|
312
|
+
}
|
|
298
313
|
|
|
299
|
-
|
|
314
|
+
if (subproofOrProofAssertionUnifies) {
|
|
315
|
+
context.commit();
|
|
300
316
|
}
|
|
301
|
-
}
|
|
317
|
+
}, context);
|
|
302
318
|
|
|
303
|
-
if (
|
|
304
|
-
context.debug(`...unified the '${
|
|
319
|
+
if (subproofOrProofAssertionUnifies) {
|
|
320
|
+
context.debug(`...unified the '${subproofOrProofAssertionString}' subproof or proof assertion with the '${suppositionString}' supposition.`);
|
|
305
321
|
}
|
|
306
322
|
|
|
307
|
-
return
|
|
323
|
+
return subproofOrProofAssertionUnifies;
|
|
308
324
|
}
|
|
309
325
|
|
|
310
326
|
toJSON() {
|
|
@@ -336,8 +352,8 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
336
352
|
static fromJSON(json, context) {
|
|
337
353
|
let supposition;
|
|
338
354
|
|
|
339
|
-
|
|
340
|
-
|
|
355
|
+
instantiate((context) => {
|
|
356
|
+
unserialise((json, context) => {
|
|
341
357
|
const { string } = json,
|
|
342
358
|
suppositionNode = instantiateSupposition(string, context),
|
|
343
359
|
node = suppositionNode, ///
|
|
@@ -346,8 +362,8 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
346
362
|
procedureCall = procedureCallFromSuppositionNode(suppositionNode, context);
|
|
347
363
|
|
|
348
364
|
supposition = new Supposition(context, string, node, breakPoint, statement, procedureCall);
|
|
349
|
-
}, context);
|
|
350
|
-
},
|
|
365
|
+
}, json, context);
|
|
366
|
+
}, context);
|
|
351
367
|
|
|
352
368
|
return supposition;
|
|
353
369
|
}
|
|
@@ -60,12 +60,12 @@ export default class ProofAssertion extends Element {
|
|
|
60
60
|
statementString = statement.getString(),
|
|
61
61
|
proofAssertionString = this.getString(); ///
|
|
62
62
|
|
|
63
|
-
context.trace(`Unifying the '${statementString}' statement with the '${proofAssertionString}' proof assertion...`);
|
|
63
|
+
context.trace(`Unifying the '${statementString}' statement with the '${proofAssertionString}' proof assertion's statement...`);
|
|
64
64
|
|
|
65
65
|
statementUnifies = this.statement.unifyStatement(statement, generalContext, specificContext);
|
|
66
66
|
|
|
67
67
|
if (statementUnifies) {
|
|
68
|
-
context.debug(`...unified the '${statementString}' statement with the '${proofAssertionString}' proof assertion.`);
|
|
68
|
+
context.debug(`...unified the '${statementString}' statement with the '${proofAssertionString}' proof assertion's statement.`);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
|
package/src/element/reference.js
CHANGED
|
@@ -6,7 +6,7 @@ import { define } from "../elements";
|
|
|
6
6
|
import { instantiateReference } from "../process/instantiate";
|
|
7
7
|
import { REFERENCE_META_TYPE_NAME } from "../metaTypeNames";
|
|
8
8
|
import { breakPointFromJSON, breakPointToBreakPointJSON } from "../utilities/breakPoint";
|
|
9
|
-
import {
|
|
9
|
+
import { ablate, attempt, serialise, reconcile, unserialise, instantiate } from "../utilities/context";
|
|
10
10
|
import { referenceFromReferenceNode, metavariableFromReferenceNode, topLevelMetaAssertionFromReferenceNode } from "../utilities/element";
|
|
11
11
|
|
|
12
12
|
export default define(class Reference extends Element {
|
|
@@ -38,6 +38,8 @@ export default define(class Reference extends Element {
|
|
|
38
38
|
return metavariableNode;
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
getMetaType() { return this.metavariable.getMetaType(); }
|
|
42
|
+
|
|
41
43
|
isEqualTo(reference) {
|
|
42
44
|
const referenceNode = reference.getNode(),
|
|
43
45
|
referenceNodeMatches = this.matchReferenceNode(referenceNode),
|
|
@@ -125,7 +127,7 @@ export default define(class Reference extends Element {
|
|
|
125
127
|
|
|
126
128
|
context.debug(`...the '${referenceString}' reference is already valid.`);
|
|
127
129
|
} else {
|
|
128
|
-
const
|
|
130
|
+
const temporaryContext = context; ///
|
|
129
131
|
|
|
130
132
|
context = this.getContext();
|
|
131
133
|
|
|
@@ -133,21 +135,14 @@ export default define(class Reference extends Element {
|
|
|
133
135
|
const metavariableValidates = this.validateMetavariable(context);
|
|
134
136
|
|
|
135
137
|
if (metavariableValidates) {
|
|
136
|
-
const
|
|
137
|
-
referenceMetaType = context.findMetaTypeByMetaTypeName(referenceMetaTypeName),
|
|
138
|
-
metaType = this.metavariable.getMetaType();
|
|
138
|
+
const metaType = this.metavariable.getMetaType();
|
|
139
139
|
|
|
140
140
|
if (metaType === null) {
|
|
141
|
-
|
|
142
|
-
labelPresent = context.isLabelPresentByReference(reference, context);
|
|
143
|
-
|
|
144
|
-
if (labelPresent) {
|
|
145
|
-
validates = true;
|
|
146
|
-
} else {
|
|
147
|
-
context.debug(`There is no label for the '${referenceString}' reference.`);
|
|
148
|
-
}
|
|
141
|
+
validates = true;
|
|
149
142
|
} else {
|
|
150
|
-
const
|
|
143
|
+
const referenceMetaTypeName = REFERENCE_META_TYPE_NAME,
|
|
144
|
+
referenceMetaType = context.findMetaTypeByMetaTypeName(referenceMetaTypeName),
|
|
145
|
+
metavariableMetaTypeEqualToReferenceMetaType = this.metavariable.isMetaTypeEqualTo(referenceMetaType);
|
|
151
146
|
|
|
152
147
|
if (metavariableMetaTypeEqualToReferenceMetaType) {
|
|
153
148
|
validates = true;
|
|
@@ -166,7 +161,7 @@ export default define(class Reference extends Element {
|
|
|
166
161
|
}
|
|
167
162
|
}, context);
|
|
168
163
|
|
|
169
|
-
context =
|
|
164
|
+
context = temporaryContext; ///
|
|
170
165
|
|
|
171
166
|
if (validates) {
|
|
172
167
|
reference = this; ///
|
|
@@ -212,11 +207,9 @@ export default define(class Reference extends Element {
|
|
|
212
207
|
|
|
213
208
|
context.trace(`Unifying the '${labelString}' label with the '${referenceString}' reference...`);
|
|
214
209
|
|
|
215
|
-
const
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
const specificContext = context; ///
|
|
210
|
+
const labelContext = label.getContext(),
|
|
211
|
+
generalContext = context, ///
|
|
212
|
+
specificContext = labelContext; ///
|
|
220
213
|
|
|
221
214
|
reconcile((specificContext) => {
|
|
222
215
|
const metavariable = label.getMetavariable(),
|
|
@@ -260,33 +253,31 @@ export default define(class Reference extends Element {
|
|
|
260
253
|
let topLevelMetaAssertionUUnifies = false;
|
|
261
254
|
|
|
262
255
|
const label = topLevelMetaAssertion.getLabel(),
|
|
263
|
-
labelContext = label.getContext(),
|
|
264
256
|
referenceString = this.getString(), ///
|
|
265
|
-
referenceContext = this.getContext(), ///
|
|
266
257
|
topLevelMetaAssertionString = topLevelMetaAssertion.getString();
|
|
267
258
|
|
|
268
|
-
context.trace(`Unifying the '${topLevelMetaAssertionString}' top level meta-assertion with the '${referenceString}' reference...`);
|
|
259
|
+
context.trace(`Unifying the '${topLevelMetaAssertionString}' top level meta-assertion's label with the '${referenceString}' reference...`);
|
|
269
260
|
|
|
270
|
-
const
|
|
261
|
+
const labelContext = label.getContext(),
|
|
262
|
+
referenceContext = this.getContext(), ///
|
|
263
|
+
generalContext = referenceContext, ///
|
|
271
264
|
specificContext = labelContext; ///
|
|
272
265
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
metavariableUnifies = this.unifyMetavariable(metavariable, generalContext, specificContext);
|
|
266
|
+
reconcile((specificContext) => {
|
|
267
|
+
const metavariable = label.getMetavariable(),
|
|
268
|
+
metavariableUnifies = this.unifyMetavariable(metavariable, generalContext, specificContext);
|
|
277
269
|
|
|
278
|
-
|
|
279
|
-
|
|
270
|
+
if (metavariableUnifies) {
|
|
271
|
+
this.topLevelMetaAssertion = topLevelMetaAssertion;
|
|
280
272
|
|
|
281
|
-
|
|
273
|
+
specificContext.commit(context);
|
|
282
274
|
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
}, specificContext, context);
|
|
275
|
+
topLevelMetaAssertionUUnifies = true;
|
|
276
|
+
}
|
|
277
|
+
}, specificContext);
|
|
287
278
|
|
|
288
279
|
if (topLevelMetaAssertionUUnifies) {
|
|
289
|
-
context.debug(`...unified the '${topLevelMetaAssertionString}' top level meta-assertion with the '${referenceString}' reference.`);
|
|
280
|
+
context.debug(`...unified the '${topLevelMetaAssertionString}' top level meta-assertion's label with the '${referenceString}' reference.`);
|
|
290
281
|
}
|
|
291
282
|
|
|
292
283
|
return topLevelMetaAssertionUUnifies;
|
|
@@ -321,8 +312,8 @@ export default define(class Reference extends Element {
|
|
|
321
312
|
static fromJSON(json, context) {
|
|
322
313
|
let reference;
|
|
323
314
|
|
|
324
|
-
|
|
325
|
-
|
|
315
|
+
instantiate((context) => {
|
|
316
|
+
unserialise((json, context) => {
|
|
326
317
|
const { string } = json,
|
|
327
318
|
referenceNode = instantiateReference(string, context),
|
|
328
319
|
node = referenceNode, ///
|
|
@@ -331,8 +322,8 @@ export default define(class Reference extends Element {
|
|
|
331
322
|
topLevelMetaAssertion = topLevelMetaAssertionFromReferenceNode(referenceNode, context);
|
|
332
323
|
|
|
333
324
|
reference = new Reference(context, string, node, breakPoint, metavariable, topLevelMetaAssertion);
|
|
334
|
-
}, context);
|
|
335
|
-
},
|
|
325
|
+
}, json, context);
|
|
326
|
+
}, context);
|
|
336
327
|
|
|
337
328
|
return reference;
|
|
338
329
|
}
|
|
@@ -340,14 +331,12 @@ export default define(class Reference extends Element {
|
|
|
340
331
|
static fromReferenceString(referenceString, context) {
|
|
341
332
|
let reference;
|
|
342
333
|
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
referenceNode = instantiateReference(string, context);
|
|
334
|
+
ablate((context) => {
|
|
335
|
+
instantiate((context) => {
|
|
336
|
+
const string = referenceString, ///
|
|
337
|
+
referenceNode = instantiateReference(string, context);
|
|
348
338
|
|
|
349
|
-
|
|
350
|
-
}, context);
|
|
339
|
+
reference = referenceFromReferenceNode(referenceNode, context);
|
|
351
340
|
}, context);
|
|
352
341
|
}, context);
|
|
353
342
|
|