/-- **"Lie in the same block" is an equivalence relation.** Reflexive: every element lies in
some block. Symmetric: obvious. Transitive: if `a, b ∈ B` and `b, c ∈ C`, then `B` and `C` share
`b`, so `B = C`, and `a, c` lie in the same block. -/
theorem same_block_equivalence {α : Type} {P : (α → Prop) → Prop} (hP : IsPartition P) :
Equivalence (SameBlock P) where
refl := by
intro a
obtain ⟨B, hB, ha⟩ := hP.covers a
exact ⟨B, hB, ha, ha⟩
symm := by
intro a b ⟨B, hB, ha, hb⟩
exact ⟨B, hB, hb, ha⟩
trans := by
intro a b c ⟨B, hB, ha, hb⟩ ⟨C, hC, hb', hc⟩
have hBC : B = C := hP.disjoint B C hB hC ⟨b, hb, hb'⟩
rw [← hBC] at hc
exact ⟨B, hB, ha, hc⟩