-
Notifications
You must be signed in to change notification settings - Fork 252
/
Cofinality.lean
1293 lines (1110 loc) · 55.6 KB
/
Cofinality.lean
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
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/-
Copyright (c) 2017 Mario Carneiro. 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
-/
import Mathlib.SetTheory.Cardinal.Ordinal
import Mathlib.SetTheory.Ordinal.FixedPoint
#align_import set_theory.cardinal.cofinality from "leanprover-community/mathlib"@"7c2ce0c2da15516b4e65d0c9e254bb6dc93abd1f"
/-!
# Cofinality
This file contains the definition of cofinality of an ordinal number and regular cardinals
## Main Definitions
* `Ordinal.cof o` is the cofinality of the ordinal `o`.
If `o` is the order type of the relation `<` on `α`, then `o.cof` is the smallest cardinality of a
subset `s` of α that is *cofinal* in `α`, i.e. `∀ x : α, ∃ y ∈ s, ¬ y < x`.
* `Cardinal.IsStrongLimit c` means that `c` is a strong limit cardinal:
`c ≠ 0 ∧ ∀ x < c, 2 ^ x < c`.
* `Cardinal.IsRegular c` means that `c` is a regular cardinal: `ℵ₀ ≤ c ∧ c.ord.cof = c`.
* `Cardinal.IsInaccessible c` means that `c` is strongly inaccessible:
`ℵ₀ < c ∧ IsRegular c ∧ IsStrongLimit c`.
## Main Statements
* `Ordinal.infinite_pigeonhole_card`: the infinite pigeonhole principle
* `Cardinal.lt_power_cof`: A consequence of König's theorem stating that `c < c ^ c.ord.cof` for
`c ≥ ℵ₀`
* `Cardinal.univ_inaccessible`: The type of ordinals in `Type u` form an inaccessible cardinal
(in `Type v` with `v > u`). This shows (externally) that in `Type u` there are at least `u`
inaccessible cardinals.
## Implementation Notes
* The cofinality is defined for ordinals.
If `c` is a cardinal number, its cofinality is `c.ord.cof`.
## Tags
cofinality, regular cardinals, limits cardinals, inaccessible cardinals,
infinite pigeonhole principle
-/
noncomputable section
open Function Cardinal Set Order
open scoped Classical
open Cardinal Ordinal
universe u v w
variable {α : Type*} {r : α → α → Prop}
/-! ### Cofinality of orders -/
namespace Order
/-- Cofinality of a reflexive order `≼`. This is the smallest cardinality
of a subset `S : Set α` such that `∀ a, ∃ b ∈ S, a ≼ b`. -/
def cof (r : α → α → Prop) : Cardinal :=
sInf { c | ∃ S : Set α, (∀ a, ∃ b ∈ S, r a b) ∧ #S = c }
#align order.cof Order.cof
/-- The set in the definition of `Order.cof` is nonempty. -/
theorem cof_nonempty (r : α → α → Prop) [IsRefl α r] :
{ c | ∃ S : Set α, (∀ a, ∃ b ∈ S, r a b) ∧ #S = c }.Nonempty :=
⟨_, Set.univ, fun a => ⟨a, ⟨⟩, refl _⟩, rfl⟩
#align order.cof_nonempty Order.cof_nonempty
theorem cof_le (r : α → α → Prop) {S : Set α} (h : ∀ a, ∃ b ∈ S, r a b) : cof r ≤ #S :=
csInf_le' ⟨S, h, rfl⟩
#align order.cof_le Order.cof_le
theorem le_cof {r : α → α → Prop} [IsRefl α r] (c : Cardinal) :
c ≤ cof r ↔ ∀ {S : Set α}, (∀ a, ∃ b ∈ S, r a b) → c ≤ #S := by
rw [cof, le_csInf_iff'' (cof_nonempty r)]
use fun H S h => H _ ⟨S, h, rfl⟩
rintro H d ⟨S, h, rfl⟩
exact H h
#align order.le_cof Order.le_cof
end Order
theorem RelIso.cof_le_lift {α : Type u} {β : Type v} {r : α → α → Prop} {s} [IsRefl β s]
(f : r ≃r s) : Cardinal.lift.{max u v} (Order.cof r) ≤
Cardinal.lift.{max u v} (Order.cof s) := by
rw [Order.cof, Order.cof, lift_sInf, lift_sInf,
le_csInf_iff'' ((Order.cof_nonempty s).image _)]
rintro - ⟨-, ⟨u, H, rfl⟩, rfl⟩
apply csInf_le'
refine
⟨_, ⟨f.symm '' u, fun a => ?_, rfl⟩,
lift_mk_eq.{u, v, max u v}.2 ⟨(f.symm.toEquiv.image u).symm⟩⟩
rcases H (f a) with ⟨b, hb, hb'⟩
refine ⟨f.symm b, mem_image_of_mem _ hb, f.map_rel_iff.1 ?_⟩
rwa [RelIso.apply_symm_apply]
#align rel_iso.cof_le_lift RelIso.cof_le_lift
theorem RelIso.cof_eq_lift {α : Type u} {β : Type v} {r s} [IsRefl α r] [IsRefl β s] (f : r ≃r s) :
Cardinal.lift.{max u v} (Order.cof r) = Cardinal.lift.{max u v} (Order.cof s) :=
(RelIso.cof_le_lift f).antisymm (RelIso.cof_le_lift f.symm)
#align rel_iso.cof_eq_lift RelIso.cof_eq_lift
theorem RelIso.cof_le {α β : Type u} {r : α → α → Prop} {s} [IsRefl β s] (f : r ≃r s) :
Order.cof r ≤ Order.cof s :=
lift_le.1 (RelIso.cof_le_lift f)
#align rel_iso.cof_le RelIso.cof_le
theorem RelIso.cof_eq {α β : Type u} {r s} [IsRefl α r] [IsRefl β s] (f : r ≃r s) :
Order.cof r = Order.cof s :=
lift_inj.1 (RelIso.cof_eq_lift f)
#align rel_iso.cof_eq RelIso.cof_eq
/-- Cofinality of a strict order `≺`. This is the smallest cardinality of a set `S : Set α` such
that `∀ a, ∃ b ∈ S, ¬ b ≺ a`. -/
def StrictOrder.cof (r : α → α → Prop) : Cardinal :=
Order.cof (swap rᶜ)
#align strict_order.cof StrictOrder.cof
/-- The set in the definition of `Order.StrictOrder.cof` is nonempty. -/
theorem StrictOrder.cof_nonempty (r : α → α → Prop) [IsIrrefl α r] :
{ c | ∃ S : Set α, Unbounded r S ∧ #S = c }.Nonempty :=
@Order.cof_nonempty α _ (IsRefl.swap rᶜ)
#align strict_order.cof_nonempty StrictOrder.cof_nonempty
/-! ### Cofinality of ordinals -/
namespace Ordinal
/-- Cofinality of an ordinal. This is the smallest cardinal of a
subset `S` of the ordinal which is unbounded, in the sense
`∀ a, ∃ b ∈ S, a ≤ b`. It is defined for all ordinals, but
`cof 0 = 0` and `cof (succ o) = 1`, so it is only really
interesting on limit ordinals (when it is an infinite cardinal). -/
def cof (o : Ordinal.{u}) : Cardinal.{u} :=
o.liftOn (fun a => StrictOrder.cof a.r)
(by
rintro ⟨α, r, wo₁⟩ ⟨β, s, wo₂⟩ ⟨⟨f, hf⟩⟩
haveI := wo₁; haveI := wo₂
dsimp only
apply @RelIso.cof_eq _ _ _ _ ?_ ?_
· constructor
exact @fun a b => not_iff_not.2 hf
· dsimp only [swap]
exact ⟨fun _ => irrefl _⟩
· dsimp only [swap]
exact ⟨fun _ => irrefl _⟩)
#align ordinal.cof Ordinal.cof
theorem cof_type (r : α → α → Prop) [IsWellOrder α r] : (type r).cof = StrictOrder.cof r :=
rfl
#align ordinal.cof_type Ordinal.cof_type
theorem le_cof_type [IsWellOrder α r] {c} : c ≤ cof (type r) ↔ ∀ S, Unbounded r S → c ≤ #S :=
(le_csInf_iff'' (StrictOrder.cof_nonempty r)).trans
⟨fun H S h => H _ ⟨S, h, rfl⟩, by
rintro H d ⟨S, h, rfl⟩
exact H _ h⟩
#align ordinal.le_cof_type Ordinal.le_cof_type
theorem cof_type_le [IsWellOrder α r] {S : Set α} (h : Unbounded r S) : cof (type r) ≤ #S :=
le_cof_type.1 le_rfl S h
#align ordinal.cof_type_le Ordinal.cof_type_le
theorem lt_cof_type [IsWellOrder α r] {S : Set α} : #S < cof (type r) → Bounded r S := by
simpa using not_imp_not.2 cof_type_le
#align ordinal.lt_cof_type Ordinal.lt_cof_type
theorem cof_eq (r : α → α → Prop) [IsWellOrder α r] : ∃ S, Unbounded r S ∧ #S = cof (type r) :=
csInf_mem (StrictOrder.cof_nonempty r)
#align ordinal.cof_eq Ordinal.cof_eq
theorem ord_cof_eq (r : α → α → Prop) [IsWellOrder α r] :
∃ S, Unbounded r S ∧ type (Subrel r S) = (cof (type r)).ord := by
let ⟨S, hS, e⟩ := cof_eq r
let ⟨s, _, e'⟩ := Cardinal.ord_eq S
let T : Set α := { a | ∃ aS : a ∈ S, ∀ b : S, s b ⟨_, aS⟩ → r b a }
suffices Unbounded r T by
refine ⟨T, this, le_antisymm ?_ (Cardinal.ord_le.2 <| cof_type_le this)⟩
rw [← e, e']
refine
(RelEmbedding.ofMonotone
(fun a : T =>
(⟨a,
let ⟨aS, _⟩ := a.2
aS⟩ :
S))
fun a b h => ?_).ordinal_type_le
rcases a with ⟨a, aS, ha⟩
rcases b with ⟨b, bS, hb⟩
change s ⟨a, _⟩ ⟨b, _⟩
refine ((trichotomous_of s _ _).resolve_left fun hn => ?_).resolve_left ?_
· exact asymm h (ha _ hn)
· intro e
injection e with e
subst b
exact irrefl _ h
intro a
have : { b : S | ¬r b a }.Nonempty :=
let ⟨b, bS, ba⟩ := hS a
⟨⟨b, bS⟩, ba⟩
let b := (IsWellFounded.wf : WellFounded s).min _ this
have ba : ¬r b a := IsWellFounded.wf.min_mem _ this
refine ⟨b, ⟨b.2, fun c => not_imp_not.1 fun h => ?_⟩, ba⟩
rw [show ∀ b : S, (⟨b, b.2⟩ : S) = b by intro b; cases b; rfl]
exact IsWellFounded.wf.not_lt_min _ this (IsOrderConnected.neg_trans h ba)
#align ordinal.ord_cof_eq Ordinal.ord_cof_eq
/-! ### Cofinality of suprema and least strict upper bounds -/
private theorem card_mem_cof {o} : ∃ (ι : _) (f : ι → Ordinal), lsub.{u, u} f = o ∧ #ι = o.card :=
⟨_, _, lsub_typein o, mk_ordinal_out o⟩
/-- The set in the `lsub` characterization of `cof` is nonempty. -/
theorem cof_lsub_def_nonempty (o) :
{ a : Cardinal | ∃ (ι : _) (f : ι → Ordinal), lsub.{u, u} f = o ∧ #ι = a }.Nonempty :=
⟨_, card_mem_cof⟩
#align ordinal.cof_lsub_def_nonempty Ordinal.cof_lsub_def_nonempty
theorem cof_eq_sInf_lsub (o : Ordinal.{u}) : cof o =
sInf { a : Cardinal | ∃ (ι : Type u) (f : ι → Ordinal), lsub.{u, u} f = o ∧ #ι = a } := by
refine le_antisymm (le_csInf (cof_lsub_def_nonempty o) ?_) (csInf_le' ?_)
· rintro a ⟨ι, f, hf, rfl⟩
rw [← type_lt o]
refine
(cof_type_le fun a => ?_).trans
(@mk_le_of_injective _ _
(fun s : typein ((· < ·) : o.out.α → o.out.α → Prop) ⁻¹' Set.range f =>
Classical.choose s.prop)
fun s t hst => by
let H := congr_arg f hst
rwa [Classical.choose_spec s.prop, Classical.choose_spec t.prop, typein_inj,
Subtype.coe_inj] at H)
have := typein_lt_self a
simp_rw [← hf, lt_lsub_iff] at this
cases' this with i hi
refine ⟨enum (· < ·) (f i) ?_, ?_, ?_⟩
· rw [type_lt, ← hf]
apply lt_lsub
· rw [mem_preimage, typein_enum]
exact mem_range_self i
· rwa [← typein_le_typein, typein_enum]
· rcases cof_eq (· < · : (Quotient.out o).α → (Quotient.out o).α → Prop) with ⟨S, hS, hS'⟩
let f : S → Ordinal := fun s => typein LT.lt s.val
refine ⟨S, f, le_antisymm (lsub_le fun i => typein_lt_self (o := o) i)
(le_of_forall_lt fun a ha => ?_), by rwa [type_lt o] at hS'⟩
rw [← type_lt o] at ha
rcases hS (enum (· < ·) a ha) with ⟨b, hb, hb'⟩
rw [← typein_le_typein, typein_enum] at hb'
exact hb'.trans_lt (lt_lsub.{u, u} f ⟨b, hb⟩)
#align ordinal.cof_eq_Inf_lsub Ordinal.cof_eq_sInf_lsub
@[simp]
theorem lift_cof (o) : Cardinal.lift.{u, v} (cof o) = cof (Ordinal.lift.{u, v} o) := by
refine inductionOn o ?_
intro α r _
apply le_antisymm
· refine le_cof_type.2 fun S H => ?_
have : Cardinal.lift.{u, v} #(ULift.up ⁻¹' S) ≤ #(S : Type (max u v)) := by
rw [← Cardinal.lift_umax.{v, u}, ← Cardinal.lift_id'.{v, u} #S]
exact mk_preimage_of_injective_lift.{v, max u v} ULift.up S (ULift.up_injective.{v, u})
refine (Cardinal.lift_le.2 <| cof_type_le ?_).trans this
exact fun a =>
let ⟨⟨b⟩, bs, br⟩ := H ⟨a⟩
⟨b, bs, br⟩
· rcases cof_eq r with ⟨S, H, e'⟩
have : #(ULift.down.{u, v} ⁻¹' S) ≤ Cardinal.lift.{u, v} #S :=
⟨⟨fun ⟨⟨x⟩, h⟩ => ⟨⟨x, h⟩⟩, fun ⟨⟨x⟩, h₁⟩ ⟨⟨y⟩, h₂⟩ e => by
simp at e; congr⟩⟩
rw [e'] at this
refine (cof_type_le ?_).trans this
exact fun ⟨a⟩ =>
let ⟨b, bs, br⟩ := H a
⟨⟨b⟩, bs, br⟩
#align ordinal.lift_cof Ordinal.lift_cof
theorem cof_le_card (o) : cof o ≤ card o := by
rw [cof_eq_sInf_lsub]
exact csInf_le' card_mem_cof
#align ordinal.cof_le_card Ordinal.cof_le_card
theorem cof_ord_le (c : Cardinal) : c.ord.cof ≤ c := by simpa using cof_le_card c.ord
#align ordinal.cof_ord_le Ordinal.cof_ord_le
theorem ord_cof_le (o : Ordinal.{u}) : o.cof.ord ≤ o :=
(ord_le_ord.2 (cof_le_card o)).trans (ord_card_le o)
#align ordinal.ord_cof_le Ordinal.ord_cof_le
theorem exists_lsub_cof (o : Ordinal) :
∃ (ι : _) (f : ι → Ordinal), lsub.{u, u} f = o ∧ #ι = cof o := by
rw [cof_eq_sInf_lsub]
exact csInf_mem (cof_lsub_def_nonempty o)
#align ordinal.exists_lsub_cof Ordinal.exists_lsub_cof
theorem cof_lsub_le {ι} (f : ι → Ordinal) : cof (lsub.{u, u} f) ≤ #ι := by
rw [cof_eq_sInf_lsub]
exact csInf_le' ⟨ι, f, rfl, rfl⟩
#align ordinal.cof_lsub_le Ordinal.cof_lsub_le
theorem cof_lsub_le_lift {ι} (f : ι → Ordinal) :
cof (lsub.{u, v} f) ≤ Cardinal.lift.{v, u} #ι := by
rw [← mk_uLift.{u, v}]
convert cof_lsub_le.{max u v} fun i : ULift.{v, u} ι => f i.down
exact
lsub_eq_of_range_eq.{u, max u v, max u v}
(Set.ext fun x => ⟨fun ⟨i, hi⟩ => ⟨ULift.up.{v, u} i, hi⟩, fun ⟨i, hi⟩ => ⟨_, hi⟩⟩)
#align ordinal.cof_lsub_le_lift Ordinal.cof_lsub_le_lift
theorem le_cof_iff_lsub {o : Ordinal} {a : Cardinal} :
a ≤ cof o ↔ ∀ {ι} (f : ι → Ordinal), lsub.{u, u} f = o → a ≤ #ι := by
rw [cof_eq_sInf_lsub]
exact
(le_csInf_iff'' (cof_lsub_def_nonempty o)).trans
⟨fun H ι f hf => H _ ⟨ι, f, hf, rfl⟩, fun H b ⟨ι, f, hf, hb⟩ => by
rw [← hb]
exact H _ hf⟩
#align ordinal.le_cof_iff_lsub Ordinal.le_cof_iff_lsub
theorem lsub_lt_ord_lift {ι} {f : ι → Ordinal} {c : Ordinal}
(hι : Cardinal.lift.{v, u} #ι < c.cof)
(hf : ∀ i, f i < c) : lsub.{u, v} f < c :=
lt_of_le_of_ne (lsub_le hf) fun h => by
subst h
exact (cof_lsub_le_lift.{u, v} f).not_lt hι
#align ordinal.lsub_lt_ord_lift Ordinal.lsub_lt_ord_lift
theorem lsub_lt_ord {ι} {f : ι → Ordinal} {c : Ordinal} (hι : #ι < c.cof) :
(∀ i, f i < c) → lsub.{u, u} f < c :=
lsub_lt_ord_lift (by rwa [(#ι).lift_id])
#align ordinal.lsub_lt_ord Ordinal.lsub_lt_ord
theorem cof_sup_le_lift {ι} {f : ι → Ordinal} (H : ∀ i, f i < sup.{u, v} f) :
cof (sup.{u, v} f) ≤ Cardinal.lift.{v, u} #ι := by
rw [← sup_eq_lsub_iff_lt_sup.{u, v}] at H
rw [H]
exact cof_lsub_le_lift f
#align ordinal.cof_sup_le_lift Ordinal.cof_sup_le_lift
theorem cof_sup_le {ι} {f : ι → Ordinal} (H : ∀ i, f i < sup.{u, u} f) :
cof (sup.{u, u} f) ≤ #ι := by
rw [← (#ι).lift_id]
exact cof_sup_le_lift H
#align ordinal.cof_sup_le Ordinal.cof_sup_le
theorem sup_lt_ord_lift {ι} {f : ι → Ordinal} {c : Ordinal} (hι : Cardinal.lift.{v, u} #ι < c.cof)
(hf : ∀ i, f i < c) : sup.{u, v} f < c :=
(sup_le_lsub.{u, v} f).trans_lt (lsub_lt_ord_lift hι hf)
#align ordinal.sup_lt_ord_lift Ordinal.sup_lt_ord_lift
theorem sup_lt_ord {ι} {f : ι → Ordinal} {c : Ordinal} (hι : #ι < c.cof) :
(∀ i, f i < c) → sup.{u, u} f < c :=
sup_lt_ord_lift (by rwa [(#ι).lift_id])
#align ordinal.sup_lt_ord Ordinal.sup_lt_ord
theorem iSup_lt_lift {ι} {f : ι → Cardinal} {c : Cardinal}
(hι : Cardinal.lift.{v, u} #ι < c.ord.cof)
(hf : ∀ i, f i < c) : iSup.{max u v + 1, u + 1} f < c := by
rw [← ord_lt_ord, iSup_ord (Cardinal.bddAbove_range.{u, v} _)]
refine sup_lt_ord_lift hι fun i => ?_
rw [ord_lt_ord]
apply hf
#align ordinal.supr_lt_lift Ordinal.iSup_lt_lift
theorem iSup_lt {ι} {f : ι → Cardinal} {c : Cardinal} (hι : #ι < c.ord.cof) :
(∀ i, f i < c) → iSup f < c :=
iSup_lt_lift (by rwa [(#ι).lift_id])
#align ordinal.supr_lt Ordinal.iSup_lt
theorem nfpFamily_lt_ord_lift {ι} {f : ι → Ordinal → Ordinal} {c} (hc : ℵ₀ < cof c)
(hc' : Cardinal.lift.{v, u} #ι < cof c) (hf : ∀ (i), ∀ b < c, f i b < c) {a} (ha : a < c) :
nfpFamily.{u, v} f a < c := by
refine sup_lt_ord_lift ((Cardinal.lift_le.2 (mk_list_le_max ι)).trans_lt ?_) fun l => ?_
· rw [lift_max]
apply max_lt _ hc'
rwa [Cardinal.lift_aleph0]
· induction' l with i l H
· exact ha
· exact hf _ _ H
#align ordinal.nfp_family_lt_ord_lift Ordinal.nfpFamily_lt_ord_lift
theorem nfpFamily_lt_ord {ι} {f : ι → Ordinal → Ordinal} {c} (hc : ℵ₀ < cof c) (hc' : #ι < cof c)
(hf : ∀ (i), ∀ b < c, f i b < c) {a} : a < c → nfpFamily.{u, u} f a < c :=
nfpFamily_lt_ord_lift hc (by rwa [(#ι).lift_id]) hf
#align ordinal.nfp_family_lt_ord Ordinal.nfpFamily_lt_ord
theorem nfpBFamily_lt_ord_lift {o : Ordinal} {f : ∀ a < o, Ordinal → Ordinal} {c} (hc : ℵ₀ < cof c)
(hc' : Cardinal.lift.{v, u} o.card < cof c) (hf : ∀ (i hi), ∀ b < c, f i hi b < c) {a} :
a < c → nfpBFamily.{u, v} o f a < c :=
nfpFamily_lt_ord_lift hc (by rwa [mk_ordinal_out]) fun i => hf _ _
#align ordinal.nfp_bfamily_lt_ord_lift Ordinal.nfpBFamily_lt_ord_lift
theorem nfpBFamily_lt_ord {o : Ordinal} {f : ∀ a < o, Ordinal → Ordinal} {c} (hc : ℵ₀ < cof c)
(hc' : o.card < cof c) (hf : ∀ (i hi), ∀ b < c, f i hi b < c) {a} :
a < c → nfpBFamily.{u, u} o f a < c :=
nfpBFamily_lt_ord_lift hc (by rwa [o.card.lift_id]) hf
#align ordinal.nfp_bfamily_lt_ord Ordinal.nfpBFamily_lt_ord
theorem nfp_lt_ord {f : Ordinal → Ordinal} {c} (hc : ℵ₀ < cof c) (hf : ∀ i < c, f i < c) {a} :
a < c → nfp f a < c :=
nfpFamily_lt_ord_lift hc (by simpa using Cardinal.one_lt_aleph0.trans hc) fun _ => hf
#align ordinal.nfp_lt_ord Ordinal.nfp_lt_ord
theorem exists_blsub_cof (o : Ordinal) :
∃ f : ∀ a < (cof o).ord, Ordinal, blsub.{u, u} _ f = o := by
rcases exists_lsub_cof o with ⟨ι, f, hf, hι⟩
rcases Cardinal.ord_eq ι with ⟨r, hr, hι'⟩
rw [← @blsub_eq_lsub' ι r hr] at hf
rw [← hι, hι']
exact ⟨_, hf⟩
#align ordinal.exists_blsub_cof Ordinal.exists_blsub_cof
theorem le_cof_iff_blsub {b : Ordinal} {a : Cardinal} :
a ≤ cof b ↔ ∀ {o} (f : ∀ a < o, Ordinal), blsub.{u, u} o f = b → a ≤ o.card :=
le_cof_iff_lsub.trans
⟨fun H o f hf => by simpa using H _ hf, fun H ι f hf => by
rcases Cardinal.ord_eq ι with ⟨r, hr, hι'⟩
rw [← @blsub_eq_lsub' ι r hr] at hf
simpa using H _ hf⟩
#align ordinal.le_cof_iff_blsub Ordinal.le_cof_iff_blsub
theorem cof_blsub_le_lift {o} (f : ∀ a < o, Ordinal) :
cof (blsub.{u, v} o f) ≤ Cardinal.lift.{v, u} o.card := by
rw [← mk_ordinal_out o]
exact cof_lsub_le_lift _
#align ordinal.cof_blsub_le_lift Ordinal.cof_blsub_le_lift
theorem cof_blsub_le {o} (f : ∀ a < o, Ordinal) : cof (blsub.{u, u} o f) ≤ o.card := by
rw [← o.card.lift_id]
exact cof_blsub_le_lift f
#align ordinal.cof_blsub_le Ordinal.cof_blsub_le
theorem blsub_lt_ord_lift {o : Ordinal.{u}} {f : ∀ a < o, Ordinal} {c : Ordinal}
(ho : Cardinal.lift.{v, u} o.card < c.cof) (hf : ∀ i hi, f i hi < c) : blsub.{u, v} o f < c :=
lt_of_le_of_ne (blsub_le hf) fun h =>
ho.not_le (by simpa [← iSup_ord, hf, h] using cof_blsub_le_lift.{u, v} f)
#align ordinal.blsub_lt_ord_lift Ordinal.blsub_lt_ord_lift
theorem blsub_lt_ord {o : Ordinal} {f : ∀ a < o, Ordinal} {c : Ordinal} (ho : o.card < c.cof)
(hf : ∀ i hi, f i hi < c) : blsub.{u, u} o f < c :=
blsub_lt_ord_lift (by rwa [o.card.lift_id]) hf
#align ordinal.blsub_lt_ord Ordinal.blsub_lt_ord
theorem cof_bsup_le_lift {o : Ordinal} {f : ∀ a < o, Ordinal} (H : ∀ i h, f i h < bsup.{u, v} o f) :
cof (bsup.{u, v} o f) ≤ Cardinal.lift.{v, u} o.card := by
rw [← bsup_eq_blsub_iff_lt_bsup.{u, v}] at H
rw [H]
exact cof_blsub_le_lift.{u, v} f
#align ordinal.cof_bsup_le_lift Ordinal.cof_bsup_le_lift
theorem cof_bsup_le {o : Ordinal} {f : ∀ a < o, Ordinal} :
(∀ i h, f i h < bsup.{u, u} o f) → cof (bsup.{u, u} o f) ≤ o.card := by
rw [← o.card.lift_id]
exact cof_bsup_le_lift
#align ordinal.cof_bsup_le Ordinal.cof_bsup_le
theorem bsup_lt_ord_lift {o : Ordinal} {f : ∀ a < o, Ordinal} {c : Ordinal}
(ho : Cardinal.lift.{v, u} o.card < c.cof) (hf : ∀ i hi, f i hi < c) : bsup.{u, v} o f < c :=
(bsup_le_blsub f).trans_lt (blsub_lt_ord_lift ho hf)
#align ordinal.bsup_lt_ord_lift Ordinal.bsup_lt_ord_lift
theorem bsup_lt_ord {o : Ordinal} {f : ∀ a < o, Ordinal} {c : Ordinal} (ho : o.card < c.cof) :
(∀ i hi, f i hi < c) → bsup.{u, u} o f < c :=
bsup_lt_ord_lift (by rwa [o.card.lift_id])
#align ordinal.bsup_lt_ord Ordinal.bsup_lt_ord
/-! ### Basic results -/
@[simp]
theorem cof_zero : cof 0 = 0 := by
refine LE.le.antisymm ?_ (Cardinal.zero_le _)
rw [← card_zero]
exact cof_le_card 0
#align ordinal.cof_zero Ordinal.cof_zero
@[simp]
theorem cof_eq_zero {o} : cof o = 0 ↔ o = 0 :=
⟨inductionOn o fun α r _ z =>
let ⟨S, hl, e⟩ := cof_eq r
type_eq_zero_iff_isEmpty.2 <|
⟨fun a =>
let ⟨b, h, _⟩ := hl a
(mk_eq_zero_iff.1 (e.trans z)).elim' ⟨_, h⟩⟩,
fun e => by simp [e]⟩
#align ordinal.cof_eq_zero Ordinal.cof_eq_zero
theorem cof_ne_zero {o} : cof o ≠ 0 ↔ o ≠ 0 :=
cof_eq_zero.not
#align ordinal.cof_ne_zero Ordinal.cof_ne_zero
@[simp]
theorem cof_succ (o) : cof (succ o) = 1 := by
apply le_antisymm
· refine inductionOn o fun α r _ => ?_
change cof (type _) ≤ _
rw [← (_ : #_ = 1)]
· apply cof_type_le
refine fun a => ⟨Sum.inr PUnit.unit, Set.mem_singleton _, ?_⟩
rcases a with (a | ⟨⟨⟨⟩⟩⟩) <;> simp [EmptyRelation]
· rw [Cardinal.mk_fintype, Set.card_singleton]
simp
· rw [← Cardinal.succ_zero, succ_le_iff]
simpa [lt_iff_le_and_ne, Cardinal.zero_le] using fun h =>
succ_ne_zero o (cof_eq_zero.1 (Eq.symm h))
#align ordinal.cof_succ Ordinal.cof_succ
@[simp]
theorem cof_eq_one_iff_is_succ {o} : cof.{u} o = 1 ↔ ∃ a, o = succ a :=
⟨inductionOn o fun α r _ z => by
rcases cof_eq r with ⟨S, hl, e⟩; rw [z] at e
cases' mk_ne_zero_iff.1 (by rw [e]; exact one_ne_zero) with a
refine
⟨typein r a,
Eq.symm <|
Quotient.sound
⟨RelIso.ofSurjective (RelEmbedding.ofMonotone ?_ fun x y => ?_) fun x => ?_⟩⟩
· apply Sum.rec <;> [exact Subtype.val; exact fun _ => a]
· rcases x with (x | ⟨⟨⟨⟩⟩⟩) <;> rcases y with (y | ⟨⟨⟨⟩⟩⟩) <;>
simp [Subrel, Order.Preimage, EmptyRelation]
exact x.2
· suffices r x a ∨ ∃ _ : PUnit.{u}, ↑a = x by
convert this
dsimp [RelEmbedding.ofMonotone]; simp
rcases trichotomous_of r x a with (h | h | h)
· exact Or.inl h
· exact Or.inr ⟨PUnit.unit, h.symm⟩
· rcases hl x with ⟨a', aS, hn⟩
refine absurd h ?_
convert hn
change _ = ↑(⟨a', aS⟩ : S)
have := le_one_iff_subsingleton.1 (le_of_eq e)
congr!,
fun ⟨a, e⟩ => by simp [e]⟩
#align ordinal.cof_eq_one_iff_is_succ Ordinal.cof_eq_one_iff_is_succ
/-- A fundamental sequence for `a` is an increasing sequence of length `o = cof a` that converges at
`a`. We provide `o` explicitly in order to avoid type rewrites. -/
def IsFundamentalSequence (a o : Ordinal.{u}) (f : ∀ b < o, Ordinal.{u}) : Prop :=
o ≤ a.cof.ord ∧ (∀ {i j} (hi hj), i < j → f i hi < f j hj) ∧ blsub.{u, u} o f = a
#align ordinal.is_fundamental_sequence Ordinal.IsFundamentalSequence
namespace IsFundamentalSequence
variable {a o : Ordinal.{u}} {f : ∀ b < o, Ordinal.{u}}
protected theorem cof_eq (hf : IsFundamentalSequence a o f) : a.cof.ord = o :=
hf.1.antisymm' <| by
rw [← hf.2.2]
exact (ord_le_ord.2 (cof_blsub_le f)).trans (ord_card_le o)
#align ordinal.is_fundamental_sequence.cof_eq Ordinal.IsFundamentalSequence.cof_eq
protected theorem strict_mono (hf : IsFundamentalSequence a o f) {i j} :
∀ hi hj, i < j → f i hi < f j hj :=
hf.2.1
#align ordinal.is_fundamental_sequence.strict_mono Ordinal.IsFundamentalSequence.strict_mono
theorem blsub_eq (hf : IsFundamentalSequence a o f) : blsub.{u, u} o f = a :=
hf.2.2
#align ordinal.is_fundamental_sequence.blsub_eq Ordinal.IsFundamentalSequence.blsub_eq
theorem ord_cof (hf : IsFundamentalSequence a o f) :
IsFundamentalSequence a a.cof.ord fun i hi => f i (hi.trans_le (by rw [hf.cof_eq])) := by
have H := hf.cof_eq
subst H
exact hf
#align ordinal.is_fundamental_sequence.ord_cof Ordinal.IsFundamentalSequence.ord_cof
theorem id_of_le_cof (h : o ≤ o.cof.ord) : IsFundamentalSequence o o fun a _ => a :=
⟨h, @fun _ _ _ _ => id, blsub_id o⟩
#align ordinal.is_fundamental_sequence.id_of_le_cof Ordinal.IsFundamentalSequence.id_of_le_cof
protected theorem zero {f : ∀ b < (0 : Ordinal), Ordinal} : IsFundamentalSequence 0 0 f :=
⟨by rw [cof_zero, ord_zero], @fun i j hi => (Ordinal.not_lt_zero i hi).elim, blsub_zero f⟩
#align ordinal.is_fundamental_sequence.zero Ordinal.IsFundamentalSequence.zero
protected theorem succ : IsFundamentalSequence (succ o) 1 fun _ _ => o := by
refine ⟨?_, @fun i j hi hj h => ?_, blsub_const Ordinal.one_ne_zero o⟩
· rw [cof_succ, ord_one]
· rw [lt_one_iff_zero] at hi hj
rw [hi, hj] at h
exact h.false.elim
#align ordinal.is_fundamental_sequence.succ Ordinal.IsFundamentalSequence.succ
protected theorem monotone (hf : IsFundamentalSequence a o f) {i j : Ordinal} (hi : i < o)
(hj : j < o) (hij : i ≤ j) : f i hi ≤ f j hj := by
rcases lt_or_eq_of_le hij with (hij | rfl)
· exact (hf.2.1 hi hj hij).le
· rfl
#align ordinal.is_fundamental_sequence.monotone Ordinal.IsFundamentalSequence.monotone
theorem trans {a o o' : Ordinal.{u}} {f : ∀ b < o, Ordinal.{u}} (hf : IsFundamentalSequence a o f)
{g : ∀ b < o', Ordinal.{u}} (hg : IsFundamentalSequence o o' g) :
IsFundamentalSequence a o' fun i hi =>
f (g i hi) (by rw [← hg.2.2]; apply lt_blsub) := by
refine ⟨?_, @fun i j _ _ h => hf.2.1 _ _ (hg.2.1 _ _ h), ?_⟩
· rw [hf.cof_eq]
exact hg.1.trans (ord_cof_le o)
· rw [@blsub_comp.{u, u, u} o _ f (@IsFundamentalSequence.monotone _ _ f hf)]
· exact hf.2.2
· exact hg.2.2
#align ordinal.is_fundamental_sequence.trans Ordinal.IsFundamentalSequence.trans
end IsFundamentalSequence
/-- Every ordinal has a fundamental sequence. -/
theorem exists_fundamental_sequence (a : Ordinal.{u}) :
∃ f, IsFundamentalSequence a a.cof.ord f := by
suffices h : ∃ o f, IsFundamentalSequence a o f by
rcases h with ⟨o, f, hf⟩
exact ⟨_, hf.ord_cof⟩
rcases exists_lsub_cof a with ⟨ι, f, hf, hι⟩
rcases ord_eq ι with ⟨r, wo, hr⟩
haveI := wo
let r' := Subrel r { i | ∀ j, r j i → f j < f i }
let hrr' : r' ↪r r := Subrel.relEmbedding _ _
haveI := hrr'.isWellOrder
refine
⟨_, _, hrr'.ordinal_type_le.trans ?_, @fun i j _ h _ => (enum r' j h).prop _ ?_,
le_antisymm (blsub_le fun i hi => lsub_le_iff.1 hf.le _) ?_⟩
· rw [← hι, hr]
· change r (hrr'.1 _) (hrr'.1 _)
rwa [hrr'.2, @enum_lt_enum _ r']
· rw [← hf, lsub_le_iff]
intro i
suffices h : ∃ i' hi', f i ≤ bfamilyOfFamily' r' (fun i => f i) i' hi' by
rcases h with ⟨i', hi', hfg⟩
exact hfg.trans_lt (lt_blsub _ _ _)
by_cases h : ∀ j, r j i → f j < f i
· refine ⟨typein r' ⟨i, h⟩, typein_lt_type _ _, ?_⟩
rw [bfamilyOfFamily'_typein]
· push_neg at h
cases' wo.wf.min_mem _ h with hji hij
refine ⟨typein r' ⟨_, fun k hkj => lt_of_lt_of_le ?_ hij⟩, typein_lt_type _ _, ?_⟩
· by_contra! H
exact (wo.wf.not_lt_min _ h ⟨IsTrans.trans _ _ _ hkj hji, H⟩) hkj
· rwa [bfamilyOfFamily'_typein]
#align ordinal.exists_fundamental_sequence Ordinal.exists_fundamental_sequence
@[simp]
theorem cof_cof (a : Ordinal.{u}) : cof (cof a).ord = cof a := by
cases' exists_fundamental_sequence a with f hf
cases' exists_fundamental_sequence a.cof.ord with g hg
exact ord_injective (hf.trans hg).cof_eq.symm
#align ordinal.cof_cof Ordinal.cof_cof
protected theorem IsNormal.isFundamentalSequence {f : Ordinal.{u} → Ordinal.{u}} (hf : IsNormal f)
{a o} (ha : IsLimit a) {g} (hg : IsFundamentalSequence a o g) :
IsFundamentalSequence (f a) o fun b hb => f (g b hb) := by
refine ⟨?_, @fun i j _ _ h => hf.strictMono (hg.2.1 _ _ h), ?_⟩
· rcases exists_lsub_cof (f a) with ⟨ι, f', hf', hι⟩
rw [← hg.cof_eq, ord_le_ord, ← hι]
suffices (lsub.{u, u} fun i => sInf { b : Ordinal | f' i ≤ f b }) = a by
rw [← this]
apply cof_lsub_le
have H : ∀ i, ∃ b < a, f' i ≤ f b := fun i => by
have := lt_lsub.{u, u} f' i
rw [hf', ← IsNormal.blsub_eq.{u, u} hf ha, lt_blsub_iff] at this
simpa using this
refine (lsub_le fun i => ?_).antisymm (le_of_forall_lt fun b hb => ?_)
· rcases H i with ⟨b, hb, hb'⟩
exact lt_of_le_of_lt (csInf_le' hb') hb
· have := hf.strictMono hb
rw [← hf', lt_lsub_iff] at this
cases' this with i hi
rcases H i with ⟨b, _, hb⟩
exact
((le_csInf_iff'' ⟨b, by exact hb⟩).2 fun c hc =>
hf.strictMono.le_iff_le.1 (hi.trans hc)).trans_lt (lt_lsub _ i)
· rw [@blsub_comp.{u, u, u} a _ (fun b _ => f b) (@fun i j _ _ h => hf.strictMono.monotone h) g
hg.2.2]
exact IsNormal.blsub_eq.{u, u} hf ha
#align ordinal.is_normal.is_fundamental_sequence Ordinal.IsNormal.isFundamentalSequence
theorem IsNormal.cof_eq {f} (hf : IsNormal f) {a} (ha : IsLimit a) : cof (f a) = cof a :=
let ⟨_, hg⟩ := exists_fundamental_sequence a
ord_injective (hf.isFundamentalSequence ha hg).cof_eq
#align ordinal.is_normal.cof_eq Ordinal.IsNormal.cof_eq
theorem IsNormal.cof_le {f} (hf : IsNormal f) (a) : cof a ≤ cof (f a) := by
rcases zero_or_succ_or_limit a with (rfl | ⟨b, rfl⟩ | ha)
· rw [cof_zero]
exact zero_le _
· rw [cof_succ, Cardinal.one_le_iff_ne_zero, cof_ne_zero, ← Ordinal.pos_iff_ne_zero]
exact (Ordinal.zero_le (f b)).trans_lt (hf.1 b)
· rw [hf.cof_eq ha]
#align ordinal.is_normal.cof_le Ordinal.IsNormal.cof_le
@[simp]
theorem cof_add (a b : Ordinal) : b ≠ 0 → cof (a + b) = cof b := fun h => by
rcases zero_or_succ_or_limit b with (rfl | ⟨c, rfl⟩ | hb)
· contradiction
· rw [add_succ, cof_succ, cof_succ]
· exact (add_isNormal a).cof_eq hb
#align ordinal.cof_add Ordinal.cof_add
theorem aleph0_le_cof {o} : ℵ₀ ≤ cof o ↔ IsLimit o := by
rcases zero_or_succ_or_limit o with (rfl | ⟨o, rfl⟩ | l)
· simp [not_zero_isLimit, Cardinal.aleph0_ne_zero]
· simp [not_succ_isLimit, Cardinal.one_lt_aleph0]
· simp [l]
refine le_of_not_lt fun h => ?_
cases' Cardinal.lt_aleph0.1 h with n e
have := cof_cof o
rw [e, ord_nat] at this
cases n
· simp at e
simp [e, not_zero_isLimit] at l
· rw [natCast_succ, cof_succ] at this
rw [← this, cof_eq_one_iff_is_succ] at e
rcases e with ⟨a, rfl⟩
exact not_succ_isLimit _ l
#align ordinal.aleph_0_le_cof Ordinal.aleph0_le_cof
@[simp]
theorem aleph'_cof {o : Ordinal} (ho : o.IsLimit) : (aleph' o).ord.cof = o.cof :=
aleph'_isNormal.cof_eq ho
#align ordinal.aleph'_cof Ordinal.aleph'_cof
@[simp]
theorem aleph_cof {o : Ordinal} (ho : o.IsLimit) : (aleph o).ord.cof = o.cof :=
aleph_isNormal.cof_eq ho
#align ordinal.aleph_cof Ordinal.aleph_cof
@[simp]
theorem cof_omega : cof ω = ℵ₀ :=
(aleph0_le_cof.2 omega_isLimit).antisymm' <| by
rw [← card_omega]
apply cof_le_card
#align ordinal.cof_omega Ordinal.cof_omega
theorem cof_eq' (r : α → α → Prop) [IsWellOrder α r] (h : IsLimit (type r)) :
∃ S : Set α, (∀ a, ∃ b ∈ S, r a b) ∧ #S = cof (type r) :=
let ⟨S, H, e⟩ := cof_eq r
⟨S, fun a =>
let a' := enum r _ (h.2 _ (typein_lt_type r a))
let ⟨b, h, ab⟩ := H a'
⟨b, h,
(IsOrderConnected.conn a b a' <|
(typein_lt_typein r).1
(by
rw [typein_enum]
exact lt_succ (typein _ _))).resolve_right
ab⟩,
e⟩
#align ordinal.cof_eq' Ordinal.cof_eq'
@[simp]
theorem cof_univ : cof univ.{u, v} = Cardinal.univ.{u, v} :=
le_antisymm (cof_le_card _)
(by
refine le_of_forall_lt fun c h => ?_
rcases lt_univ'.1 h with ⟨c, rfl⟩
rcases @cof_eq Ordinal.{u} (· < ·) _ with ⟨S, H, Se⟩
rw [univ, ← lift_cof, ← Cardinal.lift_lift.{u+1, v, u}, Cardinal.lift_lt, ← Se]
refine lt_of_not_ge fun h => ?_
cases' Cardinal.lift_down h with a e
refine Quotient.inductionOn a (fun α e => ?_) e
cases' Quotient.exact e with f
have f := Equiv.ulift.symm.trans f
let g a := (f a).1
let o := succ (sup.{u, u} g)
rcases H o with ⟨b, h, l⟩
refine l (lt_succ_iff.2 ?_)
rw [← show g (f.symm ⟨b, h⟩) = b by simp [g]]
apply le_sup)
#align ordinal.cof_univ Ordinal.cof_univ
/-! ### Infinite pigeonhole principle -/
/-- If the union of s is unbounded and s is smaller than the cofinality,
then s has an unbounded member -/
theorem unbounded_of_unbounded_sUnion (r : α → α → Prop) [wo : IsWellOrder α r] {s : Set (Set α)}
(h₁ : Unbounded r <| ⋃₀ s) (h₂ : #s < StrictOrder.cof r) : ∃ x ∈ s, Unbounded r x := by
by_contra! h
simp_rw [not_unbounded_iff] at h
let f : s → α := fun x : s => wo.wf.sup x (h x.1 x.2)
refine h₂.not_le (le_trans (csInf_le' ⟨range f, fun x => ?_, rfl⟩) mk_range_le)
rcases h₁ x with ⟨y, ⟨c, hc, hy⟩, hxy⟩
exact ⟨f ⟨c, hc⟩, mem_range_self _, fun hxz => hxy (Trans.trans (wo.wf.lt_sup _ hy) hxz)⟩
#align ordinal.unbounded_of_unbounded_sUnion Ordinal.unbounded_of_unbounded_sUnion
/-- If the union of s is unbounded and s is smaller than the cofinality,
then s has an unbounded member -/
theorem unbounded_of_unbounded_iUnion {α β : Type u} (r : α → α → Prop) [wo : IsWellOrder α r]
(s : β → Set α) (h₁ : Unbounded r <| ⋃ x, s x) (h₂ : #β < StrictOrder.cof r) :
∃ x : β, Unbounded r (s x) := by
rw [← sUnion_range] at h₁
rcases unbounded_of_unbounded_sUnion r h₁ (mk_range_le.trans_lt h₂) with ⟨_, ⟨x, rfl⟩, u⟩
exact ⟨x, u⟩
#align ordinal.unbounded_of_unbounded_Union Ordinal.unbounded_of_unbounded_iUnion
/-- The infinite pigeonhole principle -/
theorem infinite_pigeonhole {β α : Type u} (f : β → α) (h₁ : ℵ₀ ≤ #β) (h₂ : #α < (#β).ord.cof) :
∃ a : α, #(f ⁻¹' {a}) = #β := by
have : ∃ a, #β ≤ #(f ⁻¹' {a}) := by
by_contra! h
apply mk_univ.not_lt
rw [← preimage_univ, ← iUnion_of_singleton, preimage_iUnion]
exact
mk_iUnion_le_sum_mk.trans_lt
((sum_le_iSup _).trans_lt <| mul_lt_of_lt h₁ (h₂.trans_le <| cof_ord_le _) (iSup_lt h₂ h))
cases' this with x h
refine ⟨x, h.antisymm' ?_⟩
rw [le_mk_iff_exists_set]
exact ⟨_, rfl⟩
#align ordinal.infinite_pigeonhole Ordinal.infinite_pigeonhole
/-- Pigeonhole principle for a cardinality below the cardinality of the domain -/
theorem infinite_pigeonhole_card {β α : Type u} (f : β → α) (θ : Cardinal) (hθ : θ ≤ #β)
(h₁ : ℵ₀ ≤ θ) (h₂ : #α < θ.ord.cof) : ∃ a : α, θ ≤ #(f ⁻¹' {a}) := by
rcases le_mk_iff_exists_set.1 hθ with ⟨s, rfl⟩
cases' infinite_pigeonhole (f ∘ Subtype.val : s → α) h₁ h₂ with a ha
use a; rw [← ha, @preimage_comp _ _ _ Subtype.val f]
exact mk_preimage_of_injective _ _ Subtype.val_injective
#align ordinal.infinite_pigeonhole_card Ordinal.infinite_pigeonhole_card
theorem infinite_pigeonhole_set {β α : Type u} {s : Set β} (f : s → α) (θ : Cardinal)
(hθ : θ ≤ #s) (h₁ : ℵ₀ ≤ θ) (h₂ : #α < θ.ord.cof) :
∃ (a : α) (t : Set β) (h : t ⊆ s), θ ≤ #t ∧ ∀ ⦃x⦄ (hx : x ∈ t), f ⟨x, h hx⟩ = a := by
cases' infinite_pigeonhole_card f θ hθ h₁ h₂ with a ha
refine ⟨a, { x | ∃ h, f ⟨x, h⟩ = a }, ?_, ?_, ?_⟩
· rintro x ⟨hx, _⟩
exact hx
· refine
ha.trans
(ge_of_eq <|
Quotient.sound ⟨Equiv.trans ?_ (Equiv.subtypeSubtypeEquivSubtypeExists _ _).symm⟩)
simp only [coe_eq_subtype, mem_singleton_iff, mem_preimage, mem_setOf_eq]
rfl
rintro x ⟨_, hx'⟩; exact hx'
#align ordinal.infinite_pigeonhole_set Ordinal.infinite_pigeonhole_set
end Ordinal
/-! ### Regular and inaccessible cardinals -/
namespace Cardinal
open Ordinal
/-- A cardinal is a strong limit if it is not zero and it is
closed under powersets. Note that `ℵ₀` is a strong limit by this definition. -/
def IsStrongLimit (c : Cardinal) : Prop :=
c ≠ 0 ∧ ∀ x < c, (2^x) < c
#align cardinal.is_strong_limit Cardinal.IsStrongLimit
theorem IsStrongLimit.ne_zero {c} (h : IsStrongLimit c) : c ≠ 0 :=
h.1
#align cardinal.is_strong_limit.ne_zero Cardinal.IsStrongLimit.ne_zero
theorem IsStrongLimit.two_power_lt {x c} (h : IsStrongLimit c) : x < c → (2^x) < c :=
h.2 x
#align cardinal.is_strong_limit.two_power_lt Cardinal.IsStrongLimit.two_power_lt
theorem isStrongLimit_aleph0 : IsStrongLimit ℵ₀ :=
⟨aleph0_ne_zero, fun x hx => by
rcases lt_aleph0.1 hx with ⟨n, rfl⟩
exact mod_cast nat_lt_aleph0 (2 ^ n)⟩
#align cardinal.is_strong_limit_aleph_0 Cardinal.isStrongLimit_aleph0
protected theorem IsStrongLimit.isSuccLimit {c} (H : IsStrongLimit c) : IsSuccLimit c :=
isSuccLimit_of_succ_lt fun x h => (succ_le_of_lt <| cantor x).trans_lt (H.two_power_lt h)
#align cardinal.is_strong_limit.is_succ_limit Cardinal.IsStrongLimit.isSuccLimit
theorem IsStrongLimit.isLimit {c} (H : IsStrongLimit c) : IsLimit c :=
⟨H.ne_zero, H.isSuccLimit⟩
#align cardinal.is_strong_limit.is_limit Cardinal.IsStrongLimit.isLimit
theorem isStrongLimit_beth {o : Ordinal} (H : IsSuccLimit o) : IsStrongLimit (beth o) := by
rcases eq_or_ne o 0 with (rfl | h)
· rw [beth_zero]
exact isStrongLimit_aleph0
· refine ⟨beth_ne_zero o, fun a ha => ?_⟩
rw [beth_limit ⟨h, isSuccLimit_iff_succ_lt.1 H⟩] at ha
rcases exists_lt_of_lt_ciSup' ha with ⟨⟨i, hi⟩, ha⟩
have := power_le_power_left two_ne_zero ha.le
rw [← beth_succ] at this
exact this.trans_lt (beth_lt.2 (H.succ_lt hi))
#align cardinal.is_strong_limit_beth Cardinal.isStrongLimit_beth
theorem mk_bounded_subset {α : Type*} (h : ∀ x < #α, (2^x) < #α) {r : α → α → Prop}
[IsWellOrder α r] (hr : (#α).ord = type r) : #{ s : Set α // Bounded r s } = #α := by
rcases eq_or_ne #α 0 with (ha | ha)
· rw [ha]
haveI := mk_eq_zero_iff.1 ha
rw [mk_eq_zero_iff]
constructor
rintro ⟨s, hs⟩
exact (not_unbounded_iff s).2 hs (unbounded_of_isEmpty s)
have h' : IsStrongLimit #α := ⟨ha, h⟩
have ha := h'.isLimit.aleph0_le
apply le_antisymm
· have : { s : Set α | Bounded r s } = ⋃ i, 𝒫{ j | r j i } := setOf_exists _
rw [← coe_setOf, this]
refine mk_iUnion_le_sum_mk.trans ((sum_le_iSup (fun i => #(𝒫{ j | r j i }))).trans
((mul_le_max_of_aleph0_le_left ha).trans ?_))
rw [max_eq_left]
apply ciSup_le' _
intro i
rw [mk_powerset]
apply (h'.two_power_lt _).le
rw [coe_setOf, card_typein, ← lt_ord, hr]
apply typein_lt_type
· refine @mk_le_of_injective α _ (fun x => Subtype.mk {x} ?_) ?_
· apply bounded_singleton
rw [← hr]
apply ord_isLimit ha
· intro a b hab
simpa [singleton_eq_singleton_iff] using hab
#align cardinal.mk_bounded_subset Cardinal.mk_bounded_subset
theorem mk_subset_mk_lt_cof {α : Type*} (h : ∀ x < #α, (2^x) < #α) :
#{ s : Set α // #s < cof (#α).ord } = #α := by
rcases eq_or_ne #α 0 with (ha | ha)
· simp [ha]
have h' : IsStrongLimit #α := ⟨ha, h⟩
rcases ord_eq α with ⟨r, wo, hr⟩
haveI := wo
apply le_antisymm
· conv_rhs => rw [← mk_bounded_subset h hr]
apply mk_le_mk_of_subset
intro s hs
rw [hr] at hs
exact lt_cof_type hs
· refine @mk_le_of_injective α _ (fun x => Subtype.mk {x} ?_) ?_
· rw [mk_singleton]
exact one_lt_aleph0.trans_le (aleph0_le_cof.2 (ord_isLimit h'.isLimit.aleph0_le))
· intro a b hab
simpa [singleton_eq_singleton_iff] using hab
#align cardinal.mk_subset_mk_lt_cof Cardinal.mk_subset_mk_lt_cof
/-- A cardinal is regular if it is infinite and it equals its own cofinality. -/
def IsRegular (c : Cardinal) : Prop :=
ℵ₀ ≤ c ∧ c ≤ c.ord.cof
#align cardinal.is_regular Cardinal.IsRegular
theorem IsRegular.aleph0_le {c : Cardinal} (H : c.IsRegular) : ℵ₀ ≤ c :=
H.1
#align cardinal.is_regular.aleph_0_le Cardinal.IsRegular.aleph0_le
theorem IsRegular.cof_eq {c : Cardinal} (H : c.IsRegular) : c.ord.cof = c :=
(cof_ord_le c).antisymm H.2
#align cardinal.is_regular.cof_eq Cardinal.IsRegular.cof_eq
theorem IsRegular.pos {c : Cardinal} (H : c.IsRegular) : 0 < c :=
aleph0_pos.trans_le H.1
#align cardinal.is_regular.pos Cardinal.IsRegular.pos
theorem IsRegular.nat_lt {c : Cardinal} (H : c.IsRegular) (n : ℕ) : n < c :=
lt_of_lt_of_le (nat_lt_aleph0 n) H.aleph0_le
theorem IsRegular.ord_pos {c : Cardinal} (H : c.IsRegular) : 0 < c.ord := by
rw [Cardinal.lt_ord, card_zero]
exact H.pos
#align cardinal.is_regular.ord_pos Cardinal.IsRegular.ord_pos
theorem isRegular_cof {o : Ordinal} (h : o.IsLimit) : IsRegular o.cof :=
⟨aleph0_le_cof.2 h, (cof_cof o).ge⟩
#align cardinal.is_regular_cof Cardinal.isRegular_cof
theorem isRegular_aleph0 : IsRegular ℵ₀ :=
⟨le_rfl, by simp⟩
#align cardinal.is_regular_aleph_0 Cardinal.isRegular_aleph0
theorem isRegular_succ {c : Cardinal.{u}} (h : ℵ₀ ≤ c) : IsRegular (succ c) :=
⟨h.trans (le_succ c),
succ_le_of_lt
(by
cases' Quotient.exists_rep (@succ Cardinal _ _ c) with α αe; simp at αe
rcases ord_eq α with ⟨r, wo, re⟩
have := ord_isLimit (h.trans (le_succ _))
rw [← αe, re] at this ⊢
rcases cof_eq' r this with ⟨S, H, Se⟩
rw [← Se]
apply lt_imp_lt_of_le_imp_le fun h => mul_le_mul_right' h c
rw [mul_eq_self h, ← succ_le_iff, ← αe, ← sum_const']
refine le_trans ?_ (sum_le_sum (fun (x : S) => card (typein r (x : α))) _ fun i => ?_)
· simp only [← card_typein, ← mk_sigma]
exact
⟨Embedding.ofSurjective (fun x => x.2.1) fun a =>
let ⟨b, h, ab⟩ := H a
⟨⟨⟨_, h⟩, _, ab⟩, rfl⟩⟩
· rw [← lt_succ_iff, ← lt_ord, ← αe, re]
apply typein_lt_type)⟩
#align cardinal.is_regular_succ Cardinal.isRegular_succ
theorem isRegular_aleph_one : IsRegular (aleph 1) := by
rw [← succ_aleph0]
exact isRegular_succ le_rfl
#align cardinal.is_regular_aleph_one Cardinal.isRegular_aleph_one