|
| 1 | +/- |
| 2 | +Copyright (c) 2026 Snir Broshi. All rights reserved. |
| 3 | +Released under Apache 2.0 license as described in the file LICENSE. |
| 4 | +Authors: Snir Broshi |
| 5 | +-/ |
| 6 | +module |
| 7 | + |
| 8 | +public import Mathlib.SetTheory.Ordinal.Arithmetic |
| 9 | + |
| 10 | +/-! |
| 11 | +# Ordinal arithmetic commutativity |
| 12 | +
|
| 13 | +Results on the commutativity of ordinal arithmetic operations. |
| 14 | +
|
| 15 | +## References |
| 16 | +
|
| 17 | +* [Wacław Sierpiński, *Cardinal and Ordinal Numbers*][sierpinski1958] |
| 18 | +-/ |
| 19 | + |
| 20 | +public section |
| 21 | + |
| 22 | +namespace Ordinal |
| 23 | + |
| 24 | +theorem addCommute_iff_eq_mul_natCast {o₁ o₂ : Ordinal} : |
| 25 | + AddCommute o₁ o₂ ↔ ∃ (o : Ordinal) (n₁ n₂ : ℕ), o * n₁ = o₁ ∧ o * n₂ = o₂ := by |
| 26 | + refine ⟨fun hcomm ↦ ?_, ?_⟩ |
| 27 | + · induction h : o₁ + o₂ using WellFoundedLT.induction generalizing o₁ o₂ with | ind o ih |
| 28 | + subst h |
| 29 | + wlog hle : o₁ ≤ o₂ |
| 30 | + · grind [hcomm.symm] |
| 31 | + rcases eq_or_ne o₁ 0 with (rfl | h₁) |
| 32 | + · exact ⟨o₂, 0, 1, by simp, by simp⟩ |
| 33 | + let o₃ := o₂ - o₁ |
| 34 | + have hsub : o₁ + o₃ = o₂ := Ordinal.add_sub_cancel_of_le hle |
| 35 | + have hcomm' : AddCommute o₁ o₃ := add_left_cancel (a := o₁) <| by grind |
| 36 | + have hlt : o₁ + o₃ < o₁ + o₂ := by simpa [hsub, hcomm.eq] using h₁.pos |
| 37 | + rcases ih _ hlt hcomm' rfl with ⟨o, n₁, n₃, hn₁, hn₃⟩ |
| 38 | + use o, n₁, n₁ + n₃, hn₁ |
| 39 | + rw [Nat.cast_add, mul_add, hn₁, hn₃, hsub] |
| 40 | + · rintro ⟨o, n₁, n₂, rfl, rfl⟩ |
| 41 | + rw [addCommute_iff_eq, ← mul_add, ← mul_add, ← Nat.cast_add, add_comm, Nat.cast_add] |
| 42 | + |
| 43 | +end Ordinal |
0 commit comments