Documentation

Mathlib.Logic.Denumerable

Denumerable types #

This file defines denumerable (countably infinite) types as a typeclass extending Encodable. This is used to provide explicit encode/decode functions from and to , with the information that those functions are inverses of each other.

Implementation notes #

This property already has a name, namely α ≃ ℕ, but here we are interested in using it as a typeclass.

class Denumerable (α : Type u_3) extends Encodable :
Type u_3

A denumerable type is (constructively) bijective with . Typeclass equivalent of α ≃ ℕ.

Instances
theorem Denumerable.decode_inv {α : Type u_3} [self : Denumerable α] (n : ) :

decode and encode are inverses.

theorem Denumerable.decode_isSome (α : Type u_3) [Denumerable α] (n : ) :
def Denumerable.ofNat (α : Type u_3) [Denumerable α] (n : ) :
α

Returns the n-th element of α indexed by the decoding.

Equations
@[simp]
theorem Denumerable.ofNat_of_decode {α : Type u_1} [Denumerable α] {n : } {b : α} (h : Encodable.decode n = some b) :
@[simp]
def Denumerable.eqv (α : Type u_3) [Denumerable α] :
α

A denumerable type is equivalent to .

Equations
@[instance 100]
instance Denumerable.instInfinite {α : Type u_1} [Denumerable α] :
Equations
  • =
def Denumerable.mk' {α : Type u_3} (e : α ) :

A type equivalent to is denumerable.

Equations
def Denumerable.ofEquiv (α : Type u_3) {β : Type u_4} [Denumerable α] (e : β α) :

Denumerability is conserved by equivalences. This is transitivity of equivalence the denumerable way.

Equations
@[simp]
theorem Denumerable.ofEquiv_ofNat (α : Type u_3) {β : Type u_4} [Denumerable α] (e : β α) (n : ) :
def Denumerable.equiv₂ (α : Type u_3) (β : Type u_4) [Denumerable α] [Denumerable β] :
α β

All denumerable types are equivalent.

Equations
instance Denumerable.option {α : Type u_1} [Denumerable α] :

If α is denumerable, then so is Option α.

Equations
instance Denumerable.sum {α : Type u_1} {β : Type u_2} [Denumerable α] [Denumerable β] :

If α and β are denumerable, then so is their sum.

Equations
instance Denumerable.sigma {α : Type u_1} [Denumerable α] {γ : αType u_3} [(a : α) → Denumerable (γ a)] :

A denumerable collection of denumerable types is denumerable.

Equations
@[simp]
theorem Denumerable.sigma_ofNat_val {α : Type u_1} [Denumerable α] {γ : αType u_3} [(a : α) → Denumerable (γ a)] (n : ) :
instance Denumerable.prod {α : Type u_1} {β : Type u_2} [Denumerable α] [Denumerable β] :
Denumerable (α × β)

If α and β are denumerable, then so is their product.

Equations

The lift of a denumerable type is denumerable.

Equations
instance Denumerable.plift {α : Type u_1} [Denumerable α] :

The lift of a denumerable type is denumerable.

Equations
def Denumerable.pair {α : Type u_1} [Denumerable α] :
α × α α

If α is denumerable, then α × α and α are equivalent.

Equations

Subsets of #

theorem Nat.Subtype.exists_succ {s : Set } [Infinite s] (x : s) :
∃ (n : ), x + n + 1 s
def Nat.Subtype.succ {s : Set } [Infinite s] [DecidablePred fun (x : ) => x s] (x : s) :
s

Returns the next natural in a set, according to the usual ordering of .

Equations
theorem Nat.Subtype.succ_le_of_lt {s : Set } [Infinite s] [DecidablePred fun (x : ) => x s] {x : s} {y : s} (h : y < x) :
theorem Nat.Subtype.le_succ_of_forall_lt_le {s : Set } [Infinite s] [DecidablePred fun (x : ) => x s] {x : s} {y : s} (h : z < x, z y) :
theorem Nat.Subtype.lt_succ_self {s : Set } [Infinite s] [DecidablePred fun (x : ) => x s] (x : s) :
theorem Nat.Subtype.lt_succ_iff_le {s : Set } [Infinite s] [DecidablePred fun (x : ) => x s] {x : s} {y : s} :
def Nat.Subtype.ofNat (s : Set ) [DecidablePred fun (x : ) => x s] [Infinite s] :
s

Returns the n-th element of a set, according to the usual ordering of .

Equations
@[irreducible]
theorem Nat.Subtype.ofNat_surjective_aux {s : Set } [Infinite s] [DecidablePred fun (x : ) => x s] {x : } (hx : x s) :
∃ (n : ), Nat.Subtype.ofNat s n = x, hx
@[simp]
theorem Nat.Subtype.ofNat_range {s : Set } [Infinite s] [DecidablePred fun (x : ) => x s] :
@[simp]
theorem Nat.Subtype.coe_comp_ofNat_range {s : Set } [Infinite s] [DecidablePred fun (x : ) => x s] :
Set.range (Subtype.val Nat.Subtype.ofNat s) = s
def Nat.Subtype.denumerable (s : Set ) [DecidablePred fun (x : ) => x s] [Infinite s] :

Any infinite set of naturals is denumerable.

Equations

An infinite encodable type is denumerable.

Equations
instance nonempty_equiv_of_countable {α : Type u_1} {β : Type u_2} [Countable α] [Infinite α] [Countable β] [Infinite β] :
Nonempty (α β)
Equations
  • =