File: Mathlib/Logic/Denumerable.lean

full_name: Denumerable
code: /-- A denumerable type is (constructively) bijective with `ℕ`. Typeclass equivalent of `α ≃ ℕ`. -/
class Denumerable (α : Type*) extends Encodable α where
  /-- `decode` and `encode` are inverses. -/
  decode_inv : ∀ n, ∃ a ∈ decode n, encode a = n
goal: Type u_3

full_name: Denumerable.decode_inv
code: /-- A denumerable type is (constructively) bijective with `ℕ`. Typeclass equivalent of `α ≃ ℕ`. -/
class Denumerable (α : Type*) extends Encodable α where
  /-- `decode` and `encode` are inverses. -/
  decode_inv : ∀ n, ∃ a ∈ decode n, encode a = n
goal: ∃ a ∈ Encodable.decode n, Encodable.encode a = n

full_name: Denumerable.decode_isSome
code: theorem decode_isSome (α) [Denumerable α] (n : ℕ) : (decode (α := α) n).isSome 
goal: (Encodable.decode n).isSome = true

full_name: Denumerable.ofNat
code: /-- Returns the `n`-th element of `α` indexed by the decoding. -/
def ofNat (α) [Denumerable α] (n : ℕ) : α 
goal: α

full_name: Denumerable.decode_eq_ofNat
code: @[simp]
theorem decode_eq_ofNat (α) [Denumerable α] (n : ℕ) : decode (α := α) n = some (ofNat α n) 
goal: Encodable.decode n = some (Denumerable.ofNat α n)

full_name: Denumerable.ofNat_of_decode
code: @[simp]
theorem ofNat_of_decode {n b} (h : decode (α := α) n = some b) : ofNat (α := α) n = b 
goal: Denumerable.ofNat α n = b

full_name: Denumerable.encode_ofNat
code: @[simp]
theorem encode_ofNat (n) : encode (ofNat α n) = n 
goal: Encodable.encode (Denumerable.ofNat α n) = n

full_name: Denumerable.ofNat_encode
code: @[simp]
theorem ofNat_encode (a) : ofNat α (encode a) = a 
goal: Denumerable.ofNat α (Encodable.encode a) = a

full_name: Denumerable.eqv
code: /-- A denumerable type is equivalent to `ℕ`. -/
def eqv (α) [Denumerable α] : α ≃ ℕ 
goal: α ≃ ℕ

full_name: Denumerable.instInfinite
code: instance (priority := 100) : Infinite α 
goal: Infinite α

full_name: Denumerable.mk'
code: /-- A type equivalent to `ℕ` is denumerable. -/
def mk' {α} (e : α ≃ ℕ) : Denumerable α 
goal: Denumerable α

full_name: Denumerable.ofEquiv
code: /-- Denumerability is conserved by equivalences. This is transitivity of equivalence the denumerable
way. -/
def ofEquiv (α) {β} [Denumerable α] (e : β ≃ α) : Denumerable β 
goal: Denumerable β

full_name: Denumerable.ofEquiv_ofNat
code: @[simp]
theorem ofEquiv_ofNat (α) {β} [Denumerable α] (e : β ≃ α) (n) :
    @ofNat β (ofEquiv _ e) n = e.symm (ofNat α n) 
goal: Denumerable.ofNat β n = e.symm (Denumerable.ofNat α n)

full_name: Denumerable.equiv₂
code: /-- All denumerable types are equivalent. -/
def equiv₂ (α β) [Denumerable α] [Denumerable β] : α ≃ β 
goal: α ≃ β

full_name: Denumerable.nat
code: instance nat : Denumerable ℕ 
goal: Denumerable ℕ

full_name: Denumerable.ofNat_nat
code: @[simp]
theorem ofNat_nat (n) : ofNat ℕ n = n 
goal: Denumerable.ofNat ℕ n = n

full_name: Denumerable.option
code: /-- If `α` is denumerable, then so is `Option α`. -/
instance option : Denumerable (Option α) 
goal: Denumerable (Option α)

full_name: Denumerable.sum
code: /-- If `α` and `β` are denumerable, then so is their sum. -/
instance sum : Denumerable (α ⊕ β) 
goal: Denumerable (α ⊕ β)

full_name: Denumerable.sigma
code: /-- A denumerable collection of denumerable types is denumerable. -/
instance sigma : Denumerable (Sigma γ) 
goal: Denumerable (Sigma γ)

full_name: Denumerable.sigma_ofNat_val
code: @[simp]
theorem sigma_ofNat_val (n : ℕ) :
    ofNat (Sigma γ) n = ⟨ofNat α (unpair n).1, ofNat (γ _) (unpair n).2⟩ 
goal: Denumerable.ofNat (Sigma γ) n =
  ⟨Denumerable.ofNat α (Nat.unpair n).1, Denumerable.ofNat (γ (Denumerable.ofNat α (Nat.unpair n).1)) (Nat.unpair n).2⟩

full_name: Denumerable.prod
code: /-- If `α` and `β` are denumerable, then so is their product. -/
instance prod : Denumerable (α × β) 
goal: Denumerable (α × β)

full_name: Denumerable.prod_ofNat_val
code: theorem prod_ofNat_val (n : ℕ) :
    ofNat (α × β) n = (ofNat α (unpair n).1, ofNat β (unpair n).2) 
goal: Denumerable.ofNat (α × β) n = (Denumerable.ofNat α (Nat.unpair n).1, Denumerable.ofNat β (Nat.unpair n).2)

full_name: Denumerable.prod_nat_ofNat
code: @[simp]
theorem prod_nat_ofNat : ofNat (ℕ × ℕ) = unpair 
goal: Denumerable.ofNat (ℕ × ℕ) = Nat.unpair

