Commit d2c1d03
proof(lean4): mechanize BFT quorum-intersection safety (Theorem 3)
Prove the Byzantine-safety invariant that formal/PhronesisConsensus.tla
model-checks (for N=4, F=1) as a Lean theorem for ALL N, F.
Model: agents are a universe list, votes/Byzantine are Bool predicates,
cardinalities are countP. Every set fact is PROVED here, nothing about
finite sets is assumed:
* countP_incl_excl -- inclusion/exclusion: countP(p||q) + countP(p&&q)
= countP p + countP q;
* countP_or_le_length, countP_mono -- union bound + monotonicity.
Headlines (sorry-free; #print axioms reports only Lean's standard
propext / Quot.sound, plus Classical.choice for bft_agreement via
Classical.em):
* bft_no_two_quorums -- with n ≤ 3f+1 and a quorum threshold of 2f+1,
two DISTINCT values cannot both reach a quorum. The contradiction is
f+1 ≤ |overlap| ≤ f: inclusion/exclusion forces the overlap ≥ f+1,
while honest-vote-once forces it ≤ f.
* bft_agreement -- any two COMMITTED values are equal (a value is
committed when its vote set reaches 2f+1; honest agents vote for at
most one value; Byzantine may equivocate). This is the Agreement
invariant the TLA+ spec checks, here proved for all N, F.
Core Lean only (no Mathlib): by_contra is not core, so bft_agreement
uses Classical.em + cases. Builds clean, no warnings.
Docs: safety_proofs.md §3.4 gains a "Verified two ways" note (TLA+
model-check + Lean proof) and the §5 table marks BFT Safety
"Model-checked (TLA+/TLC) + Mechanized (Lean 4)".
https://claude.ai/code/session_01DQACj3RFmAPZaBPgR9SAaS1 parent a088b15 commit d2c1d03
2 files changed
Lines changed: 125 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
748 | 748 | | |
749 | 749 | | |
750 | 750 | | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
| 816 | + | |
| 817 | + | |
| 818 | + | |
| 819 | + | |
| 820 | + | |
| 821 | + | |
| 822 | + | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
| 851 | + | |
| 852 | + | |
| 853 | + | |
751 | 854 | | |
752 | 855 | | |
753 | 856 | | |
| |||
768 | 871 | | |
769 | 872 | | |
770 | 873 | | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
771 | 880 | | |
772 | 881 | | |
773 | 882 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
368 | 368 | | |
369 | 369 | | |
370 | 370 | | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
371 | 386 | | |
372 | 387 | | |
373 | 388 | | |
| |||
437 | 452 | | |
438 | 453 | | |
439 | 454 | | |
440 | | - | |
| 455 | + | |
441 | 456 | | |
442 | 457 | | |
443 | 458 | | |
| |||
0 commit comments