occam-nominal 1.0.307 → 1.0.310
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 +2 -2
- package/lib/element/assertion/contained.js +5 -8
- package/lib/element/assertion/subproof.js +12 -15
- package/lib/element/combinator/bracketed.js +2 -2
- package/lib/element/combinator.js +2 -2
- package/lib/element/declaration/combinator.js +3 -3
- package/lib/element/declaration/metavariable.js +2 -2
- package/lib/element/declaration/variable.js +4 -4
- package/lib/element/deduction.js +5 -6
- package/lib/element/derivation.js +3 -3
- package/lib/element/equality.js +3 -4
- package/lib/element/frame.js +5 -5
- package/lib/element/goal.js +5 -8
- package/lib/element/judgement.js +4 -5
- package/lib/element/label.js +5 -6
- package/lib/element/metavariable.js +67 -67
- package/lib/element/procedureCall.js +25 -25
- package/lib/element/proofAssertion/premise.js +26 -19
- package/lib/element/proofAssertion/step.js +5 -5
- package/lib/element/proofAssertion/supposition.js +4 -5
- package/lib/element/proofAssertion.js +6 -13
- package/lib/element/rule.js +13 -13
- package/lib/element/statement.js +5 -5
- package/lib/element/subDerivation.js +3 -3
- package/lib/element/subproof.js +6 -6
- package/lib/element/substitution/frame.js +3 -5
- package/lib/element/substitution/term.js +3 -5
- package/lib/element/term.js +22 -22
- package/lib/element/topLevelAssertion.js +5 -5
- package/lib/pass/continuationZip.js +2 -2
- package/lib/process/unify.js +9 -9
- package/lib/process/validate.js +9 -9
- package/lib/process/validation.js +5 -5
- package/lib/process/verify.js +18 -18
- package/lib/utilities/compression.js +137 -0
- package/lib/utilities/continuation.js +5 -5
- package/package.json +3 -3
- package/src/context/file/nominal.js +1 -1
- package/src/element/assertion/contained.js +4 -10
- package/src/element/assertion/subproof.js +11 -17
- package/src/element/combinator/bracketed.js +1 -1
- package/src/element/combinator.js +1 -1
- package/src/element/declaration/combinator.js +2 -2
- package/src/element/declaration/metavariable.js +1 -1
- package/src/element/declaration/variable.js +3 -3
- package/src/element/deduction.js +4 -6
- package/src/element/derivation.js +2 -2
- package/src/element/equality.js +2 -4
- package/src/element/frame.js +4 -4
- package/src/element/goal.js +4 -10
- package/src/element/judgement.js +4 -6
- package/src/element/label.js +4 -6
- package/src/element/metavariable.js +79 -80
- package/src/element/procedureCall.js +28 -29
- package/src/element/proofAssertion/premise.js +32 -23
- package/src/element/proofAssertion/step.js +5 -5
- package/src/element/proofAssertion/supposition.js +5 -5
- package/src/element/proofAssertion.js +7 -19
- package/src/element/rule.js +12 -12
- package/src/element/statement.js +6 -4
- package/src/element/subDerivation.js +2 -2
- package/src/element/subproof.js +5 -5
- package/src/element/substitution/frame.js +4 -6
- package/src/element/substitution/term.js +4 -6
- package/src/element/term.js +25 -27
- package/src/element/topLevelAssertion.js +4 -4
- package/src/pass/continuationZip.js +1 -1
- package/src/process/unify.js +8 -9
- package/src/process/validate.js +8 -8
- package/src/process/validation.js +4 -4
- package/src/process/verify.js +17 -17
- package/src/utilities/compression.js +115 -0
- package/src/utilities/continuation.js +4 -4
|
@@ -106,14 +106,14 @@ export default define(class Metavariable extends Element {
|
|
|
106
106
|
return comparesToMetavariableName;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
|
|
109
|
+
verify(context) {
|
|
110
110
|
let verifies = false;
|
|
111
111
|
|
|
112
112
|
const metavariableString = this.getString(); ///
|
|
113
113
|
|
|
114
114
|
context.trace(`Verifying the '${metavariableString}' metavariable...`);
|
|
115
115
|
|
|
116
|
-
const termVerifies =
|
|
116
|
+
const termVerifies = this.verifyTerm(context);
|
|
117
117
|
|
|
118
118
|
if (termVerifies) {
|
|
119
119
|
const typeVerifies = this.verifyType(context);
|
|
@@ -328,56 +328,61 @@ export default define(class Metavariable extends Element {
|
|
|
328
328
|
continuation(typeValidates);
|
|
329
329
|
}
|
|
330
330
|
|
|
331
|
-
unifyFrame(frame, generalContext, specificContext) {
|
|
332
|
-
let frameUnifies = false;
|
|
333
|
-
|
|
331
|
+
unifyFrame(frame, generalContext, specificContext, continuation) {
|
|
334
332
|
const context = specificContext, ///
|
|
335
333
|
frameString = frame.getString(),
|
|
336
334
|
metavariableString = this.getString(); ///
|
|
337
335
|
|
|
338
336
|
context.trace(`Unifying the '${frameString}' frame with the '${metavariableString}' metavariable...`);
|
|
339
337
|
|
|
338
|
+
const frameMetavariablCompares = this.compareFraemMetavaraible(frame, generalContext, specificContext);
|
|
339
|
+
|
|
340
|
+
if (frameMetavariablCompares) {
|
|
341
|
+
const frameUnifies = true;
|
|
342
|
+
|
|
343
|
+
return continuation(frameUnifies);
|
|
344
|
+
}
|
|
345
|
+
|
|
340
346
|
const metavariable = this, ///
|
|
341
|
-
|
|
347
|
+
metavariableNode = metavariable.getNode(),
|
|
348
|
+
derivedSubstitution = context.findDerivedSubstitutionByMetavariableNode(metavariableNode);
|
|
342
349
|
|
|
343
|
-
if (
|
|
344
|
-
frameUnifies =
|
|
345
|
-
} else {
|
|
346
|
-
const metavariableNode = metavariable.getNode(),
|
|
347
|
-
derivedSubstitution = context.findDerivedSubstitutionByMetavariableNode(metavariableNode);
|
|
350
|
+
if (derivedSubstitution !== null) {
|
|
351
|
+
let frameUnifies = false;
|
|
348
352
|
|
|
349
|
-
|
|
350
|
-
const derivedSubstitutionFrameComparesToFrame = derivedSubstitution.compareFrame(frame, context);
|
|
353
|
+
const derivedSubstitutionFrameComparesToFrame = derivedSubstitution.compareFrame(frame, context);
|
|
351
354
|
|
|
352
|
-
|
|
353
|
-
|
|
355
|
+
if (derivedSubstitutionFrameComparesToFrame) {
|
|
356
|
+
const derivedSubstitutionString = derivedSubstitution.getString();
|
|
354
357
|
|
|
355
|
-
|
|
358
|
+
context.trace(`The '${derivedSubstitutionString}' derived substitution is already present.`);
|
|
356
359
|
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
} else {
|
|
360
|
-
const { FrameSubstitution } = elements;
|
|
360
|
+
frameUnifies = true;
|
|
361
|
+
}
|
|
361
362
|
|
|
362
|
-
|
|
363
|
+
return continuation(frameUnifies);
|
|
364
|
+
}
|
|
363
365
|
|
|
364
|
-
|
|
366
|
+
const { FrameSubstitution } = elements,
|
|
367
|
+
frameSubstitution = FrameSubstitution.fromFrameAndMetavariable(frame, metavariable, generalContext, specificContext);
|
|
365
368
|
|
|
366
|
-
|
|
369
|
+
frameSubstitution.validate(context, (frameSubstitution) => {
|
|
370
|
+
let frameUnifies = false;
|
|
367
371
|
|
|
372
|
+
if (frameSubstitution !== null) {
|
|
368
373
|
const derivedSubstitution = frameSubstitution; ///
|
|
369
374
|
|
|
370
375
|
context.addDerivedSubstitution(derivedSubstitution);
|
|
371
376
|
|
|
372
377
|
frameUnifies = true;
|
|
373
378
|
}
|
|
374
|
-
}
|
|
375
379
|
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
380
|
+
if (frameUnifies) {
|
|
381
|
+
context.debug(`...unified the '${frameString}' frame with the '${metavariableString}' metavariable.`);
|
|
382
|
+
}
|
|
379
383
|
|
|
380
|
-
|
|
384
|
+
return continuation(frameUnifies);
|
|
385
|
+
});
|
|
381
386
|
}
|
|
382
387
|
|
|
383
388
|
unifyStatement(statement, substitution, generalContext, specificContext, continuation) {
|
|
@@ -390,13 +395,11 @@ export default define(class Metavariable extends Element {
|
|
|
390
395
|
|
|
391
396
|
context.trace(`Unifying the '${statementString}' statement with the '${metavariableString}${substitutionString}' metavariable...`);
|
|
392
397
|
|
|
393
|
-
this.
|
|
394
|
-
if (
|
|
398
|
+
this.compareStatementMetavariable(statement, generalContext, specificContext, (statementMetavariableCompares) => {
|
|
399
|
+
if (statementMetavariableCompares) {
|
|
395
400
|
const statementUnifies = true;
|
|
396
401
|
|
|
397
|
-
continuation(statementUnifies);
|
|
398
|
-
|
|
399
|
-
return;
|
|
402
|
+
return continuation(statementUnifies);
|
|
400
403
|
}
|
|
401
404
|
|
|
402
405
|
const metavariable = this, ///
|
|
@@ -418,9 +421,7 @@ export default define(class Metavariable extends Element {
|
|
|
418
421
|
statementUnifies = true;
|
|
419
422
|
}
|
|
420
423
|
|
|
421
|
-
continuation(statementUnifies);
|
|
422
|
-
|
|
423
|
-
return;
|
|
424
|
+
return continuation(statementUnifies);
|
|
424
425
|
}
|
|
425
426
|
|
|
426
427
|
const { StatementSubstitution } = elements,
|
|
@@ -439,7 +440,7 @@ export default define(class Metavariable extends Element {
|
|
|
439
440
|
context.debug(`...unified the '${statementString}' statement with the '${metavariableString}${substitutionString}' metavariable.`);
|
|
440
441
|
}
|
|
441
442
|
|
|
442
|
-
continuation(statementUnifies);
|
|
443
|
+
return continuation(statementUnifies);
|
|
443
444
|
});
|
|
444
445
|
});
|
|
445
446
|
}
|
|
@@ -454,9 +455,9 @@ export default define(class Metavariable extends Element {
|
|
|
454
455
|
context.trace(`Unifying the '${referenceString}' reference with the '${metavariableString}' metavariable...`);
|
|
455
456
|
|
|
456
457
|
const metavariable = this, ///
|
|
457
|
-
|
|
458
|
+
referenceMetavariableCompares = this.compareReferenceMetavariable(reference, generalContext, specificContext);
|
|
458
459
|
|
|
459
|
-
if (
|
|
460
|
+
if (referenceMetavariableCompares) {
|
|
460
461
|
referenceUnifies = true;
|
|
461
462
|
} else {
|
|
462
463
|
const metavariableNode = metavariable.getNode(),
|
|
@@ -517,14 +518,32 @@ export default define(class Metavariable extends Element {
|
|
|
517
518
|
return metavariableUnifies;
|
|
518
519
|
}
|
|
519
520
|
|
|
520
|
-
|
|
521
|
-
|
|
521
|
+
unifyMetavariableIntrinsically(metavariable, generalContext, specificContext, continuation) {
|
|
522
|
+
const context = specificContext, ///
|
|
523
|
+
generalMetavariable = this, ///
|
|
524
|
+
specificMetavariable = metavariable,
|
|
525
|
+
generalMetavariableString = generalMetavariable.getString(), ///
|
|
526
|
+
specificMetavariableString = specificMetavariable.getString();
|
|
527
|
+
|
|
528
|
+
context.trace(`Unifying the '${specificMetavariableString}' metavariable with the '${generalMetavariableString}' metavariable intrinsically...`);
|
|
529
|
+
|
|
530
|
+
unifyMetavariableIntrinsically(generalMetavariable, specificMetavariable, generalContext, specificContext, (metavariableUnifiesIntrinsically) => {
|
|
531
|
+
if (metavariableUnifiesIntrinsically) {
|
|
532
|
+
context.debug(`...unified the '${specificMetavariableString}' metavariable with the '${generalMetavariableString}' metavariable intrinsically.`);
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
return continuation(metavariableUnifiesIntrinsically);
|
|
536
|
+
});
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
compareFraemMetavaraible(frame, generalContext, specificContext) {
|
|
540
|
+
let frameMetavariablCompares = false;
|
|
522
541
|
|
|
523
542
|
const context = specificContext, ///
|
|
524
543
|
frameString = frame.getString(),
|
|
525
544
|
metavariableString = this.getString(); ///
|
|
526
545
|
|
|
527
|
-
context.trace(`
|
|
546
|
+
context.trace(`Comparing the '${frameString}' frame's metavariable to the '${metavariableString}' metavariable...`);
|
|
528
547
|
|
|
529
548
|
const generalContextFilePath = generalContext.getFilePath(),
|
|
530
549
|
specificContextFilePath = specificContext.getFilePath();
|
|
@@ -534,25 +553,25 @@ export default define(class Metavariable extends Element {
|
|
|
534
553
|
metavariableNodeMatches = frame.matchMetavariableNode(metavariableNode);
|
|
535
554
|
|
|
536
555
|
if (metavariableNodeMatches) {
|
|
537
|
-
|
|
556
|
+
frameMetavariablCompares = true;
|
|
538
557
|
}
|
|
539
558
|
}
|
|
540
559
|
|
|
541
|
-
if (
|
|
542
|
-
context.debug(`...
|
|
560
|
+
if (frameMetavariablCompares) {
|
|
561
|
+
context.debug(`...compared the '${frameString}' frame's metavariable to the '${metavariableString}' metavariable.`);
|
|
543
562
|
}
|
|
544
563
|
|
|
545
|
-
return
|
|
564
|
+
return frameMetavariablCompares;
|
|
546
565
|
}
|
|
547
566
|
|
|
548
|
-
|
|
549
|
-
let
|
|
567
|
+
compareReferenceMetavariable(reference, generalContext, specificContext) {
|
|
568
|
+
let referenceMetavariableCompares = false;
|
|
550
569
|
|
|
551
570
|
const context = specificContext, ///
|
|
552
571
|
referenceString = reference.getString(),
|
|
553
572
|
metavariableString = this.getString();
|
|
554
573
|
|
|
555
|
-
context.trace(`
|
|
574
|
+
context.trace(`Comparing the '${referenceString}' reference's metavariable to the '${metavariableString}' metavariable...`);
|
|
556
575
|
|
|
557
576
|
const generalContextFilePath = generalContext.getFilePath(),
|
|
558
577
|
specificContextFilePath = specificContext.getFilePath();
|
|
@@ -562,25 +581,25 @@ export default define(class Metavariable extends Element {
|
|
|
562
581
|
metavariableNodeMatches = reference.matchMetavariableNode(metavariableNode);
|
|
563
582
|
|
|
564
583
|
if (metavariableNodeMatches) {
|
|
565
|
-
|
|
584
|
+
referenceMetavariableCompares = true;
|
|
566
585
|
}
|
|
567
586
|
}
|
|
568
587
|
|
|
569
|
-
if (
|
|
570
|
-
context.trace(`...
|
|
588
|
+
if (referenceMetavariableCompares) {
|
|
589
|
+
context.trace(`...compared the '${referenceString}' reference's metavariable to the '${metavariableString}' metavariable.`);
|
|
571
590
|
}
|
|
572
591
|
|
|
573
|
-
return
|
|
592
|
+
return referenceMetavariableCompares;
|
|
574
593
|
}
|
|
575
594
|
|
|
576
|
-
|
|
577
|
-
let
|
|
595
|
+
compareStatementMetavariable(statement, generalContext, specificContext, continuation) {
|
|
596
|
+
let statementMetavariableCompares = false;
|
|
578
597
|
|
|
579
598
|
const context = specificContext, ///
|
|
580
599
|
statementString = statement.getString(),
|
|
581
600
|
metavariableString = this.getString(); ///
|
|
582
601
|
|
|
583
|
-
context.trace(`
|
|
602
|
+
context.trace(`Compares the '${statementString}' statement's metavariable to the '${metavariableString}' metavariable...`);
|
|
584
603
|
|
|
585
604
|
const generalContextFilePath = generalContext.getFilePath(),
|
|
586
605
|
specificContextFilePath = specificContext.getFilePath();
|
|
@@ -590,35 +609,15 @@ export default define(class Metavariable extends Element {
|
|
|
590
609
|
metavariableNodeMatches = statement.matchMetavariableNode(metavariableNode);
|
|
591
610
|
|
|
592
611
|
if (metavariableNodeMatches) {
|
|
593
|
-
|
|
612
|
+
statementMetavariableCompares = true;
|
|
594
613
|
}
|
|
595
614
|
}
|
|
596
615
|
|
|
597
|
-
if (
|
|
598
|
-
context.debug(`...
|
|
599
|
-
}
|
|
600
|
-
|
|
601
|
-
continuation(statementMetavariableUnifies);
|
|
602
|
-
}
|
|
603
|
-
|
|
604
|
-
unifyMetavariableIntrinsically(metavariable, generalContext, specificContext) {
|
|
605
|
-
let metavariableUnifiesIntrinsically;
|
|
606
|
-
|
|
607
|
-
const context = specificContext, ///
|
|
608
|
-
generalMetavariable = this, ///
|
|
609
|
-
specificMetavariable = metavariable,
|
|
610
|
-
generalMetavariableString = generalMetavariable.getString(), ///
|
|
611
|
-
specificMetavariableString = specificMetavariable.getString();
|
|
612
|
-
|
|
613
|
-
context.trace(`Unifying the '${specificMetavariableString}' metavariable with the '${generalMetavariableString}' metavariable intrinsically...`);
|
|
614
|
-
|
|
615
|
-
metavariableUnifiesIntrinsically = unifyMetavariableIntrinsically(generalMetavariable, specificMetavariable, generalContext, specificContext);
|
|
616
|
-
|
|
617
|
-
if (metavariableUnifiesIntrinsically) {
|
|
618
|
-
context.debug(`...unified the '${specificMetavariableString}' metavariable with the '${generalMetavariableString}' metavariable intrinsically.`);
|
|
616
|
+
if (statementMetavariableCompares) {
|
|
617
|
+
context.debug(`...compared the '${statementString}' statement's metavariable to the '${metavariableString}' metavariable.`);
|
|
619
618
|
}
|
|
620
619
|
|
|
621
|
-
|
|
620
|
+
continuation(statementMetavariableCompares);
|
|
622
621
|
}
|
|
623
622
|
|
|
624
623
|
toJSON() {
|
|
@@ -9,7 +9,7 @@ import { instantiate } from "../utilities/context";
|
|
|
9
9
|
import { instantiateProcedureCall } from "../process/instantiate";
|
|
10
10
|
import { parametersFromProcedureCallNode, procedureReferenceFromProcedureCallNode } from "../utilities/element";
|
|
11
11
|
|
|
12
|
-
const { breakPointFromJSON, breakPointToBreakPointJSON } = breakPointUtilities;
|
|
12
|
+
const { breakable, breakPointFromJSON, breakPointToBreakPointJSON } = breakPointUtilities;
|
|
13
13
|
|
|
14
14
|
export default define(class ProcedureCall extends Element {
|
|
15
15
|
constructor(context, string, node, breakPoint, parameters, procedureReference) {
|
|
@@ -44,7 +44,8 @@ export default define(class ProcedureCall extends Element {
|
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
findValues(context) {
|
|
47
|
-
const
|
|
47
|
+
const derivedSubstitutions = context.getDerivedSubstitutions(),
|
|
48
|
+
substitutions = derivedSubstitutions, ///
|
|
48
49
|
values = this.parameters.map((parameter) => {
|
|
49
50
|
const value = parameter.findValue(substitutions);
|
|
50
51
|
|
|
@@ -83,9 +84,7 @@ export default define(class ProcedureCall extends Element {
|
|
|
83
84
|
continuation(validates);
|
|
84
85
|
}
|
|
85
86
|
|
|
86
|
-
|
|
87
|
-
let unifiesIndependently = false;
|
|
88
|
-
|
|
87
|
+
unifyIndependently = breakable(function (context, continuation) {
|
|
89
88
|
const procedureCallString = this.getString(); ///
|
|
90
89
|
|
|
91
90
|
context.trace(`Unifying the '${procedureCallString}' procedure call independently...`);
|
|
@@ -94,38 +93,38 @@ export default define(class ProcedureCall extends Element {
|
|
|
94
93
|
procedure = context.findProcedureByProcedureName(procedureName),
|
|
95
94
|
values = this.findValues(context);
|
|
96
95
|
|
|
97
|
-
let term = null;
|
|
98
|
-
|
|
99
96
|
try {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
const message = exception.getMessage();
|
|
97
|
+
return procedure.callNominally(values, (term) => {
|
|
98
|
+
let unifiesIndependently = false;
|
|
103
99
|
|
|
104
|
-
|
|
105
|
-
|
|
100
|
+
if (term !== null) {
|
|
101
|
+
const boolean = term.isBoolean();
|
|
106
102
|
|
|
107
|
-
|
|
108
|
-
|
|
103
|
+
if (!boolean) {
|
|
104
|
+
context.info(`The '${procedureCallString}' procedure call did not return a boolean.`);
|
|
105
|
+
} else {
|
|
106
|
+
const primitiveValue = term.getPrimitiveValue();
|
|
109
107
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
108
|
+
if (primitiveValue) {
|
|
109
|
+
unifiesIndependently = true;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
114
113
|
|
|
115
|
-
if (
|
|
116
|
-
|
|
114
|
+
if (unifiesIndependently) {
|
|
115
|
+
context.debug(`...unified the '${procedureCallString}' procedure call independently.`);
|
|
117
116
|
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
117
|
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
}
|
|
118
|
+
return continuation(unifiesIndependently);
|
|
119
|
+
});
|
|
120
|
+
} catch (exception) {
|
|
121
|
+
const message = exception.getMessage();
|
|
124
122
|
|
|
125
|
-
|
|
126
|
-
|
|
123
|
+
context.info(message);
|
|
124
|
+
}
|
|
125
|
+
});
|
|
127
126
|
|
|
128
|
-
|
|
127
|
+
dischargeGivenTerm(term, context) {
|
|
129
128
|
let dischargedGivenTerm = false;
|
|
130
129
|
|
|
131
130
|
const termString = term.getString(),
|
|
@@ -146,7 +145,7 @@ export default define(class ProcedureCall extends Element {
|
|
|
146
145
|
term = null;
|
|
147
146
|
|
|
148
147
|
try {
|
|
149
|
-
term =
|
|
148
|
+
term = procedure.callNominally(values);
|
|
150
149
|
} catch (exception) {
|
|
151
150
|
const message = exception.getMessage();
|
|
152
151
|
|
|
@@ -177,9 +177,7 @@ export default define(class Premise extends ProofAssertion {
|
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
179
|
|
|
180
|
-
unifyIndependently(context) {
|
|
181
|
-
let unifiesIndependently = false;
|
|
182
|
-
|
|
180
|
+
unifyIndependently(context, continuation) {
|
|
183
181
|
const premiseString = this.getString(); ///
|
|
184
182
|
|
|
185
183
|
context.trace(`Unifying the '${premiseString}' premise independently...`);
|
|
@@ -191,28 +189,39 @@ export default define(class Premise extends ProofAssertion {
|
|
|
191
189
|
if (statement !== null) {
|
|
192
190
|
const premiseContext = this.getContext(), ///
|
|
193
191
|
generalContext = premiseContext, ///
|
|
194
|
-
specificContext = context
|
|
195
|
-
statementUnifiesIndependently = statement.unifyIndependently(generalContext, specificContext);
|
|
192
|
+
specificContext = context; ///
|
|
196
193
|
|
|
197
|
-
|
|
198
|
-
unifiesIndependently =
|
|
199
|
-
|
|
194
|
+
return statement.unifyIndependently(generalContext, specificContext, (statementUnifiesIndependently) => {
|
|
195
|
+
let unifiesIndependently = false;
|
|
196
|
+
|
|
197
|
+
if (statementUnifiesIndependently) {
|
|
198
|
+
unifiesIndependently = true;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
if (unifiesIndependently) {
|
|
202
|
+
context.debug(`...unified the '${premiseString}' premise independently.`);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
return continuation(unifiesIndependently);
|
|
206
|
+
});
|
|
200
207
|
}
|
|
201
208
|
|
|
202
209
|
if (procedureCall !== null) {
|
|
203
|
-
|
|
210
|
+
return procedureCall.unifyIndependently(context, (procedureCallResolvedIndependently) => {
|
|
211
|
+
let unifiesIndependently = false;
|
|
204
212
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
}
|
|
209
|
-
}, context);
|
|
213
|
+
if (procedureCallResolvedIndependently) {
|
|
214
|
+
unifiesIndependently = true;
|
|
215
|
+
}
|
|
210
216
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
217
|
+
if (unifiesIndependently) {
|
|
218
|
+
context.debug(`...unified the '${premiseString}' premise independently.`);
|
|
219
|
+
}
|
|
214
220
|
|
|
215
|
-
|
|
221
|
+
return continuation(unifiesIndependently);
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
}, context);
|
|
216
225
|
}
|
|
217
226
|
|
|
218
227
|
unifySubproof(subproof, context, continuation) {
|
|
@@ -288,12 +297,12 @@ export default define(class Premise extends ProofAssertion {
|
|
|
288
297
|
if (subproofOrProofAssertionProofAssertion) {
|
|
289
298
|
const proofAssertion = subproofOrProofAssertion; ///
|
|
290
299
|
|
|
291
|
-
this.unifyProofAssertion(proofAssertion, context, continuation);
|
|
292
|
-
} else {
|
|
293
|
-
const subproof = subproofOrProofAssertion; ///
|
|
294
|
-
|
|
295
|
-
this.unifySubproof(subproof, context, continuation);
|
|
300
|
+
return this.unifyProofAssertion(proofAssertion, context, continuation);
|
|
296
301
|
}
|
|
302
|
+
|
|
303
|
+
const subproof = subproofOrProofAssertion; ///
|
|
304
|
+
|
|
305
|
+
return this.unifySubproof(subproof, context, continuation);
|
|
297
306
|
}
|
|
298
307
|
|
|
299
308
|
toJSON() {
|
|
@@ -140,8 +140,8 @@ export default define(class Step extends ProofAssertion {
|
|
|
140
140
|
stated = qualified; ///
|
|
141
141
|
|
|
142
142
|
(stated ? declare : derive)((context) => {
|
|
143
|
-
const
|
|
144
|
-
|
|
143
|
+
const unify = this.unify.bind(this),
|
|
144
|
+
validate = this.validate.bind(this);
|
|
145
145
|
|
|
146
146
|
all([
|
|
147
147
|
validate,
|
|
@@ -275,16 +275,16 @@ export default define(class Step extends ProofAssertion {
|
|
|
275
275
|
|
|
276
276
|
const step = this; ///
|
|
277
277
|
|
|
278
|
-
some(unifySteps, (unifyStep, continuation) => {
|
|
278
|
+
return some(unifySteps, (unifyStep, continuation) => {
|
|
279
279
|
reconcile((context) => {
|
|
280
|
-
unifyStep(step, context, continuation);
|
|
280
|
+
return unifyStep(step, context, continuation);
|
|
281
281
|
}, context);
|
|
282
282
|
}, (unifies) => {
|
|
283
283
|
if (unifies) {
|
|
284
284
|
context.debug(`...unified the '${stepString}' step.`);
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
-
continuation(unifies);
|
|
287
|
+
return continuation(unifies);
|
|
288
288
|
});
|
|
289
289
|
}
|
|
290
290
|
|
|
@@ -288,12 +288,12 @@ export default define(class Supposition extends ProofAssertion {
|
|
|
288
288
|
if (subproofOrProofAssertionProofAssertion) {
|
|
289
289
|
const proofAssertion = subproofOrProofAssertion; ///
|
|
290
290
|
|
|
291
|
-
this.unifyProofAssertion(proofAssertion, context, continuation);
|
|
292
|
-
} else {
|
|
293
|
-
const subproof = subproofOrProofAssertion; ///
|
|
294
|
-
|
|
295
|
-
this.unifySubproof(subproof, context, continuation);
|
|
291
|
+
return this.unifyProofAssertion(proofAssertion, context, continuation);
|
|
296
292
|
}
|
|
293
|
+
|
|
294
|
+
const subproof = subproofOrProofAssertion; ///
|
|
295
|
+
|
|
296
|
+
return this.unifySubproof(subproof, context, continuation);
|
|
297
297
|
}
|
|
298
298
|
|
|
299
299
|
toJSON() {
|
|
@@ -34,12 +34,6 @@ export default class ProofAssertion extends Element {
|
|
|
34
34
|
return step;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
-
isNonsensical() {
|
|
38
|
-
const nonsensical = (this.statement === null);
|
|
39
|
-
|
|
40
|
-
return nonsensical;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
37
|
compareStep(step, context) {
|
|
44
38
|
let comparesToStep = false;
|
|
45
39
|
|
|
@@ -86,30 +80,24 @@ export default class ProofAssertion extends Element {
|
|
|
86
80
|
}
|
|
87
81
|
|
|
88
82
|
unifyStatement(statement, generalContext, specificContext, continuation) {
|
|
83
|
+
if (this.statement === null) {
|
|
84
|
+
const statementUnifies = false;
|
|
85
|
+
|
|
86
|
+
return continuation(statementUnifies);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
89
|
const context = specificContext, ///
|
|
90
90
|
statementString = statement.getString(),
|
|
91
91
|
proofAssertionString = this.getString(); ///
|
|
92
92
|
|
|
93
93
|
context.trace(`Unifying the '${statementString}' statement with the '${proofAssertionString}' proof assertion's statement...`);
|
|
94
94
|
|
|
95
|
-
const nonsensical = this.isNonsensical();
|
|
96
|
-
|
|
97
|
-
if (nonsensical) {
|
|
98
|
-
const statementUnifies = false;
|
|
99
|
-
|
|
100
|
-
context.debug(`Unable to unify the '${statementString}' statement with the '${proofAssertionString}' proof assertion because it is nonsense.`);
|
|
101
|
-
|
|
102
|
-
continuation(statementUnifies);
|
|
103
|
-
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
95
|
this.statement.unifyStatement(statement, generalContext, specificContext, (statementUnifies) => {
|
|
108
96
|
if (statementUnifies) {
|
|
109
97
|
context.debug(`...unified the '${statementString}' statement with the '${proofAssertionString}' proof assertion's statement.`);
|
|
110
98
|
}
|
|
111
99
|
|
|
112
|
-
continuation(statementUnifies);
|
|
100
|
+
return continuation(statementUnifies);
|
|
113
101
|
});
|
|
114
102
|
}
|
|
115
103
|
}
|
package/src/element/rule.js
CHANGED
|
@@ -129,14 +129,14 @@ export default define(class Rule extends Element {
|
|
|
129
129
|
|
|
130
130
|
context.trace(`Verifying the '${ruleString}' rule's labels...`);
|
|
131
131
|
|
|
132
|
-
every(this.labels, (label, continuation) => {
|
|
133
|
-
this.verifyLabel(label, context, continuation);
|
|
132
|
+
return every(this.labels, (label, continuation) => {
|
|
133
|
+
return this.verifyLabel(label, context, continuation);
|
|
134
134
|
}, (labelsVerify) => {
|
|
135
135
|
if (labelsVerify) {
|
|
136
136
|
context.debug(`...verified the '${ruleString}' rule's labels.`);
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
conntinuation(labelsVerify);
|
|
139
|
+
return conntinuation(labelsVerify);
|
|
140
140
|
});
|
|
141
141
|
}
|
|
142
142
|
|
|
@@ -168,8 +168,8 @@ export default define(class Rule extends Element {
|
|
|
168
168
|
|
|
169
169
|
context.trace(`Verifying the '${ruleString}' rule's premises...`);
|
|
170
170
|
|
|
171
|
-
forwardsEvery(this.premises, (premise, continuation) => {
|
|
172
|
-
this.verifyPremise(premise, context, continuation);
|
|
171
|
+
return forwardsEvery(this.premises, (premise, continuation) => {
|
|
172
|
+
return this.verifyPremise(premise, context, continuation);
|
|
173
173
|
}, (premisesVerify) => {
|
|
174
174
|
if (premisesVerify) {
|
|
175
175
|
context.debug(`...verified the '${ruleString}' rule's premises.`);
|
|
@@ -194,7 +194,7 @@ export default define(class Rule extends Element {
|
|
|
194
194
|
});
|
|
195
195
|
}
|
|
196
196
|
|
|
197
|
-
unifyStepWithConclusion
|
|
197
|
+
unifyStepWithConclusion(step, context, continuation) {
|
|
198
198
|
const ruleString = this.getString(),
|
|
199
199
|
stepString = step.getString(),
|
|
200
200
|
conclusionString = this.conclusion.getString();
|
|
@@ -214,7 +214,7 @@ export default define(class Rule extends Element {
|
|
|
214
214
|
|
|
215
215
|
return continuation(stepUnifiesWithConclusion);
|
|
216
216
|
});
|
|
217
|
-
}
|
|
217
|
+
}
|
|
218
218
|
|
|
219
219
|
unifyStepAndSubproofOrProofAssertions(step, subproofOrProofAssertions, context, continuation) {
|
|
220
220
|
this.unifyStepWithConclusion(step, context, (statementUnifiesWithConclusion) => {
|
|
@@ -241,24 +241,24 @@ export default define(class Rule extends Element {
|
|
|
241
241
|
}
|
|
242
242
|
|
|
243
243
|
unifySubproofOrProofAssertionsWithPremise(subproofOrProofAssertions, premise, context, continuation) {
|
|
244
|
-
extract(subproofOrProofAssertions, (subproofOrProofAssertion, continuation) => {
|
|
244
|
+
return extract(subproofOrProofAssertions, (subproofOrProofAssertion, continuation) => {
|
|
245
245
|
premise.unifySubproofOrProofAssertion(subproofOrProofAssertion, context, continuation);
|
|
246
|
-
}, (subproofOrProofAssertion) => {
|
|
246
|
+
}, (subproofOrProofAssertion = null) => {
|
|
247
247
|
if (subproofOrProofAssertion !== null) {
|
|
248
248
|
const subproofOrProofAssertionsUnifiesWithPremise = true;
|
|
249
249
|
|
|
250
250
|
return continuation(subproofOrProofAssertionsUnifiesWithPremise);
|
|
251
251
|
}
|
|
252
252
|
|
|
253
|
-
premise.unifyIndependently(context, continuation);
|
|
253
|
+
return premise.unifyIndependently(context, continuation);
|
|
254
254
|
});
|
|
255
255
|
}
|
|
256
256
|
|
|
257
257
|
unifySubproofOrProofAssertionsWithPremises(subproofOrProofAssertions, context, continuation) {
|
|
258
258
|
subproofOrProofAssertions = reverse(subproofOrProofAssertions); ///
|
|
259
259
|
|
|
260
|
-
backwardsEvery(this.premises, (premise, continuation) => {
|
|
261
|
-
this.unifySubproofOrProofAssertionsWithPremise(subproofOrProofAssertions, premise, context, continuation);
|
|
260
|
+
return backwardsEvery(this.premises, (premise, continuation) => {
|
|
261
|
+
return this.unifySubproofOrProofAssertionsWithPremise(subproofOrProofAssertions, premise, context, continuation);
|
|
262
262
|
}, continuation);
|
|
263
263
|
}
|
|
264
264
|
|