full_name: Denumerable.int
code: instance int : Denumerable ℤ 
goal: Denumerable ℤ

full_name: Denumerable.pnat
code: instance pnat : Denumerable ℕ+ 
goal: Denumerable ℕ+

full_name: Denumerable.ulift
code: /-- The lift of a denumerable type is denumerable. -/
instance ulift : Denumerable (ULift α) 
goal: Denumerable (ULift.{u_3, u_1} α)

full_name: Denumerable.plift
code: /-- The lift of a denumerable type is denumerable. -/
instance plift : Denumerable (PLift α) 
goal: Denumerable (PLift α)

full_name: Denumerable.pair
code: /-- If `α` is denumerable, then `α × α` and `α` are equivalent. -/
def pair : α × α ≃ α 
goal: α × α ≃ α

full_name: Nat.Subtype.exists_succ
code: theorem exists_succ (x : s) : ∃ n, (x : ℕ) + n + 1 ∈ s 
goal: ∃ n, ↑x + n + 1 ∈ s

full_name: Nat.Subtype.succ
code: /-- Returns the next natural in a set, according to the usual ordering of `ℕ`. -/
def succ (x : s) : s 
goal: ↑s

full_name: Nat.Subtype.succ_le_of_lt
code: theorem succ_le_of_lt {x y : s} (h : y < x) : succ y ≤ x 
goal: Nat.Subtype.succ y ≤ x

full_name: Nat.Subtype.le_succ_of_forall_lt_le
code: theorem le_succ_of_forall_lt_le {x y : s} (h : ∀ z < x, z ≤ y) : x ≤ succ y 
goal: x ≤ Nat.Subtype.succ y

full_name: Nat.Subtype.lt_succ_self
code: theorem lt_succ_self (x : s) : x < succ x 
goal: x < Nat.Subtype.succ x

full_name: Nat.Subtype.lt_succ_iff_le
code: theorem lt_succ_iff_le {x y : s} : x < succ y ↔ x ≤ y 
goal: x < Nat.Subtype.succ y ↔ x ≤ y

full_name: Nat.Subtype.ofNat
code: /-- Returns the `n`-th element of a set, according to the usual ordering of `ℕ`. -/
def ofNat (s : Set ℕ) [DecidablePred (· ∈ s)] [Infinite s] : ℕ → s
  
goal: ℕ → ↑s

full_name: Nat.Subtype.ofNat_surjective_aux
code: theorem ofNat_surjective_aux : ∀ {x : ℕ} (hx : x ∈ s), ∃ n, ofNat s n = ⟨x, hx⟩
  
goal: ∃ n, Nat.Subtype.ofNat s n = ⟨x, hx⟩

full_name: Nat.Subtype.ofNat_surjective
code: theorem ofNat_surjective : Surjective (ofNat s) 
goal: Function.Surjective (Nat.Subtype.ofNat s)

full_name: Nat.Subtype.ofNat_range
code: @[simp]
theorem ofNat_range : Set.range (ofNat s) = Set.univ 
goal: Set.range (Nat.Subtype.ofNat s) = Set.univ

full_name: Nat.Subtype.coe_comp_ofNat_range
code: @[simp]
theorem coe_comp_ofNat_range : Set.range ((↑) ∘ ofNat s : ℕ → ℕ) = s 
goal: Set.range (Subtype.val ∘ Nat.Subtype.ofNat s) = s

full_name: _private.Mathlib.Logic.Denumerable.0.Nat.Subtype.toFunAux
code: private def toFunAux (x : s) : ℕ 
goal: ℕ

full_name: _private.Mathlib.Logic.Denumerable.0.Nat.Subtype.toFunAux_eq
code: private theorem toFunAux_eq {s : Set ℕ} [DecidablePred (· ∈ s)] (x : s) :
    toFunAux x = ((Finset.range x).filter (· ∈ s)).card 
goal: Nat.Subtype.toFunAux x = (Finset.filter (fun x => x ∈ s) (Finset.range ↑x)).card

full_name: _private.Mathlib.Logic.Denumerable.0.Nat.Subtype.right_inverse_aux
code: private theorem right_inverse_aux : ∀ n, toFunAux (ofNat s n) = n
  
goal: Nat.Subtype.toFunAux (Nat.Subtype.ofNat s n) = n

full_name: Nat.Subtype.denumerable
code: /-- Any infinite set of naturals is denumerable. -/
def denumerable (s : Set ℕ) [DecidablePred (· ∈ s)] [Infinite s] : Denumerable s 
goal: Denumerable ↑s

full_name: Denumerable.ofEncodableOfInfinite
code: /-- An infinite encodable type is denumerable. -/
def ofEncodableOfInfinite (α : Type*) [Encodable α] [Infinite α] : Denumerable α 
goal: Denumerable α

full_name: nonempty_denumerable
code: /-- See also `nonempty_encodable`, `nonempty_fintype`. -/
theorem nonempty_denumerable (α : Type*) [Countable α] [Infinite α] : Nonempty (Denumerable α) 
goal: Nonempty (Denumerable α)

full_name: nonempty_denumerable_iff
code: theorem nonempty_denumerable_iff {α : Type*} :
    Nonempty (Denumerable α) ↔ Countable α ∧ Infinite α 
goal: Nonempty (Denumerable α) ↔ Countable α ∧ Infinite α

full_name: nonempty_equiv_of_countable
code: instance nonempty_equiv_of_countable [Countable α] [Infinite α] [Countable β] [Infinite β] :
    Nonempty (α ≃ β) 
goal: Nonempty (α ≃ β)