Lean4
/-- Dictionary / lexicographic linear_order for pairs. -/
instance linearOrder [LinearOrder ι] [∀ i, LinearOrder (α i)] : LinearOrder (Σₗ' i, α i) :=
{ Lex.partialOrder with
le_total := by
rintro ⟨i, a⟩ ⟨j, b⟩
obtain hij | rfl | hji := lt_trichotomy i j
· exact Or.inl (Lex.left _ _ hij)
· obtain hab | hba := le_total a b
· exact Or.inl (Lex.right _ hab)
· exact Or.inr (Lex.right _ hba)
· exact Or.inr (Lex.left _ _ hji),
toDecidableEq := PSigma.decidableEq, toDecidableLE := Lex.decidable _ _, toDecidableLT := Lex.decidable _ _ }