Naturals pairing function #
This file defines a pairing function for the naturals as follows:
0 1 4 9 16
2 3 5 10 17
6 7 8 11 18
12 13 14 15 19
20 21 22 23 24
It has the advantage of being monotone in both directions and sending ⟦0, n^2 - 1⟧
to
⟦0, n - 1⟧²
.
@[simp]
An equivalence between ℕ × ℕ
and ℕ
.
Equations
- nat.mkpair_equiv = {to_fun := function.uncurry nat.mkpair, inv_fun := nat.unpair, left_inv := nat.mkpair_equiv._proof_1, right_inv := nat.mkpair_unpair}
@[simp]
theorem
nat.mkpair_lt_mkpair_left
{a₁ a₂ : ℕ}
(b : ℕ)
(h : a₁ < a₂) :
nat.mkpair a₁ b < nat.mkpair a₂ b
theorem
nat.mkpair_lt_mkpair_right
(a : ℕ)
{b₁ b₂ : ℕ}
(h : b₁ < b₂) :
nat.mkpair a b₁ < nat.mkpair a b₂
theorem
supr_unpair
{α : Type u_1}
[complete_lattice α]
(f : ℕ → ℕ → α) :
(⨆ (n : ℕ), f (nat.unpair n).fst (nat.unpair n).snd) = ⨆ (i j : ℕ), f i j
theorem
infi_unpair
{α : Type u_1}
[complete_lattice α]
(f : ℕ → ℕ → α) :
(⨅ (n : ℕ), f (nat.unpair n).fst (nat.unpair n).snd) = ⨅ (i j : ℕ), f i j
theorem
set.Union_unpair
{α : Type u_1}
(f : ℕ → ℕ → set α) :
(⋃ (n : ℕ), f (nat.unpair n).fst (nat.unpair n).snd) = ⋃ (i j : ℕ), f i j
theorem
set.Inter_unpair
{α : Type u_1}
(f : ℕ → ℕ → set α) :
(⋂ (n : ℕ), f (nat.unpair n).fst (nat.unpair n).snd) = ⋂ (i j : ℕ), f i j