Proof compression: tactics and the Robbins problem#
A good formal proof is compressed. Repeated fragments have been turned into lemmas, bookkeeping into tactics, and long terms into abbreviations. This chapter shows it on one famous example: the proof that every Robbins algebra is Boolean, found in 1996 by William McCune’s program EQP (see The Robbins problem). We take the shortest published computer proof known to us, turn it into a proof in tactics checked by our kernel from lecture 3, design new tactics that shorten it, and measure the effect. Then we analyse “heavy” code of other people with the same theorem — formalizations in Lean, Isabelle and Mizar — and ask what could be compressed in it.
The chapter has five parts:
The shortest proof: EQP’s twelve equations — how many steps a proof has; EQP’s twelve equations (search m5-50, November 1996) are exactly Mann’s lemmas 44–54; our kernel checks them as theorems, and the Otter proof without built-in associativity is more than three times longer.
Tactics that compress — four tactics:
ac(a normal form with a proof),rw_ac(matching modulo associativity and commutativity),ac_simp(simplification to the end) andauto(creative expansions from a search); their structure, cost and design principles.The whole proof in tactics — the whole proof from the Robbins equation to Huntington’s equation: lemmas with hypotheses, sections with constants as abbreviations of terms, the result checked by the kernel with the assumptions A1, A2, R; three sizes of a proof — the script, the proof object and the tree without lemmas.
Heavy code: Lean, Isabelle, Mizar — four formalizations (Lean 4, Lean 3, Isabelle, Mizar) and machine proofs (EQP, Otter) as data: sizes, tactic profiles, the bookkeeping of associativity and commutativity,
metis; what would compress it.Scenarios: building tactics — scenarios in the Boole Lab and in the Tactic Lab: the script and the proof object, a tactic with a measure of progress, a tactic that loops, what the kernel sees; exercises and references.
Materials
The code of the chapter exists in two language versions: kernel/
(ac.py, robbins.py, robbins_proof.py) and jadro/
(ac.py, robbins.py, robbins_dowod.py). Other people’s code with proofs is fetched by the script
obce/pobierz.py (pinned versions, SHA-256 checksums); we do not publish it on the course site. Tactics made of
combinators are composed in the Boole Lab
and in the Tactic Lab.
Map of examples
Example |
What it shows |
Where |
|---|---|---|
Table I of McCune’s paper: 8, 12, 86 steps |
the length of a proof depends on what we count |
|
equation 8855 = lemma |
Winker’s condition 2 after eight EQP steps |
|
12 EQP equations = |
Mann’s proof is the EQP proof written out as lemmas |
|
Otter: 40 steps instead of 12 |
the cost of no built-in associativity and commutativity |
|
the cost of |
bookkeeping that the tactic removes from the script |
|
|
search instead of a creative hint |
|
lemma 36 for \(k = 1, 2, 3\) |
induction unrolled into a loop |
|
\(e\) of 329 symbols and the constant \(e\) |
abbreviations compress terms |
|
the tree without lemmas: over half a billion nodes |
lemmas compress proofs |
|
33 × |
where the bookkeeping sits in other people’s code |
|
|
a measure of progress: the number of inversions |