The areas / V03. Sets, finite structures and big operators
Mathlib.Data.Set.Countable
62 declarations and 4 deprecated aliases. Mathlib docs · Source
Countable sets
In this file we define Set.Countable s as Countable s
and prove basic properties of this definition.
Note that this definition does not provide a computable encoding.
For a noncomputable conversion to Encodable s, use Set.Countable.nonempty_encodable.
Tags
sets, countable set
theorem Set.enumerateCountable.match_1.congr_eq_2 E1 #
∀ {α : Type u_1} {s : Set α} (motive : Option ↑s → Sort u_2) (x : Option ↑s) (h_1 : (y : ↑s) → motive (some y))
(h_2 : Unit → motive none),
x = none →
(match x with
| some y => h_1 y
| none => h_2 ()) ≍
h_2 ()
theorem Set.enumerateCountable.match_1.congr_eq_1 E1 #
∀ {α : Type u_1} {s : Set α} (motive : Option ↑s → Sort u_2) (x : Option ↑s) (h_1 : (y : ↑s) → motive (some y))
(h_2 : Unit → motive none) (y : ↑s),
x = some y →
(match x with
| some y => h_1 y
| none => h_2 ()) ≍
h_1 y
def Set.Countable E1 #
{α : Type u} → Set α → Prop
A set s is countable if the corresponding subtype is countable,
i.e., there exists an injective map f : s → ℕ.
Note that this is an abbreviation, so hs : Set.Countable s in the proof context
is the same as an instance Countable s.
For a constructive version, see Encodable.
theorem Set.countable_coe_iff E0 #
∀ {α : Type u} {s : Set α}, Countable ↑s ↔ s.Countable
theorem Set.to_countable E1 #
∀ {α : Type u} (s : Set α) [Countable ↑s], s.Countable
Prove Set.Countable from a Countable instance on the subtype.
theorem Countable.to_set E1 #
∀ {α : Type u} {s : Set α}, Countable ↑s → s.Countable
Restate Set.Countable as a Countable instance.
theorem Set.Countable.to_subtype E1 #
∀ {α : Type u} {s : Set α}, s.Countable → Countable ↑s
Restate Set.Countable as a Countable instance.
theorem Set.countable_iff_exists_injective E1 #
∀ {α : Type u} {s : Set α}, s.Countable ↔ ∃ f, Function.Injective f
theorem Set.countable_iff_exists_injOn E1 #
∀ {α : Type u} {s : Set α}, s.Countable ↔ ∃ f, Set.InjOn f s
A set s : Set α is countable if and only if there exists a function α → ℕ injective
on s.
theorem Set.countable_iff_nonempty_encodable E1 #
∀ {α : Type u} {s : Set α}, s.Countable ↔ Nonempty (Encodable ↑s)
theorem Set.Countable.nonempty_encodable E1 #
∀ {α : Type u} {s : Set α}, s.Countable → Nonempty (Encodable ↑s)
Alias of the forward direction of Set.countable_iff_nonempty_encodable.
def Set.Countable.toEncodable E1 #
{α : Type u} → {s : Set α} → s.Countable → Encodable ↑s
Convert Set.Countable s to Encodable s (noncomputable).
def Set.enumerateCountable E1 #
{α : Type u} → {s : Set α} → s.Countable → α → ℕ → α
Noncomputably enumerate elements in a set. The default value is used to extend the domain to
all of ℕ.
theorem Set.subset_range_enumerate E1 #
∀ {α : Type u} {s : Set α} (h : s.Countable) (default : α), s ⊆ Set.range (Set.enumerateCountable h default)
theorem Set.range_enumerateCountable_subset E1 #
∀ {α : Type u} {s : Set α} (h : s.Countable) (default : α),
Set.range (Set.enumerateCountable h default) ⊆ insert default s
theorem Set.range_enumerateCountable_of_mem E1 #
∀ {α : Type u} {s : Set α} (h : s.Countable) {default : α},
default ∈ s → Set.range (Set.enumerateCountable h default) = s
theorem Set.enumerateCountable_mem E1 #
∀ {α : Type u} {s : Set α} (h : s.Countable) {default : α},
default ∈ s → ∀ (n : ℕ), Set.enumerateCountable h default n ∈ s
theorem Set.Countable.mono E1 #
∀ {α : Type u} {s₁ s₂ : Set α}, s₁ ⊆ s₂ → s₂.Countable → s₁.Countable
theorem Set.countable_range E1 #
∀ {β : Type v} {ι : Sort x} [Countable ι] (f : ι → β), (Set.range f).Countable
theorem Set.countable_iff_exists_subset_range E1 #
∀ {α : Type u} [Nonempty α] {s : Set α}, s.Countable ↔ ∃ f, s ⊆ Set.range f
theorem Set.countable_iff_exists_surjective E1 #
∀ {α : Type u} {s : Set α}, s.Nonempty → (s.Countable ↔ ∃ f, Function.Surjective f)
A non-empty set is countable iff there exists a surjection from the natural numbers onto the subtype induced by the set.
theorem Set.Countable.exists_surjective E1 #
∀ {α : Type u} {s : Set α}, s.Nonempty → s.Countable → ∃ f, Function.Surjective f
Alias of the forward direction of Set.countable_iff_exists_surjective.
A non-empty set is countable iff there exists a surjection from the natural numbers onto the subtype induced by the set.
theorem Set.countable_univ_iff E0 #
∀ {α : Type u}, Set.univ.Countable ↔ Countable α
theorem Set.countable_univ E1 #
∀ {α : Type u} [Countable α], Set.univ.Countable
theorem Set.not_countable_univ_iff E0 #
∀ {α : Type u}, ¬Set.univ.Countable ↔ Uncountable α
theorem Set.not_countable_univ E1 #
∀ {α : Type u} [Uncountable α], ¬Set.univ.Countable
theorem Set.Countable.exists_eq_range E1 #
∀ {α : Type u} {s : Set α}, s.Countable → s.Nonempty → ∃ f, s = Set.range f
If s : Set α is a nonempty countable set, then there exists a map
f : ℕ → α such that s = range f.
theorem Set.countable_empty E0 #
∀ {α : Type u}, ∅.Countable
theorem Set.countable_singleton E0 #
∀ {α : Type u} (a : α), {a}.Countable
theorem Set.Countable.image E1 #
∀ {α : Type u} {β : Type v} {s : Set α}, s.Countable → ∀ (f : α → β), (f '' s).Countable
theorem Set.Infinite.exists_subset_countable_infinite E1 #
∀ {α : Type u} {s : Set α}, s.Infinite → ∃ t ⊆ s, t.Countable ∧ t.Infinite
theorem Set.MapsTo.countable_of_injOn E1 #
∀ {α : Type u} {β : Type v} {s : Set α} {t : Set β} {f : α → β},
Set.MapsTo f s t → Set.InjOn f s → t.Countable → s.Countable
theorem Set.Countable.preimage_of_injOn E1 #
∀ {α : Type u} {β : Type v} {s : Set β}, s.Countable → ∀ {f : α → β}, Set.InjOn f (f ⁻¹' s) → (f ⁻¹' s).Countable
theorem Set.Countable.preimage E1 #
∀ {α : Type u} {β : Type v} {s : Set β}, s.Countable → ∀ {f : α → β}, Function.Injective f → (f ⁻¹' s).Countable
theorem Set.exists_seq_iSup_eq_top_iff_countable E1 #
∀ {α : Type u} [inst : CompleteLattice α] {p : α → Prop},
(∃ x, p x) → ((∃ s, (∀ (n : ℕ), p (s n)) ∧ ⨆ n, s n = ⊤) ↔ ∃ S, S.Countable ∧ (∀ s ∈ S, p s) ∧ sSup S = ⊤)
theorem Set.exists_seq_cover_iff_countable E1 #
∀ {α : Type u} {p : Set α → Prop},
(∃ s, p s) → ((∃ s, (∀ (n : ℕ), p (s n)) ∧ ⋃ n, s n = Set.univ) ↔ ∃ S, S.Countable ∧ (∀ s ∈ S, p s) ∧ ⋃₀ S = Set.univ)
theorem Set.countable_of_injective_of_countable_image E1 #
∀ {α : Type u} {β : Type v} {s : Set α} {f : α → β}, Set.InjOn f s → (f '' s).Countable → s.Countable
theorem Set.countable_iUnion E1 #
∀ {α : Type u} {ι : Sort x} {t : ι → Set α} [Countable ι], (∀ (i : ι), (t i).Countable) → (⋃ i, t i).Countable
theorem Set.countable_iUnion_iff E0 #
∀ {α : Type u} {ι : Sort x} [Countable ι] {t : ι → Set α}, (⋃ i, t i).Countable ↔ ∀ (i : ι), (t i).Countable
theorem Set.Countable.biUnion_iff E0 #
∀ {α : Type u} {β : Type v} {s : Set α} {t : (a : α) → a ∈ s → Set β},
s.Countable → ((⋃ a, ⋃ (h : a ∈ s), t a h).Countable ↔ ∀ (a : α) (ha : a ∈ s), (t a ha).Countable)
theorem Set.Countable.sUnion_iff E0 #
∀ {α : Type u} {s : Set (Set α)}, s.Countable → ((⋃₀ s).Countable ↔ ∀ a ∈ s, a.Countable)
theorem Set.Countable.biUnion E1 #
∀ {α : Type u} {β : Type v} {s : Set α} {t : (a : α) → a ∈ s → Set β},
s.Countable → (∀ (a : α) (ha : a ∈ s), (t a ha).Countable) → (⋃ a, ⋃ (h : a ∈ s), t a h).Countable
Alias of the reverse direction of Set.Countable.biUnion_iff.
theorem Set.Countable.sUnion E1 #
∀ {α : Type u} {s : Set (Set α)}, s.Countable → (∀ a ∈ s, a.Countable) → (⋃₀ s).Countable
Alias of the reverse direction of Set.Countable.sUnion_iff.
theorem Set.countable_union E0 #
∀ {α : Type u} {s t : Set α}, (s ∪ t).Countable ↔ s.Countable ∧ t.Countable
theorem Set.Countable.union E1 #
∀ {α : Type u} {s t : Set α}, s.Countable → t.Countable → (s ∪ t).Countable
theorem Set.Countable.of_sdiff E1 #
∀ {α : Type u} {s t : Set α}, (s \ t).Countable → t.Countable → s.Countable
theorem Set.countable_insert E0 #
∀ {α : Type u} {s : Set α} {a : α}, (insert a s).Countable ↔ s.Countable
theorem Set.Countable.insert E1 #
∀ {α : Type u} {s : Set α} (a : α), s.Countable → (insert a s).Countable
theorem Set.Finite.countable E1 #
∀ {α : Type u} {s : Set α}, s.Finite → s.Countable
theorem Set.Countable.of_subsingleton E1 #
∀ {α : Type u} [Subsingleton α] (s : Set α), s.Countable
theorem Set.Subsingleton.countable E1 #
∀ {α : Type u} {s : Set α}, s.Subsingleton → s.Countable
theorem Set.countable_isTop E1 #
∀ (α : Type u_1) [inst : PartialOrder α], {x | IsTop x}.Countable
theorem Set.countable_isBot E1 #
∀ (α : Type u_1) [inst : PartialOrder α], {x | IsBot x}.Countable
theorem Set.countable_ofPred_finite_subset E1 #
∀ {α : Type u} {s : Set α}, s.Countable → {t | t.Finite ∧ t ⊆ s}.Countable
The set of finite subsets of a countable set is countable.
theorem Set.Countable.ofPred_finite E1 #
∀ {α : Type u} [Countable α], {s | s.Finite}.Countable
The set of finite sets in a countable type is countable.
theorem Set.Countable.of_preimage_singleton E1 #
∀ {α : Type u} {β : Type v} {f : α → β} [Countable β], (∀ (b : β), (f ⁻¹' {b}).Countable) → Countable α
If the codomain of a map is countable and the fibres are countable, the domain is countable.
theorem Set.countable_univ_pi E1 #
∀ {α : Type u} {π : α → Type u_1} [Finite α] {s : (a : α) → Set (π a)},
(∀ (a : α), (s a).Countable) → (Set.univ.pi s).Countable
theorem Set.countable_pi E1 #
∀ {α : Type u} {π : α → Type u_1} [Finite α] {s : (a : α) → Set (π a)},
(∀ (a : α), (s a).Countable) → {f | ∀ (a : α), f a ∈ s a}.Countable
theorem Set.Countable.prod E1 #
∀ {α : Type u} {β : Type v} {s : Set α} {t : Set β}, s.Countable → t.Countable → (s ×ˢ t).Countable
theorem Set.Countable.image2 E1 #
∀ {α : Type u} {β : Type v} {γ : Type w} {s : Set α} {t : Set β},
s.Countable → t.Countable → ∀ (f : α → β → γ), (Set.image2 f s t).Countable
theorem Set.countable_ofPred_nonempty_of_disjoint E1 #
∀ {α : Type u} {β : Type v} {f : β → Set α},
Pairwise (Function.onFun Disjoint f) →
∀ {s : Set α}, (∀ (t : β), f t ⊆ s) → s.Countable → {t | (f t).Nonempty}.Countable
If a family of disjoint sets is included in a countable set, then only countably many of them are nonempty.
theorem Finset.countable_toSet E1 #
∀ {α : Type u} (s : Finset α), (↑s).Countable
Deprecated aliases
| Name | New name | Since |
|---|---|---|
Set.Countable.of_diff | Set.Countable.of_sdiff | 2026-06-03 |
Set.Countable.setOf_finite | Set.Countable.ofPred_finite | 2026-07-09 |
Set.countable_setOf_finite_subset | Set.countable_ofPred_finite_subset | 2026-07-09 |
Set.countable_setOf_nonempty_of_disjoint | Set.countable_ofPred_nonempty_of_disjoint | 2026-07-09 |