Skip to content

Commit 18e2f51

Browse files
committed
little golf
1 parent 5d33eb9 commit 18e2f51

1 file changed

Lines changed: 40 additions & 48 deletions

File tree

Mathlib/SetTheory/Cardinal/Pigeonhole.lean

Lines changed: 40 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -144,54 +144,46 @@ theorem Uncountable.exists_uncountable_pairwise_inter_eq {α : Type u} {ι : Typ
144144
| zero =>
145145
exact ⟨s, subset_rfl, ∅, hs, fun i hi j hj hij => by grind⟩
146146
| succ n ih =>
147-
by_cases h : ∀ a, Countable {i ∈ s | a ∈ f i}
148-
· let g : Ordinal.{v} → ι := WellFoundedLT.fix fun j ih =>
149-
Classical.epsilon fun i => i ∈ s ∧ ∀ k (hk : k < j), f i ∩ f (ih k hk) = ∅
150-
have hg : ∀ j < ω₁, g j ∈ s ∧ ∀ k < j, f (g j) ∩ f (g k) = ∅ := by
151-
intro j hj
152-
have hg : g j = Classical.epsilon fun i => i ∈ s ∧ ∀ k (hk : k < j), f i ∩ f (g k) = ∅ := by
153-
simp only [g]
154-
rw [WellFoundedLT.fix_eq]
155-
suffices {i ∈ s | ∀ k (hk : k < j), f i ∩ f (g k) = ∅}.Nonempty by
156-
simp only [nonempty_def, mem_setOf_eq] at this
157-
apply Classical.epsilon_spec at this
158-
rw [← hg] at this
159-
exact this
160-
apply Uncountable.nonempty
161-
rw [setOf_and, setOf_mem_eq, ← diff_compl, ← diff_self_inter]
162-
apply hs.to_set.diff
163-
simp_rw [compl_setOf, not_forall, setOf_exists, ← mem_Iio, inter_iUnion₂]
164-
apply Countable.biUnion
165-
· rwa [← le_aleph0_iff_set_countable, mk_Iio_ordinal, lift_le_aleph0, ← lt_succ_iff,
166-
succ_aleph0, ← lt_ord, ord_aleph]
167-
· intro a ha
168-
simp_rw [Finset.eq_empty_iff_forall_notMem, Finset.mem_inter, not_and', not_forall,
169-
← SetLike.mem_coe, setOf_exists, not_not, inter_iUnion₂]
170-
apply Countable.biUnion
171-
· apply Finite.countable
172-
simp
173-
· intro i hi
174-
simp_rw [SetLike.mem_coe, inter_setOf_eq_sep]
175-
exact h i
176-
have hg' : InjOn g (Iio ω₁) := by
177-
intro j hj k hk hjk
178-
by_contra hjk'
179-
wlog hjk'' : k < j generalizing j k
180-
· exact this hk hj hjk.symm (ne_comm.1 hjk') (lt_of_le_of_ne (le_of_not_gt hjk'') hjk')
181-
have := (hg j hj).2 k hjk''
182-
simp only [← hjk, Finset.inter_self] at this
183-
simpa [this] using hn _ (hg j hj).1
184-
refine ⟨g '' Iio ω₁, by grind, ∅, .to_subtype (.image ?_ hg'), Pairwise.image ?_⟩
185-
· rw [← uncountable_coe_iff, ← aleph0_lt_mk_iff, mk_Iio_ordinal, aleph0_lt_lift, card_omega]
186-
exact aleph0_lt_aleph_one
187-
intro j hj k hk hjk
188-
simp only [Function.onFun_apply]
189-
wlog hjk' : k < j generalizing j k
190-
· rw [Finset.inter_comm]
191-
exact this hk hj hjk.symm (lt_of_le_of_ne (le_of_not_gt hjk') hjk)
192-
exact (hg j hj).2 k hjk'
193-
· simp only [not_forall, not_countable_iff] at h
194-
rcases h with ⟨a, ha⟩
147+
by_cases h : ∃ a, Uncountable {i ∈ s | a ∈ f i}
148+
· rcases h with ⟨a, ha⟩
195149
rcases ih (fun i => f i \ {a}) _ (by grind) ha with ⟨s', hs', t, hs'', ht⟩
196150
exact ⟨s', hs'.trans (sep_subset _ _), t ∪ {a}, hs'', fun i hi j hj hij => by
197151
grind [Set.Pairwise]⟩
152+
simp only [coe_setOf, not_exists, not_uncountable_iff] at h
153+
let g : Ordinal.{v} → ι := WellFoundedLT.fix fun j ih =>
154+
Classical.epsilon fun i => i ∈ s ∧ ∀ k (hk : k < j), f i ∩ f (ih k hk) = ∅
155+
have hg : ∀ j < ω₁, g j ∈ s ∧ ∀ k < j, f (g j) ∩ f (g k) = ∅ := by
156+
intro j hj
157+
suffices {i ∈ s | ∀ k (hk : k < j), f i ∩ f (g k) = ∅}.Nonempty by
158+
simp only [nonempty_def, mem_setOf_eq] at this
159+
apply Classical.epsilon_spec at this
160+
unfold g
161+
rwa [WellFoundedLT.fix_eq]
162+
rw [setOf_and, setOf_mem_eq, ← diff_compl, ← diff_self_inter]
163+
refine (hs.to_set.diff ?_).nonempty
164+
simp_rw [compl_setOf, not_forall, setOf_exists, ← mem_Iio, inter_iUnion₂]
165+
refine .biUnion ?_ fun a ha => ?_
166+
· rwa [← le_aleph0_iff_set_countable, mk_Iio_ordinal, lift_le_aleph0, ← lt_succ_iff,
167+
succ_aleph0, ← lt_ord, ord_aleph]
168+
· simp_rw [Finset.eq_empty_iff_forall_notMem, Finset.mem_inter, not_and', not_forall,
169+
← SetLike.mem_coe, setOf_exists, not_not, inter_iUnion₂]
170+
refine .biUnion (Finset.finite_toSet _).countable fun i hi => ?_
171+
simp_rw [SetLike.mem_coe, inter_setOf_eq_sep]
172+
exact h i
173+
have hg' : InjOn g (Iio ω₁) := by
174+
intro j hj k hk hjk
175+
by_contra hjk'
176+
wlog hjk'' : k < j generalizing j k
177+
· exact this hk hj hjk.symm (ne_comm.1 hjk') (lt_of_le_of_ne (le_of_not_gt hjk'') hjk')
178+
have := (hg j hj).2 k hjk''
179+
simp only [← hjk, Finset.inter_self] at this
180+
simpa [this] using hn _ (hg j hj).1
181+
refine ⟨g '' Iio ω₁, by grind, ∅, .to_subtype (.image ?_ hg'), Pairwise.image ?_⟩
182+
· rw [← uncountable_coe_iff, ← aleph0_lt_mk_iff, mk_Iio_ordinal, aleph0_lt_lift, card_omega]
183+
exact aleph0_lt_aleph_one
184+
intro j hj k hk hjk
185+
simp only [Function.onFun_apply]
186+
wlog hjk' : k < j generalizing j k
187+
· rw [Finset.inter_comm]
188+
exact this hk hj hjk.symm (lt_of_le_of_ne (le_of_not_gt hjk') hjk)
189+
exact (hg j hj).2 k hjk'

0 commit comments

Comments
 (0)