Mathlib.Data.Nat.Pairing
27 declarations. Mathlib docs · Source
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⟧².
def Nat.pair E1 #
ℕ → ℕ → ℕ
Pairing function for the natural numbers.
def Nat.unpair E1 #
ℕ → ℕ × ℕ
Unpairing function for the natural numbers.
theorem Nat.pair_unpair E0 #
∀ (n : ℕ), Nat.pair (Nat.unpair n).1 (Nat.unpair n).2 = n
theorem Nat.pair_eq_of_unpair_eq E0 #
∀ {n a b : ℕ}, Nat.unpair n = (a, b) → Nat.pair a b = n
theorem Nat.unpair_pair E0 #
∀ (a b : ℕ), Nat.unpair (Nat.pair a b) = (a, b)
def Nat.pairEquiv E1 #
ℕ × ℕ ≃ ℕ
An equivalence between ℕ × ℕ and ℕ.
theorem Nat.pairEquiv_apply E0 #
⇑Nat.pairEquiv = Function.uncurry Nat.pair
theorem Nat.pairEquiv_symm_apply E0 #
⇑Nat.pairEquiv.symm = Nat.unpair
theorem Nat.surjective_unpair E1 #
Function.Surjective Nat.unpair
theorem Nat.pair_eq_pair E0 #
∀ {a b c d : ℕ}, Nat.pair a b = Nat.pair c d ↔ a = c ∧ b = d
theorem Nat.unpair_lt E1 #
∀ {n : ℕ}, 1 ≤ n → (Nat.unpair n).1 < n
theorem Nat.unpair_zero E0 #
Nat.unpair 0 = 0
theorem Nat.unpair_left_le E1 #
∀ (n : ℕ), (Nat.unpair n).1 ≤ n
theorem Nat.left_le_pair E1 #
∀ (a b : ℕ), a ≤ Nat.pair a b
theorem Nat.right_le_pair E1 #
∀ (a b : ℕ), b ≤ Nat.pair a b
theorem Nat.unpair_right_le E1 #
∀ (n : ℕ), (Nat.unpair n).2 ≤ n
theorem Nat.pair_lt_pair_left E1 #
∀ {a₁ a₂ : ℕ} (b : ℕ), a₁ < a₂ → Nat.pair a₁ b < Nat.pair a₂ b
theorem Nat.pair_lt_pair_right E1 #
∀ (a : ℕ) {b₁ b₂ : ℕ}, b₁ < b₂ → Nat.pair a b₁ < Nat.pair a b₂
theorem Nat.pair_lt_max_add_one_sq E1 #
∀ (m n : ℕ), Nat.pair m n < (max m n + 1) ^ 2
theorem Nat.max_sq_add_min_le_pair E1 #
∀ (m n : ℕ), max m n ^ 2 + min m n ≤ Nat.pair m n
theorem Nat.add_le_pair E1 #
∀ (m n : ℕ), m + n ≤ Nat.pair m n
theorem Nat.unpair_add_le E1 #
∀ (n : ℕ), (Nat.unpair n).1 + (Nat.unpair n).2 ≤ n
theorem iInf_unpair E1 #
∀ {α : Type u_1} [inst : CompleteLattice α] (f : ℕ → ℕ → α), ⨅ n, f (Nat.unpair n).1 (Nat.unpair n).2 = ⨅ i, ⨅ j, f i j
theorem iSup_unpair E1 #
∀ {α : Type u_1} [inst : CompleteLattice α] (f : ℕ → ℕ → α), ⨆ n, f (Nat.unpair n).1 (Nat.unpair n).2 = ⨆ i, ⨆ j, f i j
theorem Set.iUnion_unpair_prod E1 #
∀ {α : Type u_1} {β : Type u_2} {s : ℕ → Set α} {t : ℕ → Set β},
⋃ n, s (Nat.unpair n).1 ×ˢ t (Nat.unpair n).2 = (⋃ n, s n) ×ˢ ⋃ n, t n
theorem Set.iUnion_unpair E1 #
∀ {α : Type u_1} (f : ℕ → ℕ → Set α), ⋃ n, f (Nat.unpair n).1 (Nat.unpair n).2 = ⋃ i, ⋃ j, f i j
theorem Set.iInter_unpair E1 #
∀ {α : Type u_1} (f : ℕ → ℕ → Set α), ⋂ n, f (Nat.unpair n).1 (Nat.unpair n).2 = ⋂ i, ⋂ j, f i j