@@ -3,10 +3,11 @@ Copyright (c) 2017 Johannes Hölzl. All rights reserved.
33Released under Apache 2.0 license as described in the file LICENSE.
44Authors: Mario Carneiro, Floris van Doorn, Violeta Hernández Palacios
55-/
6- import Mathlib.SetTheory.Ordinal.Basic
7- import Mathlib.Data.Nat.SuccPred
86import Mathlib.Algebra.GroupWithZero.Divisibility
7+ import Mathlib.Data.Nat.SuccPred
8+ import Mathlib.Order.SuccPred.InitialSeg
99import Mathlib.SetTheory.Cardinal.UnivLE
10+ import Mathlib.SetTheory.Ordinal.Basic
1011
1112/-!
1213# Ordinal arithmetic
@@ -197,33 +198,36 @@ theorem lift_pred (o : Ordinal.{v}) : lift.{u} (pred o) = pred (lift.{u} o) := b
197198
198199TODO: deprecate this in favor of `Order.IsSuccLimit`. -/
199200def IsLimit (o : Ordinal) : Prop :=
200- o ≠ 0 ∧ ∀ a < o, succ a < o
201+ IsSuccLimit o
202+
203+ theorem isLimit_iff {o} : IsLimit o ↔ o ≠ 0 ∧ IsSuccPrelimit o := by
204+ simp [IsLimit, IsSuccLimit]
201205
202206theorem IsLimit.isSuccPrelimit {o} (h : IsLimit o) : IsSuccPrelimit o :=
203- isSuccPrelimit_iff_succ_lt.mpr h. 2
207+ IsSuccLimit.isSuccPrelimit h
204208
205209@ [deprecated IsLimit.isSuccPrelimit (since := "2024-09-05" )]
206210alias IsLimit.isSuccLimit := IsLimit.isSuccPrelimit
207211
208212theorem IsLimit.succ_lt {o a : Ordinal} (h : IsLimit o) : a < o → succ a < o :=
209- h. 2 a
213+ IsSuccLimit.succ_lt h
210214
211215theorem isSuccPrelimit_zero : IsSuccPrelimit (0 : Ordinal) := isSuccPrelimit_bot
212216
213217@ [deprecated isSuccPrelimit_zero (since := "2024-09-05" )]
214218alias isSuccLimit_zero := isSuccPrelimit_zero
215219
216- theorem not_zero_isLimit : ¬IsLimit 0
217- | ⟨h, _⟩ => h rfl
220+ theorem not_zero_isLimit : ¬IsLimit 0 :=
221+ not_isSuccLimit_bot
218222
219- theorem not_succ_isLimit (o) : ¬IsLimit (succ o)
220- | ⟨_, h⟩ => lt_irrefl _ (h _ (lt_succ o))
223+ theorem not_succ_isLimit (o) : ¬IsLimit (succ o) :=
224+ not_isSuccLimit_succ o
221225
222226theorem not_succ_of_isLimit {o} (h : IsLimit o) : ¬∃ a, o = succ a
223227 | ⟨a, e⟩ => not_succ_isLimit a (e ▸ h)
224228
225229theorem succ_lt_of_isLimit {o a : Ordinal} (h : IsLimit o) : succ a < o ↔ a < o :=
226- ⟨(lt_succ a).trans, h. 2 _⟩
230+ IsSuccLimit.succ_lt_iff h
227231
228232theorem le_succ_of_isLimit {o} (h : IsLimit o) {a} : o ≤ succ a ↔ o ≤ a :=
229233 le_iff_le_iff_lt_iff_lt.2 <| succ_lt_of_isLimit h
@@ -238,29 +242,23 @@ theorem lt_limit {o} (h : IsLimit o) {a} : a < o ↔ ∃ x < o, a < x := by
238242
239243@[simp]
240244theorem lift_isLimit (o : Ordinal.{v}) : IsLimit (lift.{u,v} o) ↔ IsLimit o :=
241- and_congr (not_congr <| by simpa only [lift_zero] using @lift_inj o 0 )
242- ⟨fun H a h => (lift_lt.{u,v}).1 <|
243- by simpa only [lift_succ] using H _ (lift_lt.2 h), fun H a h => by
244- obtain ⟨a', rfl⟩ := mem_range_lift_of_le h.le
245- rw [← lift_succ, lift_lt]
246- exact H a' (lift_lt.1 h)⟩
245+ liftInitialSeg.isSuccLimit_apply_iff
247246
248247theorem IsLimit.pos {o : Ordinal} (h : IsLimit o) : 0 < o :=
249- lt_of_le_of_ne (Ordinal.zero_le _) h.1 .symm
248+ IsSuccLimit.bot_lt h
249+
250+ theorem IsLimit.ne_zero {o : Ordinal} (h : IsLimit o) : o ≠ 0 :=
251+ h.pos.ne'
250252
251253theorem IsLimit.one_lt {o : Ordinal} (h : IsLimit o) : 1 < o := by
252- simpa only [succ_zero] using h.2 _ h.pos
254+ simpa only [succ_zero] using h.succ_lt h.pos
253255
254256theorem IsLimit.nat_lt {o : Ordinal} (h : IsLimit o) : ∀ n : ℕ, (n : Ordinal) < o
255257 | 0 => h.pos
256- | n + 1 => h.2 _ (IsLimit.nat_lt h n)
258+ | n + 1 => h.succ_lt (IsLimit.nat_lt h n)
257259
258260theorem zero_or_succ_or_limit (o : Ordinal) : o = 0 ∨ (∃ a, o = succ a) ∨ IsLimit o := by
259- classical
260- exact if o0 : o = 0 then Or.inl o0
261- else
262- if h : ∃ a, o = succ a then Or.inr (Or.inl h)
263- else Or.inr <| Or.inr ⟨o0, fun _a => (succ_lt_of_not_succ h).2 ⟩
261+ simpa [eq_comm] using isMin_or_mem_range_succ_or_isSuccLimit o
264262
265263theorem isLimit_of_not_succ_of_ne_zero {o : Ordinal} (h : ¬∃ a, o = succ a) (h' : o ≠ 0 ) :
266264 IsLimit o := ((zero_or_succ_or_limit o).resolve_left h').resolve_left h
@@ -279,23 +277,24 @@ theorem IsLimit.iSup_Iio {o : Ordinal} (h : IsLimit o) : ⨆ a : Iio o, a.1 = o
279277 induction at successor ordinals and at limit ordinals, then it holds for all ordinals. -/
280278@[elab_as_elim]
281279def limitRecOn {C : Ordinal → Sort *} (o : Ordinal) (H₁ : C 0 ) (H₂ : ∀ o, C o → C (succ o))
282- (H₃ : ∀ o, IsLimit o → (∀ o' < o, C o') → C o) : C o :=
283- SuccOrder.prelimitRecOn o (fun o _ ↦ H₂ o) fun o hl ↦
284- if h : o = 0 then fun _ ↦ h ▸ H₁ else H₃ o ⟨h, fun _ ↦ hl.succ_lt⟩
280+ (H₃ : ∀ o, IsLimit o → (∀ o' < o, C o') → C o) : C o := by
281+ refine SuccOrder.limitRecOn o (fun a ha ↦ ?_) (fun a _ ↦ H₂ a) H₃
282+ convert H₁
283+ simpa using ha
285284
286285@[simp]
287- theorem limitRecOn_zero {C} (H₁ H₂ H₃) : @limitRecOn C 0 H₁ H₂ H₃ = H₁ := by
288- rw [limitRecOn, SuccOrder.prelimitRecOn_of_isSuccPrelimit _ _ isSuccPrelimit_zero, dif_pos rfl]
286+ theorem limitRecOn_zero {C} (H₁ H₂ H₃) : @limitRecOn C 0 H₁ H₂ H₃ = H₁ :=
287+ SuccOrder.limitRecOn_isMin _ _ _ isMin_bot
289288
290289@[simp]
291290theorem limitRecOn_succ {C} (o H₁ H₂ H₃) :
292- @limitRecOn C (succ o) H₁ H₂ H₃ = H₂ o (@limitRecOn C o H₁ H₂ H₃) := by
293- rw [limitRecOn, limitRecOn, SuccOrder.prelimitRecOn_succ]
291+ @limitRecOn C (succ o) H₁ H₂ H₃ = H₂ o (@limitRecOn C o H₁ H₂ H₃) :=
292+ SuccOrder.limitRecOn_succ ..
294293
295294@[simp]
296295theorem limitRecOn_limit {C} (o H₁ H₂ H₃ h) :
297- @limitRecOn C o H₁ H₂ H₃ = H₃ o h fun x _h => @limitRecOn C x H₁ H₂ H₃ := by
298- simp_rw [limitRecOn, SuccOrder.prelimitRecOn_of_isSuccPrelimit _ _ h.isSuccPrelimit, dif_neg h. 1 ]
296+ @limitRecOn C o H₁ H₂ H₃ = H₃ o h fun x _h => @limitRecOn C x H₁ H₂ H₃ :=
297+ SuccOrder.limitRecOn_of_isSuccLimit ..
299298
300299/-- Bounded recursion on ordinals. Similar to `limitRecOn`, with the assumption `o < l`
301300 added to all cases. The final term's domain is the ordinals below `l`. -/
@@ -347,7 +346,7 @@ alias out_no_max_of_succ_lt := toType_noMax_of_succ_lt
347346
348347theorem bounded_singleton {r : α → α → Prop } [IsWellOrder α r] (hr : (type r).IsLimit) (x) :
349348 Bounded r {x} := by
350- refine ⟨enum r ⟨succ (typein r x), hr.2 _ (typein_lt_type r x)⟩, ?_⟩
349+ refine ⟨enum r ⟨succ (typein r x), hr.succ_lt (typein_lt_type r x)⟩, ?_⟩
351350 intro b hb
352351 rw [mem_singleton_iff.1 hb]
353352 nth_rw 1 [← enum_typein r x]
@@ -398,7 +397,7 @@ theorem IsNormal.strictMono {f} (H : IsNormal f) : StrictMono f := fun a b =>
398397 limitRecOn b (Not.elim (not_lt_of_le <| Ordinal.zero_le _))
399398 (fun _b IH h =>
400399 (lt_or_eq_of_le (le_of_lt_succ h)).elim (fun h => (IH h).trans (H.1 _)) fun e => e ▸ H.1 _)
401- fun _b l _IH h => lt_of_lt_of_le (H.1 a) ((H.2 _ l _).1 le_rfl _ (l.2 _ h))
400+ fun _b l _IH h => lt_of_lt_of_le (H.1 a) ((H.2 _ l _).1 le_rfl _ (l.succ_lt h))
402401
403402theorem IsNormal.monotone {f} (H : IsNormal f) : Monotone f :=
404403 H.strictMono.monotone
@@ -460,10 +459,14 @@ theorem IsNormal.trans {f g} (H₁ : IsNormal f) (H₂ : IsNormal g) : IsNormal
460459 ⟨fun _x => H₁.lt_iff.2 (H₂.1 _), fun o l _a =>
461460 H₁.le_set' (· < o) ⟨0 , l.pos⟩ g _ fun _c => H₂.2 _ l _⟩
462461
463- theorem IsNormal.isLimit {f} (H : IsNormal f) {o} (l : IsLimit o) : IsLimit (f o) :=
464- ⟨ne_of_gt <| (Ordinal.zero_le _).trans_lt <| H.lt_iff.2 l.pos, fun _ h =>
465- let ⟨_b, h₁, h₂⟩ := (H.limit_lt l).1 h
466- (succ_le_of_lt h₂).trans_lt (H.lt_iff.2 h₁)⟩
462+ theorem IsNormal.isLimit {f} (H : IsNormal f) {o} (ho : IsLimit o) : IsLimit (f o) := by
463+ rw [isLimit_iff, isSuccPrelimit_iff_succ_lt]
464+ use (H.lt_iff.2 ho.pos).ne_bot
465+ intro a ha
466+ obtain ⟨b, hb, hab⟩ := (H.limit_lt ho).1 ha
467+ rw [← succ_le_iff] at hab
468+ apply hab.trans_lt
469+ rwa [H.lt_iff]
467470
468471theorem add_le_of_limit {a b c : Ordinal} (h : IsLimit b) : a + b ≤ c ↔ ∀ b' < b, a + b' ≤ c :=
469472 ⟨fun h _ l => (add_le_add_left l.le _).trans h, fun H =>
@@ -482,7 +485,7 @@ theorem add_le_of_limit {a b c : Ordinal} (h : IsLimit b) : a + b ≤ c ↔ ∀
482485 · exact irrefl _ (this _)
483486 intro x
484487 rw [← typein_lt_typein (Sum.Lex r s), typein_enum]
485- have := H _ (h.2 _ (typein_lt_type s x))
488+ have := H _ (h.succ_lt (typein_lt_type s x))
486489 rw [add_succ, succ_le_iff] at this
487490 refine
488491 (RelEmbedding.ofMonotone (fun a => ?_) fun a b => ?_).ordinal_type_le.trans_lt this
@@ -566,6 +569,9 @@ protected theorem sub_eq_zero_iff_le {a b : Ordinal} : a - b = 0 ↔ a ≤ b :=
566569 ⟨fun h => by simpa only [h, add_zero] using le_add_sub a b, fun h => by
567570 rwa [← Ordinal.le_zero, sub_le, add_zero]⟩
568571
572+ protected theorem sub_ne_zero_iff_lt {a b : Ordinal} : a - b ≠ 0 ↔ b < a := by
573+ simpa using Ordinal.sub_eq_zero_iff_le.not
574+
569575theorem sub_sub (a b c : Ordinal) : a - b - c = a - (b + c) :=
570576 eq_of_forall_ge_iff fun d => by rw [sub_le, sub_le, sub_le, add_assoc]
571577
@@ -587,9 +593,12 @@ theorem lt_add_iff {a b c : Ordinal} (hc : c ≠ 0) : a < b + c ↔ ∃ d < c, a
587593 rintro ⟨d, hd, ha⟩
588594 exact ha.trans_lt (add_lt_add_left hd b)
589595
590- theorem isLimit_sub {a b} (l : IsLimit a) (h : b < a) : IsLimit (a - b) :=
591- ⟨ne_of_gt <| lt_sub.2 <| by rwa [add_zero], fun c h => by
592- rw [lt_sub, add_succ]; exact l.2 _ (lt_sub.1 h)⟩
596+ theorem isLimit_sub {a b} (ha : IsLimit a) (h : b < a) : IsLimit (a - b) := by
597+ rw [isLimit_iff, Ordinal.sub_ne_zero_iff_lt, isSuccPrelimit_iff_succ_lt]
598+ refine ⟨h, fun c hc ↦ ?_⟩
599+ rw [lt_sub] at hc ⊢
600+ rw [add_succ]
601+ exact ha.succ_lt hc
593602
594603@ [deprecated isLimit_sub (since := "2024-10-11" )]
595604alias sub_isLimit := isLimit_sub
@@ -732,7 +741,7 @@ private theorem mul_le_of_limit_aux {α β r s} [IsWellOrder α r] [IsWellOrder
732741 exact irrefl _ (this _ _)
733742 intro a b
734743 rw [← typein_lt_typein (Prod.Lex s r), typein_enum]
735- have := H _ (h.2 _ (typein_lt_type s b))
744+ have := H _ (h.succ_lt (typein_lt_type s b))
736745 rw [mul_succ] at this
737746 have := ((add_lt_add_iff_left _).2 (typein_lt_type _ a)).trans_le this
738747 refine (RelEmbedding.ofMonotone (fun a => ?_) fun a b => ?_).ordinal_type_le.trans_lt this
@@ -1897,7 +1906,7 @@ theorem bsup_eq_blsub_iff_lt_bsup {o : Ordinal.{u}} (f : ∀ a < o, Ordinal.{max
18971906 apply lt_blsub, fun h => le_antisymm (bsup_le_blsub f) (blsub_le h)⟩
18981907
18991908theorem bsup_eq_blsub_of_lt_succ_limit {o : Ordinal.{u}} (ho : IsLimit o)
1900- {f : ∀ a < o, Ordinal.{max u v}} (hf : ∀ a ha, f a ha < f (succ a) (ho.2 a ha)) :
1909+ {f : ∀ a < o, Ordinal.{max u v}} (hf : ∀ a ha, f a ha < f (succ a) (ho.succ_lt ha)) :
19011910 bsup.{_, v} o f = blsub.{_, v} o f := by
19021911 rw [bsup_eq_blsub_iff_lt_bsup]
19031912 exact fun i hi => (hf i hi).trans_le (le_bsup f _ _)
@@ -1975,7 +1984,7 @@ theorem blsub_comp {o o' : Ordinal.{max u v}} {f : ∀ a < o, Ordinal.{max u v w
19751984
19761985theorem IsNormal.bsup_eq {f : Ordinal.{u} → Ordinal.{max u v}} (H : IsNormal f) {o : Ordinal.{u}}
19771986 (h : IsLimit o) : (Ordinal.bsup.{_, v} o fun x _ => f x) = f o := by
1978- rw [← IsNormal.bsup.{u, u, v} H (fun x _ => x) h.1 , bsup_id_limit h. 2 ]
1987+ rw [← IsNormal.bsup.{u, u, v} H (fun x _ => x) h.ne_bot , bsup_id_limit fun _ ↦ h.succ_lt ]
19791988
19801989theorem IsNormal.blsub_eq {f : Ordinal.{u} → Ordinal.{max u v}} (H : IsNormal f) {o : Ordinal.{u}}
19811990 (h : IsLimit o) : (blsub.{_, v} o fun x _ => f x) = f o := by
@@ -2360,10 +2369,11 @@ theorem one_lt_omega0 : 1 < ω := by simpa only [Nat.cast_one] using nat_lt_omeg
23602369@ [deprecated "No deprecation message was provided." (since := "2024-09-30" )]
23612370alias one_lt_omega := one_lt_omega0
23622371
2363- theorem isLimit_omega0 : IsLimit ω :=
2364- ⟨omega0_ne_zero, fun o h => by
2365- let ⟨n, e⟩ := lt_omega0.1 h
2366- rw [e]; exact nat_lt_omega0 (n + 1 )⟩
2372+ theorem isLimit_omega0 : IsLimit ω := by
2373+ rw [isLimit_iff, isSuccPrelimit_iff_succ_lt]
2374+ refine ⟨omega0_ne_zero, fun o h => ?_⟩
2375+ obtain ⟨n, rfl⟩ := lt_omega0.1 h
2376+ exact nat_lt_omega0 (n + 1 )
23672377
23682378@ [deprecated "No deprecation message was provided." (since := "2024-10-14" )]
23692379alias omega0_isLimit := isLimit_omega0
@@ -2393,8 +2403,8 @@ theorem sup_natCast : sup Nat.cast = ω :=
23932403alias sup_nat_cast := sup_natCast
23942404
23952405theorem nat_lt_limit {o} (h : IsLimit o) : ∀ n : ℕ, ↑n < o
2396- | 0 => lt_of_le_of_ne (Ordinal.zero_le o) h. 1 .symm
2397- | n + 1 => h.2 _ (nat_lt_limit h n)
2406+ | 0 => h.pos
2407+ | n + 1 => h.succ_lt (nat_lt_limit h n)
23982408
23992409theorem omega0_le_of_isLimit {o} (h : IsLimit o) : ω ≤ o :=
24002410 omega0_le.2 fun n => le_of_lt <| nat_lt_limit h n
@@ -2403,7 +2413,7 @@ theorem omega0_le_of_isLimit {o} (h : IsLimit o) : ω ≤ o :=
24032413alias omega_le_of_isLimit := omega0_le_of_isLimit
24042414
24052415theorem isLimit_iff_omega0_dvd {a : Ordinal} : IsLimit a ↔ a ≠ 0 ∧ ω ∣ a := by
2406- refine ⟨fun l => ⟨l.1 , ⟨a / ω, le_antisymm ?_ (mul_div_le _ _)⟩⟩, fun h => ?_⟩
2416+ refine ⟨fun l => ⟨l.ne_zero , ⟨a / ω, le_antisymm ?_ (mul_div_le _ _)⟩⟩, fun h => ?_⟩
24072417 · refine (limit_le l).2 fun x hx => le_of_lt ?_
24082418 rw [← div_lt omega0_ne_zero, ← succ_le_iff, le_div omega0_ne_zero, mul_succ,
24092419 add_le_of_limit isLimit_omega0]
@@ -2428,7 +2438,7 @@ theorem add_mul_limit_aux {a b c : Ordinal} (ba : b + a = a) (l : IsLimit c)
24282438 rw [IH _ h]
24292439 apply (add_le_add_left _ _).trans
24302440 · rw [← mul_succ]
2431- exact mul_le_mul_left' (succ_le_of_lt <| l.2 _ h) _
2441+ exact mul_le_mul_left' (succ_le_of_lt <| l.succ_lt h) _
24322442 · rw [← ba]
24332443 exact le_add_right _ _)
24342444 (mul_le_mul_right' (le_add_right _ _) _)
@@ -2495,6 +2505,7 @@ namespace Cardinal
24952505open Ordinal
24962506
24972507theorem isLimit_ord {c} (co : ℵ₀ ≤ c) : (ord c).IsLimit := by
2508+ rw [isLimit_iff, isSuccPrelimit_iff_succ_lt]
24982509 refine ⟨fun h => aleph0_ne_zero ?_, fun a => lt_imp_lt_of_le_imp_le fun h => ?_⟩
24992510 · rw [← Ordinal.le_zero, ord_le] at h
25002511 simpa only [card_zero, nonpos_iff_eq_zero] using co.trans h
@@ -2509,7 +2520,7 @@ theorem isLimit_ord {c} (co : ℵ₀ ≤ c) : (ord c).IsLimit := by
25092520alias ord_isLimit := isLimit_ord
25102521
25112522theorem noMaxOrder {c} (h : ℵ₀ ≤ c) : NoMaxOrder c.ord.toType :=
2512- toType_noMax_of_succ_lt (isLimit_ord h).2
2523+ toType_noMax_of_succ_lt fun _ ↦ (isLimit_ord h).succ_lt
25132524
25142525end Cardinal
25152526
0 commit comments