occam-verify-cli 0.0.1245 → 0.0.1247
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.js +172 -210
- package/lib/context/local.js +95 -125
- package/lib/dom/assertion/contained.js +44 -22
- package/lib/dom/assertion/defined.js +34 -17
- package/lib/dom/combinator/bracketed.js +167 -0
- package/lib/dom/combinator.js +163 -0
- package/lib/{constructor → dom/constructor}/bracketed.js +7 -7
- package/lib/dom/constructor.js +190 -0
- package/lib/dom/declaration/combinator.js +2 -8
- package/lib/dom/declaration/constructor.js +42 -7
- package/lib/dom/declaration.js +113 -71
- package/lib/dom/equality.js +3 -3
- package/lib/dom/frame.js +111 -76
- package/lib/dom/judgement.js +29 -3
- package/lib/dom/label.js +22 -15
- package/lib/dom/metaLemma.js +20 -41
- package/lib/dom/metatheorem.js +20 -41
- package/lib/dom/metavariable.js +7 -7
- package/lib/dom/reference.js +32 -18
- package/lib/dom/rule.js +3 -4
- package/lib/dom/statement.js +2 -2
- package/lib/dom/term.js +2 -2
- package/lib/dom/topLevelAssertion.js +50 -71
- package/lib/dom/type.js +3 -3
- package/lib/dom/variable.js +5 -5
- package/lib/equivalence.js +2 -2
- package/lib/index.js +7 -3
- package/lib/mixins/statement/verify.js +3 -3
- package/lib/mixins/term/verify.js +2 -3
- package/lib/substitution/statement.js +2 -2
- package/lib/unifier/{label.js → reference.js} +14 -14
- package/lib/utilities/json.js +5 -7
- package/lib/utilities/unification.js +25 -6
- package/lib/verifier/combinator.js +3 -3
- package/lib/verifier/constructor.js +3 -3
- package/package.json +5 -5
- package/src/context/file.js +166 -206
- package/src/context/local.js +73 -83
- package/src/dom/assertion/contained.js +60 -27
- package/src/dom/assertion/defined.js +44 -20
- package/src/{combinator → dom/combinator}/bracketed.js +6 -5
- package/src/{combinator.js → dom/combinator.js} +8 -7
- package/src/{constructor → dom/constructor}/bracketed.js +6 -5
- package/src/{constructor.js → dom/constructor.js} +8 -7
- package/src/dom/declaration/combinator.js +2 -3
- package/src/dom/declaration/constructor.js +3 -2
- package/src/dom/declaration.js +133 -101
- package/src/dom/equality.js +2 -2
- package/src/dom/frame.js +151 -95
- package/src/dom/judgement.js +36 -2
- package/src/dom/label.js +18 -13
- package/src/dom/metaLemma.js +23 -55
- package/src/dom/metatheorem.js +23 -55
- package/src/dom/metavariable.js +6 -6
- package/src/dom/reference.js +43 -25
- package/src/dom/rule.js +2 -2
- package/src/dom/statement.js +1 -1
- package/src/dom/term.js +1 -1
- package/src/dom/topLevelAssertion.js +53 -86
- package/src/dom/type.js +2 -2
- package/src/dom/variable.js +4 -4
- package/src/equivalence.js +1 -1
- package/src/index.js +4 -0
- package/src/mixins/statement/verify.js +3 -2
- package/src/mixins/term/verify.js +2 -3
- package/src/substitution/statement.js +1 -1
- package/src/unifier/{label.js → reference.js} +6 -6
- package/src/utilities/json.js +4 -4
- package/src/utilities/unification.js +43 -5
- package/src/verifier/combinator.js +2 -2
- package/src/verifier/constructor.js +2 -2
- package/lib/combinator/bracketed.js +0 -126
- package/lib/combinator.js +0 -122
- package/lib/constructor.js +0 -149
package/src/context/file.js
CHANGED
|
@@ -313,97 +313,60 @@ export default class FileContext {
|
|
|
313
313
|
return fileContext;
|
|
314
314
|
}
|
|
315
315
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
const metavariableDeclared = (metavariable !== null);
|
|
320
|
-
|
|
321
|
-
return metavariableDeclared;
|
|
316
|
+
addType(type) {
|
|
317
|
+
this.types.push(type);
|
|
322
318
|
}
|
|
323
319
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
typeDeclared = (type !== null);
|
|
327
|
-
|
|
328
|
-
return typeDeclared;
|
|
320
|
+
addRule(rule) {
|
|
321
|
+
this.rules.push(rule);
|
|
329
322
|
}
|
|
330
323
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
variableDeclared = (variable !== null);
|
|
334
|
-
|
|
335
|
-
return variableDeclared;
|
|
324
|
+
addAxiom(axiom) {
|
|
325
|
+
this.axioms.push(axiom);
|
|
336
326
|
}
|
|
337
327
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
metavariableDeclared = (metavariable !== null);
|
|
341
|
-
|
|
342
|
-
return metavariableDeclared;
|
|
328
|
+
addLemma(lemma) {
|
|
329
|
+
this.lemmas.push(lemma);
|
|
343
330
|
}
|
|
344
331
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
labelPresent = (label !== null);
|
|
348
|
-
|
|
349
|
-
return labelPresent;
|
|
332
|
+
addTheorem(theorem) {
|
|
333
|
+
this.theorems.push(theorem);
|
|
350
334
|
}
|
|
351
335
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
labelPresent = (label !== null);
|
|
355
|
-
|
|
356
|
-
return labelPresent;
|
|
336
|
+
addVariable(variable) {
|
|
337
|
+
this.variables.push(variable);
|
|
357
338
|
}
|
|
358
339
|
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
types.push(objectType);
|
|
363
|
-
|
|
364
|
-
const type = types.find((type) => {
|
|
365
|
-
const typeNameMatches = type.matchTypeName(typeName);
|
|
366
|
-
|
|
367
|
-
if (typeNameMatches) {
|
|
368
|
-
return true;
|
|
369
|
-
}
|
|
370
|
-
}) || null;
|
|
371
|
-
|
|
372
|
-
return type;
|
|
340
|
+
addMetaLemma(metaLemma) {
|
|
341
|
+
this.metaLemmas.push(metaLemma);
|
|
373
342
|
}
|
|
374
343
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
const metaTypeNameMatches = metaType.matchMetaTypeName(metaTypeName);
|
|
379
|
-
|
|
380
|
-
if (metaTypeNameMatches) {
|
|
381
|
-
return true;
|
|
382
|
-
}
|
|
383
|
-
}) || null;
|
|
344
|
+
addConjecture(conjecture) {
|
|
345
|
+
this.conjectures.push(conjecture);
|
|
346
|
+
}
|
|
384
347
|
|
|
385
|
-
|
|
348
|
+
addCombinator(combinator) {
|
|
349
|
+
this.combinators.push(combinator);
|
|
386
350
|
}
|
|
387
351
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
const variableNameMatches = variable.matchVariableName(variableName);
|
|
352
|
+
addConstructor(constructor) {
|
|
353
|
+
this.constructors.push(constructor);
|
|
354
|
+
}
|
|
392
355
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
}) || null;
|
|
356
|
+
addMetatheorem(metatheorem) {
|
|
357
|
+
this.metatheorems.push(metatheorem);
|
|
358
|
+
}
|
|
397
359
|
|
|
398
|
-
|
|
360
|
+
addMetavariable(metavariable) {
|
|
361
|
+
this.metavariables.push(metavariable);
|
|
399
362
|
}
|
|
400
363
|
|
|
401
|
-
|
|
364
|
+
findLabelByReference(reference, context) {
|
|
402
365
|
const labels = this.getLabels(),
|
|
403
366
|
label = labels.find((label) => {
|
|
404
|
-
const
|
|
367
|
+
const metavariableUnified = label.unifyReference(reference, context);
|
|
405
368
|
|
|
406
|
-
if (
|
|
369
|
+
if (metavariableUnified) {
|
|
407
370
|
return true;
|
|
408
371
|
}
|
|
409
372
|
}) || null;
|
|
@@ -411,19 +374,6 @@ export default class FileContext {
|
|
|
411
374
|
return label;
|
|
412
375
|
}
|
|
413
376
|
|
|
414
|
-
findLabelByMetavariableNode(metavariableNode) {
|
|
415
|
-
const labels = this.getLabels(),
|
|
416
|
-
label = labels.find((label) => {
|
|
417
|
-
const metavariableNodeMatches = label.matchMetavariableNode(metavariableNode);
|
|
418
|
-
|
|
419
|
-
if (metavariableNodeMatches) {
|
|
420
|
-
return true;
|
|
421
|
-
}
|
|
422
|
-
}) || null;
|
|
423
|
-
|
|
424
|
-
return label;
|
|
425
|
-
}
|
|
426
|
-
|
|
427
377
|
findRuleByReference(reference) {
|
|
428
378
|
const rules = this.getRules(),
|
|
429
379
|
metavariableName = reference.getMetavariableName(),
|
|
@@ -509,14 +459,14 @@ export default class FileContext {
|
|
|
509
459
|
}
|
|
510
460
|
|
|
511
461
|
findMetaLemmasByReference(reference) {
|
|
512
|
-
const metaLemmas = this.getMetaLemmas()
|
|
462
|
+
const metaLemmas = this.getMetaLemmas(),
|
|
463
|
+
substitutions = Substitutions.fromNothing();
|
|
513
464
|
|
|
514
465
|
filter(metaLemmas, (metaLemma) => {
|
|
515
466
|
const context = this, ///
|
|
516
|
-
|
|
517
|
-
referenceUnified = metaLemma.unifyReference(reference, substitutions, context);
|
|
467
|
+
metaLemmaUnified = reference.unifyMetaLemma(metaLemma, substitutions, context);
|
|
518
468
|
|
|
519
|
-
if (
|
|
469
|
+
if (metaLemmaUnified) {
|
|
520
470
|
return true;
|
|
521
471
|
}
|
|
522
472
|
});
|
|
@@ -525,14 +475,14 @@ export default class FileContext {
|
|
|
525
475
|
}
|
|
526
476
|
|
|
527
477
|
findMetatheoremsByReference(reference) {
|
|
528
|
-
const metatheorems = this.getMetatheorems()
|
|
478
|
+
const metatheorems = this.getMetatheorems(),
|
|
479
|
+
substitutions = Substitutions.fromNothing();
|
|
529
480
|
|
|
530
|
-
|
|
481
|
+
filter(metatheorems, (metatheorem) => {
|
|
531
482
|
const context = this, ///
|
|
532
|
-
|
|
533
|
-
referenceUnified = metatheorem.unifyReference(reference, substitutions, context);
|
|
483
|
+
metatheoremUnified = reference.unifyMetatheorem(metatheorem, substitutions, context);
|
|
534
484
|
|
|
535
|
-
if (
|
|
485
|
+
if (metatheoremUnified) {
|
|
536
486
|
return true;
|
|
537
487
|
}
|
|
538
488
|
});
|
|
@@ -550,22 +500,93 @@ export default class FileContext {
|
|
|
550
500
|
return axiomLemmaTheoremConjecture;
|
|
551
501
|
}
|
|
552
502
|
|
|
553
|
-
|
|
554
|
-
const
|
|
555
|
-
|
|
503
|
+
findMetavariable(metavariable, generalContext, specificContext) {
|
|
504
|
+
const specificMetavariable = metavariable, ///
|
|
505
|
+
metavariables = this.getMetavariables();
|
|
506
|
+
|
|
507
|
+
metavariable = metavariables.find((metavariable) => {
|
|
508
|
+
const generalMetavariable = metavariable; ///
|
|
509
|
+
|
|
510
|
+
metavariable = specificMetavariable; ///
|
|
511
|
+
|
|
512
|
+
const metavariableUnified = generalMetavariable.unifyMetavariable(metavariable, generalContext, specificContext);
|
|
513
|
+
|
|
514
|
+
if (metavariableUnified) {
|
|
515
|
+
return true;
|
|
516
|
+
}
|
|
517
|
+
}) || null;
|
|
518
|
+
|
|
519
|
+
return metavariable;
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
findTypeByTypeName(typeName) {
|
|
523
|
+
let types = this.getTypes();
|
|
524
|
+
|
|
525
|
+
types.push(objectType);
|
|
556
526
|
|
|
557
|
-
|
|
558
|
-
const
|
|
559
|
-
generalVariableEqualToSpecificVariable = generalVariable.isEqualTo(specificVariable);
|
|
527
|
+
const type = types.find((type) => {
|
|
528
|
+
const typeNameMatches = type.matchTypeName(typeName);
|
|
560
529
|
|
|
561
|
-
if (
|
|
530
|
+
if (typeNameMatches) {
|
|
562
531
|
return true;
|
|
563
532
|
}
|
|
564
533
|
}) || null;
|
|
565
534
|
|
|
535
|
+
return type;
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
findMetaTypeByMetaTypeName(metaTypeName) {
|
|
539
|
+
const metaTypes = this.getMetaTypes(),
|
|
540
|
+
metaType = metaTypes.find((metaType) => {
|
|
541
|
+
const metaTypeNameMatches = metaType.matchMetaTypeName(metaTypeName);
|
|
542
|
+
|
|
543
|
+
if (metaTypeNameMatches) {
|
|
544
|
+
return true;
|
|
545
|
+
}
|
|
546
|
+
}) || null;
|
|
547
|
+
|
|
548
|
+
return metaType;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
findVariableByVariableName(variableName) {
|
|
552
|
+
const variables = this.getVariables(),
|
|
553
|
+
variable = variables.find((variable) => {
|
|
554
|
+
const variableNameMatches = variable.matchVariableName(variableName);
|
|
555
|
+
|
|
556
|
+
if (variableNameMatches) {
|
|
557
|
+
return true;
|
|
558
|
+
}
|
|
559
|
+
}) || null;
|
|
560
|
+
|
|
566
561
|
return variable;
|
|
567
562
|
}
|
|
568
563
|
|
|
564
|
+
findLabelByMetavariableName(metavariableName) {
|
|
565
|
+
const labels = this.getLabels(),
|
|
566
|
+
label = labels.find((label) => {
|
|
567
|
+
const metavariableNameMatches = label.matchMetavariableName(metavariableName);
|
|
568
|
+
|
|
569
|
+
if (metavariableNameMatches) {
|
|
570
|
+
return true;
|
|
571
|
+
}
|
|
572
|
+
}) || null;
|
|
573
|
+
|
|
574
|
+
return label;
|
|
575
|
+
}
|
|
576
|
+
|
|
577
|
+
findLabelByMetavariableNode(metavariableNode) {
|
|
578
|
+
const labels = this.getLabels(),
|
|
579
|
+
label = labels.find((label) => {
|
|
580
|
+
const metavariableNodeMatches = label.matchMetavariableNode(metavariableNode);
|
|
581
|
+
|
|
582
|
+
if (metavariableNodeMatches) {
|
|
583
|
+
return true;
|
|
584
|
+
}
|
|
585
|
+
}) || null;
|
|
586
|
+
|
|
587
|
+
return label;
|
|
588
|
+
}
|
|
589
|
+
|
|
569
590
|
findJudgementByMetavariable(metavariable) {
|
|
570
591
|
const judgements = this.getJudgements(),
|
|
571
592
|
judgement = judgements.find((judgement) => {
|
|
@@ -596,96 +617,83 @@ export default class FileContext {
|
|
|
596
617
|
return metavariable;
|
|
597
618
|
}
|
|
598
619
|
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
metavariables = this.getMetavariables();
|
|
602
|
-
|
|
603
|
-
metavariable = metavariables.find((metavariable) => {
|
|
604
|
-
const generalMetavariable = metavariable; ///
|
|
605
|
-
|
|
606
|
-
metavariable = specificMetavariable; ///
|
|
607
|
-
|
|
608
|
-
const metavariableUnified = generalMetavariable.unifyMetavariable(metavariable, generalContext, specificContext);
|
|
620
|
+
isMetavariablePresent(metavariable, generalContext, specificContext) {
|
|
621
|
+
metavariable = this.findMetavariable(metavariable, generalContext, specificContext); ///
|
|
609
622
|
|
|
610
|
-
|
|
611
|
-
return true;
|
|
612
|
-
}
|
|
613
|
-
}) || null;
|
|
623
|
+
const metavariablePresent = (metavariable !== null);
|
|
614
624
|
|
|
615
|
-
return
|
|
625
|
+
return metavariablePresent;
|
|
616
626
|
}
|
|
617
627
|
|
|
618
|
-
|
|
619
|
-
const
|
|
620
|
-
|
|
628
|
+
isTypePresentByTypeName(typeName) {
|
|
629
|
+
const type = this.findTypeByTypeName(typeName),
|
|
630
|
+
typeDeclared = (type !== null);
|
|
621
631
|
|
|
622
|
-
return
|
|
632
|
+
return typeDeclared;
|
|
623
633
|
}
|
|
624
634
|
|
|
625
|
-
|
|
626
|
-
const
|
|
627
|
-
|
|
635
|
+
isVariablePresentByVariableName(variableName) {
|
|
636
|
+
const variable = this.findVariableByVariableName(variableName),
|
|
637
|
+
variablePresent = (variable !== null);
|
|
628
638
|
|
|
629
|
-
return
|
|
639
|
+
return variablePresent;
|
|
630
640
|
}
|
|
631
641
|
|
|
632
|
-
|
|
633
|
-
const
|
|
634
|
-
|
|
642
|
+
isLabelPresentByMetavariableName(metavariableName) {
|
|
643
|
+
const label = this.findLabelByMetavariableName(metavariableName),
|
|
644
|
+
labelPresent = (label !== null);
|
|
635
645
|
|
|
636
|
-
return
|
|
646
|
+
return labelPresent;
|
|
637
647
|
}
|
|
638
648
|
|
|
639
|
-
|
|
640
|
-
const
|
|
641
|
-
|
|
649
|
+
isLabelPresentByMetavariableNode(metavariableNode) {
|
|
650
|
+
const label = this.findLabelByMetavariableNode(metavariableNode),
|
|
651
|
+
labelPresent = (label !== null);
|
|
642
652
|
|
|
643
|
-
return
|
|
653
|
+
return labelPresent;
|
|
644
654
|
}
|
|
645
655
|
|
|
646
|
-
|
|
647
|
-
const
|
|
648
|
-
|
|
656
|
+
isMetavariablePresentByMetavariableName(metavariableName) {
|
|
657
|
+
const metavariable = this.findMetavariableByMetavariableName(metavariableName),
|
|
658
|
+
metavariablePresent = (metavariable !== null);
|
|
649
659
|
|
|
650
|
-
return
|
|
660
|
+
return metavariablePresent;
|
|
651
661
|
}
|
|
652
662
|
|
|
653
|
-
|
|
654
|
-
const
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
663
|
+
isLabelPresentByReference(reference) {
|
|
664
|
+
const labels = this.getLabels(),
|
|
665
|
+
labelPresent = labels.some((label) => {
|
|
666
|
+
const context = this, ///
|
|
667
|
+
substitutions = Substitutions.fromNothing(),
|
|
668
|
+
labelUnified = reference.unifyLabel(label, substitutions, context);
|
|
659
669
|
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
670
|
+
if (labelUnified) {
|
|
671
|
+
return true;
|
|
672
|
+
}
|
|
673
|
+
});
|
|
663
674
|
|
|
664
|
-
return
|
|
675
|
+
return labelPresent;
|
|
665
676
|
}
|
|
666
677
|
|
|
667
|
-
|
|
668
|
-
const
|
|
669
|
-
|
|
670
|
-
metaLemmasPresent = (metaLemmasLength > 0);
|
|
678
|
+
isProcedurePresentByReference(reference) {
|
|
679
|
+
const procedure = this.findProcedureByReference(reference),
|
|
680
|
+
procedurePresent = (procedure !== null);
|
|
671
681
|
|
|
672
|
-
return
|
|
682
|
+
return procedurePresent;
|
|
673
683
|
}
|
|
674
684
|
|
|
675
|
-
|
|
676
|
-
const
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
return metatheoremsPresent;
|
|
681
|
-
}
|
|
685
|
+
isMetavariablePresentByReference(reference) {
|
|
686
|
+
const metavariables = this.getMetavariables(),
|
|
687
|
+
metavariablePresent = metavariables.some((metavariable) => {
|
|
688
|
+
const context = this, ///
|
|
689
|
+
metavariableUnified = reference.unifyMetavariable(metavariable, context);
|
|
682
690
|
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
691
|
+
if (metavariableUnified) {
|
|
692
|
+
return true;
|
|
693
|
+
}
|
|
694
|
+
});
|
|
687
695
|
|
|
688
|
-
return
|
|
696
|
+
return metavariablePresent;
|
|
689
697
|
}
|
|
690
698
|
|
|
691
699
|
nodeAsString(node, tokens = null) {
|
|
@@ -730,54 +738,6 @@ export default class FileContext {
|
|
|
730
738
|
|
|
731
739
|
tokensAsString(tokens) { return tokensAsString(tokens); }
|
|
732
740
|
|
|
733
|
-
addType(type) {
|
|
734
|
-
this.types.push(type);
|
|
735
|
-
}
|
|
736
|
-
|
|
737
|
-
addRule(rule) {
|
|
738
|
-
this.rules.push(rule);
|
|
739
|
-
}
|
|
740
|
-
|
|
741
|
-
addAxiom(axiom) {
|
|
742
|
-
this.axioms.push(axiom);
|
|
743
|
-
}
|
|
744
|
-
|
|
745
|
-
addLemma(lemma) {
|
|
746
|
-
this.lemmas.push(lemma);
|
|
747
|
-
}
|
|
748
|
-
|
|
749
|
-
addTheorem(theorem) {
|
|
750
|
-
this.theorems.push(theorem);
|
|
751
|
-
}
|
|
752
|
-
|
|
753
|
-
addVariable(variable) {
|
|
754
|
-
this.variables.push(variable);
|
|
755
|
-
}
|
|
756
|
-
|
|
757
|
-
addMetaLemma(metaLemma) {
|
|
758
|
-
this.metaLemmas.push(metaLemma);
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
addConjecture(conjecture) {
|
|
762
|
-
this.conjectures.push(conjecture);
|
|
763
|
-
}
|
|
764
|
-
|
|
765
|
-
addCombinator(combinator) {
|
|
766
|
-
this.combinators.push(combinator);
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
addConstructor(constructor) {
|
|
770
|
-
this.constructors.push(constructor);
|
|
771
|
-
}
|
|
772
|
-
|
|
773
|
-
addMetatheorem(metatheorem) {
|
|
774
|
-
this.metatheorems.push(metatheorem);
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
addMetavariable(metavariable) {
|
|
778
|
-
this.metavariables.push(metavariable);
|
|
779
|
-
}
|
|
780
|
-
|
|
781
741
|
findFile(filePath) { return this.releaseContext.findFile(filePath); }
|
|
782
742
|
|
|
783
743
|
trace(message) { this.releaseContext.trace(message, this.filePath); }
|