Documentation

Mathlib.Data.Set.Countable

Countable sets #

def Set.Countable {α : Type u} (s : Set α) :

A set is countable if there exists an encoding of the set into the natural numbers. An encoding is an injection with a partial inverse, which can be viewed as a constructive analogue of countability. (For the most part, theorems about Countable will be classical and Encodable will be constructive.)

Equations
Instances For
    @[simp]
    theorem Set.countable_coe_iff {α : Type u} {s : Set α} :
    theorem Set.to_countable {α : Type u} (s : Set α) [Countable ↑s] :

    Prove Set.Countable from a Countable instance on the subtype.

    theorem Countable.to_set {α : Type u} {s : Set α} :

    Restate Set.Countable as a Countable instance.

    theorem Set.Countable.to_subtype {α : Type u} {s : Set α} :

    Restate Set.Countable as a Countable instance.

    theorem Set.countable_iff_exists_injOn {α : Type u} {s : Set α} :

    A set s : Set α is countable if and only if there exists a function α → ℕ injective on s.

    def Set.Countable.toEncodable {α : Type u} {s : Set α} :

    Convert Set.Countable s to Encodable s (noncomputable).

    Equations
    • Set.Countable.toEncodable = Classical.choice
    Instances For
      def Set.enumerateCountable {α : Type u} {s : Set α} (h : Set.Countable s) (default : α) :
      ℕ → α

      Noncomputably enumerate elements in a set. The default value is used to extend the domain to all of ℕ.

      Equations
      Instances For
        theorem Set.subset_range_enumerate {α : Type u} {s : Set α} (h : Set.Countable s) (default : α) :
        theorem Set.Countable.mono {α : Type u} {s₁ : Set α} {s₂ : Set α} (h : s₁ ⊆ s₂) :
        theorem Set.countable_range {β : Type v} {ι : Sort x} [Countable ι] (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 {α : Type u} {s : Set α} (hs : Set.Nonempty s) :

        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 {α : Type u} [Countable α] :
        Set.Countable Set.univ
        theorem Set.Countable.exists_eq_range {α : Type u} {s : Set α} (hc : Set.Countable s) (hs : Set.Nonempty s) :
        ∃ f, s = Set.range f

        If s : Set α is a nonempty countable set, then there exists a map f : ℕ → α such that s = range f.

        @[simp]
        theorem Set.countable_singleton {α : Type u} (a : α) :
        theorem Set.Countable.image {α : Type u} {β : Type v} {s : Set α} (hs : Set.Countable s) (f : α → β) :
        theorem Set.MapsTo.countable_of_injOn {α : Type u} {β : Type v} {s : Set α} {t : Set β} {f : α → β} (hf : Set.MapsTo f s t) (hf' : Set.InjOn f s) (ht : Set.Countable t) :
        theorem Set.Countable.preimage_of_injOn {α : Type u} {β : Type v} {s : Set β} (hs : Set.Countable s) {f : α → β} (hf : Set.InjOn f (f ⁻¹' s)) :
        theorem Set.Countable.preimage {α : Type u} {β : Type v} {s : Set β} (hs : Set.Countable s) {f : α → β} (hf : Function.Injective f) :
        theorem Set.exists_seq_iSup_eq_top_iff_countable {α : Type u} [CompleteLattice α] {p : α → Prop} (h : ∃ x, p x) :
        (∃ s, ((n : ℕ) → p (s n)) ∧ ⨆ (n : ℕ), s n = ⊤) ↔ ∃ S, Set.Countable S ∧ ((s : α) → s ∈ S → p s) ∧ sSup S = ⊤
        theorem Set.exists_seq_cover_iff_countable {α : Type u} {p : Set α → Prop} (h : ∃ s, p s) :
        (∃ s, ((n : ℕ) → p (s n)) ∧ ⋃ (n : ℕ), s n = Set.univ) ↔ ∃ S, Set.Countable S ∧ ((s : Set α) → s ∈ S → p s) ∧ ⋃₀ S = Set.univ
        theorem Set.countable_of_injective_of_countable_image {α : Type u} {β : Type v} {s : Set α} {f : α → β} (hf : Set.InjOn f s) (hs : Set.Countable (f '' s)) :
        theorem Set.countable_iUnion {α : Type u} {ι : Sort x} {t : ι → Set α} [Countable ι] (ht : ∀ (i : ι), Set.Countable (t i)) :
        Set.Countable (⋃ (i : ι), t i)
        @[simp]
        theorem Set.countable_iUnion_iff {α : Type u} {ι : Sort x} [Countable ι] {t : ι → Set α} :
        Set.Countable (⋃ (i : ι), t i) ↔ ∀ (i : ι), Set.Countable (t i)
        theorem Set.Countable.biUnion_iff {α : Type u} {β : Type v} {s : Set α} {t : (a : α) → a ∈ s → Set β} (hs : Set.Countable s) :
        Set.Countable (⋃ (a : α) (h : a ∈ s), t a h) ↔ ∀ (a : α) (ha : a ∈ s), Set.Countable (t a ha)
        theorem Set.Countable.sUnion_iff {α : Type u} {s : Set (Set α)} (hs : Set.Countable s) :
        Set.Countable (⋃₀ s) ↔ ∀ (a : Set α), a ∈ s → Set.Countable a
        theorem Set.Countable.biUnion {α : Type u} {β : Type v} {s : Set α} {t : (a : α) → a ∈ s → Set β} (hs : Set.Countable s) :
        (∀ (a : α) (ha : a ∈ s), Set.Countable (t a ha)) → Set.Countable (⋃ (a : α) (h : a ∈ s), t a h)

        Alias of the reverse direction of Set.Countable.biUnion_iff.

        theorem Set.Countable.sUnion {α : Type u} {s : Set (Set α)} (hs : Set.Countable s) :
        (∀ (a : Set α), a ∈ s → Set.Countable a) → Set.Countable (⋃₀ s)

        Alias of the reverse direction of Set.Countable.sUnion_iff.

        @[simp]
        theorem Set.countable_union {α : Type u} {s : Set α} {t : Set α} :
        theorem Set.Countable.union {α : Type u} {s : Set α} {t : Set α} (hs : Set.Countable s) (ht : Set.Countable t) :
        theorem Set.Countable.of_diff {α : Type u} {s : Set α} {t : Set α} (h : Set.Countable (s \ t)) (ht : Set.Countable t) :
        @[simp]
        theorem Set.countable_insert {α : Type u} {s : Set α} {a : α} :
        theorem Set.Countable.insert {α : Type u} {s : Set α} (a : α) (h : Set.Countable s) :
        theorem Set.Finite.countable {α : Type u} {s : Set α} :
        theorem Set.countable_setOf_finite_subset {α : Type u} {s : Set α} (hs : Set.Countable s) :

        The set of finite subsets of a countable set is countable.

        theorem Set.countable_univ_pi {α : Type u} {π : α → Type u_1} [Finite α] {s : (a : α) → Set (π a)} (hs : ∀ (a : α), Set.Countable (s a)) :
        Set.Countable (Set.pi Set.univ s)
        theorem Set.countable_pi {α : Type u} {π : α → Type u_1} [Finite α] {s : (a : α) → Set (π a)} (hs : ∀ (a : α), Set.Countable (s a)) :
        Set.Countable {f | ∀ (a : α), f a ∈ s a}
        theorem Set.Countable.prod {α : Type u} {β : Type v} {s : Set α} {t : Set β} (hs : Set.Countable s) (ht : Set.Countable t) :
        theorem Set.Countable.image2 {α : Type u} {β : Type v} {γ : Type w} {s : Set α} {t : Set β} (hs : Set.Countable s) (ht : Set.Countable t) (f : α → β → γ) :
        theorem Set.countable_setOf_nonempty_of_disjoint {α : Type u} {β : Type v} {f : β → Set α} (hf : Pairwise (Disjoint on f)) {s : Set α} (h'f : ∀ (t : β), f t ⊆ s) (hs : Set.Countable s) :

        If a family of disjoint sets is included in a countable set, then only countably many of them are nonempty.

        theorem Finset.countable_toSet {α : Type u} (s : Finset α) :