occam-verify-cli 0.0.1246 → 0.0.1248
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 +170 -209
- 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 +141 -149
- 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 +13 -58
- package/lib/dom/metatheorem.js +11 -117
- package/lib/dom/metavariable.js +7 -7
- package/lib/dom/reference.js +60 -18
- package/lib/dom/rule.js +6 -7
- package/lib/dom/statement.js +2 -2
- package/lib/dom/term.js +2 -2
- package/lib/dom/topLevelAssertion.js +78 -99
- package/lib/dom/topLevelMetaAssertion.js +253 -0
- 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/string.js +3 -3
- 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 +161 -205
- 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} +28 -27
- package/src/dom/declaration/combinator.js +2 -3
- package/src/dom/declaration/constructor.js +3 -2
- package/src/dom/declaration.js +163 -199
- 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 +5 -78
- package/src/dom/metatheorem.js +8 -121
- package/src/dom/metavariable.js +6 -6
- package/src/dom/reference.js +85 -25
- package/src/dom/rule.js +7 -5
- package/src/dom/statement.js +1 -1
- package/src/dom/term.js +1 -1
- package/src/dom/topLevelAssertion.js +86 -128
- package/src/dom/topLevelMetaAssertion.js +154 -0
- 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/string.js +2 -2
- package/src/utilities/unification.js +44 -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
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
import { arrayUtilities } from "necessary";
|
|
4
4
|
|
|
5
5
|
import Equivalences from "../equivalences";
|
|
6
|
-
import Substitutions from "../substitutions";
|
|
7
6
|
import topLevelVerifier from "../verifier/topLevel";
|
|
8
7
|
|
|
9
8
|
import { objectType } from "../dom/type";
|
|
@@ -313,97 +312,60 @@ export default class FileContext {
|
|
|
313
312
|
return fileContext;
|
|
314
313
|
}
|
|
315
314
|
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
const metavariableDeclared = (metavariable !== null);
|
|
320
|
-
|
|
321
|
-
return metavariableDeclared;
|
|
315
|
+
addType(type) {
|
|
316
|
+
this.types.push(type);
|
|
322
317
|
}
|
|
323
318
|
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
typeDeclared = (type !== null);
|
|
327
|
-
|
|
328
|
-
return typeDeclared;
|
|
319
|
+
addRule(rule) {
|
|
320
|
+
this.rules.push(rule);
|
|
329
321
|
}
|
|
330
322
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
variableDeclared = (variable !== null);
|
|
334
|
-
|
|
335
|
-
return variableDeclared;
|
|
323
|
+
addAxiom(axiom) {
|
|
324
|
+
this.axioms.push(axiom);
|
|
336
325
|
}
|
|
337
326
|
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
metavariableDeclared = (metavariable !== null);
|
|
341
|
-
|
|
342
|
-
return metavariableDeclared;
|
|
327
|
+
addLemma(lemma) {
|
|
328
|
+
this.lemmas.push(lemma);
|
|
343
329
|
}
|
|
344
330
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
labelPresent = (label !== null);
|
|
348
|
-
|
|
349
|
-
return labelPresent;
|
|
331
|
+
addTheorem(theorem) {
|
|
332
|
+
this.theorems.push(theorem);
|
|
350
333
|
}
|
|
351
334
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
labelPresent = (label !== null);
|
|
355
|
-
|
|
356
|
-
return labelPresent;
|
|
335
|
+
addVariable(variable) {
|
|
336
|
+
this.variables.push(variable);
|
|
357
337
|
}
|
|
358
338
|
|
|
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;
|
|
339
|
+
addMetaLemma(metaLemma) {
|
|
340
|
+
this.metaLemmas.push(metaLemma);
|
|
373
341
|
}
|
|
374
342
|
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
const metaTypeNameMatches = metaType.matchMetaTypeName(metaTypeName);
|
|
379
|
-
|
|
380
|
-
if (metaTypeNameMatches) {
|
|
381
|
-
return true;
|
|
382
|
-
}
|
|
383
|
-
}) || null;
|
|
343
|
+
addConjecture(conjecture) {
|
|
344
|
+
this.conjectures.push(conjecture);
|
|
345
|
+
}
|
|
384
346
|
|
|
385
|
-
|
|
347
|
+
addCombinator(combinator) {
|
|
348
|
+
this.combinators.push(combinator);
|
|
386
349
|
}
|
|
387
350
|
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
const variableNameMatches = variable.matchVariableName(variableName);
|
|
351
|
+
addConstructor(constructor) {
|
|
352
|
+
this.constructors.push(constructor);
|
|
353
|
+
}
|
|
392
354
|
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
}) || null;
|
|
355
|
+
addMetatheorem(metatheorem) {
|
|
356
|
+
this.metatheorems.push(metatheorem);
|
|
357
|
+
}
|
|
397
358
|
|
|
398
|
-
|
|
359
|
+
addMetavariable(metavariable) {
|
|
360
|
+
this.metavariables.push(metavariable);
|
|
399
361
|
}
|
|
400
362
|
|
|
401
|
-
|
|
363
|
+
findLabelByReference(reference, context) {
|
|
402
364
|
const labels = this.getLabels(),
|
|
403
365
|
label = labels.find((label) => {
|
|
404
|
-
const
|
|
366
|
+
const metavariableUnified = label.unifyReference(reference, context);
|
|
405
367
|
|
|
406
|
-
if (
|
|
368
|
+
if (metavariableUnified) {
|
|
407
369
|
return true;
|
|
408
370
|
}
|
|
409
371
|
}) || null;
|
|
@@ -411,19 +373,6 @@ export default class FileContext {
|
|
|
411
373
|
return label;
|
|
412
374
|
}
|
|
413
375
|
|
|
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
376
|
findRuleByReference(reference) {
|
|
428
377
|
const rules = this.getRules(),
|
|
429
378
|
metavariableName = reference.getMetavariableName(),
|
|
@@ -513,10 +462,9 @@ export default class FileContext {
|
|
|
513
462
|
|
|
514
463
|
filter(metaLemmas, (metaLemma) => {
|
|
515
464
|
const context = this, ///
|
|
516
|
-
|
|
517
|
-
referenceUnified = metaLemma.unifyReference(reference, substitutions, context);
|
|
465
|
+
metaLemmaUnified = reference.unifyMetaLemma(metaLemma, context);
|
|
518
466
|
|
|
519
|
-
if (
|
|
467
|
+
if (metaLemmaUnified) {
|
|
520
468
|
return true;
|
|
521
469
|
}
|
|
522
470
|
});
|
|
@@ -527,12 +475,11 @@ export default class FileContext {
|
|
|
527
475
|
findMetatheoremsByReference(reference) {
|
|
528
476
|
const metatheorems = this.getMetatheorems();
|
|
529
477
|
|
|
530
|
-
|
|
478
|
+
filter(metatheorems, (metatheorem) => {
|
|
531
479
|
const context = this, ///
|
|
532
|
-
|
|
533
|
-
referenceUnified = metatheorem.unifyReference(reference, substitutions, context);
|
|
480
|
+
metatheoremUnified = reference.unifyMetatheorem(metatheorem, context);
|
|
534
481
|
|
|
535
|
-
if (
|
|
482
|
+
if (metatheoremUnified) {
|
|
536
483
|
return true;
|
|
537
484
|
}
|
|
538
485
|
});
|
|
@@ -550,22 +497,93 @@ export default class FileContext {
|
|
|
550
497
|
return axiomLemmaTheoremConjecture;
|
|
551
498
|
}
|
|
552
499
|
|
|
553
|
-
|
|
554
|
-
const
|
|
555
|
-
|
|
500
|
+
findMetavariable(metavariable, generalContext, specificContext) {
|
|
501
|
+
const specificMetavariable = metavariable, ///
|
|
502
|
+
metavariables = this.getMetavariables();
|
|
503
|
+
|
|
504
|
+
metavariable = metavariables.find((metavariable) => {
|
|
505
|
+
const generalMetavariable = metavariable; ///
|
|
506
|
+
|
|
507
|
+
metavariable = specificMetavariable; ///
|
|
508
|
+
|
|
509
|
+
const metavariableUnified = generalMetavariable.unifyMetavariable(metavariable, generalContext, specificContext);
|
|
510
|
+
|
|
511
|
+
if (metavariableUnified) {
|
|
512
|
+
return true;
|
|
513
|
+
}
|
|
514
|
+
}) || null;
|
|
515
|
+
|
|
516
|
+
return metavariable;
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
findTypeByTypeName(typeName) {
|
|
520
|
+
let types = this.getTypes();
|
|
521
|
+
|
|
522
|
+
types.push(objectType);
|
|
556
523
|
|
|
557
|
-
|
|
558
|
-
const
|
|
559
|
-
generalVariableEqualToSpecificVariable = generalVariable.isEqualTo(specificVariable);
|
|
524
|
+
const type = types.find((type) => {
|
|
525
|
+
const typeNameMatches = type.matchTypeName(typeName);
|
|
560
526
|
|
|
561
|
-
if (
|
|
527
|
+
if (typeNameMatches) {
|
|
562
528
|
return true;
|
|
563
529
|
}
|
|
564
530
|
}) || null;
|
|
565
531
|
|
|
532
|
+
return type;
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
findMetaTypeByMetaTypeName(metaTypeName) {
|
|
536
|
+
const metaTypes = this.getMetaTypes(),
|
|
537
|
+
metaType = metaTypes.find((metaType) => {
|
|
538
|
+
const metaTypeNameMatches = metaType.matchMetaTypeName(metaTypeName);
|
|
539
|
+
|
|
540
|
+
if (metaTypeNameMatches) {
|
|
541
|
+
return true;
|
|
542
|
+
}
|
|
543
|
+
}) || null;
|
|
544
|
+
|
|
545
|
+
return metaType;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
findVariableByVariableName(variableName) {
|
|
549
|
+
const variables = this.getVariables(),
|
|
550
|
+
variable = variables.find((variable) => {
|
|
551
|
+
const variableNameMatches = variable.matchVariableName(variableName);
|
|
552
|
+
|
|
553
|
+
if (variableNameMatches) {
|
|
554
|
+
return true;
|
|
555
|
+
}
|
|
556
|
+
}) || null;
|
|
557
|
+
|
|
566
558
|
return variable;
|
|
567
559
|
}
|
|
568
560
|
|
|
561
|
+
findLabelByMetavariableName(metavariableName) {
|
|
562
|
+
const labels = this.getLabels(),
|
|
563
|
+
label = labels.find((label) => {
|
|
564
|
+
const metavariableNameMatches = label.matchMetavariableName(metavariableName);
|
|
565
|
+
|
|
566
|
+
if (metavariableNameMatches) {
|
|
567
|
+
return true;
|
|
568
|
+
}
|
|
569
|
+
}) || null;
|
|
570
|
+
|
|
571
|
+
return label;
|
|
572
|
+
}
|
|
573
|
+
|
|
574
|
+
findLabelByMetavariableNode(metavariableNode) {
|
|
575
|
+
const labels = this.getLabels(),
|
|
576
|
+
label = labels.find((label) => {
|
|
577
|
+
const metavariableNodeMatches = label.matchMetavariableNode(metavariableNode);
|
|
578
|
+
|
|
579
|
+
if (metavariableNodeMatches) {
|
|
580
|
+
return true;
|
|
581
|
+
}
|
|
582
|
+
}) || null;
|
|
583
|
+
|
|
584
|
+
return label;
|
|
585
|
+
}
|
|
586
|
+
|
|
569
587
|
findJudgementByMetavariable(metavariable) {
|
|
570
588
|
const judgements = this.getJudgements(),
|
|
571
589
|
judgement = judgements.find((judgement) => {
|
|
@@ -596,96 +614,82 @@ export default class FileContext {
|
|
|
596
614
|
return metavariable;
|
|
597
615
|
}
|
|
598
616
|
|
|
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);
|
|
617
|
+
isMetavariablePresent(metavariable, generalContext, specificContext) {
|
|
618
|
+
metavariable = this.findMetavariable(metavariable, generalContext, specificContext); ///
|
|
609
619
|
|
|
610
|
-
|
|
611
|
-
return true;
|
|
612
|
-
}
|
|
613
|
-
}) || null;
|
|
620
|
+
const metavariablePresent = (metavariable !== null);
|
|
614
621
|
|
|
615
|
-
return
|
|
622
|
+
return metavariablePresent;
|
|
616
623
|
}
|
|
617
624
|
|
|
618
|
-
|
|
619
|
-
const
|
|
620
|
-
|
|
625
|
+
isTypePresentByTypeName(typeName) {
|
|
626
|
+
const type = this.findTypeByTypeName(typeName),
|
|
627
|
+
typeDeclared = (type !== null);
|
|
621
628
|
|
|
622
|
-
return
|
|
629
|
+
return typeDeclared;
|
|
623
630
|
}
|
|
624
631
|
|
|
625
|
-
|
|
626
|
-
const
|
|
627
|
-
|
|
632
|
+
isVariablePresentByVariableName(variableName) {
|
|
633
|
+
const variable = this.findVariableByVariableName(variableName),
|
|
634
|
+
variablePresent = (variable !== null);
|
|
628
635
|
|
|
629
|
-
return
|
|
636
|
+
return variablePresent;
|
|
630
637
|
}
|
|
631
638
|
|
|
632
|
-
|
|
633
|
-
const
|
|
634
|
-
|
|
639
|
+
isLabelPresentByMetavariableName(metavariableName) {
|
|
640
|
+
const label = this.findLabelByMetavariableName(metavariableName),
|
|
641
|
+
labelPresent = (label !== null);
|
|
635
642
|
|
|
636
|
-
return
|
|
643
|
+
return labelPresent;
|
|
637
644
|
}
|
|
638
645
|
|
|
639
|
-
|
|
640
|
-
const
|
|
641
|
-
|
|
646
|
+
isLabelPresentByMetavariableNode(metavariableNode) {
|
|
647
|
+
const label = this.findLabelByMetavariableNode(metavariableNode),
|
|
648
|
+
labelPresent = (label !== null);
|
|
642
649
|
|
|
643
|
-
return
|
|
650
|
+
return labelPresent;
|
|
644
651
|
}
|
|
645
652
|
|
|
646
|
-
|
|
647
|
-
const
|
|
648
|
-
|
|
653
|
+
isMetavariablePresentByMetavariableName(metavariableName) {
|
|
654
|
+
const metavariable = this.findMetavariableByMetavariableName(metavariableName),
|
|
655
|
+
metavariablePresent = (metavariable !== null);
|
|
649
656
|
|
|
650
|
-
return
|
|
657
|
+
return metavariablePresent;
|
|
651
658
|
}
|
|
652
659
|
|
|
653
|
-
|
|
654
|
-
const
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
}
|
|
660
|
+
isLabelPresentByReference(reference) {
|
|
661
|
+
const labels = this.getLabels(),
|
|
662
|
+
labelPresent = labels.some((label) => {
|
|
663
|
+
const context = this, ///
|
|
664
|
+
labelUnified = reference.unifyLabel(label, context);
|
|
659
665
|
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
666
|
+
if (labelUnified) {
|
|
667
|
+
return true;
|
|
668
|
+
}
|
|
669
|
+
});
|
|
663
670
|
|
|
664
|
-
return
|
|
671
|
+
return labelPresent;
|
|
665
672
|
}
|
|
666
673
|
|
|
667
|
-
|
|
668
|
-
const
|
|
669
|
-
|
|
670
|
-
metaLemmasPresent = (metaLemmasLength > 0);
|
|
674
|
+
isProcedurePresentByReference(reference) {
|
|
675
|
+
const procedure = this.findProcedureByReference(reference),
|
|
676
|
+
procedurePresent = (procedure !== null);
|
|
671
677
|
|
|
672
|
-
return
|
|
678
|
+
return procedurePresent;
|
|
673
679
|
}
|
|
674
680
|
|
|
675
|
-
|
|
676
|
-
const
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
return metatheoremsPresent;
|
|
681
|
-
}
|
|
681
|
+
isMetavariablePresentByReference(reference) {
|
|
682
|
+
const metavariables = this.getMetavariables(),
|
|
683
|
+
metavariablePresent = metavariables.some((metavariable) => {
|
|
684
|
+
const context = this, ///
|
|
685
|
+
metavariableUnified = reference.unifyMetavariable(metavariable, context);
|
|
682
686
|
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
+
if (metavariableUnified) {
|
|
688
|
+
return true;
|
|
689
|
+
}
|
|
690
|
+
});
|
|
687
691
|
|
|
688
|
-
return
|
|
692
|
+
return metavariablePresent;
|
|
689
693
|
}
|
|
690
694
|
|
|
691
695
|
nodeAsString(node, tokens = null) {
|
|
@@ -730,54 +734,6 @@ export default class FileContext {
|
|
|
730
734
|
|
|
731
735
|
tokensAsString(tokens) { return tokensAsString(tokens); }
|
|
732
736
|
|
|
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
737
|
findFile(filePath) { return this.releaseContext.findFile(filePath); }
|
|
782
738
|
|
|
783
739
|
trace(message) { this.releaseContext.trace(message, this.filePath); }
|