A tale of four theorem provers, or: A (reasonably) opinionated comparison of Isabelle/HOL, Lean, HOL4, and Agda

28 points by blueberrywren


ettolrach

I've only ever learnt Agda, and I feel like I should learn another popular proof assistant, but I can never understand the proofs that are made in other proof assistants. I suppose the point is not to understand but to trust that the compiler has checked it? The fact that Agda has barely any tactics means that at the end of the proof, you're left with a very readable program.

For example, the proof that 2 is prime from the post:

theorem prime_two : prime 2 := by
  simp
  intros k x
  simp [divides] at x
  have ⟨q,hq⟩ := x
  (cases q <;> cases k <;> grind)

versus

two-prime : Prime 2
two-prime .gt1 = s≤s (s≤s z≤n)
two-prime .div zero (divides (suc q) eq) rewrite *-comm q 0 = ⊥-elim (1+n≢0 eq)
two-prime .div (suc zero) (divides (suc q) eq) = inj₁ refl
two-prime .div (2+ zero) (divides (suc q) eq) = inj₂ refl

I can understand the Agda proof by looking up what the requirements of the field gt1 and div are, then I can understand what the available arguments represent and what we're supposed to return as the return value of the function. But in the Lean proof, I have no clue what it's doing; what's the first simp for, what's grind actually doing? I can't translate the proof into mathematical terms, which I personally find annoying.

ashikun

I do find myself wondering where Rocq (being also fairly constructive and automatable) sits here, though I presume it’d rank similarly to Lean based on my vague failed attempts to learn Lean from a Rocq user perspective over the years.

I’ve never quite got a good handle on what Lean does better than Rocq, and any cases of the opposite.