Skip to content

Commit

Permalink
feat(SetTheory/Cardinal/Basic): add missing lift versions of `iUnio…
Browse files Browse the repository at this point in the history
…n` lemmas (#9187)

Also move some lift lemmas to be next to their non-lift counterparts.

For now this does not generalize to `ι : Sort v` as this would make a mess with `PLift`.
  • Loading branch information
eric-wieser committed Dec 23, 2023
1 parent a7fbc9e commit a9c72c7
Showing 1 changed file with 50 additions and 24 deletions.
74 changes: 50 additions & 24 deletions Mathlib/SetTheory/Cardinal/Basic.lean
Expand Up @@ -2167,6 +2167,11 @@ theorem mk_range_eq (f : α → β) (h : Injective f) : #(range f) = #α :=
mk_congr (Equiv.ofInjective f h).symm
#align cardinal.mk_range_eq Cardinal.mk_range_eq

theorem mk_range_eq_lift {α : Type u} {β : Type v} {f : α → β} (hf : Injective f) :
lift.{max u w} #(range f) = lift.{max v w} #α :=
lift_mk_eq.{v,u,w}.mpr ⟨(Equiv.ofInjective f hf).symm⟩
#align cardinal.mk_range_eq_lift Cardinal.mk_range_eq_lift

theorem mk_range_eq_of_injective {α : Type u} {β : Type v} {f : α → β} (hf : Injective f) :
lift.{u} #(range f) = lift.{v} #α :=
lift_mk_eq'.mpr ⟨(Equiv.ofInjective f hf).symm⟩
Expand All @@ -2177,32 +2182,62 @@ lemma lift_mk_le_lift_mk_of_injective {α : Type u} {β : Type v} {f : α → β
rw [← Cardinal.mk_range_eq_of_injective hf]
exact Cardinal.lift_le.2 (Cardinal.mk_set_le _)

theorem mk_range_eq_lift {α : Type u} {β : Type v} {f : α → β} (hf : Injective f) :
lift.{max u w} #(range f) = lift.{max v w} #α :=
lift_mk_eq.{v,u,w}.mpr ⟨(Equiv.ofInjective f hf).symm⟩
#align cardinal.mk_range_eq_lift Cardinal.mk_range_eq_lift
theorem mk_image_eq_of_injOn {α β : Type u} (f : α → β) (s : Set α) (h : InjOn f s) :
#(f '' s) = #s :=
mk_congr (Equiv.Set.imageOfInjOn f s h).symm
#align cardinal.mk_image_eq_of_inj_on Cardinal.mk_image_eq_of_injOn

theorem mk_image_eq_of_injOn_lift {α : Type u} {β : Type v} (f : α → β) (s : Set α)
(h : InjOn f s) : lift.{u} #(f '' s) = lift.{v} #s :=
lift_mk_eq.{v, u, 0}.mpr ⟨(Equiv.Set.imageOfInjOn f s h).symm⟩
#align cardinal.mk_image_eq_of_inj_on_lift Cardinal.mk_image_eq_of_injOn_lift

theorem mk_image_eq {α β : Type u} {f : α → β} {s : Set α} (hf : Injective f) : #(f '' s) = #s :=
mk_congr (Equiv.Set.image f s hf).symm
mk_image_eq_of_injOn _ _ <| hf.injOn _
#align cardinal.mk_image_eq Cardinal.mk_image_eq

theorem mk_image_eq_lift {α : Type u} {β : Type v} (f : α → β) (s : Set α) (h : Injective f) :
lift.{u} #(f '' s) = lift.{v} #s :=
mk_image_eq_of_injOn_lift _ _ <| h.injOn _
#align cardinal.mk_image_eq_lift Cardinal.mk_image_eq_lift

theorem mk_iUnion_le_sum_mk {α ι : Type u} {f : ι → Set α} : #(⋃ i, f i) ≤ sum fun i => #(f i) :=
calc
#(⋃ i, f i) ≤ #(Σi, f i) := mk_le_of_surjective (Set.sigmaToiUnion_surjective f)
_ = sum fun i => #(f i) := mk_sigma _
#align cardinal.mk_Union_le_sum_mk Cardinal.mk_iUnion_le_sum_mk

theorem mk_iUnion_le_sum_mk_lift {α : Type u} {ι : Type v} {f : ι → Set α} :
lift.{v} #(⋃ i, f i) ≤ sum fun i => #(f i) :=
calc
lift.{v} #(⋃ i, f i) ≤ #(Σi, f i) :=
mk_le_of_surjective <| ULift.up_surjective.comp (Set.sigmaToiUnion_surjective f)
_ = sum fun i => #(f i) := mk_sigma _

theorem mk_iUnion_eq_sum_mk {α ι : Type u} {f : ι → Set α}
(h : ∀ i j, i ≠ j → Disjoint (f i) (f j)) : #(⋃ i, f i) = sum fun i => #(f i) :=
calc
#(⋃ i, f i) = #(Σi, f i) := mk_congr (Set.unionEqSigmaOfDisjoint h)
_ = sum fun i => #(f i) := mk_sigma _
#align cardinal.mk_Union_eq_sum_mk Cardinal.mk_iUnion_eq_sum_mk

theorem mk_iUnion_eq_sum_mk_lift {α : Type u} {ι : Type v} {f : ι → Set α}
(h : ∀ i j, i ≠ j → Disjoint (f i) (f j)) :
lift.{v} #(⋃ i, f i) = sum fun i => #(f i) :=
calc
lift.{v} #(⋃ i, f i) = #(Σi, f i) :=
mk_congr <| .trans Equiv.ulift (Set.unionEqSigmaOfDisjoint h)
_ = sum fun i => #(f i) := mk_sigma _

theorem mk_iUnion_le {α ι : Type u} (f : ι → Set α) : #(⋃ i, f i) ≤ #ι * ⨆ i, #(f i) :=
mk_iUnion_le_sum_mk.trans (sum_le_iSup _)
#align cardinal.mk_Union_le Cardinal.mk_iUnion_le

theorem mk_iUnion_le_lift {α : Type u} {ι : Type v} (f : ι → Set α) :
lift.{v} #(⋃ i, f i) ≤ lift.{u} #ι * ⨆ i, lift.{v} #(f i) := by
refine mk_iUnion_le_sum_mk_lift.trans <| Eq.trans_le ?_ (sum_le_iSup_lift _)
rw [← lift_sum, lift_id'.{_,u}]

theorem mk_sUnion_le {α : Type u} (A : Set (Set α)) : #(⋃₀ A) ≤ #A * ⨆ s : A, #s := by
rw [sUnion_eq_iUnion]
apply mk_iUnion_le
Expand All @@ -2214,6 +2249,11 @@ theorem mk_biUnion_le {ι α : Type u} (A : ι → Set α) (s : Set ι) :
apply mk_iUnion_le
#align cardinal.mk_bUnion_le Cardinal.mk_biUnion_le

theorem mk_biUnion_le_lift {α : Type u} {ι : Type v} (A : ι → Set α) (s : Set ι) :
lift.{v} #(⋃ x ∈ s, A x) ≤ lift.{u} #s * ⨆ x : s, lift.{v} #(A x.1) := by
rw [biUnion_eq_iUnion]
apply mk_iUnion_le_lift

theorem finset_card_lt_aleph0 (s : Finset α) : #(↑s : Set α) < ℵ₀ :=
lt_aleph0_of_finite _
#align cardinal.finset_card_lt_aleph_0 Cardinal.finset_card_lt_aleph0
Expand Down Expand Up @@ -2303,20 +2343,6 @@ theorem mk_union_le_aleph0 {α} {P Q : Set α} :
← countable_union]
#align cardinal.mk_union_le_aleph_0 Cardinal.mk_union_le_aleph0

theorem mk_image_eq_lift {α : Type u} {β : Type v} (f : α → β) (s : Set α) (h : Injective f) :
lift.{u} #(f '' s) = lift.{v} #s :=
lift_mk_eq.{v, u, 0}.mpr ⟨(Equiv.Set.image f s h).symm⟩
#align cardinal.mk_image_eq_lift Cardinal.mk_image_eq_lift

theorem mk_image_eq_of_injOn_lift {α : Type u} {β : Type v} (f : α → β) (s : Set α)
(h : InjOn f s) : lift.{u} #(f '' s) = lift.{v} #s :=
lift_mk_eq.{v, u, 0}.mpr ⟨(Equiv.Set.imageOfInjOn f s h).symm⟩
#align cardinal.mk_image_eq_of_inj_on_lift Cardinal.mk_image_eq_of_injOn_lift

theorem mk_image_eq_of_injOn {α β : Type u} (f : α → β) (s : Set α) (h : InjOn f s) :
#(f '' s) = #s :=
mk_congr (Equiv.Set.imageOfInjOn f s h).symm
#align cardinal.mk_image_eq_of_inj_on Cardinal.mk_image_eq_of_injOn

theorem mk_subtype_of_equiv {α β : Type u} (p : β → Prop) (e : α ≃ β) :
#{ a : α // p (e a) } = #{ b : β // p b } :=
Expand Down Expand Up @@ -2353,6 +2379,11 @@ theorem mk_preimage_of_injective_of_subset_range_lift {β : Type v} (f : α →
le_antisymm (mk_preimage_of_injective_lift f s h) (mk_preimage_of_subset_range_lift f s h2)
#align cardinal.mk_preimage_of_injective_of_subset_range_lift Cardinal.mk_preimage_of_injective_of_subset_range_lift

theorem mk_preimage_of_injective_of_subset_range (f : α → β) (s : Set β) (h : Injective f)
(h2 : s ⊆ range f) : #(f ⁻¹' s) = #s := by
convert mk_preimage_of_injective_of_subset_range_lift.{u, u} f s h h2 using 1 <;> rw [lift_id]
#align cardinal.mk_preimage_of_injective_of_subset_range Cardinal.mk_preimage_of_injective_of_subset_range

theorem mk_preimage_of_injective (f : α → β) (s : Set β) (h : Injective f) :
#(f ⁻¹' s) ≤ #s := by
rw [← lift_id #(↑(f ⁻¹' s)), ← lift_id #(↑s)]
Expand All @@ -2365,11 +2396,6 @@ theorem mk_preimage_of_subset_range (f : α → β) (s : Set β) (h : s ⊆ rang
exact mk_preimage_of_subset_range_lift f s h
#align cardinal.mk_preimage_of_subset_range Cardinal.mk_preimage_of_subset_range

theorem mk_preimage_of_injective_of_subset_range (f : α → β) (s : Set β) (h : Injective f)
(h2 : s ⊆ range f) : #(f ⁻¹' s) = #s := by
convert mk_preimage_of_injective_of_subset_range_lift.{u, u} f s h h2 using 1 <;> rw [lift_id]
#align cardinal.mk_preimage_of_injective_of_subset_range Cardinal.mk_preimage_of_injective_of_subset_range

theorem mk_subset_ge_of_subset_image_lift {α : Type u} {β : Type v} (f : α → β) {s : Set α}
{t : Set β} (h : t ⊆ f '' s) : lift.{u} #t ≤ lift.{v} #({ x ∈ s | f x ∈ t } : Set α) := by
rw [image_eq_range] at h
Expand Down

0 comments on commit a9c72c7

Please sign in to comment.