Skip to content

Commit 5bb7551

Browse files
committed
add
1 parent 7048ffa commit 5bb7551

1 file changed

Lines changed: 67 additions & 0 deletions

File tree

Mathlib/Data/Set/Countable.lean

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,3 +321,70 @@ end Set
321321

322322
theorem Finset.countable_toSet (s : Finset α) : Set.Countable (↑s : Set α) :=
323323
s.finite_toSet.countable
324+
325+
namespace Set
326+
327+
/-- A set is uncountable if it is not countable.
328+
329+
This is protected so that it does not conflict with global `Uncountable`. -/
330+
protected def Uncountable (s : Set α) : Prop :=
331+
¬s.Countable
332+
333+
@[simp, push]
334+
theorem not_countable_iff_uncountable {s : Set α} : ¬s.Countable ↔ s.Uncountable := .rfl
335+
336+
@[simp, push]
337+
theorem not_uncountable_iff_countable {s : Set α} : ¬s.Uncountable ↔ s.Countable :=
338+
not_not
339+
340+
alias ⟨_, Countable.not_uncountable⟩ := not_uncountable_iff_countable
341+
342+
@[simp] lemma Uncountable.not_countable {s : Set α} (hs : s.Uncountable) : ¬ s.Countable := hs
343+
344+
attribute [simp] Countable.not_uncountable
345+
346+
theorem uncountable_coe_iff {s : Set α} : Uncountable s ↔ s.Uncountable :=
347+
not_countable_iff.symm.trans countable_coe_iff.not
348+
349+
alias ⟨_root_.Uncountable.to_set, Uncountable.to_subtype⟩ := uncountable_coe_iff
350+
351+
theorem uncountable_univ_iff : (@univ α).Uncountable ↔ Uncountable α := by
352+
rw [Set.Uncountable, countable_univ_iff, not_countable_iff]
353+
354+
theorem uncountable_univ [h : Uncountable α] : (@univ α).Uncountable :=
355+
uncountable_univ_iff.2 h
356+
357+
theorem uncountable_of_countable_compl [Uncountable α] {s : Set α} (hs : sᶜ.Countable) :
358+
s.Uncountable := fun h =>
359+
Set.uncountable_univ (α := α) (by simpa using hs.union h)
360+
361+
theorem Finite.uncountable_compl [Uncountable α] {s : Set α} (hs : s.Countable) :
362+
sᶜ.Uncountable := fun h =>
363+
Set.uncountable_univ (α := α) (by simpa using hs.union h)
364+
365+
theorem Uncountable.diff {s t : Set α} (hs : s.Uncountable) (ht : t.Countable) :
366+
(s \ t).Uncountable := fun h =>
367+
hs <| h.of_diff ht
368+
369+
@[simp]
370+
theorem uncountable_union {s t : Set α} : (s ∪ t).Uncountable ↔ s.Uncountable ∨ t.Uncountable := by
371+
simp only [Set.Uncountable, countable_union, not_and_or]
372+
373+
theorem Uncountable.of_image (f : α → β) {s : Set α} (hs : (f '' s).Uncountable) : s.Uncountable :=
374+
mt (Countable.image · f) hs
375+
376+
theorem Uncountable.image {s : Set α} {f : α → β} (hs : s.Uncountable) (hi : InjOn f s) :
377+
(f '' s).Uncountable :=
378+
mt (countable_of_injective_of_countable_image hi) hs
379+
380+
theorem Uncountable.range [Uncountable α] {f : α → β} (hi : Injective f) :
381+
(range f).Uncountable := by
382+
simpa using uncountable_univ.image (hi.injOn (s := Set.univ))
383+
384+
theorem Uncountable.infinite {s : Set α} (hs : s.Uncountable) : s.Infinite :=
385+
mt Finite.countable hs
386+
387+
theorem Uncountable.nonempty {s : Set α} (hs : s.Uncountable) : s.Nonempty :=
388+
hs.infinite.nonempty
389+
390+
end Set

0 commit comments

Comments
 (0)