MathLabs
TheoremProved

Transitivity of equality from Eq.rec

Statement

There is a term Eq.trans:a=b→b=c→a=c\mathrm{Eq.trans} : a = b \to b = c \to a = c built only from Eq.rec\mathsf{Eq.rec}.

Why is it true?

Chaining equalities (a=b=ca=b=c therefore a=ca=c) is used in essentially every proof; if it were an axiom instead of a derived term, the kernel would have to trust that axiom rather than verify it by computation.

Proof sketch

Fix a,ba,b and h1:a=bh_1 : a = b. Given h2:b=ch_2 : b = c for arbitrary cc, we want a proof of a=ca = c. Apply Eq.rec\mathsf{Eq.rec} to h2h_2 with motive C(y,h):=(a=y)C(y, h) := (a = y), indexed by the point yy and the proof hh connecting bb to yy.

The base case required is C(b,refl b)C(b, \mathrm{refl}\,b), i.e. a=ba = b — exactly h1h_1. So h1h_1 is the base-case proof supplied to Eq.rec\mathsf{Eq.rec}.

Eq.rec\mathsf{Eq.rec} then delivers, for every cc and every h2:b=ch_2 : b = c, a proof of C(c,h2)=(a=c)C(c, h_2) = (a = c), which is what we wanted.

So Eq.trans h1 h2:=Eq.rec (C:=λy h, a=y) h1 c h2\mathrm{Eq.trans}\,h_1\,h_2 := \mathsf{Eq.rec}\,(C := \lambda y\, h,\, a = y)\,h_1\,c\,h_2 has type Eq.trans:a=b→b=c→a=c\mathrm{Eq.trans} : a = b \to b = c \to a = c. Notice the pattern shared with symmetry: both proofs "transport" a fact along an equality by choosing the right motive CC, then let the kernel's fixed reduction rule for Eq.rec\mathsf{Eq.rec} on refl\mathrm{refl} do the actual work.

Topics that use this theorem

Step-by-step proofs

No step-by-step proof yet for this theorem.

References

  1. Leonardo de Moura, Sebastian Ullrich (2021). The Lean 4 Theorem Prover and Programming Language
  2. Xavier Leroy (2009). Formal verification of a realistic compiler
  3. Terence Tao, et al. (2023). A Proof of the Polynomial Freiman-Ruzsa Conjecture · arXiv:2311.05762