Skip to content

Commit efc0e39

Browse files
committed
refactor(SetTheory/Ordinal): introduce natCast_pow (leanprover-community#34662)
We introduce `natCast_pow : ↑(m ^ n) = ↑m ^ n` for ordinals. We deprecate `natCast_opow : ↑(m ^ n) = ↑m ^ ↑n`, which aside from being named wrong, has an RHS which is not simp-normal. See [Zulip](https://leanprover.zulipchat.com/#narrow/channel/287929-mathlib4/topic/Ordinal.20exponentiation.20problems/with/571572044).
1 parent 26e91fa commit efc0e39

5 files changed

Lines changed: 13 additions & 14 deletions

File tree

Mathlib/SetTheory/Cardinal/Ordinal.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ theorem card_opow_le_of_omega0_le_right (a : Ordinal) {b : Ordinal} (hb : ω ≤
118118
theorem card_opow_le (a b : Ordinal) : (a ^ b).card ≤ max ℵ₀ (max a.card b.card) := by
119119
obtain ⟨n, rfl⟩ | ha := eq_nat_or_omega0_le a
120120
· obtain ⟨m, rfl⟩ | hb := eq_nat_or_omega0_le b
121-
· rw [← natCast_opow, card_nat]
121+
· rw [opow_natCast, ← natCast_pow, card_nat]
122122
exact le_max_of_le_left natCast_le_aleph0
123123
· exact (card_opow_le_of_omega0_le_right _ hb).trans (le_max_right _ _)
124124
· exact (card_opow_le_of_omega0_le_left ha _).trans (le_max_right _ _)

Mathlib/SetTheory/Ordinal/Arithmetic.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,6 +1055,7 @@ theorem lift_ofNat (n : ℕ) [n.AtLeastTwo] :
10551055
theorem lt_omega0 {o : Ordinal} : o < ω ↔ ∃ n : ℕ, o = n := by
10561056
simp_rw [← Cardinal.ord_aleph0, Cardinal.lt_ord, lt_aleph0, card_eq_nat]
10571057

1058+
@[simp]
10581059
theorem nat_lt_omega0 (n : ℕ) : ↑n < ω :=
10591060
lt_omega0.2 ⟨_, rfl⟩
10601061

Mathlib/SetTheory/Ordinal/Exponential.lean

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -500,18 +500,18 @@ theorem lt_omega0_opow_succ {a b : Ordinal} : a < ω ^ succ b ↔ ∃ n : ℕ, a
500500
/-! ### Interaction with `Nat.cast` -/
501501

502502
@[simp, norm_cast]
503-
theorem natCast_opow (m : ℕ) : ∀ n : ℕ, ↑(m ^ n : ℕ) = (m : Ordinal) ^ (n : Ordinal)
503+
theorem natCast_pow (m : ℕ) : ∀ n : ℕ, ↑(m ^ n : ℕ) = (m : Ordinal) ^ n
504504
| 0 => by simp
505-
| n + 1 => by
506-
rw [pow_succ, natCast_mul, natCast_opow m n, Nat.cast_succ, add_one_eq_succ, opow_succ]
505+
| n + 1 => by simp [pow_succ, natCast_pow m n]
506+
507+
@[deprecated natCast_pow (since := "2026-01-31")]
508+
theorem natCast_opow (m : ℕ) : ∀ n : ℕ, ↑(m ^ n : ℕ) = (m : Ordinal) ^ (n : Ordinal) := by
509+
simp
507510

508511
theorem iSup_pow_natCast {o : Ordinal} (ho : 0 < o) : ⨆ n : ℕ, o ^ n = o ^ ω := by
509-
simp_rw [← opow_natCast]
510512
rcases (one_le_iff_pos.2 ho).lt_or_eq with ho₁ | rfl
511-
· exact apply_omega0_of_isNormal (isNormal_opow ho₁)
512-
· rw [one_opow]
513-
refine le_antisymm (Ordinal.iSup_le fun n => by rw [one_opow]) ?_
514-
exact_mod_cast Ordinal.le_iSup _ 0
513+
· simpa using apply_omega0_of_isNormal (isNormal_opow ho₁)
514+
· simp
515515

516516
@[deprecated (since := "2025-12-25")]
517517
alias iSup_pow := iSup_pow_natCast

Mathlib/SetTheory/Ordinal/Principal.lean

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,9 +405,7 @@ theorem mul_eq_opow_log_succ (ha : a ≠ 0) (hb : Principal (· * ·) b) (hb₂
405405

406406
theorem principal_opow_omega0 : Principal (· ^ ·) ω := fun a b ha hb =>
407407
match a, b, lt_omega0.1 ha, lt_omega0.1 hb with
408-
| _, _, ⟨m, rfl⟩, ⟨n, rfl⟩ => by
409-
simp_rw [← natCast_opow]
410-
apply nat_lt_omega0
408+
| _, _, ⟨m, rfl⟩, ⟨n, rfl⟩ => by simp [← natCast_pow]
411409

412410
theorem opow_omega0 (a1 : 1 < a) (h : a < ω) : a ^ ω = ω :=
413411
((opow_le_of_isSuccLimit (one_le_iff_ne_zero.1 <| le_of_lt a1) isSuccLimit_omega0).2 fun _ hb =>

Mathlib/Tactic/NormNum/Ordinal.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def evalOrdinalMod : NormNumExt where
184184

185185
lemma isNat_ordinalOPow.{u} : ∀ {a b : Ordinal.{u}} {an bn rn : ℕ},
186186
IsNat a an → IsNat b bn → an ^ bn = rn → IsNat (a ^ b) rn
187-
| _, _, _, _, _, ⟨rfl⟩, ⟨rfl⟩, rfl => ⟨Eq.symm <| natCast_opow ..
187+
| _, _, _, _, _, ⟨rfl⟩, ⟨rfl⟩, rfl => ⟨(opow_natCast ..).trans (natCast_pow ..).symm
188188

189189
/-- The `norm_num` extension for homogeneous power on ordinals. -/
190190
@[norm_num (_ : Ordinal) ^ (_ : Ordinal)]
@@ -208,7 +208,7 @@ def evalOrdinalOPow : NormNumExt where
208208

209209
lemma isNat_ordinalNPow.{u} : ∀ {a : Ordinal.{u}} {b an bn rn : ℕ},
210210
IsNat a an → IsNat b bn → an ^ bn = rn → IsNat (a ^ b) rn
211-
| _, _, _, _, _, ⟨rfl⟩, ⟨rfl⟩, rfl => ⟨Eq.symm <| natCast_opow .. |>.trans <| opow_natCast ..⟩
211+
| _, _, _, _, _, ⟨rfl⟩, ⟨rfl⟩, rfl => ⟨Eq.symm <| natCast_pow ..⟩
212212

213213
/-- The `norm_num` extension for natural power on ordinals. -/
214214
@[norm_num (_ : Ordinal) ^ (_ : ℕ)]

0 commit comments

Comments
 (0)