Equivalences involving ℕ #
This file defines some additional constructive equivalences using Encodable and the pairing
function on ℕ.
An equivalence between Bool × ℕ and ℕ, by mapping (true, x) to 2 * x + 1 and
(false, x) to 2 * x.
Instances For
@[simp]
@[simp]
theorem
Equiv.boolProdNatEquivNat_apply
(a✝ : Bool × ℕ)
:
boolProdNatEquivNat a✝ = Function.uncurry Nat.bit a✝
An equivalence between ℕ ⊕ ℕ and ℕ, by mapping (Sum.inl x) to 2 * x and (Sum.inr x) to
2 * x + 1.
Instances For
@[simp]
theorem
Equiv.natSumNatEquivNat_symm_apply
(a✝ : ℕ)
:
natSumNatEquivNat.symm a✝ = if a✝.bodd = true then Sum.inr a✝.div2 else Sum.inl a✝.div2
@[simp]
theorem
Equiv.natSumNatEquivNat_apply :
⇑natSumNatEquivNat = Sum.elim (fun (x : ℕ) => 2 * x) fun (x : ℕ) => 2 * x + 1
An equivalence between ℤ and ℕ, through ℤ ≃ ℕ ⊕ ℕ and ℕ ⊕ ℕ ≃ ℕ.
Instances For
An equivalence between α × α and α, given that there is an equivalence between α and ℕ.