The Mathlib Handbook

The volumes of the handbook are not written yet. This site shows the map of Mathlib that they will follow, at Mathlib 4472534b60.

The areas / V01. The language of Mathlib

Mathlib.Logic.Equiv.Nat

8 declarations. Mathlib docs · Source

def Equiv.boolProdNatEquivNat E1 #

Bool × ℕ ≃ ℕ

An equivalence between Bool × ℕ and ℕ, by mapping (true, x) to 2 * x + 1 and (false, x) to 2 * x.

theorem Equiv.boolProdNatEquivNat_symm_apply E0 #

∀ (n : ℕ), Equiv.boolProdNatEquivNat.symm n = (n.bodd, n.div2)

theorem Equiv.boolProdNatEquivNat_apply E0 #

∀ (a : Bool × ℕ), Equiv.boolProdNatEquivNat a = Function.uncurry Nat.bit a

def Equiv.natSumNatEquivNat E1 #

ℕ ⊕ ℕ ≃ ℕ

An equivalence between ℕ ⊕ ℕ and ℕ, by mapping (Sum.inl x) to 2 * x and (Sum.inr x) to 2 * x + 1.

theorem Equiv.natSumNatEquivNat_symm_apply E0 #

∀ (a : ℕ), Equiv.natSumNatEquivNat.symm a = if a.bodd = true then Sum.inr a.div2 else Sum.inl a.div2

theorem Equiv.natSumNatEquivNat_apply E0 #

⇑Equiv.natSumNatEquivNat = Sum.elim (fun x ↦ 2 * x) fun x ↦ 2 * x + 1

def Equiv.intEquivNat E1 #

ℤ ≃ ℕ

An equivalence between ℤ and ℕ, through ℤ ≃ ℕ ⊕ ℕ and ℕ ⊕ ℕ ≃ ℕ.

def Equiv.prodEquivOfEquivNat E1 #

{α : Type u_1} → α ≃ ℕ → α × α ≃ α

An equivalence between α × α and α, given that there is an equivalence between α and ℕ.