Documentation

Mathlib.Data.Countable.Defs

Countable and uncountable types #

In this file we define a typeclass Countable saying that a given Sort* is countable and a typeclass Uncountable saying that a given Type* is uncountable.

See also Encodable for a version that singles out a specific encoding of elements of α by natural numbers.

This file also provides a few instances of these typeclasses. More instances can be found in other files.

Definition and basic properties #

class Countable (α : Sort u) :

A type α is countable if there exists an injective map α → ℕ.

  • exists_injective_nat' : ∃ (f : α), Function.Injective f

    A type α is countable if there exists an injective map α → ℕ.

Instances
    theorem countable_iff_exists_injective (α : Sort u) :
    Countable α ∃ (f : α), Function.Injective f
    theorem Countable.exists_injective_nat (α : Sort u) [Countable α] :
    ∃ (f : α), Function.Injective f
    theorem Function.Injective.countable {α : Sort u} {β : Sort v} [Countable β] {f : αβ} (hf : Injective f) :
    theorem Function.Surjective.countable {α : Sort u} {β : Sort v} [Countable α] {f : αβ} (hf : Surjective f) :
    theorem exists_surjective_nat (α : Sort u) [Nonempty α] [Countable α] :
    ∃ (f : α), Function.Surjective f
    theorem countable_iff_exists_surjective {α : Sort u} [Nonempty α] :
    Countable α ∃ (f : α), Function.Surjective f
    theorem Countable.of_equiv {β : Sort v} (α : Sort u_1) [Countable α] (e : α β) :
    theorem Equiv.countable_iff {α : Sort u} {β : Sort v} (e : α β) :
    instance instCountableULift {β : Type v} [Countable β] :
    Countable (ULift.{u, v} β)

    Operations on Sort*s #

    instance instCountablePLift {α : Sort u} [Countable α] :
    Countable (PLift α)
    @[instance 100]
    instance Subsingleton.to_countable {α : Sort u} [Subsingleton α] :
    @[instance 500]
    instance Subtype.countable {α : Sort u} [Countable α] {p : αProp} :
    Countable { x : α // p x }
    instance instCountableFin {n : } :
    Countable (Fin n)
    @[instance 100]
    instance Finite.to_countable {α : Sort u} [Finite α] :
    @[instance 100]
    instance Prop.countable (p : Prop) :
    @[instance 500]
    instance Quotient.countable {α : Sort u} [Countable α] {r : ααProp} :
    Countable (Quot r)
    @[instance 500]
    instance instCountableQuotient {α : Sort u} [Countable α] {s : Setoid α} :
    Countable (Quotient s)

    Uncountable types #

    class Uncountable (α : Sort u_1) :

    A type α is uncountable if it is not countable.

    • not_countable : ¬Countable α

      A type α is uncountable if it is not countable.

    Instances
      @[simp]
      theorem not_uncountable {α : Sort u} [Countable α] :
      @[simp]
      theorem not_countable {α : Sort u} [Uncountable α] :
      theorem Function.Injective.uncountable {α : Sort u} {β : Sort v} [Uncountable α] {f : αβ} (hf : Injective f) :
      theorem Function.Surjective.uncountable {α : Sort u} {β : Sort v} [Uncountable β] {f : αβ} (hf : Surjective f) :
      theorem not_injective_uncountable_countable {α : Sort u} {β : Sort v} [Uncountable α] [Countable β] (f : αβ) :
      ¬Function.Injective f
      theorem not_surjective_countable_uncountable {α : Sort u} {β : Sort v} [Countable α] [Uncountable β] (f : αβ) :
      ¬Function.Surjective f
      theorem uncountable_iff_forall_not_surjective {α : Sort u} [Nonempty α] :
      Uncountable α ∀ (f : α), ¬Function.Surjective f
      theorem Uncountable.of_equiv {β : Sort v} (α : Sort u_1) [Uncountable α] (e : α β) :
      theorem Equiv.uncountable_iff {α : Sort u} {β : Sort v} (e : α β) :
      instance instUncountableULift {β : Type v} [Uncountable β] :
      Uncountable (ULift.{u, v} β)
      @[instance 100]