occam-verify-cli 1.0.871 → 1.0.873
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/mnemic.js +21 -121
- package/lib/element/assumption.js +7 -5
- package/lib/element/metavariable.js +5 -26
- package/lib/element/reference.js +3 -19
- package/lib/element/statement.js +8 -10
- package/lib/element/substitution/frame.js +8 -7
- package/lib/element/substitution/reference.js +7 -7
- package/lib/element/substitution/statement.js +5 -3
- package/lib/element/substitution/term.js +8 -6
- package/lib/process/unify.js +32 -32
- package/lib/utilities/context.js +25 -13
- package/lib/utilities/json.js +8 -4
- package/lib/utilities/validation.js +2 -2
- package/package.json +4 -4
- package/src/context/mnemic.js +10 -160
- package/src/element/assumption.js +7 -5
- package/src/element/metavariable.js +5 -36
- package/src/element/reference.js +3 -28
- package/src/element/statement.js +8 -10
- package/src/element/substitution/frame.js +9 -6
- package/src/element/substitution/reference.js +7 -7
- package/src/element/substitution/statement.js +7 -3
- package/src/element/substitution/term.js +10 -5
- package/src/process/unify.js +49 -49
- package/src/utilities/context.js +29 -13
- package/src/utilities/json.js +10 -6
- package/src/utilities/validation.js +2 -4
package/src/context/mnemic.js
CHANGED
|
@@ -175,260 +175,110 @@ export default class MnemicContext extends Context {
|
|
|
175
175
|
|
|
176
176
|
addTerm(term) {
|
|
177
177
|
const context = this, ///
|
|
178
|
-
termA = term, ///
|
|
179
178
|
termString = term.getString();
|
|
180
179
|
|
|
181
180
|
context.trace(`Adding the '${termString}' term to the mnemic context...`);
|
|
182
181
|
|
|
183
|
-
|
|
184
|
-
termB = terms.find((term) => {
|
|
185
|
-
const termB = term, ///
|
|
186
|
-
termAComparesToTermB = termA.compareTerm(termB);
|
|
187
|
-
|
|
188
|
-
if (termAComparesToTermB) {
|
|
189
|
-
return true;
|
|
190
|
-
}
|
|
191
|
-
}) || null;
|
|
192
|
-
|
|
193
|
-
if (termB !== null) {
|
|
194
|
-
context.trace(`The '${termString}' term has already been added to the mnemic context.`);
|
|
195
|
-
} else {
|
|
196
|
-
this.terms.push(term);
|
|
197
|
-
}
|
|
182
|
+
this.terms.push(term);
|
|
198
183
|
|
|
199
184
|
context.debug(`...added the '${termString}' term to the mnemic context.`);
|
|
200
185
|
}
|
|
201
186
|
|
|
202
187
|
addFrame(frame) {
|
|
203
188
|
const context = this, ///
|
|
204
|
-
frameA = frame, ///
|
|
205
189
|
frameString = frame.getString();
|
|
206
190
|
|
|
207
191
|
context.trace(`Adding the '${frameString}' frame to the mnemic context...`);
|
|
208
192
|
|
|
209
|
-
|
|
210
|
-
frameB = frames.find((frame) => {
|
|
211
|
-
const frameB = frame, ///
|
|
212
|
-
frameAEqualToFrameB = frameA.isEqualTo(frameB);
|
|
213
|
-
|
|
214
|
-
if (frameAEqualToFrameB) {
|
|
215
|
-
return true;
|
|
216
|
-
}
|
|
217
|
-
}) || null;
|
|
218
|
-
|
|
219
|
-
if (frameB !== null) {
|
|
220
|
-
context.trace(`The '${frameString}' frame has already been added to the mnemic context.`);
|
|
221
|
-
} else {
|
|
222
|
-
this.frames.push(frame);
|
|
223
|
-
}
|
|
193
|
+
this.frames.push(frame);
|
|
224
194
|
|
|
225
195
|
context.debug(`...added the '${frameString}' frame to the mnemic context.`);
|
|
226
196
|
}
|
|
227
197
|
|
|
228
198
|
addEquality(equality) {
|
|
229
199
|
const context = this, ///
|
|
230
|
-
equalityA = equality, ///
|
|
231
200
|
equalityString = equality.getString();
|
|
232
201
|
|
|
233
202
|
context.trace(`Adding the '${equalityString}' equality to the mnemic context...`);
|
|
234
203
|
|
|
235
|
-
|
|
236
|
-
equalityB = equalities.find((equality) => {
|
|
237
|
-
const equalityB = equality, ///
|
|
238
|
-
equalityAEqualToEqualityB = equalityA.isEqualTo(equalityB);
|
|
239
|
-
|
|
240
|
-
if (equalityAEqualToEqualityB) {
|
|
241
|
-
return true;
|
|
242
|
-
}
|
|
243
|
-
}) || null;
|
|
244
|
-
|
|
245
|
-
if (equalityB !== null) {
|
|
246
|
-
context.trace(`The '${equalityString}' equality has already been added to the mnemic context.`);
|
|
247
|
-
} else {
|
|
248
|
-
this.equalities.push(equality);
|
|
249
|
-
}
|
|
204
|
+
this.equalities.push(equality);
|
|
250
205
|
|
|
251
206
|
context.debug(`...added the '${equalityString}' equality to the mnemic context.`);
|
|
252
207
|
}
|
|
253
208
|
|
|
254
209
|
addJudgement(judgement) {
|
|
255
210
|
const context = this, ///
|
|
256
|
-
judgementA = judgement, ///
|
|
257
211
|
judgementString = judgement.getString();
|
|
258
212
|
|
|
259
213
|
context.trace(`Adding the '${judgementString}' judgement to the mnemic context...`);
|
|
260
214
|
|
|
261
|
-
|
|
262
|
-
judgementB = judgements.find((judgement) => {
|
|
263
|
-
const judgementB = judgement, ///
|
|
264
|
-
judgementAEqualToEqualityB = judgementA.isEqualTo(judgementB);
|
|
265
|
-
|
|
266
|
-
if (judgementAEqualToEqualityB) {
|
|
267
|
-
return true;
|
|
268
|
-
}
|
|
269
|
-
}) || null;
|
|
270
|
-
|
|
271
|
-
if (judgementB !== null) {
|
|
272
|
-
context.trace(`The '${judgementString}' judgement has already been added to the mnemic context.`);
|
|
273
|
-
} else {
|
|
274
|
-
this.judgements.push(judgement);
|
|
275
|
-
}
|
|
215
|
+
this.judgements.push(judgement);
|
|
276
216
|
|
|
277
217
|
context.debug(`...added the '${judgementString}' judgement to the mnemic context.`);
|
|
278
218
|
}
|
|
279
219
|
|
|
280
220
|
addStatement(statement) {
|
|
281
221
|
const context = this, ///
|
|
282
|
-
statementA = statement, ///
|
|
283
222
|
statementString = statement.getString();
|
|
284
223
|
|
|
285
224
|
context.trace(`Adding the '${statementString}' statement to the mnemic context...`);
|
|
286
225
|
|
|
287
|
-
|
|
288
|
-
statementB = statements.find((statement) => {
|
|
289
|
-
const statementB = statement, ///
|
|
290
|
-
statementAEqualToStatementB = statementA.isEqualTo(statementB);
|
|
291
|
-
|
|
292
|
-
if (statementAEqualToStatementB) {
|
|
293
|
-
return true;
|
|
294
|
-
}
|
|
295
|
-
}) || null;
|
|
296
|
-
|
|
297
|
-
if (statementB !== null) {
|
|
298
|
-
context.trace(`The '${statementString}' statement has already been added to the mnemic context.`);
|
|
299
|
-
} else {
|
|
300
|
-
this.statements.push(statement);
|
|
301
|
-
}
|
|
226
|
+
this.statements.push(statement);
|
|
302
227
|
|
|
303
228
|
context.debug(`...added the '${statementString}' statement to the mnemic context.`);
|
|
304
229
|
}
|
|
305
230
|
|
|
306
231
|
addAssertion(assertion) {
|
|
307
232
|
const context = this, ///
|
|
308
|
-
assertionA = assertion, ///
|
|
309
233
|
assertionString = assertion.getString();
|
|
310
234
|
|
|
311
235
|
context.trace(`Adding the '${assertionString}' assertion to the mnemic context...`);
|
|
312
236
|
|
|
313
|
-
|
|
314
|
-
assertionB = assertions.find((assertion) => {
|
|
315
|
-
const assertionB = assertion, ///
|
|
316
|
-
assertionAEqualToAssertionB = assertionA.isEqualTo(assertionB);
|
|
317
|
-
|
|
318
|
-
if (assertionAEqualToAssertionB) {
|
|
319
|
-
return true;
|
|
320
|
-
}
|
|
321
|
-
}) || null;
|
|
322
|
-
|
|
323
|
-
if (assertionB !== null) {
|
|
324
|
-
context.trace(`The '${assertionString}' assertion has already been added to the mnemic context.`);
|
|
325
|
-
} else {
|
|
326
|
-
this.assertions.push(assertion);
|
|
327
|
-
}
|
|
237
|
+
this.assertions.push(assertion);
|
|
328
238
|
|
|
329
239
|
context.debug(`...added the '${assertionString}' assertion to the mnemic context.`);
|
|
330
240
|
}
|
|
331
241
|
|
|
332
242
|
addReference(reference) {
|
|
333
243
|
const context = this, ///
|
|
334
|
-
referenceA = reference, ///
|
|
335
244
|
referenceString = reference.getString();
|
|
336
245
|
|
|
337
246
|
context.trace(`Adding the '${referenceString}' reference to the mnemic context...`);
|
|
338
247
|
|
|
339
|
-
|
|
340
|
-
referenceB = references.find((reference) => {
|
|
341
|
-
const referenceB = reference, ///
|
|
342
|
-
referenceAEqualToReferenceB = referenceA.isEqualTo(referenceB);
|
|
343
|
-
|
|
344
|
-
if (referenceAEqualToReferenceB) {
|
|
345
|
-
return true;
|
|
346
|
-
}
|
|
347
|
-
}) || null;
|
|
348
|
-
|
|
349
|
-
if (referenceB !== null) {
|
|
350
|
-
context.trace(`The '${referenceString}' reference has already been added to the mnemic context.`);
|
|
351
|
-
} else {
|
|
352
|
-
this.references.push(reference);
|
|
353
|
-
}
|
|
248
|
+
this.references.push(reference);
|
|
354
249
|
|
|
355
250
|
context.debug(`...added the '${referenceString}' reference to the mnemic context.`);
|
|
356
251
|
}
|
|
357
252
|
|
|
358
253
|
addAssumption(assumption) {
|
|
359
254
|
const context = this, ///
|
|
360
|
-
assumptionA = assumption, ///
|
|
361
255
|
assumptionString = assumption.getString();
|
|
362
256
|
|
|
363
257
|
context.trace(`Adding the '${assumptionString}' assumption to the mnemic context...`);
|
|
364
258
|
|
|
365
|
-
|
|
366
|
-
assumptionB = assumptions.find((assumption) => {
|
|
367
|
-
const assumptionB = assumption, ///
|
|
368
|
-
assumptionAEqualToAssumptionB = assumptionA.isEqualTo(assumptionB);
|
|
369
|
-
|
|
370
|
-
if (assumptionAEqualToAssumptionB) {
|
|
371
|
-
return true;
|
|
372
|
-
}
|
|
373
|
-
}) || null;
|
|
374
|
-
|
|
375
|
-
if (assumptionB !== null) {
|
|
376
|
-
context.trace(`The '${assumptionString}' assumption has already been added to the mnemic context.`);
|
|
377
|
-
} else {
|
|
378
|
-
this.assumptions.push(assumption);
|
|
379
|
-
}
|
|
259
|
+
this.assumptions.push(assumption);
|
|
380
260
|
|
|
381
261
|
context.debug(`...added the '${assumptionString}' assumption to the mnemic context.`);
|
|
382
262
|
}
|
|
383
263
|
|
|
384
264
|
addMetavariable(metavariable) {
|
|
385
265
|
const context = this, ///
|
|
386
|
-
metavariableA = metavariable, ///
|
|
387
266
|
metavariableString = metavariable.getString();
|
|
388
267
|
|
|
389
268
|
context.trace(`Adding the '${metavariableString}' metavariable to the mnemic context...`);
|
|
390
269
|
|
|
391
|
-
|
|
392
|
-
metavariableB = metavariables.find((metavariable) => {
|
|
393
|
-
const metavariableB = metavariable, ///
|
|
394
|
-
metavariableAEqualToSubstitutionB = metavariableA.isEqualTo(metavariableB);
|
|
395
|
-
|
|
396
|
-
if (metavariableAEqualToSubstitutionB) {
|
|
397
|
-
return true;
|
|
398
|
-
}
|
|
399
|
-
}) || null;
|
|
400
|
-
|
|
401
|
-
if (metavariableB !== null) {
|
|
402
|
-
context.trace(`The '${metavariableString}' metavariable has already been added to the mnemic context.`);
|
|
403
|
-
} else {
|
|
404
|
-
this.metavariables.push(metavariable);
|
|
405
|
-
}
|
|
270
|
+
this.metavariables.push(metavariable);
|
|
406
271
|
|
|
407
272
|
context.debug(`...added the '${metavariableString}' metavariable to the mnemic context.`);
|
|
408
273
|
}
|
|
409
274
|
|
|
410
275
|
addSubstitution(substitution) {
|
|
411
276
|
const context = this, ///
|
|
412
|
-
substitutionA = substitution, ///
|
|
413
277
|
substitutionString = substitution.getString();
|
|
414
278
|
|
|
415
279
|
context.trace(`Adding the '${substitutionString}' substitution to the mnemic context...`);
|
|
416
280
|
|
|
417
|
-
|
|
418
|
-
substitutionB = substitutions.find((substitution) => {
|
|
419
|
-
const substitutionB = substitution, ///
|
|
420
|
-
substitutionAEqualToSubstitutionB = substitutionA.isEqualTo(substitutionB);
|
|
421
|
-
|
|
422
|
-
if (substitutionAEqualToSubstitutionB) {
|
|
423
|
-
return true;
|
|
424
|
-
}
|
|
425
|
-
}) || null;
|
|
426
|
-
|
|
427
|
-
if (substitutionB !== null) {
|
|
428
|
-
context.trace(`The '${substitutionString}' substitution has already been added to the mnemic context.`);
|
|
429
|
-
} else {
|
|
430
|
-
this.substitutions.push(substitution);
|
|
431
|
-
}
|
|
281
|
+
this.substitutions.push(substitution);
|
|
432
282
|
|
|
433
283
|
context.debug(`...added the '${substitutionString}' substitution to the mnemic context.`);
|
|
434
284
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import { Element } from "occam-languages";
|
|
4
4
|
|
|
5
5
|
import { define } from "../elements";
|
|
6
|
-
import {
|
|
6
|
+
import {instantiate, reconcile} from "../utilities/context";
|
|
7
7
|
import { instantiateAssumption } from "../process/instantiate";
|
|
8
8
|
|
|
9
9
|
export default define(class Assumption extends Element {
|
|
@@ -209,11 +209,13 @@ export default define(class Assumption extends Element {
|
|
|
209
209
|
|
|
210
210
|
context.trace(`Unifying the '${topLevelMetaAssertionString}' top level meta-assertion with the '${assumptionString}' assumption...`);
|
|
211
211
|
|
|
212
|
-
|
|
212
|
+
reconcile((context) => {
|
|
213
|
+
topLevelMetaAssertionUnifies = this.reference.unifyTopLevelMetaAssertion(topLevelMetaAssertion, context);
|
|
213
214
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
215
|
+
if (topLevelMetaAssertionUnifies) {
|
|
216
|
+
topLevelMetaAssertionUnifies = this.statement.unifyTopLevelMetaAssertion(topLevelMetaAssertion, context);
|
|
217
|
+
}
|
|
218
|
+
}, context);
|
|
217
219
|
|
|
218
220
|
if (topLevelMetaAssertionUnifies) {
|
|
219
221
|
context.trace(`...unified the '${topLevelMetaAssertionString}' top level meta-assertion with the '${assumptionString}' assumption...`);
|
|
@@ -514,18 +514,6 @@ export default define(class Metavariable extends Element {
|
|
|
514
514
|
|
|
515
515
|
if (metavariableNodeMatches) {
|
|
516
516
|
frameMetavariableUnifies = true;
|
|
517
|
-
} else {
|
|
518
|
-
const frameSingular = frame.isSingular();
|
|
519
|
-
|
|
520
|
-
if (frameSingular) {
|
|
521
|
-
const frameMetavariableName = frame.getMetavariableName(),
|
|
522
|
-
frameDeclaredMetavariable = context.findDeclaredMetavariableByMetavariableName(frameMetavariableName),
|
|
523
|
-
frameMetavariableUnifiesIntrinsically = this.unifyMetavariableIntrinsically(frameDeclaredMetavariable, generalContext, specificContext);
|
|
524
|
-
|
|
525
|
-
if (frameMetavariableUnifiesIntrinsically) {
|
|
526
|
-
frameMetavariableUnifies = true;
|
|
527
|
-
}
|
|
528
|
-
}
|
|
529
517
|
}
|
|
530
518
|
}
|
|
531
519
|
|
|
@@ -549,18 +537,11 @@ export default define(class Metavariable extends Element {
|
|
|
549
537
|
specificContextFilePath = specificContext.getFilePath();
|
|
550
538
|
|
|
551
539
|
if (generalContextFilePath === specificContextFilePath) {
|
|
552
|
-
const
|
|
553
|
-
|
|
540
|
+
const metavariableNode = this.getMetavariableNode(),
|
|
541
|
+
metavariableNodeMatches = reference.matchMetavariableNode(metavariableNode);
|
|
554
542
|
|
|
555
|
-
if (
|
|
543
|
+
if (metavariableNodeMatches) {
|
|
556
544
|
referenceMetavariableUnifies = true;
|
|
557
|
-
} else {
|
|
558
|
-
const referenceMetavariable = reference.getMetavariable(),
|
|
559
|
-
referenceMetavariableUnifiesIntrinsically = this.unifyMetavariableIntrinsically(referenceMetavariable, generalContext, specificContext);
|
|
560
|
-
|
|
561
|
-
if (referenceMetavariableUnifiesIntrinsically) {
|
|
562
|
-
referenceMetavariableUnifies = true;
|
|
563
|
-
}
|
|
564
545
|
}
|
|
565
546
|
}
|
|
566
547
|
|
|
@@ -585,22 +566,10 @@ export default define(class Metavariable extends Element {
|
|
|
585
566
|
|
|
586
567
|
if (generalContextFilePath === specificContextFilePath) {
|
|
587
568
|
const metavariableNode = this.getMetavariableNode(),
|
|
588
|
-
|
|
569
|
+
metavariableNodeMatches = statement.matchMetavariableNode(metavariableNode);
|
|
589
570
|
|
|
590
|
-
if (
|
|
571
|
+
if (metavariableNodeMatches) {
|
|
591
572
|
statementMetavariableUnifies = true;
|
|
592
|
-
} else {
|
|
593
|
-
const statementSingular = statement.isSingular();
|
|
594
|
-
|
|
595
|
-
if (statementSingular) {
|
|
596
|
-
const statementMetavariableName = statement.getMetavariableName(),
|
|
597
|
-
statementDeclaredMetavariable = context.findDeclaredMetavariableByMetavariableName(statementMetavariableName),
|
|
598
|
-
statementMetavariableUnifiesIntrinsically = this.unifyMetavariableIntrinsically(statementDeclaredMetavariable, generalContext, specificContext);
|
|
599
|
-
|
|
600
|
-
if (statementMetavariableUnifiesIntrinsically) {
|
|
601
|
-
statementMetavariableUnifies = true;
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
573
|
}
|
|
605
574
|
}
|
|
606
575
|
|
package/src/element/reference.js
CHANGED
|
@@ -76,26 +76,6 @@ export default define(class Reference extends Element {
|
|
|
76
76
|
return comparesToParamter;
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
compareMetavariable(metavariable) {
|
|
80
|
-
let comparesToMetavariable = false;
|
|
81
|
-
|
|
82
|
-
let metavariableName;
|
|
83
|
-
|
|
84
|
-
metavariableName = this.metavariable.getName();
|
|
85
|
-
|
|
86
|
-
const metavariableNameA = metavariableName ///
|
|
87
|
-
|
|
88
|
-
metavariableName = metavariable.getName();
|
|
89
|
-
|
|
90
|
-
const metavariableNameB = metavariableName; ///
|
|
91
|
-
|
|
92
|
-
if (metavariableNameA === metavariableNameB) {
|
|
93
|
-
comparesToMetavariable = true;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return comparesToMetavariable;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
79
|
compareTopLevelMetaAssertion(topLevelMetaAssertion) {
|
|
100
80
|
let topLevelMetaAssertionCompares = false;
|
|
101
81
|
|
|
@@ -274,18 +254,13 @@ export default define(class Reference extends Element {
|
|
|
274
254
|
const label = topLevelMetaAssertion.getLabel(),
|
|
275
255
|
labelContext = label.getContext(),
|
|
276
256
|
referenceString = this.getString(), ///
|
|
277
|
-
|
|
257
|
+
referenceContext = this.getContext(), ///
|
|
278
258
|
topLevelMetaAssertionString = topLevelMetaAssertion.getString();
|
|
279
259
|
|
|
280
260
|
context.trace(`Unifying the '${topLevelMetaAssertionString}' top level meta-assertion with the '${referenceString}' reference...`);
|
|
281
261
|
|
|
282
|
-
const
|
|
283
|
-
|
|
284
|
-
context = this.getContext();
|
|
285
|
-
|
|
286
|
-
const generalContext = context; ///
|
|
287
|
-
|
|
288
|
-
context = temporaryContext; ///
|
|
262
|
+
const generalContext = referenceContext, ///
|
|
263
|
+
specificContext = labelContext; ///
|
|
289
264
|
|
|
290
265
|
join((specificContext) => {
|
|
291
266
|
reconcile((specificContext) => {
|
package/src/element/statement.js
CHANGED
|
@@ -6,7 +6,7 @@ import { define } from "../elements";
|
|
|
6
6
|
import { unifyStatement } from "../process/unify";
|
|
7
7
|
import { validateStatements } from "../utilities/validation";
|
|
8
8
|
import { instantiateStatement } from "../process/instantiate";
|
|
9
|
-
import {
|
|
9
|
+
import { reconcile, instantiate } from "../utilities/context";
|
|
10
10
|
|
|
11
11
|
export default define(class Statement extends Element {
|
|
12
12
|
getStatementNode() {
|
|
@@ -257,17 +257,15 @@ export default define(class Statement extends Element {
|
|
|
257
257
|
const generalContext = context, ///
|
|
258
258
|
specificContext = deductionContext; ///
|
|
259
259
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
const deductionStatementUnifies = this.unifyStatement(deductionStatement, generalContext, specificContext);
|
|
260
|
+
reconcile((specificContext) => {
|
|
261
|
+
const deductionStatementUnifies = this.unifyStatement(deductionStatement, generalContext, specificContext);
|
|
263
262
|
|
|
264
|
-
|
|
265
|
-
|
|
263
|
+
if (deductionStatementUnifies) {
|
|
264
|
+
specificContext.commit(context);
|
|
266
265
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
}, specificContext, context);
|
|
266
|
+
deductionUnifies = true;
|
|
267
|
+
}
|
|
268
|
+
}, specificContext);
|
|
271
269
|
|
|
272
270
|
if (deductionUnifies) {
|
|
273
271
|
context.debug(`...unified the '${deductionString}' deduction with the '${statementString}' statement.`);
|
|
@@ -208,15 +208,18 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
208
208
|
return frameSubstitutionn;
|
|
209
209
|
}
|
|
210
210
|
|
|
211
|
-
static fromStatement(statement,
|
|
211
|
+
static fromStatement(statement, context) {
|
|
212
212
|
let frameSubstitution = null;
|
|
213
213
|
|
|
214
214
|
const frameSubstitutionNode = statement.getFrameSubstitutionNode();
|
|
215
215
|
|
|
216
216
|
if (frameSubstitutionNode !== null) {
|
|
217
|
-
|
|
217
|
+
ablate((context) => {
|
|
218
|
+
const generalContext = context, ///
|
|
219
|
+
specificContext = context; ///
|
|
220
|
+
|
|
218
221
|
frameSubstitution = frameSubstitutionFromFrameSubstitutionNode(frameSubstitutionNode, generalContext, specificContext);
|
|
219
|
-
},
|
|
222
|
+
}, context);
|
|
220
223
|
}
|
|
221
224
|
|
|
222
225
|
return frameSubstitution;
|
|
@@ -225,9 +228,9 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
225
228
|
static fromFrameAndMetavariable(frame, metavariable, generalContext, specificContext) {
|
|
226
229
|
let frameSubstitution
|
|
227
230
|
|
|
228
|
-
|
|
231
|
+
ablates((generalContext, specificContext) => {
|
|
232
|
+
const context = specificContext; ///
|
|
229
233
|
|
|
230
|
-
ablate((context) => {
|
|
231
234
|
instantiate((context) => {
|
|
232
235
|
const specificContext = context, ///
|
|
233
236
|
frameSubstitutionString = frameSubstitutionStringFromFrameAndMetavariable(frame, metavariable),
|
|
@@ -236,7 +239,7 @@ export default define(class FrameSubstitution extends Substitution {
|
|
|
236
239
|
|
|
237
240
|
frameSubstitution = frameSubstitutionFromFrameSubstitutionNode(frameSubstitutionNode, generalContext, specificContext);
|
|
238
241
|
}, context);
|
|
239
|
-
},
|
|
242
|
+
}, generalContext, specificContext);
|
|
240
243
|
|
|
241
244
|
return frameSubstitution;
|
|
242
245
|
}
|
|
@@ -5,7 +5,7 @@ import Substitution from "../substitution";
|
|
|
5
5
|
import { define } from "../../elements";
|
|
6
6
|
import { instantiateReferenceSubstitution } from "../../process/instantiate";
|
|
7
7
|
import { referenceSubstitutionFromReferenceSubstitutionNode } from "../../utilities/element";
|
|
8
|
-
import {
|
|
8
|
+
import { ablates, attempts, descend, instantiate, unserialises } from "../../utilities/context";
|
|
9
9
|
import { referenceSubstitutionStringFromReferenceAndMetavariable } from "../../utilities/string";
|
|
10
10
|
|
|
11
11
|
export default define(class ReferenceSubstitution extends Substitution {
|
|
@@ -216,9 +216,9 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
216
216
|
static fromReferenceAndMetavariable(reference, metavariable, generalContext, specificContext) {
|
|
217
217
|
let referenceSubstitution;
|
|
218
218
|
|
|
219
|
-
|
|
219
|
+
ablates((generalContext, specificContext) => {
|
|
220
|
+
const context = specificContext; ///
|
|
220
221
|
|
|
221
|
-
ablate((context) => {
|
|
222
222
|
instantiate((context) => {
|
|
223
223
|
const specificContext = context, ///
|
|
224
224
|
referenceSubstitutionString = referenceSubstitutionStringFromReferenceAndMetavariable(reference, metavariable),
|
|
@@ -227,7 +227,7 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
227
227
|
|
|
228
228
|
referenceSubstitution = referenceSubstitutionFromReferenceSubstitutionNode(referenceSubstitutionNode, generalContext, specificContext);
|
|
229
229
|
}, context);
|
|
230
|
-
},
|
|
230
|
+
}, generalContext, specificContext);
|
|
231
231
|
|
|
232
232
|
return referenceSubstitution;
|
|
233
233
|
}
|
|
@@ -235,9 +235,9 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
235
235
|
static fromAssumptionAndMetaLevelAssumption(assumption, metaLevelAssumption, generalContext, specificContext) {
|
|
236
236
|
let referenceSubstitution;
|
|
237
237
|
|
|
238
|
-
|
|
238
|
+
ablates((generalContext, specificContext) => {
|
|
239
|
+
const context = specificContext; ///
|
|
239
240
|
|
|
240
|
-
ablate((context) => {
|
|
241
241
|
instantiate((context) => {
|
|
242
242
|
const specificContext = context, ///
|
|
243
243
|
metavariable = assumption.getMetavariable(),
|
|
@@ -248,7 +248,7 @@ export default define(class ReferenceSubstitution extends Substitution {
|
|
|
248
248
|
|
|
249
249
|
referenceSubstitution = referenceSubstitutionFromReferenceSubstitutionNode(referenceSubstitutionNode, generalContext, specificContext);
|
|
250
250
|
}, context);
|
|
251
|
-
},
|
|
251
|
+
}, generalContext, specificContext);
|
|
252
252
|
|
|
253
253
|
return referenceSubstitution;
|
|
254
254
|
}
|
|
@@ -7,7 +7,7 @@ import { unifySubstitution } from "../../process/unify";
|
|
|
7
7
|
import { stripBracketsFromStatement } from "../../utilities/brackets";
|
|
8
8
|
import { instantiateStatementSubstitution } from "../../process/instantiate";
|
|
9
9
|
import { statementSubstitutionFromStatementSubstitutionNode } from "../../utilities/element";
|
|
10
|
-
import { join, ablate, attempts, descend, reconcile, instantiate, unserialises } from "../../utilities/context";
|
|
10
|
+
import { join, ablate, ablates, attempts, descend, reconcile, instantiate, unserialises } from "../../utilities/context";
|
|
11
11
|
import { statementSubstitutionStringFromStatementAndMetavariable, statementSubstitutionStringFromStatementMetavariableAndSubstitution } from "../../utilities/string";
|
|
12
12
|
|
|
13
13
|
export default define(class StatementSubstitution extends Substitution {
|
|
@@ -380,16 +380,20 @@ export default define(class StatementSubstitution extends Substitution {
|
|
|
380
380
|
|
|
381
381
|
let statementSubstitution;
|
|
382
382
|
|
|
383
|
-
|
|
383
|
+
ablates((generalContext, specificContext) => {
|
|
384
|
+
const context = specificContext; ///
|
|
385
|
+
|
|
384
386
|
instantiate((context) => {
|
|
385
387
|
const specificContext = context, ///
|
|
386
388
|
statementSubstitutionString = statementSubstitutionStringFromStatementAndMetavariable(statement, metavariable),
|
|
387
389
|
string = statementSubstitutionString, ///
|
|
388
390
|
statementSubstitutionNode = instantiateStatementSubstitution(string, context);
|
|
389
391
|
|
|
392
|
+
generalContext.gainTokens(specificContext);
|
|
393
|
+
|
|
390
394
|
statementSubstitution = statementSubstitutionFromStatementSubstitutionNode(statementSubstitutionNode, generalContext, specificContext);
|
|
391
395
|
}, context);
|
|
392
|
-
},
|
|
396
|
+
}, generalContext, specificContext);
|
|
393
397
|
|
|
394
398
|
return statementSubstitution;
|
|
395
399
|
}
|
|
@@ -219,15 +219,18 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
219
219
|
return termSubstitutionn;
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
-
static fromStatement(statement,
|
|
222
|
+
static fromStatement(statement, context) {
|
|
223
223
|
let termSubstitution = null;
|
|
224
224
|
|
|
225
225
|
const termSubstitutionNode = statement.getTermSubstitutionNode();
|
|
226
226
|
|
|
227
227
|
if (termSubstitutionNode !== null) {
|
|
228
|
-
|
|
228
|
+
ablate((context) => {
|
|
229
|
+
const generalContext = context, ///
|
|
230
|
+
specificContext = context; ///
|
|
231
|
+
|
|
229
232
|
termSubstitution = termSubstitutionFromTermSubstitutionNode(termSubstitutionNode, generalContext, specificContext);
|
|
230
|
-
},
|
|
233
|
+
}, context);
|
|
231
234
|
}
|
|
232
235
|
|
|
233
236
|
return termSubstitution;
|
|
@@ -240,7 +243,9 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
240
243
|
|
|
241
244
|
let termSubstitution;
|
|
242
245
|
|
|
243
|
-
|
|
246
|
+
ablates((generalContext, specificContext) => {
|
|
247
|
+
const context = specificContext; ///
|
|
248
|
+
|
|
244
249
|
instantiate((context) => {
|
|
245
250
|
const specificContext = context, ///
|
|
246
251
|
termSubstitutionString = termSubstitutionStringFromTermAndVariable(term, variable),
|
|
@@ -249,7 +254,7 @@ export default define(class TermSubstitution extends Substitution {
|
|
|
249
254
|
|
|
250
255
|
termSubstitution = termSubstitutionFromTermSubstitutionNode(termSubstitutionNode, generalContext, specificContext);
|
|
251
256
|
}, context);
|
|
252
|
-
},
|
|
257
|
+
}, generalContext, specificContext);
|
|
253
258
|
|
|
254
259
|
return termSubstitution;
|
|
255
260
|
}
|