forked from leanprover-community/mathlib4
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFamily.lean
More file actions
887 lines (699 loc) · 37.2 KB
/
Family.lean
File metadata and controls
887 lines (699 loc) · 37.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
/-
Copyright (c) 2017 Johannes Hölzl. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro, Floris van Doorn, Violeta Hernández Palacios
-/
module
public import Mathlib.SetTheory.Ordinal.Arithmetic
/-!
# Arithmetic on families of ordinals
## Main definitions and results
* `sup`, `lsub`: the supremum / least strict upper bound of an indexed family of ordinals in
`Type u`, as an ordinal in `Type u`.
* `bsup`, `blsub`: the supremum / least strict upper bound of a set of ordinals indexed by ordinals
less than a given ordinal `o`.
Various other basic arithmetic results are given in `Principal.lean` instead.
-/
@[expose] public section
assert_not_exists Field Module
noncomputable section
open Function Cardinal Set Equiv Order
open scoped Ordinal
universe u v w
namespace Ordinal
variable {α β γ : Type*} {r : α → α → Prop} {s : β → β → Prop} {t : γ → γ → Prop}
/-! ### Families of ordinals
There are two kinds of indexed families that naturally arise when dealing with ordinals: those
indexed by some type in the appropriate universe, and those indexed by ordinals less than another.
The following API allows one to convert from one kind of family to the other.
In many cases, this makes it easy to prove claims about one kind of family via the corresponding
claim on the other. -/
/-- Converts a family indexed by a `Type u` to one indexed by an `Ordinal.{u}` using a specified
well-ordering. -/
def bfamilyOfFamily' {ι : Type u} (r : ι → ι → Prop) [IsWellOrder ι r] (f : ι → α) :
∀ a < type r, α := fun a ha => f (enum r ⟨a, ha⟩)
/-- Converts a family indexed by a `Type u` to one indexed by an `Ordinal.{u}` using a well-ordering
given by the axiom of choice. -/
def bfamilyOfFamily {ι : Type u} : (ι → α) → ∀ a < type (@WellOrderingRel ι), α :=
bfamilyOfFamily' WellOrderingRel
/-- Converts a family indexed by an `Ordinal.{u}` to one indexed by a `Type u` using a specified
well-ordering. -/
def familyOfBFamily' {ι : Type u} (r : ι → ι → Prop) [IsWellOrder ι r] {o} (ho : type r = o)
(f : ∀ a < o, α) : ι → α := fun i =>
f (typein r i)
(by
rw [← ho]
exact typein_lt_type r i)
/-- Converts a family indexed by an `Ordinal.{u}` to one indexed by a `Type u` using a well-ordering
given by the axiom of choice. -/
def familyOfBFamily (o : Ordinal) (f : ∀ a < o, α) : o.ToType → α :=
familyOfBFamily' (· < ·) (type_toType o) f
@[simp]
theorem bfamilyOfFamily'_typein {ι} (r : ι → ι → Prop) [IsWellOrder ι r] (f : ι → α) (i) :
bfamilyOfFamily' r f (typein r i) (typein_lt_type r i) = f i := by
simp only [bfamilyOfFamily', enum_typein]
@[simp]
theorem bfamilyOfFamily_typein {ι} (f : ι → α) (i) :
bfamilyOfFamily f (typein _ i) (typein_lt_type _ i) = f i :=
bfamilyOfFamily'_typein _ f i
theorem familyOfBFamily'_enum {ι : Type u} (r : ι → ι → Prop) [IsWellOrder ι r] {o}
(ho : type r = o) (f : ∀ a < o, α) (i hi) :
familyOfBFamily' r ho f (enum r ⟨i, by rwa [ho]⟩) = f i hi := by
simp only [familyOfBFamily', typein_enum]
theorem familyOfBFamily_enum (o : Ordinal) (f : ∀ a < o, α) (i hi) :
familyOfBFamily o f (enum (α := o.ToType) (· < ·) ⟨i, hi.trans_eq (type_toType _).symm⟩)
= f i hi :=
familyOfBFamily'_enum _ (type_toType o) f _ _
/-- The range of a family indexed by ordinals. -/
def brange (o : Ordinal) (f : ∀ a < o, α) : Set α :=
{ a | ∃ i hi, f i hi = a }
theorem mem_brange {o : Ordinal} {f : ∀ a < o, α} {a} : a ∈ brange o f ↔ ∃ i hi, f i hi = a :=
Iff.rfl
theorem mem_brange_self {o} (f : ∀ a < o, α) (i hi) : f i hi ∈ brange o f :=
⟨i, hi, rfl⟩
@[simp]
theorem range_familyOfBFamily' {ι : Type u} (r : ι → ι → Prop) [IsWellOrder ι r] {o}
(ho : type r = o) (f : ∀ a < o, α) : range (familyOfBFamily' r ho f) = brange o f := by
refine Set.ext fun a => ⟨?_, ?_⟩
· rintro ⟨b, rfl⟩
apply mem_brange_self
· rintro ⟨i, hi, rfl⟩
exact ⟨_, familyOfBFamily'_enum _ _ _ _ _⟩
@[simp]
theorem range_familyOfBFamily {o} (f : ∀ a < o, α) : range (familyOfBFamily o f) = brange o f :=
range_familyOfBFamily' _ _ f
@[simp]
theorem brange_bfamilyOfFamily' {ι : Type u} (r : ι → ι → Prop) [IsWellOrder ι r] (f : ι → α) :
brange _ (bfamilyOfFamily' r f) = range f := by
refine Set.ext fun a => ⟨?_, ?_⟩
· rintro ⟨i, hi, rfl⟩
apply mem_range_self
· rintro ⟨b, rfl⟩
exact ⟨_, _, bfamilyOfFamily'_typein _ _ _⟩
@[simp]
theorem brange_bfamilyOfFamily {ι : Type u} (f : ι → α) : brange _ (bfamilyOfFamily f) = range f :=
brange_bfamilyOfFamily' _ _
@[simp]
theorem brange_const {o : Ordinal} (ho : o ≠ 0) {c : α} : (brange o fun _ _ => c) = {c} := by
rw [← range_familyOfBFamily]
exact @Set.range_const _ o.ToType (nonempty_toType_iff.2 ho) c
theorem comp_bfamilyOfFamily' {ι : Type u} (r : ι → ι → Prop) [IsWellOrder ι r] (f : ι → α)
(g : α → β) : (fun i hi => g (bfamilyOfFamily' r f i hi)) = bfamilyOfFamily' r (g ∘ f) :=
rfl
theorem comp_bfamilyOfFamily {ι : Type u} (f : ι → α) (g : α → β) :
(fun i hi => g (bfamilyOfFamily f i hi)) = bfamilyOfFamily (g ∘ f) :=
rfl
theorem comp_familyOfBFamily' {ι : Type u} (r : ι → ι → Prop) [IsWellOrder ι r] {o}
(ho : type r = o) (f : ∀ a < o, α) (g : α → β) :
g ∘ familyOfBFamily' r ho f = familyOfBFamily' r ho fun i hi => g (f i hi) :=
rfl
theorem comp_familyOfBFamily {o} (f : ∀ a < o, α) (g : α → β) :
g ∘ familyOfBFamily o f = familyOfBFamily o fun i hi => g (f i hi) :=
rfl
/-! ### Supremum of a family of ordinals -/
/-- The range of an indexed ordinal function, whose outputs live in a higher universe than the
inputs, is always bounded above. See `Ordinal.lsub` for an explicit bound. -/
theorem bddAbove_range {ι : Type u} (f : ι → Ordinal.{max u v}) : BddAbove (Set.range f) :=
⟨(iSup (succ ∘ card ∘ f)).ord, by
rintro a ⟨i, rfl⟩
exact le_of_lt (Cardinal.lt_ord.2 ((lt_succ _).trans_le
(le_ciSup (Cardinal.bddAbove_range _) _)))⟩
theorem bddAbove_of_small (s : Set Ordinal.{u}) [h : Small.{u} s] : BddAbove s := by
obtain ⟨a, ha⟩ := bddAbove_range (fun x => ((@equivShrink s h).symm x).val)
use a
intro b hb
simpa using ha (mem_range_self (equivShrink s ⟨b, hb⟩))
theorem bddAbove_iff_small {s : Set Ordinal.{u}} : BddAbove s ↔ Small.{u} s :=
⟨fun ⟨a, h⟩ => small_subset <| show s ⊆ Iic a from fun _ hx => h hx, fun _ =>
bddAbove_of_small _⟩
theorem bddAbove_image {s : Set Ordinal.{u}} (hf : BddAbove s)
(f : Ordinal.{u} → Ordinal.{max u v}) : BddAbove (f '' s) := by
rw [bddAbove_iff_small] at hf ⊢
exact small_lift _
theorem bddAbove_range_comp {ι : Type u} {f : ι → Ordinal.{v}} (hf : BddAbove (range f))
(g : Ordinal.{v} → Ordinal.{max v w}) : BddAbove (range (g ∘ f)) := by
rw [range_comp]
exact bddAbove_image hf g
/-- `le_ciSup` whenever the input type is small in the output universe. This lemma sometimes
fails to infer `f` in simple cases and needs it to be given explicitly. -/
protected theorem le_iSup {ι} (f : ι → Ordinal.{u}) [Small.{u} ι] : ∀ i, f i ≤ iSup f :=
le_ciSup (bddAbove_of_small _)
/-- `ciSup_le_iff'` whenever the input type is small in the output universe. -/
protected theorem iSup_le_iff {ι} {f : ι → Ordinal.{u}} {a : Ordinal.{u}} [Small.{u} ι] :
iSup f ≤ a ↔ ∀ i, f i ≤ a :=
ciSup_le_iff' (bddAbove_of_small _)
/-- An alias of `ciSup_le'` for discoverability. -/
protected theorem iSup_le {ι} {f : ι → Ordinal} {a} : (∀ i, f i ≤ a) → iSup f ≤ a :=
ciSup_le'
/-- `lt_ciSup_iff'` whenever the input type is small in the output universe. -/
protected theorem lt_iSup_iff {ι} {f : ι → Ordinal.{u}} {a : Ordinal.{u}} [Small.{u} ι] :
a < iSup f ↔ ∃ i, a < f i :=
lt_ciSup_iff' (bddAbove_of_small _)
-- TODO: state in terms of `IsSuccLimit`.
theorem succ_lt_iSup_of_ne_iSup {ι} {f : ι → Ordinal.{u}} [Small.{u} ι]
(hf : ∀ i, f i ≠ iSup f) {a} (hao : a < iSup f) : succ a < iSup f := by
by_contra! hoa
exact hao.not_ge (Ordinal.iSup_le fun i ↦ le_of_lt_succ <|
((Ordinal.le_iSup _ _).lt_of_ne (hf i)).trans_le hoa)
-- TODO: generalize to conditionally complete lattices.
theorem iSup_eq_zero_iff {ι} {f : ι → Ordinal.{u}} [Small.{u} ι] :
iSup f = 0 ↔ ∀ i, f i = 0 := by
refine
⟨fun h i => ?_, fun h =>
le_antisymm (Ordinal.iSup_le fun i => nonpos_iff_eq_zero.2 (h i)) (zero_le _)⟩
rw [← nonpos_iff_eq_zero, ← h]
exact Ordinal.le_iSup f i
-- TODO: generalize or remove
theorem iSup_eq_of_range_eq {ι ι'} {f : ι → Ordinal} {g : ι' → Ordinal}
(h : Set.range f = Set.range g) : iSup f = iSup g :=
congr_arg _ h
@[deprecated (since := "2025-10-08")] alias iSup_succ := _root_.iSup_succ
-- TODO: generalize to conditionally complete lattices
theorem iSup_sum {α β} (f : α ⊕ β → Ordinal.{u}) [Small.{u} α] [Small.{u} β] :
iSup f = max (⨆ a, f (Sum.inl a)) (⨆ b, f (Sum.inr b)) := by
apply (Ordinal.iSup_le _).antisymm (max_le _ _)
· rintro (i | i)
· exact le_max_of_le_left (Ordinal.le_iSup (fun x ↦ f (Sum.inl x)) i)
· exact le_max_of_le_right (Ordinal.le_iSup (fun x ↦ f (Sum.inr x)) i)
all_goals
apply csSup_le_csSup' (bddAbove_of_small _)
rintro i ⟨a, rfl⟩
apply mem_range_self
theorem unbounded_range_of_le_iSup {α β : Type u} (r : α → α → Prop) [IsWellOrder α r] (f : β → α)
(h : type r ≤ ⨆ i, typein r (f i)) : Unbounded r (range f) :=
(not_bounded_iff _).1 fun ⟨x, hx⟩ =>
h.not_gt <| lt_of_le_of_lt
(Ordinal.iSup_le fun y => ((typein_lt_typein r).2 <| hx _ <| mem_range_self y).le)
(typein_lt_type r x)
set_option linter.deprecated false in
@[deprecated Order.IsNormal.map_iSup (since := "2025-12-25")]
theorem IsNormal.map_iSup_of_bddAbove {f : Ordinal.{u} → Ordinal.{v}} (H : Ordinal.IsNormal f)
{ι : Type*} (g : ι → Ordinal.{u}) (hg : BddAbove (range g))
[Nonempty ι] : f (⨆ i, g i) = ⨆ i, f (g i) :=
Order.IsNormal.map_iSup H hg
set_option linter.deprecated false in
@[deprecated Order.IsNormal.map_iSup (since := "2025-12-25")]
theorem IsNormal.map_iSup {f : Ordinal.{u} → Ordinal.{v}} (H : Ordinal.IsNormal f)
{ι : Type w} (g : ι → Ordinal.{u}) [Small.{u} ι] [Nonempty ι] :
f (⨆ i, g i) = ⨆ i, f (g i) :=
Order.IsNormal.map_iSup H (bddAbove_of_small _)
set_option linter.deprecated false in
@[deprecated Order.IsNormal.map_sSup (since := "2025-12-25")]
theorem IsNormal.map_sSup_of_bddAbove {f : Ordinal.{u} → Ordinal.{v}} (H : Ordinal.IsNormal f)
{s : Set Ordinal.{u}} (hs : BddAbove s) (hn : s.Nonempty) : f (sSup s) = sSup (f '' s) :=
Order.IsNormal.map_sSup H hn hs
set_option linter.deprecated false in
@[deprecated Order.IsNormal.map_sSup (since := "2025-12-25")]
theorem IsNormal.map_sSup {f : Ordinal.{u} → Ordinal.{v}} (H : IsNormal f)
{s : Set Ordinal.{u}} (hn : s.Nonempty) [Small.{u} s] : f (sSup s) = sSup (f '' s) :=
Order.IsNormal.map_sSup H hn (bddAbove_of_small _)
set_option linter.deprecated false in
@[deprecated Order.IsNormal.apply_of_isSuccLimit (since := "2025-12-25")]
theorem IsNormal.apply_of_isSuccLimit {f : Ordinal.{u} → Ordinal.{v}} (H : Ordinal.IsNormal f)
{o : Ordinal} (ho : IsSuccLimit o) : f o = ⨆ a : Iio o, f a :=
Order.IsNormal.apply_of_isSuccLimit H ho
theorem sSup_ord (s : Set Cardinal) : (sSup s).ord = sSup (ord '' s) := by
obtain rfl | hn := s.eq_empty_or_nonempty
· simp
· by_cases hs : BddAbove s
· exact isNormal_ord.map_sSup hn hs
· rw [csSup_of_not_bddAbove hs, csSup_of_not_bddAbove (bddAbove_ord_image_iff.not.2 hs)]
simp
theorem iSup_ord {ι} (f : ι → Cardinal) : (⨆ i, f i).ord = ⨆ i, (f i).ord := by
rw [iSup, iSup, sSup_ord, range_comp']
theorem lift_card_sInf_compl_le (s : Set Ordinal.{u}) :
Cardinal.lift.{u + 1} (sInf sᶜ).card ≤ #s := by
rw [← mk_Iio_ordinal]
refine mk_le_mk_of_subset fun x (hx : x < _) ↦ ?_
rw [← not_notMem]
exact notMem_of_lt_csInf' hx
theorem card_sInf_range_compl_le_lift {ι : Type u} (f : ι → Ordinal.{max u v}) :
(sInf (range f)ᶜ).card ≤ Cardinal.lift.{v} #ι := by
rw [← Cardinal.lift_le.{max u v + 1}, Cardinal.lift_lift]
apply (lift_card_sInf_compl_le _).trans
rw [← Cardinal.lift_id'.{u, max u v + 1} #(range _)]
exact mk_range_le_lift
theorem card_sInf_range_compl_le {ι : Type u} (f : ι → Ordinal.{u}) :
(sInf (range f)ᶜ).card ≤ #ι :=
Cardinal.lift_id #ι ▸ card_sInf_range_compl_le_lift f
theorem sInf_compl_lt_lift_ord_succ {ι : Type u} (f : ι → Ordinal.{max u v}) :
sInf (range f)ᶜ < lift.{v} (succ #ι).ord := by
rw [lift_ord, Cardinal.lift_succ, ← card_le_iff]
exact card_sInf_range_compl_le_lift f
theorem sInf_compl_lt_ord_succ {ι : Type u} (f : ι → Ordinal.{u}) :
sInf (range f)ᶜ < (succ #ι).ord :=
lift_id (succ #ι).ord ▸ sInf_compl_lt_lift_ord_succ f
-- TODO: remove `bsup` in favor of `iSup` in a future refactor.
section bsup
theorem iSup_eq_iSup {ι ι' : Type u} (r : ι → ι → Prop) (r' : ι' → ι' → Prop) [IsWellOrder ι r]
[IsWellOrder ι' r'] {o : Ordinal} (ho : type r = o) (ho' : type r' = o) (f : ∀ a < o, Ordinal) :
iSup (familyOfBFamily' r ho f) = iSup (familyOfBFamily' r' ho' f) :=
iSup_eq_of_range_eq (by simp)
/-- The supremum of a family of ordinals indexed by the set of ordinals less than some
`o : Ordinal.{u}`. This is a special case of `iSup` over the family provided by
`familyOfBFamily`. -/
def bsup (o : Ordinal.{u}) (f : ∀ a < o, Ordinal.{max u v}) : Ordinal.{max u v} :=
iSup (familyOfBFamily o f)
@[simp]
theorem iSup_eq_bsup {o : Ordinal} (f : ∀ a < o, Ordinal) :
iSup (familyOfBFamily o f) = bsup o f :=
rfl
theorem iSup'_eq_bsup {o : Ordinal} {ι} (r : ι → ι → Prop) [IsWellOrder ι r] (ho : type r = o)
(f : ∀ a < o, Ordinal) : iSup (familyOfBFamily' r ho f) = bsup o f :=
iSup_eq_iSup r _ ho _ f
theorem sSup_eq_bsup {o : Ordinal} (f : ∀ a < o, Ordinal) : sSup (brange o f) = bsup o f := by
congr
rw [range_familyOfBFamily]
@[simp]
theorem bsup'_eq_iSup {ι} (r : ι → ι → Prop) [IsWellOrder ι r] (f : ι → Ordinal) :
bsup _ (bfamilyOfFamily' r f) = iSup f := by
simp +unfoldPartialApp only [← iSup'_eq_bsup r, enum_typein, familyOfBFamily', bfamilyOfFamily']
@[simp]
theorem bsup_eq_iSup {ι} (f : ι → Ordinal) : bsup _ (bfamilyOfFamily f) = iSup f :=
bsup'_eq_iSup _ f
theorem bsup_eq_bsup {ι : Type u} (r r' : ι → ι → Prop) [IsWellOrder ι r] [IsWellOrder ι r']
(f : ι → Ordinal.{max u v}) :
bsup.{_, v} _ (bfamilyOfFamily' r f) = bsup.{_, v} _ (bfamilyOfFamily' r' f) := by
rw [bsup'_eq_iSup, bsup'_eq_iSup]
@[congr]
theorem bsup_congr {o₁ o₂ : Ordinal.{u}} (f : ∀ a < o₁, Ordinal.{max u v}) (ho : o₁ = o₂) :
bsup.{_, v} o₁ f = bsup.{_, v} o₂ fun a h => f a (h.trans_eq ho.symm) := by
subst ho
rfl
theorem bsup_le_iff {o f a} : bsup.{u, v} o f ≤ a ↔ ∀ i h, f i h ≤ a :=
Ordinal.iSup_le_iff.trans
⟨fun h i hi => by
rw [← familyOfBFamily_enum o f]
exact h _, fun h _ => h _ _⟩
theorem bsup_le {o : Ordinal} {f : ∀ b < o, Ordinal} {a} :
(∀ i h, f i h ≤ a) → bsup.{u, v} o f ≤ a :=
bsup_le_iff.2
theorem le_bsup {o} (f : ∀ a < o, Ordinal) (i h) : f i h ≤ bsup o f :=
bsup_le_iff.1 le_rfl _ _
theorem lt_bsup {o : Ordinal.{u}} (f : ∀ a < o, Ordinal.{max u v}) {a} :
a < bsup.{_, v} o f ↔ ∃ i hi, a < f i hi := by
simpa only [not_forall, not_le] using not_congr (@bsup_le_iff.{_, v} _ f a)
theorem IsNormal.bsup {f : Ordinal → Ordinal} (H : IsNormal f) {o : Ordinal} :
∀ (g : ∀ a < o, Ordinal), o ≠ 0 → f (bsup o g) = bsup o fun a h => f (g a h) :=
inductionOn o fun α r _ g h => by
haveI := type_ne_zero_iff_nonempty.1 h
rw [← iSup'_eq_bsup r, Order.IsNormal.map_iSup H (bddAbove_of_small _), ← iSup'_eq_bsup r] <;>
rfl
theorem lt_bsup_of_ne_bsup {o : Ordinal.{u}} {f : ∀ a < o, Ordinal.{max u v}} :
(∀ i h, f i h ≠ bsup.{_, v} o f) ↔ ∀ i h, f i h < bsup.{_, v} o f :=
⟨fun hf _ _ => lt_of_le_of_ne (le_bsup _ _ _) (hf _ _), fun hf _ _ => ne_of_lt (hf _ _)⟩
theorem bsup_not_succ_of_ne_bsup {o : Ordinal.{u}} {f : ∀ a < o, Ordinal.{max u v}}
(hf : ∀ {i : Ordinal} (h : i < o), f i h ≠ bsup.{_, v} o f) (a) :
a < bsup.{_, v} o f → succ a < bsup.{_, v} o f := by
rw [← iSup_eq_bsup] at *
exact succ_lt_iSup_of_ne_iSup fun i => hf _
@[simp]
theorem bsup_eq_zero_iff {o} {f : ∀ a < o, Ordinal} : bsup o f = 0 ↔ ∀ i hi, f i hi = 0 := by
refine
⟨fun h i hi => ?_, fun h =>
le_antisymm (bsup_le fun i hi => nonpos_iff_eq_zero.2 (h i hi)) (zero_le _)⟩
rw [← nonpos_iff_eq_zero, ← h]
exact le_bsup f i hi
theorem lt_bsup_of_limit {o : Ordinal} {f : ∀ a < o, Ordinal}
(hf : ∀ {a a'} (ha : a < o) (ha' : a' < o), a < a' → f a ha < f a' ha')
(ho : ∀ a < o, succ a < o) (i h) : f i h < bsup o f :=
(hf _ _ <| lt_succ i).trans_le (le_bsup f (succ i) <| ho _ h)
theorem bsup_succ_of_mono {o : Ordinal} {f : ∀ a < succ o, Ordinal}
(hf : ∀ {i j} (hi hj), i ≤ j → f i hi ≤ f j hj) : bsup _ f = f o (lt_succ o) :=
le_antisymm (bsup_le fun _i hi => hf _ _ <| le_of_lt_succ hi) (le_bsup _ _ _)
@[simp]
theorem bsup_zero (f : ∀ a < (0 : Ordinal), Ordinal) : bsup 0 f = 0 :=
bsup_eq_zero_iff.2 fun _i hi => (not_lt_zero hi).elim
theorem bsup_const {o : Ordinal.{u}} (ho : o ≠ 0) (a : Ordinal.{max u v}) :
(bsup.{_, v} o fun _ _ => a) = a :=
le_antisymm (bsup_le fun _ _ => le_rfl) (le_bsup _ 0 (pos_iff_ne_zero.2 ho))
@[simp]
theorem bsup_one (f : ∀ a < (1 : Ordinal), Ordinal) : bsup 1 f = f 0 zero_lt_one := by
simp_rw [← iSup_eq_bsup, ciSup_unique, familyOfBFamily, familyOfBFamily', typein_one_toType]
theorem bsup_le_of_brange_subset {o o'} {f : ∀ a < o, Ordinal} {g : ∀ a < o', Ordinal}
(h : brange o f ⊆ brange o' g) : bsup.{u, max v w} o f ≤ bsup.{v, max u w} o' g :=
bsup_le fun i hi => by
obtain ⟨j, hj, hj'⟩ := h ⟨i, hi, rfl⟩
rw [← hj']
apply le_bsup
theorem bsup_eq_of_brange_eq {o o'} {f : ∀ a < o, Ordinal} {g : ∀ a < o', Ordinal}
(h : brange o f = brange o' g) : bsup.{u, max v w} o f = bsup.{v, max u w} o' g :=
(bsup_le_of_brange_subset.{u, v, w} h.le).antisymm (bsup_le_of_brange_subset.{v, u, w} h.ge)
theorem iSup_Iio_eq_bsup {o} {f : ∀ a < o, Ordinal} : ⨆ a : Iio o, f a.1 a.2 = bsup o f := by
simp_rw [Iio, bsup, iSup, range_familyOfBFamily, brange, range, Subtype.exists, mem_setOf]
@[deprecated (since := "2025-10-01")] alias sup_eq_sup := iSup_eq_iSup
@[deprecated (since := "2025-10-01")] alias sup_eq_bsup' := iSup'_eq_bsup
@[deprecated (since := "2025-10-01")] alias sup_eq_bsup := iSup_eq_bsup
@[deprecated (since := "2025-10-01")] alias bsup_eq_sup' := bsup'_eq_iSup
@[deprecated (since := "2025-10-01")] alias bsup_eq_sup := bsup_eq_iSup
end bsup
-- TODO: bring the lsub API in line with the sSup / iSup API, or deprecate it altogether.
section lsub
/-- The least strict upper bound of a family of ordinals. -/
def lsub {ι : Type u} (f : ι → Ordinal.{max u v}) : Ordinal :=
iSup (succ ∘ f)
@[simp]
theorem iSup_eq_lsub {ι} (f : ι → Ordinal) : iSup (succ ∘ f) = lsub f :=
rfl
theorem lsub_le_iff {ι} {f : ι → Ordinal} {a} : lsub f ≤ a ↔ ∀ i, f i < a := by
simpa using Ordinal.iSup_le_iff (f := succ ∘ f)
theorem lsub_le {ι} {f : ι → Ordinal} {a} : (∀ i, f i < a) → lsub f ≤ a :=
lsub_le_iff.2
theorem lt_lsub {ι} (f : ι → Ordinal) (i) : f i < lsub f :=
succ_le_iff.1 (Ordinal.le_iSup _ i)
theorem lt_lsub_iff {ι} {f : ι → Ordinal} {a} : a < lsub f ↔ ∃ i, a ≤ f i := by
simpa only [not_forall, not_lt, not_le] using not_congr lsub_le_iff
theorem iSup_le_lsub {ι} (f : ι → Ordinal) : iSup f ≤ lsub f :=
Ordinal.iSup_le fun i => (lt_lsub f i).le
theorem lsub_le_succ_iSup {ι} (f : ι → Ordinal) : lsub f ≤ succ (iSup f) :=
lsub_le fun i => lt_succ_iff.2 (Ordinal.le_iSup f i)
theorem iSup_eq_lsub_or_succ_iSup_eq_lsub {ι} (f : ι → Ordinal) :
iSup f = lsub f ∨ succ (iSup f) = lsub f := by
rcases eq_or_lt_of_le (iSup_le_lsub f) with h | h
· exact Or.inl h
· exact Or.inr ((succ_le_of_lt h).antisymm (lsub_le_succ_iSup f))
theorem succ_iSup_le_lsub_iff {ι} (f : ι → Ordinal) :
succ (iSup f) ≤ lsub f ↔ ∃ i, f i = iSup f := by
refine ⟨fun h => ?_, ?_⟩
· by_contra! hf
have := forall_congr' fun i ↦ (Ordinal.le_iSup f i).lt_iff_ne.symm
exact (succ_le_iff.1 h).ne ((iSup_le_lsub f).antisymm (lsub_le (this.1 hf)))
rintro ⟨_, hf⟩
rw [succ_le_iff, ← hf]
exact lt_lsub _ _
theorem succ_iSup_eq_lsub_iff {ι} (f : ι → Ordinal) :
succ (iSup f) = lsub f ↔ ∃ i, f i = iSup f :=
(lsub_le_succ_iSup f).ge_iff_eq'.symm.trans (succ_iSup_le_lsub_iff f)
theorem iSup_eq_lsub_iff {ι} (f : ι → Ordinal) :
iSup f = lsub f ↔ ∀ a < lsub f, succ a < lsub f := by
refine ⟨fun h => ?_, fun hf => le_antisymm (iSup_le_lsub f) (lsub_le fun i => ?_)⟩
· rw [← h]
exact fun a => succ_lt_iSup_of_ne_iSup fun i => (lsub_le_iff.1 (le_of_eq h.symm) i).ne
by_contra! hle
have heq := (succ_iSup_eq_lsub_iff f).2 ⟨i, le_antisymm (Ordinal.le_iSup _ _) hle⟩
have :=
hf _
(by
rw [← heq]
exact lt_succ (iSup f))
rw [heq] at this
exact this.false
theorem iSup_eq_lsub_iff_lt_iSup {ι} (f : ι → Ordinal) :
iSup f = lsub f ↔ ∀ i, f i < iSup f :=
⟨fun h i => by
rw [h]
apply lt_lsub, fun h => le_antisymm (iSup_le_lsub f) (lsub_le h)⟩
@[simp]
theorem lsub_empty {ι} [h : IsEmpty ι] (f : ι → Ordinal) : lsub f = 0 := by
rw [← nonpos_iff_eq_zero, lsub_le_iff]
exact h.elim
theorem lsub_pos {ι} [h : Nonempty ι] (f : ι → Ordinal) : 0 < lsub f :=
h.elim fun i => (zero_le _).trans_lt (lt_lsub f i)
@[simp]
theorem lsub_eq_zero_iff {ι} (f : ι → Ordinal) :
lsub.{_, v} f = 0 ↔ IsEmpty ι := by
refine ⟨fun h => ⟨fun i => ?_⟩, fun h => @lsub_empty _ h _⟩
have := @lsub_pos.{_, v} _ ⟨i⟩ f
rw [h] at this
exact this.false
@[simp]
theorem lsub_const {ι} [Nonempty ι] (o : Ordinal) : (lsub fun _ : ι => o) = succ o :=
ciSup_const
@[simp]
theorem lsub_unique {ι} [Unique ι] (f : ι → Ordinal) : lsub f = succ (f default) :=
ciSup_unique
theorem lsub_le_of_range_subset {ι ι'} {f : ι → Ordinal} {g : ι' → Ordinal}
(h : Set.range f ⊆ Set.range g) : lsub.{u, max v w} f ≤ lsub.{v, max u w} g :=
csSup_le_csSup' (bddAbove_range.{v, max u w} _)
(by convert Set.image_mono h <;> apply Set.range_comp)
theorem lsub_eq_of_range_eq {ι ι'} {f : ι → Ordinal} {g : ι' → Ordinal}
(h : Set.range f = Set.range g) : lsub.{u, max v w} f = lsub.{v, max u w} g :=
(lsub_le_of_range_subset.{u, v, w} h.le).antisymm (lsub_le_of_range_subset.{v, u, w} h.ge)
@[simp]
theorem lsub_sum {α : Type u} {β : Type v} (f : α ⊕ β → Ordinal) :
lsub.{max u v, w} f =
max (lsub.{u, max v w} fun a => f (Sum.inl a)) (lsub.{v, max u w} fun b => f (Sum.inr b)) :=
iSup_sum _
theorem lsub_notMem_range {ι} (f : ι → Ordinal) :
lsub f ∉ Set.range f := fun ⟨i, h⟩ =>
h.not_lt (lt_lsub f i)
theorem nonempty_compl_range {ι : Type u} (f : ι → Ordinal.{max u v}) : (Set.range f)ᶜ.Nonempty :=
⟨_, lsub_notMem_range f⟩
@[simp]
theorem lsub_typein (o : Ordinal) : lsub.{u, u} (typein (α := o.ToType) (· < ·)) = o :=
(lsub_le.{u, u} typein_lt_self).antisymm
(by
by_contra! h
have h := h.trans_eq (type_toType o).symm
simpa [typein_enum] using lt_lsub.{u, u} (typein (· < ·)) (enum (· < ·) ⟨_, h⟩))
theorem iSup_typein_limit {o : Ordinal.{u}} (ho : ∀ a, a < o → succ a < o) :
iSup (typein ((· < ·) : o.ToType → o.ToType → Prop)) = o := by
rw [(iSup_eq_lsub_iff.{u, u} (typein (· < ·))).2] <;> rw [lsub_typein o]
assumption
@[simp]
theorem iSup_typein_succ {o : Ordinal} :
iSup (typein ((· < ·) : (succ o).ToType → (succ o).ToType → Prop)) = o := by
rcases iSup_eq_lsub_or_succ_iSup_eq_lsub
(typein ((· < ·) : (succ o).ToType → (succ o).ToType → Prop)) with h | h
· rw [iSup_eq_lsub_iff] at h
simp only [lsub_typein] at h
exact (h o (lt_succ o)).false.elim
rw [← succ_eq_succ_iff, h]
apply lsub_typein
@[deprecated (since := "2025-10-01")] alias sup_eq_lsub := iSup_eq_lsub
@[deprecated (since := "2025-10-01")] alias sup_le_lsub := iSup_le_lsub
@[deprecated (since := "2025-10-01")] alias lsub_le_sup_succ := lsub_le_succ_iSup
@[deprecated (since := "2025-10-01")] alias sup_eq_lsub_or_sup_succ_eq_lsub :=
iSup_eq_lsub_or_succ_iSup_eq_lsub
@[deprecated (since := "2025-10-01")] alias sup_succ_le_lsub := succ_iSup_le_lsub_iff
@[deprecated (since := "2025-10-01")] alias sup_succ_eq_lsub := succ_iSup_eq_lsub_iff
@[deprecated (since := "2025-10-01")] alias sup_eq_lsub_iff_succ := iSup_eq_lsub_iff
@[deprecated (since := "2025-10-01")] alias sup_eq_lsub_iff_lt_sup := iSup_eq_lsub_iff_lt_iSup
@[deprecated (since := "2025-10-01")] alias sup_typein_limit := iSup_typein_limit
@[deprecated (since := "2025-10-01")] alias sup_typein_succ := iSup_typein_succ
end lsub
-- TODO: either deprecate this in favor of `lsub` when its universes are generalized, or deprecate
-- both of them at once.
section blsub
/-- The least strict upper bound of a family of ordinals indexed by the set of ordinals less than
some `o : Ordinal.{u}`.
This is to `lsub` as `bsup` is to `sup`. -/
def blsub (o : Ordinal.{u}) (f : ∀ a < o, Ordinal.{max u v}) : Ordinal.{max u v} :=
bsup.{_, v} o fun a ha => succ (f a ha)
@[simp]
theorem bsup_eq_blsub (o : Ordinal.{u}) (f : ∀ a < o, Ordinal.{max u v}) :
(bsup.{_, v} o fun a ha => succ (f a ha)) = blsub.{_, v} o f :=
rfl
theorem lsub_eq_blsub' {ι : Type u} (r : ι → ι → Prop) [IsWellOrder ι r] {o} (ho : type r = o)
(f : ∀ a < o, Ordinal) : lsub (familyOfBFamily' r ho f) = blsub o f :=
iSup'_eq_bsup r ho fun a ha => succ (f a ha)
theorem lsub_eq_lsub {ι ι' : Type u} (r : ι → ι → Prop) (r' : ι' → ι' → Prop) [IsWellOrder ι r]
[IsWellOrder ι' r'] {o} (ho : type r = o) (ho' : type r' = o)
(f : ∀ a < o, Ordinal.{max u v}) :
lsub.{_, v} (familyOfBFamily' r ho f) = lsub.{_, v} (familyOfBFamily' r' ho' f) := by
rw [lsub_eq_blsub', lsub_eq_blsub']
@[simp]
theorem lsub_eq_blsub {o : Ordinal.{u}} (f : ∀ a < o, Ordinal.{max u v}) :
lsub.{_, v} (familyOfBFamily o f) = blsub.{_, v} o f :=
lsub_eq_blsub' _ _ _
@[simp]
theorem blsub_eq_lsub' {ι : Type u} (r : ι → ι → Prop) [IsWellOrder ι r]
(f : ι → Ordinal.{max u v}) : blsub.{_, v} _ (bfamilyOfFamily' r f) = lsub.{_, v} f :=
bsup'_eq_iSup r (succ ∘ f)
theorem blsub_eq_blsub {ι : Type u} (r r' : ι → ι → Prop) [IsWellOrder ι r] [IsWellOrder ι r']
(f : ι → Ordinal.{max u v}) :
blsub.{_, v} _ (bfamilyOfFamily' r f) = blsub.{_, v} _ (bfamilyOfFamily' r' f) := by
rw [blsub_eq_lsub', blsub_eq_lsub']
@[simp]
theorem blsub_eq_lsub {ι : Type u} (f : ι → Ordinal.{max u v}) :
blsub.{_, v} _ (bfamilyOfFamily f) = lsub.{_, v} f :=
blsub_eq_lsub' _ _
@[congr]
theorem blsub_congr {o₁ o₂ : Ordinal.{u}} (f : ∀ a < o₁, Ordinal.{max u v}) (ho : o₁ = o₂) :
blsub.{_, v} o₁ f = blsub.{_, v} o₂ fun a h => f a (h.trans_eq ho.symm) := by
subst ho
rfl
theorem blsub_le_iff {o : Ordinal.{u}} {f : ∀ a < o, Ordinal.{max u v}} {a} :
blsub.{_, v} o f ≤ a ↔ ∀ i h, f i h < a := by
convert bsup_le_iff.{_, v} (f := fun a ha => succ (f a ha)) (a := a) using 2
simp_rw [succ_le_iff]
theorem blsub_le {o : Ordinal} {f : ∀ b < o, Ordinal} {a} : (∀ i h, f i h < a) → blsub o f ≤ a :=
blsub_le_iff.2
theorem lt_blsub {o} (f : ∀ a < o, Ordinal) (i h) : f i h < blsub o f :=
blsub_le_iff.1 le_rfl _ _
theorem lt_blsub_iff {o : Ordinal.{u}} {f : ∀ b < o, Ordinal.{max u v}} {a} :
a < blsub.{_, v} o f ↔ ∃ i hi, a ≤ f i hi := by
simpa only [not_forall, not_lt, not_le] using not_congr (@blsub_le_iff.{_, v} _ f a)
theorem bsup_le_blsub {o : Ordinal.{u}} (f : ∀ a < o, Ordinal.{max u v}) :
bsup.{_, v} o f ≤ blsub.{_, v} o f :=
bsup_le fun i h => (lt_blsub f i h).le
theorem blsub_le_bsup_succ {o : Ordinal.{u}} (f : ∀ a < o, Ordinal.{max u v}) :
blsub.{_, v} o f ≤ succ (bsup.{_, v} o f) :=
blsub_le fun i h => lt_succ_iff.2 (le_bsup f i h)
theorem bsup_eq_blsub_or_succ_bsup_eq_blsub {o : Ordinal.{u}} (f : ∀ a < o, Ordinal.{max u v}) :
bsup.{_, v} o f = blsub.{_, v} o f ∨ succ (bsup.{_, v} o f) = blsub.{_, v} o f := by
rw [← iSup_eq_bsup, ← lsub_eq_blsub]
exact iSup_eq_lsub_or_succ_iSup_eq_lsub _
theorem bsup_succ_le_blsub {o : Ordinal.{u}} (f : ∀ a < o, Ordinal.{max u v}) :
succ (bsup.{_, v} o f) ≤ blsub.{_, v} o f ↔ ∃ i hi, f i hi = bsup.{_, v} o f := by
refine ⟨fun h => ?_, ?_⟩
· by_contra! hf
exact
ne_of_lt (succ_le_iff.1 h)
(le_antisymm (bsup_le_blsub f) (blsub_le (lt_bsup_of_ne_bsup.1 hf)))
rintro ⟨_, _, hf⟩
rw [succ_le_iff, ← hf]
exact lt_blsub _ _ _
theorem bsup_succ_eq_blsub {o : Ordinal.{u}} (f : ∀ a < o, Ordinal.{max u v}) :
succ (bsup.{_, v} o f) = blsub.{_, v} o f ↔ ∃ i hi, f i hi = bsup.{_, v} o f :=
(blsub_le_bsup_succ f).ge_iff_eq'.symm.trans (bsup_succ_le_blsub f)
theorem bsup_eq_blsub_iff_succ {o : Ordinal.{u}} (f : ∀ a < o, Ordinal.{max u v}) :
bsup.{_, v} o f = blsub.{_, v} o f ↔ ∀ a < blsub.{_, v} o f, succ a < blsub.{_, v} o f := by
rw [← iSup_eq_bsup, ← lsub_eq_blsub]
apply iSup_eq_lsub_iff
theorem bsup_eq_blsub_iff_lt_bsup {o : Ordinal.{u}} (f : ∀ a < o, Ordinal.{max u v}) :
bsup.{_, v} o f = blsub.{_, v} o f ↔ ∀ i hi, f i hi < bsup.{_, v} o f :=
⟨fun h i => by
rw [h]
apply lt_blsub, fun h => le_antisymm (bsup_le_blsub f) (blsub_le h)⟩
theorem bsup_eq_blsub_of_lt_succ_limit {o : Ordinal.{u}} (ho : IsSuccLimit o)
{f : ∀ a < o, Ordinal.{max u v}} (hf : ∀ a ha, f a ha < f (succ a) (ho.succ_lt ha)) :
bsup.{_, v} o f = blsub.{_, v} o f := by
rw [bsup_eq_blsub_iff_lt_bsup]
exact fun i hi => (hf i hi).trans_le (le_bsup f _ _)
theorem blsub_succ_of_mono {o : Ordinal.{u}} {f : ∀ a < succ o, Ordinal.{max u v}}
(hf : ∀ {i j} (hi hj), i ≤ j → f i hi ≤ f j hj) : blsub.{_, v} _ f = succ (f o (lt_succ o)) :=
bsup_succ_of_mono fun {_ _} hi hj h => succ_le_succ (hf hi hj h)
@[simp]
theorem blsub_eq_zero_iff {o} {f : ∀ a < o, Ordinal} : blsub o f = 0 ↔ o = 0 := by
rw [← lsub_eq_blsub, lsub_eq_zero_iff]
exact isEmpty_toType_iff
@[simp]
theorem blsub_zero (f : ∀ a < (0 : Ordinal), Ordinal) : blsub 0 f = 0 := by rw [blsub_eq_zero_iff]
theorem blsub_pos {o : Ordinal} (ho : 0 < o) (f : ∀ a < o, Ordinal) : 0 < blsub o f :=
(zero_le _).trans_lt (lt_blsub f 0 ho)
theorem blsub_type {α : Type u} (r : α → α → Prop) [IsWellOrder α r]
(f : ∀ a < type r, Ordinal.{max u v}) :
blsub.{_, v} (type r) f = lsub.{_, v} fun a => f (typein r a) (typein_lt_type _ _) :=
eq_of_forall_ge_iff fun o => by
rw [blsub_le_iff, lsub_le_iff]
exact ⟨fun H b => H _ _, fun H i h => by simpa only [typein_enum] using H (enum r ⟨i, h⟩)⟩
theorem blsub_const {o : Ordinal} (ho : o ≠ 0) (a : Ordinal) :
(blsub.{u, v} o fun _ _ => a) = succ a :=
bsup_const.{u, v} ho (succ a)
@[simp]
theorem blsub_one (f : ∀ a < (1 : Ordinal), Ordinal) : blsub 1 f = succ (f 0 zero_lt_one) :=
bsup_one _
@[simp]
theorem blsub_id : ∀ o, (blsub.{u, u} o fun x _ => x) = o :=
lsub_typein
theorem bsup_id_limit {o : Ordinal} : (∀ a < o, succ a < o) → (bsup.{u, u} o fun x _ => x) = o :=
iSup_typein_limit
@[simp]
theorem bsup_id_add_one (o) : (bsup.{u, u} (o + 1) fun x _ => x) = o :=
iSup_typein_succ
theorem bsup_id_succ (o) : (bsup.{u, u} (succ o) fun x _ => x) = o :=
iSup_typein_succ
theorem blsub_le_of_brange_subset {o o'} {f : ∀ a < o, Ordinal} {g : ∀ a < o', Ordinal}
(h : brange o f ⊆ brange o' g) : blsub.{u, max v w} o f ≤ blsub.{v, max u w} o' g :=
bsup_le_of_brange_subset.{u, v, w} fun a ⟨b, hb, hb'⟩ => by
obtain ⟨c, hc, hc'⟩ := h ⟨b, hb, rfl⟩
simp_rw [← hc'] at hb'
exact ⟨c, hc, hb'⟩
theorem blsub_eq_of_brange_eq {o o'} {f : ∀ a < o, Ordinal} {g : ∀ a < o', Ordinal}
(h : { o | ∃ i hi, f i hi = o } = { o | ∃ i hi, g i hi = o }) :
blsub.{u, max v w} o f = blsub.{v, max u w} o' g :=
(blsub_le_of_brange_subset.{u, v, w} h.le).antisymm (blsub_le_of_brange_subset.{v, u, w} h.ge)
theorem bsup_comp {o o' : Ordinal.{max u v}} {f : ∀ a < o, Ordinal.{max u v w}}
(hf : ∀ {i j} (hi) (hj), i ≤ j → f i hi ≤ f j hj) {g : ∀ a < o', Ordinal.{max u v}}
(hg : blsub.{_, u} o' g = o) :
(bsup.{_, w} o' fun a ha => f (g a ha) (by rw [← hg]; apply lt_blsub)) = bsup.{_, w} o f := by
apply le_antisymm <;> refine bsup_le fun i hi => ?_
· apply le_bsup
· rw [← hg, lt_blsub_iff] at hi
rcases hi with ⟨j, hj, hj'⟩
exact (hf _ _ hj').trans (le_bsup _ _ _)
theorem blsub_comp {o o' : Ordinal.{max u v}} {f : ∀ a < o, Ordinal.{max u v w}}
(hf : ∀ {i j} (hi) (hj), i ≤ j → f i hi ≤ f j hj) {g : ∀ a < o', Ordinal.{max u v}}
(hg : blsub.{_, u} o' g = o) :
(blsub.{_, w} o' fun a ha => f (g a ha) (by rw [← hg]; apply lt_blsub)) = blsub.{_, w} o f :=
@bsup_comp.{u, v, w} o _ (fun a ha => succ (f a ha))
(fun {_ _} _ _ h => succ_le_succ_iff.2 (hf _ _ h)) g hg
theorem IsNormal.bsup_eq {f : Ordinal.{u} → Ordinal.{max u v}} (H : IsNormal f) {o : Ordinal.{u}}
(h : IsSuccLimit o) : (Ordinal.bsup.{_, v} o fun x _ => f x) = f o := by
rw [← IsNormal.bsup.{u, u, v} H (fun x _ => x) h.ne_bot, bsup_id_limit fun _ ↦ h.succ_lt]
theorem IsNormal.blsub_eq {f : Ordinal.{u} → Ordinal.{max u v}} (H : IsNormal f) {o : Ordinal.{u}}
(h : IsSuccLimit o) : (blsub.{_, v} o fun x _ => f x) = f o := by
rw [← IsNormal.bsup_eq.{u, v} H h, bsup_eq_blsub_of_lt_succ_limit h]
exact fun a _ => H.strictMono (lt_succ a)
theorem isNormal_iff_lt_succ_and_bsup_eq {f : Ordinal.{u} → Ordinal.{max u v}} :
IsNormal f ↔ (∀ a, f a < f (succ a)) ∧
∀ o, IsSuccLimit o → (bsup.{_, v} o fun x _ => f x) = f o :=
⟨fun h => ⟨fun a ↦ h.strictMono (lt_succ a), @IsNormal.bsup_eq f h⟩, fun ⟨h₁, h₂⟩ =>
.of_succ_lt h₁ fun ho ↦ by
rw [← h₂ _ ho]
simpa [IsLUB, upperBounds, lowerBounds, IsLeast, bsup_le_iff] using le_bsup _⟩
theorem isNormal_iff_lt_succ_and_blsub_eq {f : Ordinal.{u} → Ordinal.{max u v}} :
IsNormal f ↔ (∀ a, f a < f (succ a)) ∧
∀ o, IsSuccLimit o → (blsub.{_, v} o fun x _ => f x) = f o := by
rw [isNormal_iff_lt_succ_and_bsup_eq.{u, v}, and_congr_right_iff]
intro h
constructor <;> intro H o ho <;> have := H o ho <;>
rwa [← bsup_eq_blsub_of_lt_succ_limit ho fun a _ => h a] at *
@[deprecated IsNormal.ext (since := "2025-12-25")]
theorem IsNormal.eq_iff_zero_and_succ {f g : Ordinal.{u} → Ordinal.{u}} (hf : IsNormal f)
(hg : IsNormal g) : f = g ↔ f 0 = g 0 ∧ ∀ a, f a = g a → f (succ a) = g (succ a) :=
Order.IsNormal.ext hf hg
end blsub
end Ordinal
/-! ### Results about injectivity and surjectivity -/
theorem not_surjective_of_ordinal {α : Type*} [Small.{u} α] (f : α → Ordinal.{u}) :
¬ Surjective f := by
intro h
obtain ⟨a, ha⟩ := h (⨆ i, succ (f i))
apply ha.not_lt
rw [Ordinal.lt_iSup_iff]
exact ⟨a, Order.lt_succ _⟩
theorem not_injective_of_ordinal {α : Type*} [Small.{u} α] (f : Ordinal.{u} → α) :
¬ Injective f := fun h ↦ not_surjective_of_ordinal _ (invFun_surjective h)
@[deprecated (since := "2025-08-21")]
alias not_surjective_of_ordinal_of_small := not_surjective_of_ordinal
@[deprecated (since := "2025-08-21")]
alias not_injective_of_ordinal_of_small := not_injective_of_ordinal
/-- The type of ordinals in universe `u` is not `Small.{u}`. This is the type-theoretic analog of
the Burali-Forti paradox. -/
theorem not_small_ordinal : ¬Small.{u} Ordinal.{max u v} := fun h =>
@not_injective_of_ordinal _ h _ fun _a _b => Ordinal.lift_inj.{v, u}.1
instance Ordinal.uncountable : Uncountable Ordinal.{u} :=
Uncountable.of_not_small not_small_ordinal.{u}
theorem Ordinal.not_bddAbove_compl_of_small (s : Set Ordinal.{u}) [hs : Small.{u} s] :
¬BddAbove sᶜ := by
rw [bddAbove_iff_small]
intro h
have := small_union s sᶜ
rw [union_compl_self, small_univ_iff] at this
exact not_small_ordinal this
namespace Ordinal
/-! ### Casting naturals into ordinals, compatibility with operations -/
@[simp]
theorem iSup_natCast : iSup Nat.cast = ω :=
(Ordinal.iSup_le fun n => (nat_lt_omega0 n).le).antisymm <| omega0_le.2 <| Ordinal.le_iSup _
theorem apply_omega0_of_isNormal {f : Ordinal.{u} → Ordinal.{v}} (hf : IsNormal f) :
⨆ n : ℕ, f n = f ω := by
rw [← iSup_natCast, hf.map_iSup (bddAbove_of_small _)]
@[deprecated (since := "2025-12-25")]
alias IsNormal.apply_omega0 := apply_omega0_of_isNormal
@[simp]
theorem iSup_add_natCast (o : Ordinal) : ⨆ n : ℕ, o + n = o + ω :=
apply_omega0_of_isNormal (isNormal_add_right o)
@[deprecated (since := "2025-12-25")]
alias iSup_add_nat := iSup_add_natCast
@[simp]
theorem iSup_mul_natCast (o : Ordinal) : ⨆ n : ℕ, o * n = o * ω := by
rcases eq_zero_or_pos o with (rfl | ho)
· rw [zero_mul]
exact iSup_eq_zero_iff.2 fun n => zero_mul (n : Ordinal)
· exact apply_omega0_of_isNormal (isNormal_mul_right ho)
@[deprecated (since := "2025-12-25")]
alias iSup_mul_nat := iSup_mul_natCast
end Ordinal