data.nat.pairing
⟷
Mathlib.Data.Nat.Pairing
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(last sync)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -3,7 +3,7 @@ Copyright (c) 2015 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura, Mario Carneiro
-/
-import Data.Nat.Sqrt
+import Data.Nat.Defs
import Data.Set.Lattice
import Algebra.Group.Prod
import Algebra.Order.Monoid.MinMax
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -114,7 +114,7 @@ theorem unpair_lt {n : ℕ} (n1 : 1 ≤ n) : (unpair n).1 < n :=
simp [unpair]; change sqrt n with s
by_cases h : n - s * s < s <;> simp [h]
· exact lt_of_lt_of_le h (sqrt_le_self _)
- · simp at h
+ · simp at h
have s0 : 0 < s := sqrt_pos.2 n1
exact lt_of_le_of_lt h (tsub_lt_self n1 (mul_pos s0 s0))
#align nat.unpair_lt Nat.unpair_lt
@@ -157,11 +157,11 @@ theorem pair_lt_pair_left {a₁ a₂} (b) (h : a₁ < a₂) : pair a₁ b < pair
by
by_cases h₁ : a₁ < b <;> simp [mkpair, h₁, add_assoc]
· by_cases h₂ : a₂ < b <;> simp [mkpair, h₂, h]
- simp at h₂
+ simp at h₂
apply add_lt_add_of_le_of_lt
exact mul_self_le_mul_self h₂
exact lt_add_right _ _ _ h
- · simp at h₁
+ · simp at h₁
simp [not_lt_of_gt (lt_of_le_of_lt h₁ h)]
apply add_lt_add
exact mul_self_lt_mul_self h
@@ -176,7 +176,7 @@ theorem pair_lt_pair_right (a) {b₁ b₂} (h : b₁ < b₂) : pair a b₁ < pai
· simp [mkpair, lt_trans h₁ h, h]
exact mul_self_lt_mul_self h
· by_cases h₂ : a < b₂ <;> simp [mkpair, h₂, h]
- simp at h₁
+ simp at h₁
rw [add_comm, add_comm _ a, add_assoc, add_lt_add_iff_left]
rwa [add_comm, ← sqrt_lt, sqrt_add_eq]
exact le_trans h₁ (Nat.le_add_left _ _)
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,10 +3,10 @@ Copyright (c) 2015 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura, Mario Carneiro
-/
-import Mathbin.Data.Nat.Sqrt
-import Mathbin.Data.Set.Lattice
-import Mathbin.Algebra.Group.Prod
-import Mathbin.Algebra.Order.Monoid.MinMax
+import Data.Nat.Sqrt
+import Data.Set.Lattice
+import Algebra.Group.Prod
+import Algebra.Order.Monoid.MinMax
#align_import data.nat.pairing from "leanprover-community/mathlib"@"c3291da49cfa65f0d43b094750541c0731edc932"
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,17 +2,14 @@
Copyright (c) 2015 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura, Mario Carneiro
-
-! This file was ported from Lean 3 source module data.nat.pairing
-! leanprover-community/mathlib commit c3291da49cfa65f0d43b094750541c0731edc932
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Data.Nat.Sqrt
import Mathbin.Data.Set.Lattice
import Mathbin.Algebra.Group.Prod
import Mathbin.Algebra.Order.Monoid.MinMax
+#align_import data.nat.pairing from "leanprover-community/mathlib"@"c3291da49cfa65f0d43b094750541c0731edc932"
+
/-!
# Naturals pairing function
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -186,6 +186,7 @@ theorem pair_lt_pair_right (a) {b₁ b₂} (h : b₁ < b₂) : pair a b₁ < pai
#align nat.mkpair_lt_mkpair_right Nat.pair_lt_pair_right
-/
+#print Nat.pair_lt_max_add_one_sq /-
theorem pair_lt_max_add_one_sq (m n : ℕ) : pair m n < (max m n + 1) ^ 2 :=
by
rw [mkpair, add_sq, mul_one, two_mul, sq, add_assoc, add_assoc]
@@ -195,7 +196,9 @@ theorem pair_lt_max_add_one_sq (m n : ℕ) : pair m n < (max m n + 1) ^ 2 :=
· rw [if_neg h.not_lt, max_eq_left h, add_lt_add_iff_left, add_assoc, add_lt_add_iff_left]
exact lt_succ_of_le h
#align nat.mkpair_lt_max_add_one_sq Nat.pair_lt_max_add_one_sq
+-/
+#print Nat.max_sq_add_min_le_pair /-
theorem max_sq_add_min_le_pair (m n : ℕ) : max m n ^ 2 + min m n ≤ pair m n :=
by
rw [mkpair]
@@ -204,6 +207,7 @@ theorem max_sq_add_min_le_pair (m n : ℕ) : max m n ^ 2 + min m n ≤ pair m n
· rw [if_neg h.not_lt, max_eq_left h, min_eq_right h, sq, add_assoc, add_le_add_iff_left]
exact le_add_self
#align nat.max_sq_add_min_le_mkpair Nat.max_sq_add_min_le_pair
+-/
#print Nat.add_le_pair /-
theorem add_le_pair (m n : ℕ) : m + n ≤ pair m n :=
@@ -225,16 +229,20 @@ open Nat
section CompleteLattice
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (i j) -/
+#print iSup_unpair /-
theorem iSup_unpair {α} [CompleteLattice α] (f : ℕ → ℕ → α) :
(⨆ n : ℕ, f n.unpair.1 n.unpair.2) = ⨆ (i : ℕ) (j : ℕ), f i j := by
rw [← (iSup_prod : (⨆ i : ℕ × ℕ, f i.1 i.2) = _), ← nat.surjective_unpair.supr_comp]
#align supr_unpair iSup_unpair
+-/
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (i j) -/
+#print iInf_unpair /-
theorem iInf_unpair {α} [CompleteLattice α] (f : ℕ → ℕ → α) :
(⨅ n : ℕ, f n.unpair.1 n.unpair.2) = ⨅ (i : ℕ) (j : ℕ), f i j :=
iSup_unpair (show ℕ → ℕ → αᵒᵈ from f)
#align infi_unpair iInf_unpair
+-/
end CompleteLattice
@@ -242,10 +250,12 @@ namespace Set
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print Set.iUnion_unpair_prod /-
theorem iUnion_unpair_prod {α β} {s : ℕ → Set α} {t : ℕ → Set β} :
(⋃ n : ℕ, s n.unpair.fst ×ˢ t n.unpair.snd) = (⋃ n, s n) ×ˢ ⋃ n, t n := by rw [← Union_prod];
convert surjective_unpair.Union_comp _; rfl
#align set.Union_unpair_prod Set.iUnion_unpair_prod
+-/
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (i j) -/
#print Set.iUnion_unpair /-
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -117,7 +117,7 @@ theorem unpair_lt {n : ℕ} (n1 : 1 ≤ n) : (unpair n).1 < n :=
simp [unpair]; change sqrt n with s
by_cases h : n - s * s < s <;> simp [h]
· exact lt_of_lt_of_le h (sqrt_le_self _)
- · simp at h
+ · simp at h
have s0 : 0 < s := sqrt_pos.2 n1
exact lt_of_le_of_lt h (tsub_lt_self n1 (mul_pos s0 s0))
#align nat.unpair_lt Nat.unpair_lt
@@ -160,11 +160,11 @@ theorem pair_lt_pair_left {a₁ a₂} (b) (h : a₁ < a₂) : pair a₁ b < pair
by
by_cases h₁ : a₁ < b <;> simp [mkpair, h₁, add_assoc]
· by_cases h₂ : a₂ < b <;> simp [mkpair, h₂, h]
- simp at h₂
+ simp at h₂
apply add_lt_add_of_le_of_lt
exact mul_self_le_mul_self h₂
exact lt_add_right _ _ _ h
- · simp at h₁
+ · simp at h₁
simp [not_lt_of_gt (lt_of_le_of_lt h₁ h)]
apply add_lt_add
exact mul_self_lt_mul_self h
@@ -179,7 +179,7 @@ theorem pair_lt_pair_right (a) {b₁ b₂} (h : b₁ < b₂) : pair a b₁ < pai
· simp [mkpair, lt_trans h₁ h, h]
exact mul_self_lt_mul_self h
· by_cases h₂ : a < b₂ <;> simp [mkpair, h₂, h]
- simp at h₁
+ simp at h₁
rw [add_comm, add_comm _ a, add_assoc, add_lt_add_iff_left]
rwa [add_comm, ← sqrt_lt, sqrt_add_eq]
exact le_trans h₁ (Nat.le_add_left _ _)
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -186,12 +186,6 @@ theorem pair_lt_pair_right (a) {b₁ b₂} (h : b₁ < b₂) : pair a b₁ < pai
#align nat.mkpair_lt_mkpair_right Nat.pair_lt_pair_right
-/
-/- warning: nat.mkpair_lt_max_add_one_sq -> Nat.pair_lt_max_add_one_sq is a dubious translation:
-lean 3 declaration is
- forall (m : Nat) (n : Nat), LT.lt.{0} Nat Nat.hasLt (Nat.pair m n) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) (LinearOrder.max.{0} Nat Nat.linearOrder m n) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne)))) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))
-but is expected to have type
- forall (m : Nat) (n : Nat), LT.lt.{0} Nat instLTNat (Nat.pair m n) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) (Max.max.{0} Nat Nat.instMaxNat m n) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))
-Case conversion may be inaccurate. Consider using '#align nat.mkpair_lt_max_add_one_sq Nat.pair_lt_max_add_one_sqₓ'. -/
theorem pair_lt_max_add_one_sq (m n : ℕ) : pair m n < (max m n + 1) ^ 2 :=
by
rw [mkpair, add_sq, mul_one, two_mul, sq, add_assoc, add_assoc]
@@ -202,12 +196,6 @@ theorem pair_lt_max_add_one_sq (m n : ℕ) : pair m n < (max m n + 1) ^ 2 :=
exact lt_succ_of_le h
#align nat.mkpair_lt_max_add_one_sq Nat.pair_lt_max_add_one_sq
-/- warning: nat.max_sq_add_min_le_mkpair -> Nat.max_sq_add_min_le_pair is a dubious translation:
-lean 3 declaration is
- forall (m : Nat) (n : Nat), LE.le.{0} Nat Nat.hasLe (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (LinearOrder.max.{0} Nat Nat.linearOrder m n) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))) (LinearOrder.min.{0} Nat Nat.linearOrder m n)) (Nat.pair m n)
-but is expected to have type
- forall (m : Nat) (n : Nat), LE.le.{0} Nat instLENat (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (Max.max.{0} Nat Nat.instMaxNat m n) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))) (Min.min.{0} Nat instMinNat m n)) (Nat.pair m n)
-Case conversion may be inaccurate. Consider using '#align nat.max_sq_add_min_le_mkpair Nat.max_sq_add_min_le_pairₓ'. -/
theorem max_sq_add_min_le_pair (m n : ℕ) : max m n ^ 2 + min m n ≤ pair m n :=
by
rw [mkpair]
@@ -236,24 +224,12 @@ open Nat
section CompleteLattice
-/- warning: supr_unpair -> iSup_unpair is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : CompleteLattice.{u1} α] (f : Nat -> Nat -> α), Eq.{succ u1} α (iSup.{u1, 1} α (CompleteSemilatticeSup.toHasSup.{u1} α (CompleteLattice.toCompleteSemilatticeSup.{u1} α _inst_1)) Nat (fun (n : Nat) => f (Prod.fst.{0, 0} Nat Nat (Nat.unpair n)) (Prod.snd.{0, 0} Nat Nat (Nat.unpair n)))) (iSup.{u1, 1} α (CompleteSemilatticeSup.toHasSup.{u1} α (CompleteLattice.toCompleteSemilatticeSup.{u1} α _inst_1)) Nat (fun (i : Nat) => iSup.{u1, 1} α (CompleteSemilatticeSup.toHasSup.{u1} α (CompleteLattice.toCompleteSemilatticeSup.{u1} α _inst_1)) Nat (fun (j : Nat) => f i j)))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : CompleteLattice.{u1} α] (f : Nat -> Nat -> α), Eq.{succ u1} α (iSup.{u1, 1} α (CompleteLattice.toSupSet.{u1} α _inst_1) Nat (fun (n : Nat) => f (Prod.fst.{0, 0} Nat Nat (Nat.unpair n)) (Prod.snd.{0, 0} Nat Nat (Nat.unpair n)))) (iSup.{u1, 1} α (CompleteLattice.toSupSet.{u1} α _inst_1) Nat (fun (i : Nat) => iSup.{u1, 1} α (CompleteLattice.toSupSet.{u1} α _inst_1) Nat (fun (j : Nat) => f i j)))
-Case conversion may be inaccurate. Consider using '#align supr_unpair iSup_unpairₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (i j) -/
theorem iSup_unpair {α} [CompleteLattice α] (f : ℕ → ℕ → α) :
(⨆ n : ℕ, f n.unpair.1 n.unpair.2) = ⨆ (i : ℕ) (j : ℕ), f i j := by
rw [← (iSup_prod : (⨆ i : ℕ × ℕ, f i.1 i.2) = _), ← nat.surjective_unpair.supr_comp]
#align supr_unpair iSup_unpair
-/- warning: infi_unpair -> iInf_unpair is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : CompleteLattice.{u1} α] (f : Nat -> Nat -> α), Eq.{succ u1} α (iInf.{u1, 1} α (CompleteSemilatticeInf.toHasInf.{u1} α (CompleteLattice.toCompleteSemilatticeInf.{u1} α _inst_1)) Nat (fun (n : Nat) => f (Prod.fst.{0, 0} Nat Nat (Nat.unpair n)) (Prod.snd.{0, 0} Nat Nat (Nat.unpair n)))) (iInf.{u1, 1} α (CompleteSemilatticeInf.toHasInf.{u1} α (CompleteLattice.toCompleteSemilatticeInf.{u1} α _inst_1)) Nat (fun (i : Nat) => iInf.{u1, 1} α (CompleteSemilatticeInf.toHasInf.{u1} α (CompleteLattice.toCompleteSemilatticeInf.{u1} α _inst_1)) Nat (fun (j : Nat) => f i j)))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : CompleteLattice.{u1} α] (f : Nat -> Nat -> α), Eq.{succ u1} α (iInf.{u1, 1} α (CompleteLattice.toInfSet.{u1} α _inst_1) Nat (fun (n : Nat) => f (Prod.fst.{0, 0} Nat Nat (Nat.unpair n)) (Prod.snd.{0, 0} Nat Nat (Nat.unpair n)))) (iInf.{u1, 1} α (CompleteLattice.toInfSet.{u1} α _inst_1) Nat (fun (i : Nat) => iInf.{u1, 1} α (CompleteLattice.toInfSet.{u1} α _inst_1) Nat (fun (j : Nat) => f i j)))
-Case conversion may be inaccurate. Consider using '#align infi_unpair iInf_unpairₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (i j) -/
theorem iInf_unpair {α} [CompleteLattice α] (f : ℕ → ℕ → α) :
(⨅ n : ℕ, f n.unpair.1 n.unpair.2) = ⨅ (i : ℕ) (j : ℕ), f i j :=
@@ -264,12 +240,6 @@ end CompleteLattice
namespace Set
-/- warning: set.Union_unpair_prod -> Set.iUnion_unpair_prod is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {s : Nat -> (Set.{u1} α)} {t : Nat -> (Set.{u2} β)}, Eq.{succ (max u1 u2)} (Set.{max u1 u2} (Prod.{u1, u2} α β)) (Set.iUnion.{max u1 u2, 1} (Prod.{u1, u2} α β) Nat (fun (n : Nat) => Set.prod.{u1, u2} α β (s (Prod.fst.{0, 0} Nat Nat (Nat.unpair n))) (t (Prod.snd.{0, 0} Nat Nat (Nat.unpair n))))) (Set.prod.{u1, u2} α β (Set.iUnion.{u1, 1} α Nat (fun (n : Nat) => s n)) (Set.iUnion.{u2, 1} β Nat (fun (n : Nat) => t n)))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} {s : Nat -> (Set.{u2} α)} {t : Nat -> (Set.{u1} β)}, Eq.{max (succ u2) (succ u1)} (Set.{max u1 u2} (Prod.{u2, u1} α β)) (Set.iUnion.{max u1 u2, 1} (Prod.{u2, u1} α β) Nat (fun (n : Nat) => Set.prod.{u2, u1} α β (s (Prod.fst.{0, 0} Nat Nat (Nat.unpair n))) (t (Prod.snd.{0, 0} Nat Nat (Nat.unpair n))))) (Set.prod.{u2, u1} α β (Set.iUnion.{u2, 1} α Nat (fun (n : Nat) => s n)) (Set.iUnion.{u1, 1} β Nat (fun (n : Nat) => t n)))
-Case conversion may be inaccurate. Consider using '#align set.Union_unpair_prod Set.iUnion_unpair_prodₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem iUnion_unpair_prod {α β} {s : ℕ → Set α} {t : ℕ → Set β} :
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -83,9 +83,7 @@ theorem unpair_pair (a b : ℕ) : unpair (pair a b) = (a, b) :=
have be : sqrt (b * b + a) = b := sqrt_add_eq _ (le_trans (le_of_lt h) (Nat.le_add_left _ _))
simp [unpair, be, add_tsub_cancel_right, h]
· show unpair (a * a + a + b) = (a, b)
- have ae : sqrt (a * a + (a + b)) = a :=
- by
- rw [sqrt_add_eq]
+ have ae : sqrt (a * a + (a + b)) = a := by rw [sqrt_add_eq];
exact add_le_add_left (le_of_not_gt h) _
simp [unpair, ae, Nat.not_lt_zero, add_assoc]
#align nat.unpair_mkpair Nat.unpair_pair
@@ -127,9 +125,7 @@ theorem unpair_lt {n : ℕ} (n1 : 1 ≤ n) : (unpair n).1 < n :=
#print Nat.unpair_zero /-
@[simp]
-theorem unpair_zero : unpair 0 = 0 := by
- rw [unpair]
- simp
+theorem unpair_zero : unpair 0 = 0 := by rw [unpair]; simp
#align nat.unpair_zero Nat.unpair_zero
-/
@@ -223,9 +219,7 @@ theorem max_sq_add_min_le_pair (m n : ℕ) : max m n ^ 2 + min m n ≤ pair m n
#print Nat.add_le_pair /-
theorem add_le_pair (m n : ℕ) : m + n ≤ pair m n :=
- (max_sq_add_min_le_pair _ _).trans' <|
- by
- rw [sq, ← min_add_max, add_comm, add_le_add_iff_right]
+ (max_sq_add_min_le_pair _ _).trans' <| by rw [sq, ← min_add_max, add_comm, add_le_add_iff_right];
exact le_mul_self _
#align nat.add_le_mkpair Nat.add_le_pair
-/
@@ -279,11 +273,8 @@ Case conversion may be inaccurate. Consider using '#align set.Union_unpair_prod
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem iUnion_unpair_prod {α β} {s : ℕ → Set α} {t : ℕ → Set β} :
- (⋃ n : ℕ, s n.unpair.fst ×ˢ t n.unpair.snd) = (⋃ n, s n) ×ˢ ⋃ n, t n :=
- by
- rw [← Union_prod]
- convert surjective_unpair.Union_comp _
- rfl
+ (⋃ n : ℕ, s n.unpair.fst ×ˢ t n.unpair.snd) = (⋃ n, s n) ×ˢ ⋃ n, t n := by rw [← Union_prod];
+ convert surjective_unpair.Union_comp _; rfl
#align set.Union_unpair_prod Set.iUnion_unpair_prod
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (i j) -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/e3fb84046afd187b710170887195d50bada934ee
@@ -242,64 +242,64 @@ open Nat
section CompleteLattice
-/- warning: supr_unpair -> supᵢ_unpair is a dubious translation:
+/- warning: supr_unpair -> iSup_unpair is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : CompleteLattice.{u1} α] (f : Nat -> Nat -> α), Eq.{succ u1} α (supᵢ.{u1, 1} α (CompleteSemilatticeSup.toHasSup.{u1} α (CompleteLattice.toCompleteSemilatticeSup.{u1} α _inst_1)) Nat (fun (n : Nat) => f (Prod.fst.{0, 0} Nat Nat (Nat.unpair n)) (Prod.snd.{0, 0} Nat Nat (Nat.unpair n)))) (supᵢ.{u1, 1} α (CompleteSemilatticeSup.toHasSup.{u1} α (CompleteLattice.toCompleteSemilatticeSup.{u1} α _inst_1)) Nat (fun (i : Nat) => supᵢ.{u1, 1} α (CompleteSemilatticeSup.toHasSup.{u1} α (CompleteLattice.toCompleteSemilatticeSup.{u1} α _inst_1)) Nat (fun (j : Nat) => f i j)))
+ forall {α : Type.{u1}} [_inst_1 : CompleteLattice.{u1} α] (f : Nat -> Nat -> α), Eq.{succ u1} α (iSup.{u1, 1} α (CompleteSemilatticeSup.toHasSup.{u1} α (CompleteLattice.toCompleteSemilatticeSup.{u1} α _inst_1)) Nat (fun (n : Nat) => f (Prod.fst.{0, 0} Nat Nat (Nat.unpair n)) (Prod.snd.{0, 0} Nat Nat (Nat.unpair n)))) (iSup.{u1, 1} α (CompleteSemilatticeSup.toHasSup.{u1} α (CompleteLattice.toCompleteSemilatticeSup.{u1} α _inst_1)) Nat (fun (i : Nat) => iSup.{u1, 1} α (CompleteSemilatticeSup.toHasSup.{u1} α (CompleteLattice.toCompleteSemilatticeSup.{u1} α _inst_1)) Nat (fun (j : Nat) => f i j)))
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : CompleteLattice.{u1} α] (f : Nat -> Nat -> α), Eq.{succ u1} α (supᵢ.{u1, 1} α (CompleteLattice.toSupSet.{u1} α _inst_1) Nat (fun (n : Nat) => f (Prod.fst.{0, 0} Nat Nat (Nat.unpair n)) (Prod.snd.{0, 0} Nat Nat (Nat.unpair n)))) (supᵢ.{u1, 1} α (CompleteLattice.toSupSet.{u1} α _inst_1) Nat (fun (i : Nat) => supᵢ.{u1, 1} α (CompleteLattice.toSupSet.{u1} α _inst_1) Nat (fun (j : Nat) => f i j)))
-Case conversion may be inaccurate. Consider using '#align supr_unpair supᵢ_unpairₓ'. -/
+ forall {α : Type.{u1}} [_inst_1 : CompleteLattice.{u1} α] (f : Nat -> Nat -> α), Eq.{succ u1} α (iSup.{u1, 1} α (CompleteLattice.toSupSet.{u1} α _inst_1) Nat (fun (n : Nat) => f (Prod.fst.{0, 0} Nat Nat (Nat.unpair n)) (Prod.snd.{0, 0} Nat Nat (Nat.unpair n)))) (iSup.{u1, 1} α (CompleteLattice.toSupSet.{u1} α _inst_1) Nat (fun (i : Nat) => iSup.{u1, 1} α (CompleteLattice.toSupSet.{u1} α _inst_1) Nat (fun (j : Nat) => f i j)))
+Case conversion may be inaccurate. Consider using '#align supr_unpair iSup_unpairₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (i j) -/
-theorem supᵢ_unpair {α} [CompleteLattice α] (f : ℕ → ℕ → α) :
+theorem iSup_unpair {α} [CompleteLattice α] (f : ℕ → ℕ → α) :
(⨆ n : ℕ, f n.unpair.1 n.unpair.2) = ⨆ (i : ℕ) (j : ℕ), f i j := by
- rw [← (supᵢ_prod : (⨆ i : ℕ × ℕ, f i.1 i.2) = _), ← nat.surjective_unpair.supr_comp]
-#align supr_unpair supᵢ_unpair
+ rw [← (iSup_prod : (⨆ i : ℕ × ℕ, f i.1 i.2) = _), ← nat.surjective_unpair.supr_comp]
+#align supr_unpair iSup_unpair
-/- warning: infi_unpair -> infᵢ_unpair is a dubious translation:
+/- warning: infi_unpair -> iInf_unpair is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : CompleteLattice.{u1} α] (f : Nat -> Nat -> α), Eq.{succ u1} α (infᵢ.{u1, 1} α (CompleteSemilatticeInf.toHasInf.{u1} α (CompleteLattice.toCompleteSemilatticeInf.{u1} α _inst_1)) Nat (fun (n : Nat) => f (Prod.fst.{0, 0} Nat Nat (Nat.unpair n)) (Prod.snd.{0, 0} Nat Nat (Nat.unpair n)))) (infᵢ.{u1, 1} α (CompleteSemilatticeInf.toHasInf.{u1} α (CompleteLattice.toCompleteSemilatticeInf.{u1} α _inst_1)) Nat (fun (i : Nat) => infᵢ.{u1, 1} α (CompleteSemilatticeInf.toHasInf.{u1} α (CompleteLattice.toCompleteSemilatticeInf.{u1} α _inst_1)) Nat (fun (j : Nat) => f i j)))
+ forall {α : Type.{u1}} [_inst_1 : CompleteLattice.{u1} α] (f : Nat -> Nat -> α), Eq.{succ u1} α (iInf.{u1, 1} α (CompleteSemilatticeInf.toHasInf.{u1} α (CompleteLattice.toCompleteSemilatticeInf.{u1} α _inst_1)) Nat (fun (n : Nat) => f (Prod.fst.{0, 0} Nat Nat (Nat.unpair n)) (Prod.snd.{0, 0} Nat Nat (Nat.unpair n)))) (iInf.{u1, 1} α (CompleteSemilatticeInf.toHasInf.{u1} α (CompleteLattice.toCompleteSemilatticeInf.{u1} α _inst_1)) Nat (fun (i : Nat) => iInf.{u1, 1} α (CompleteSemilatticeInf.toHasInf.{u1} α (CompleteLattice.toCompleteSemilatticeInf.{u1} α _inst_1)) Nat (fun (j : Nat) => f i j)))
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : CompleteLattice.{u1} α] (f : Nat -> Nat -> α), Eq.{succ u1} α (infᵢ.{u1, 1} α (CompleteLattice.toInfSet.{u1} α _inst_1) Nat (fun (n : Nat) => f (Prod.fst.{0, 0} Nat Nat (Nat.unpair n)) (Prod.snd.{0, 0} Nat Nat (Nat.unpair n)))) (infᵢ.{u1, 1} α (CompleteLattice.toInfSet.{u1} α _inst_1) Nat (fun (i : Nat) => infᵢ.{u1, 1} α (CompleteLattice.toInfSet.{u1} α _inst_1) Nat (fun (j : Nat) => f i j)))
-Case conversion may be inaccurate. Consider using '#align infi_unpair infᵢ_unpairₓ'. -/
+ forall {α : Type.{u1}} [_inst_1 : CompleteLattice.{u1} α] (f : Nat -> Nat -> α), Eq.{succ u1} α (iInf.{u1, 1} α (CompleteLattice.toInfSet.{u1} α _inst_1) Nat (fun (n : Nat) => f (Prod.fst.{0, 0} Nat Nat (Nat.unpair n)) (Prod.snd.{0, 0} Nat Nat (Nat.unpair n)))) (iInf.{u1, 1} α (CompleteLattice.toInfSet.{u1} α _inst_1) Nat (fun (i : Nat) => iInf.{u1, 1} α (CompleteLattice.toInfSet.{u1} α _inst_1) Nat (fun (j : Nat) => f i j)))
+Case conversion may be inaccurate. Consider using '#align infi_unpair iInf_unpairₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (i j) -/
-theorem infᵢ_unpair {α} [CompleteLattice α] (f : ℕ → ℕ → α) :
+theorem iInf_unpair {α} [CompleteLattice α] (f : ℕ → ℕ → α) :
(⨅ n : ℕ, f n.unpair.1 n.unpair.2) = ⨅ (i : ℕ) (j : ℕ), f i j :=
- supᵢ_unpair (show ℕ → ℕ → αᵒᵈ from f)
-#align infi_unpair infᵢ_unpair
+ iSup_unpair (show ℕ → ℕ → αᵒᵈ from f)
+#align infi_unpair iInf_unpair
end CompleteLattice
namespace Set
-/- warning: set.Union_unpair_prod -> Set.unionᵢ_unpair_prod is a dubious translation:
+/- warning: set.Union_unpair_prod -> Set.iUnion_unpair_prod is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {s : Nat -> (Set.{u1} α)} {t : Nat -> (Set.{u2} β)}, Eq.{succ (max u1 u2)} (Set.{max u1 u2} (Prod.{u1, u2} α β)) (Set.unionᵢ.{max u1 u2, 1} (Prod.{u1, u2} α β) Nat (fun (n : Nat) => Set.prod.{u1, u2} α β (s (Prod.fst.{0, 0} Nat Nat (Nat.unpair n))) (t (Prod.snd.{0, 0} Nat Nat (Nat.unpair n))))) (Set.prod.{u1, u2} α β (Set.unionᵢ.{u1, 1} α Nat (fun (n : Nat) => s n)) (Set.unionᵢ.{u2, 1} β Nat (fun (n : Nat) => t n)))
+ forall {α : Type.{u1}} {β : Type.{u2}} {s : Nat -> (Set.{u1} α)} {t : Nat -> (Set.{u2} β)}, Eq.{succ (max u1 u2)} (Set.{max u1 u2} (Prod.{u1, u2} α β)) (Set.iUnion.{max u1 u2, 1} (Prod.{u1, u2} α β) Nat (fun (n : Nat) => Set.prod.{u1, u2} α β (s (Prod.fst.{0, 0} Nat Nat (Nat.unpair n))) (t (Prod.snd.{0, 0} Nat Nat (Nat.unpair n))))) (Set.prod.{u1, u2} α β (Set.iUnion.{u1, 1} α Nat (fun (n : Nat) => s n)) (Set.iUnion.{u2, 1} β Nat (fun (n : Nat) => t n)))
but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} {s : Nat -> (Set.{u2} α)} {t : Nat -> (Set.{u1} β)}, Eq.{max (succ u2) (succ u1)} (Set.{max u1 u2} (Prod.{u2, u1} α β)) (Set.unionᵢ.{max u1 u2, 1} (Prod.{u2, u1} α β) Nat (fun (n : Nat) => Set.prod.{u2, u1} α β (s (Prod.fst.{0, 0} Nat Nat (Nat.unpair n))) (t (Prod.snd.{0, 0} Nat Nat (Nat.unpair n))))) (Set.prod.{u2, u1} α β (Set.unionᵢ.{u2, 1} α Nat (fun (n : Nat) => s n)) (Set.unionᵢ.{u1, 1} β Nat (fun (n : Nat) => t n)))
-Case conversion may be inaccurate. Consider using '#align set.Union_unpair_prod Set.unionᵢ_unpair_prodₓ'. -/
+ forall {α : Type.{u2}} {β : Type.{u1}} {s : Nat -> (Set.{u2} α)} {t : Nat -> (Set.{u1} β)}, Eq.{max (succ u2) (succ u1)} (Set.{max u1 u2} (Prod.{u2, u1} α β)) (Set.iUnion.{max u1 u2, 1} (Prod.{u2, u1} α β) Nat (fun (n : Nat) => Set.prod.{u2, u1} α β (s (Prod.fst.{0, 0} Nat Nat (Nat.unpair n))) (t (Prod.snd.{0, 0} Nat Nat (Nat.unpair n))))) (Set.prod.{u2, u1} α β (Set.iUnion.{u2, 1} α Nat (fun (n : Nat) => s n)) (Set.iUnion.{u1, 1} β Nat (fun (n : Nat) => t n)))
+Case conversion may be inaccurate. Consider using '#align set.Union_unpair_prod Set.iUnion_unpair_prodₓ'. -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
-theorem unionᵢ_unpair_prod {α β} {s : ℕ → Set α} {t : ℕ → Set β} :
+theorem iUnion_unpair_prod {α β} {s : ℕ → Set α} {t : ℕ → Set β} :
(⋃ n : ℕ, s n.unpair.fst ×ˢ t n.unpair.snd) = (⋃ n, s n) ×ˢ ⋃ n, t n :=
by
rw [← Union_prod]
convert surjective_unpair.Union_comp _
rfl
-#align set.Union_unpair_prod Set.unionᵢ_unpair_prod
+#align set.Union_unpair_prod Set.iUnion_unpair_prod
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (i j) -/
-#print Set.unionᵢ_unpair /-
-theorem unionᵢ_unpair {α} (f : ℕ → ℕ → Set α) :
+#print Set.iUnion_unpair /-
+theorem iUnion_unpair {α} (f : ℕ → ℕ → Set α) :
(⋃ n : ℕ, f n.unpair.1 n.unpair.2) = ⋃ (i : ℕ) (j : ℕ), f i j :=
- supᵢ_unpair f
-#align set.Union_unpair Set.unionᵢ_unpair
+ iSup_unpair f
+#align set.Union_unpair Set.iUnion_unpair
-/
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (i j) -/
-#print Set.interᵢ_unpair /-
-theorem interᵢ_unpair {α} (f : ℕ → ℕ → Set α) :
+#print Set.iInter_unpair /-
+theorem iInter_unpair {α} (f : ℕ → ℕ → Set α) :
(⋂ n : ℕ, f n.unpair.1 n.unpair.2) = ⋂ (i : ℕ) (j : ℕ), f i j :=
- infᵢ_unpair f
-#align set.Inter_unpair Set.interᵢ_unpair
+ iInf_unpair f
+#align set.Inter_unpair Set.iInter_unpair
-/
end Set
mathlib commit https://github.com/leanprover-community/mathlib/commit/0148d455199ed64bf8eb2f493a1e7eb9211ce170
@@ -37,12 +37,12 @@ open Prod Decidable Function
namespace Nat
-#print Nat.mkpair /-
+#print Nat.pair /-
/-- Pairing function for the natural numbers. -/
@[pp_nodot]
-def mkpair (a b : ℕ) : ℕ :=
+def pair (a b : ℕ) : ℕ :=
if a < b then b * b + a else a * a + a + b
-#align nat.mkpair Nat.mkpair
+#align nat.mkpair Nat.pair
-/
#print Nat.unpair /-
@@ -54,9 +54,9 @@ def unpair (n : ℕ) : ℕ × ℕ :=
#align nat.unpair Nat.unpair
-/
-#print Nat.mkpair_unpair /-
+#print Nat.pair_unpair /-
@[simp]
-theorem mkpair_unpair (n : ℕ) : mkpair (unpair n).1 (unpair n).2 = n :=
+theorem pair_unpair (n : ℕ) : pair (unpair n).1 (unpair n).2 = n :=
by
dsimp only [unpair]; set s := sqrt n
have sm : s * s + (n - s * s) = n := add_tsub_cancel_of_le (sqrt_le _)
@@ -65,18 +65,18 @@ theorem mkpair_unpair (n : ℕ) : mkpair (unpair n).1 (unpair n).2 = n :=
· have hl : n - s * s - s ≤ s :=
tsub_le_iff_left.mpr (tsub_le_iff_left.mpr <| by rw [← add_assoc] <;> apply sqrt_le_add)
simp [mkpair, hl.not_lt, add_assoc, add_tsub_cancel_of_le (le_of_not_gt h), sm]
-#align nat.mkpair_unpair Nat.mkpair_unpair
+#align nat.mkpair_unpair Nat.pair_unpair
-/
-#print Nat.mkpair_unpair' /-
-theorem mkpair_unpair' {n a b} (H : unpair n = (a, b)) : mkpair a b = n := by
+#print Nat.pair_unpair' /-
+theorem pair_unpair' {n a b} (H : unpair n = (a, b)) : pair a b = n := by
simpa [H] using mkpair_unpair n
-#align nat.mkpair_unpair' Nat.mkpair_unpair'
+#align nat.mkpair_unpair' Nat.pair_unpair'
-/
-#print Nat.unpair_mkpair /-
+#print Nat.unpair_pair /-
@[simp]
-theorem unpair_mkpair (a b : ℕ) : unpair (mkpair a b) = (a, b) :=
+theorem unpair_pair (a b : ℕ) : unpair (pair a b) = (a, b) :=
by
dsimp only [mkpair]; split_ifs
· show unpair (b * b + a) = (a, b)
@@ -88,28 +88,28 @@ theorem unpair_mkpair (a b : ℕ) : unpair (mkpair a b) = (a, b) :=
rw [sqrt_add_eq]
exact add_le_add_left (le_of_not_gt h) _
simp [unpair, ae, Nat.not_lt_zero, add_assoc]
-#align nat.unpair_mkpair Nat.unpair_mkpair
+#align nat.unpair_mkpair Nat.unpair_pair
-/
-#print Nat.mkpairEquiv /-
+#print Nat.pairEquiv /-
/-- An equivalence between `ℕ × ℕ` and `ℕ`. -/
@[simps (config := { fullyApplied := false })]
-def mkpairEquiv : ℕ × ℕ ≃ ℕ :=
- ⟨uncurry mkpair, unpair, fun ⟨a, b⟩ => unpair_mkpair a b, mkpair_unpair⟩
-#align nat.mkpair_equiv Nat.mkpairEquiv
+def pairEquiv : ℕ × ℕ ≃ ℕ :=
+ ⟨uncurry pair, unpair, fun ⟨a, b⟩ => unpair_pair a b, pair_unpair⟩
+#align nat.mkpair_equiv Nat.pairEquiv
-/
#print Nat.surjective_unpair /-
theorem surjective_unpair : Surjective unpair :=
- mkpairEquiv.symm.Surjective
+ pairEquiv.symm.Surjective
#align nat.surjective_unpair Nat.surjective_unpair
-/
-#print Nat.mkpair_eq_mkpair /-
+#print Nat.pair_eq_pair /-
@[simp]
-theorem mkpair_eq_mkpair {a b c d : ℕ} : mkpair a b = mkpair c d ↔ a = c ∧ b = d :=
- mkpairEquiv.Injective.eq_iff.trans (@Prod.ext_iff ℕ ℕ (a, b) (c, d))
-#align nat.mkpair_eq_mkpair Nat.mkpair_eq_mkpair
+theorem pair_eq_pair {a b c d : ℕ} : pair a b = pair c d ↔ a = c ∧ b = d :=
+ pairEquiv.Injective.eq_iff.trans (@Prod.ext_iff ℕ ℕ (a, b) (c, d))
+#align nat.mkpair_eq_mkpair Nat.pair_eq_pair
-/
#print Nat.unpair_lt /-
@@ -140,17 +140,17 @@ theorem unpair_left_le : ∀ n : ℕ, (unpair n).1 ≤ n
#align nat.unpair_left_le Nat.unpair_left_le
-/
-#print Nat.left_le_mkpair /-
-theorem left_le_mkpair (a b : ℕ) : a ≤ mkpair a b := by simpa using unpair_left_le (mkpair a b)
-#align nat.left_le_mkpair Nat.left_le_mkpair
+#print Nat.left_le_pair /-
+theorem left_le_pair (a b : ℕ) : a ≤ pair a b := by simpa using unpair_left_le (mkpair a b)
+#align nat.left_le_mkpair Nat.left_le_pair
-/
-#print Nat.right_le_mkpair /-
-theorem right_le_mkpair (a b : ℕ) : b ≤ mkpair a b :=
+#print Nat.right_le_pair /-
+theorem right_le_pair (a b : ℕ) : b ≤ pair a b :=
by
by_cases h : a < b <;> simp [mkpair, h]
exact le_trans (le_mul_self _) (Nat.le_add_right _ _)
-#align nat.right_le_mkpair Nat.right_le_mkpair
+#align nat.right_le_mkpair Nat.right_le_pair
-/
#print Nat.unpair_right_le /-
@@ -159,8 +159,8 @@ theorem unpair_right_le (n : ℕ) : (unpair n).2 ≤ n := by
#align nat.unpair_right_le Nat.unpair_right_le
-/
-#print Nat.mkpair_lt_mkpair_left /-
-theorem mkpair_lt_mkpair_left {a₁ a₂} (b) (h : a₁ < a₂) : mkpair a₁ b < mkpair a₂ b :=
+#print Nat.pair_lt_pair_left /-
+theorem pair_lt_pair_left {a₁ a₂} (b) (h : a₁ < a₂) : pair a₁ b < pair a₂ b :=
by
by_cases h₁ : a₁ < b <;> simp [mkpair, h₁, add_assoc]
· by_cases h₂ : a₂ < b <;> simp [mkpair, h₂, h]
@@ -173,11 +173,11 @@ theorem mkpair_lt_mkpair_left {a₁ a₂} (b) (h : a₁ < a₂) : mkpair a₁ b
apply add_lt_add
exact mul_self_lt_mul_self h
apply add_lt_add_right <;> assumption
-#align nat.mkpair_lt_mkpair_left Nat.mkpair_lt_mkpair_left
+#align nat.mkpair_lt_mkpair_left Nat.pair_lt_pair_left
-/
-#print Nat.mkpair_lt_mkpair_right /-
-theorem mkpair_lt_mkpair_right (a) {b₁ b₂} (h : b₁ < b₂) : mkpair a b₁ < mkpair a b₂ :=
+#print Nat.pair_lt_pair_right /-
+theorem pair_lt_pair_right (a) {b₁ b₂} (h : b₁ < b₂) : pair a b₁ < pair a b₂ :=
by
by_cases h₁ : a < b₁ <;> simp [mkpair, h₁, add_assoc]
· simp [mkpair, lt_trans h₁ h, h]
@@ -187,16 +187,16 @@ theorem mkpair_lt_mkpair_right (a) {b₁ b₂} (h : b₁ < b₂) : mkpair a b₁
rw [add_comm, add_comm _ a, add_assoc, add_lt_add_iff_left]
rwa [add_comm, ← sqrt_lt, sqrt_add_eq]
exact le_trans h₁ (Nat.le_add_left _ _)
-#align nat.mkpair_lt_mkpair_right Nat.mkpair_lt_mkpair_right
+#align nat.mkpair_lt_mkpair_right Nat.pair_lt_pair_right
-/
-/- warning: nat.mkpair_lt_max_add_one_sq -> Nat.mkpair_lt_max_add_one_sq is a dubious translation:
+/- warning: nat.mkpair_lt_max_add_one_sq -> Nat.pair_lt_max_add_one_sq is a dubious translation:
lean 3 declaration is
- forall (m : Nat) (n : Nat), LT.lt.{0} Nat Nat.hasLt (Nat.mkpair m n) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) (LinearOrder.max.{0} Nat Nat.linearOrder m n) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne)))) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))
+ forall (m : Nat) (n : Nat), LT.lt.{0} Nat Nat.hasLt (Nat.pair m n) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) (LinearOrder.max.{0} Nat Nat.linearOrder m n) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne)))) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne)))))
but is expected to have type
- forall (m : Nat) (n : Nat), LT.lt.{0} Nat instLTNat (Nat.mkpair m n) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) (Max.max.{0} Nat Nat.instMaxNat m n) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))
-Case conversion may be inaccurate. Consider using '#align nat.mkpair_lt_max_add_one_sq Nat.mkpair_lt_max_add_one_sqₓ'. -/
-theorem mkpair_lt_max_add_one_sq (m n : ℕ) : mkpair m n < (max m n + 1) ^ 2 :=
+ forall (m : Nat) (n : Nat), LT.lt.{0} Nat instLTNat (Nat.pair m n) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) (Max.max.{0} Nat Nat.instMaxNat m n) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2)))
+Case conversion may be inaccurate. Consider using '#align nat.mkpair_lt_max_add_one_sq Nat.pair_lt_max_add_one_sqₓ'. -/
+theorem pair_lt_max_add_one_sq (m n : ℕ) : pair m n < (max m n + 1) ^ 2 :=
by
rw [mkpair, add_sq, mul_one, two_mul, sq, add_assoc, add_assoc]
cases lt_or_le m n
@@ -204,35 +204,35 @@ theorem mkpair_lt_max_add_one_sq (m n : ℕ) : mkpair m n < (max m n + 1) ^ 2 :=
exact h.trans_le (self_le_add_right n _)
· rw [if_neg h.not_lt, max_eq_left h, add_lt_add_iff_left, add_assoc, add_lt_add_iff_left]
exact lt_succ_of_le h
-#align nat.mkpair_lt_max_add_one_sq Nat.mkpair_lt_max_add_one_sq
+#align nat.mkpair_lt_max_add_one_sq Nat.pair_lt_max_add_one_sq
-/- warning: nat.max_sq_add_min_le_mkpair -> Nat.max_sq_add_min_le_mkpair is a dubious translation:
+/- warning: nat.max_sq_add_min_le_mkpair -> Nat.max_sq_add_min_le_pair is a dubious translation:
lean 3 declaration is
- forall (m : Nat) (n : Nat), LE.le.{0} Nat Nat.hasLe (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (LinearOrder.max.{0} Nat Nat.linearOrder m n) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))) (LinearOrder.min.{0} Nat Nat.linearOrder m n)) (Nat.mkpair m n)
+ forall (m : Nat) (n : Nat), LE.le.{0} Nat Nat.hasLe (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat (Monoid.Pow.{0} Nat Nat.monoid)) (LinearOrder.max.{0} Nat Nat.linearOrder m n) (OfNat.ofNat.{0} Nat 2 (OfNat.mk.{0} Nat 2 (bit0.{0} Nat Nat.hasAdd (One.one.{0} Nat Nat.hasOne))))) (LinearOrder.min.{0} Nat Nat.linearOrder m n)) (Nat.pair m n)
but is expected to have type
- forall (m : Nat) (n : Nat), LE.le.{0} Nat instLENat (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (Max.max.{0} Nat Nat.instMaxNat m n) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))) (Min.min.{0} Nat instMinNat m n)) (Nat.mkpair m n)
-Case conversion may be inaccurate. Consider using '#align nat.max_sq_add_min_le_mkpair Nat.max_sq_add_min_le_mkpairₓ'. -/
-theorem max_sq_add_min_le_mkpair (m n : ℕ) : max m n ^ 2 + min m n ≤ mkpair m n :=
+ forall (m : Nat) (n : Nat), LE.le.{0} Nat instLENat (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (Max.max.{0} Nat Nat.instMaxNat m n) (OfNat.ofNat.{0} Nat 2 (instOfNatNat 2))) (Min.min.{0} Nat instMinNat m n)) (Nat.pair m n)
+Case conversion may be inaccurate. Consider using '#align nat.max_sq_add_min_le_mkpair Nat.max_sq_add_min_le_pairₓ'. -/
+theorem max_sq_add_min_le_pair (m n : ℕ) : max m n ^ 2 + min m n ≤ pair m n :=
by
rw [mkpair]
cases lt_or_le m n
· rw [if_pos h, max_eq_right h.le, min_eq_left h.le, sq]
· rw [if_neg h.not_lt, max_eq_left h, min_eq_right h, sq, add_assoc, add_le_add_iff_left]
exact le_add_self
-#align nat.max_sq_add_min_le_mkpair Nat.max_sq_add_min_le_mkpair
+#align nat.max_sq_add_min_le_mkpair Nat.max_sq_add_min_le_pair
-#print Nat.add_le_mkpair /-
-theorem add_le_mkpair (m n : ℕ) : m + n ≤ mkpair m n :=
- (max_sq_add_min_le_mkpair _ _).trans' <|
+#print Nat.add_le_pair /-
+theorem add_le_pair (m n : ℕ) : m + n ≤ pair m n :=
+ (max_sq_add_min_le_pair _ _).trans' <|
by
rw [sq, ← min_add_max, add_comm, add_le_add_iff_right]
exact le_mul_self _
-#align nat.add_le_mkpair Nat.add_le_mkpair
+#align nat.add_le_mkpair Nat.add_le_pair
-/
#print Nat.unpair_add_le /-
theorem unpair_add_le (n : ℕ) : (unpair n).1 + (unpair n).2 ≤ n :=
- (add_le_mkpair _ _).trans_eq (mkpair_unpair _)
+ (add_le_pair _ _).trans_eq (pair_unpair _)
#align nat.unpair_add_le Nat.unpair_add_le
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
@@ -127,8 +127,8 @@ theorem pair_lt_pair_left {a₁ a₂} (b) (h : a₁ < a₂) : pair a₁ b < pair
· by_cases h₂ : a₂ < b <;> simp [pair, h₂, h]
simp? at h₂ says simp only [not_lt] at h₂
apply Nat.add_lt_add_of_le_of_lt
- exact Nat.mul_self_le_mul_self h₂
- exact Nat.lt_add_right _ h
+ · exact Nat.mul_self_le_mul_self h₂
+ · exact Nat.lt_add_right _ h
· simp at h₁
simp only [not_lt_of_gt (lt_of_le_of_lt h₁ h), ite_false]
apply add_lt_add
@@ -155,7 +155,7 @@ theorem pair_lt_max_add_one_sq (m n : ℕ) : pair m n < (max m n + 1) ^ 2 := by
theorem max_sq_add_min_le_pair (m n : ℕ) : max m n ^ 2 + min m n ≤ pair m n := by
rw [pair]
cases' lt_or_le m n with h h
- rw [if_pos h, max_eq_right h.le, min_eq_left h.le, Nat.pow_two]
+ · rw [if_pos h, max_eq_right h.le, min_eq_left h.le, Nat.pow_two]
rw [if_neg h.not_lt, max_eq_left h, min_eq_right h, Nat.pow_two, Nat.add_assoc,
Nat.add_le_add_iff_left]
exact Nat.le_add_left _ _
@@ -132,8 +132,8 @@ theorem pair_lt_pair_left {a₁ a₂} (b) (h : a₁ < a₂) : pair a₁ b < pair
· simp at h₁
simp only [not_lt_of_gt (lt_of_le_of_lt h₁ h), ite_false]
apply add_lt_add
- exact Nat.mul_self_lt_mul_self h
- apply Nat.add_lt_add_right; assumption
+ · exact Nat.mul_self_lt_mul_self h
+ · apply Nat.add_lt_add_right; assumption
#align nat.mkpair_lt_mkpair_left Nat.pair_lt_pair_left
theorem pair_lt_pair_right (a) {b₁ b₂} (h : b₁ < b₂) : pair a b₁ < pair a b₂ := by
Nat.sqrt
material (#11866)
Move the content of Data.Nat.ForSqrt
and Data.Nat.Sqrt
to Data.Nat.Defs
by using Nat
-specific Std lemmas rather than the mathlib general ones. This makes it ready to move to Std if wanted.
@@ -3,10 +3,8 @@ Copyright (c) 2015 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura, Mario Carneiro
-/
-import Mathlib.Data.Nat.Sqrt
import Mathlib.Data.Set.Lattice
import Mathlib.Algebra.Group.Prod
-import Mathlib.Algebra.Order.Monoid.MinMax
#align_import data.nat.pairing from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
@@ -49,12 +47,12 @@ def unpair (n : ℕ) : ℕ × ℕ :=
@[simp]
theorem pair_unpair (n : ℕ) : pair (unpair n).1 (unpair n).2 = n := by
dsimp only [unpair]; let s := sqrt n
- have sm : s * s + (n - s * s) = n := add_tsub_cancel_of_le (sqrt_le _)
+ have sm : s * s + (n - s * s) = n := Nat.add_sub_cancel' (sqrt_le _)
split_ifs with h
· simp [pair, h, sm]
- · have hl : n - s * s - s ≤ s :=
- tsub_le_iff_left.mpr (tsub_le_iff_left.mpr <| by rw [← add_assoc]; apply sqrt_le_add)
- simp [pair, hl.not_lt, add_assoc, add_tsub_cancel_of_le (le_of_not_gt h), sm]
+ · have hl : n - s * s - s ≤ s := Nat.sub_le_iff_le_add.2
+ (Nat.sub_le_iff_le_add'.2 <| by rw [← Nat.add_assoc]; apply sqrt_le_add)
+ simp [pair, hl.not_lt, Nat.add_assoc, Nat.add_sub_cancel' (le_of_not_gt h), sm]
#align nat.mkpair_unpair Nat.pair_unpair
theorem pair_unpair' {n a b} (H : unpair n = (a, b)) : pair a b = n := by
@@ -66,12 +64,12 @@ theorem unpair_pair (a b : ℕ) : unpair (pair a b) = (a, b) := by
dsimp only [pair]; split_ifs with h
· show unpair (b * b + a) = (a, b)
have be : sqrt (b * b + a) = b := sqrt_add_eq _ (le_trans (le_of_lt h) (Nat.le_add_left _ _))
- simp [unpair, be, add_tsub_cancel_right, h]
+ simp [unpair, be, Nat.add_sub_cancel_left, h]
· show unpair (a * a + a + b) = (a, b)
have ae : sqrt (a * a + (a + b)) = a := by
rw [sqrt_add_eq]
- exact add_le_add_left (le_of_not_gt h) _
- simp [unpair, ae, Nat.not_lt_zero, add_assoc]
+ exact Nat.add_le_add_left (le_of_not_gt h) _
+ simp [unpair, ae, Nat.not_lt_zero, Nat.add_assoc, Nat.add_sub_cancel_left]
#align nat.unpair_mkpair Nat.unpair_pair
/-- An equivalence between `ℕ × ℕ` and `ℕ`. -/
@@ -93,12 +91,12 @@ theorem pair_eq_pair {a b c d : ℕ} : pair a b = pair c d ↔ a = c ∧ b = d :
theorem unpair_lt {n : ℕ} (n1 : 1 ≤ n) : (unpair n).1 < n := by
let s := sqrt n
- simp only [unpair, ge_iff_le, tsub_le_iff_right, gt_iff_lt]
+ simp only [unpair, ge_iff_le, Nat.sub_le_iff_le_add]
by_cases h : n - s * s < s <;> simp [h]
· exact lt_of_lt_of_le h (sqrt_le_self _)
· simp at h
have s0 : 0 < s := sqrt_pos.2 n1
- exact lt_of_le_of_lt h (tsub_lt_self n1 (mul_pos s0 s0))
+ exact lt_of_le_of_lt h (Nat.sub_lt n1 (Nat.mul_pos s0 s0))
#align nat.unpair_lt Nat.unpair_lt
@[simp]
@@ -125,51 +123,50 @@ theorem unpair_right_le (n : ℕ) : (unpair n).2 ≤ n := by
#align nat.unpair_right_le Nat.unpair_right_le
theorem pair_lt_pair_left {a₁ a₂} (b) (h : a₁ < a₂) : pair a₁ b < pair a₂ b := by
- by_cases h₁ : a₁ < b <;> simp [pair, h₁, add_assoc]
+ by_cases h₁ : a₁ < b <;> simp [pair, h₁, Nat.add_assoc]
· by_cases h₂ : a₂ < b <;> simp [pair, h₂, h]
simp? at h₂ says simp only [not_lt] at h₂
- apply add_lt_add_of_le_of_lt
- exact mul_self_le_mul_self h₂
+ apply Nat.add_lt_add_of_le_of_lt
+ exact Nat.mul_self_le_mul_self h₂
exact Nat.lt_add_right _ h
· simp at h₁
simp only [not_lt_of_gt (lt_of_le_of_lt h₁ h), ite_false]
apply add_lt_add
- exact mul_self_lt_mul_self h
- apply add_lt_add_right; assumption
+ exact Nat.mul_self_lt_mul_self h
+ apply Nat.add_lt_add_right; assumption
#align nat.mkpair_lt_mkpair_left Nat.pair_lt_pair_left
theorem pair_lt_pair_right (a) {b₁ b₂} (h : b₁ < b₂) : pair a b₁ < pair a b₂ := by
- by_cases h₁ : a < b₁ <;> simp [pair, h₁, add_assoc]
+ by_cases h₁ : a < b₁ <;> simp [pair, h₁, Nat.add_assoc]
· simp [pair, lt_trans h₁ h, h]
exact mul_self_lt_mul_self h
· by_cases h₂ : a < b₂ <;> simp [pair, h₂, h]
simp? at h₁ says simp only [not_lt] at h₁
- rw [add_comm, add_comm _ a, add_assoc, add_lt_add_iff_left]
- rwa [add_comm, ← sqrt_lt, sqrt_add_eq]
+ rw [Nat.add_comm, Nat.add_comm _ a, Nat.add_assoc, Nat.add_lt_add_iff_left]
+ rwa [Nat.add_comm, ← sqrt_lt, sqrt_add_eq]
exact le_trans h₁ (Nat.le_add_left _ _)
#align nat.mkpair_lt_mkpair_right Nat.pair_lt_pair_right
theorem pair_lt_max_add_one_sq (m n : ℕ) : pair m n < (max m n + 1) ^ 2 := by
- rw [pair, add_sq, mul_one, two_mul, sq, add_assoc, add_assoc]
- cases' (lt_or_le m n) with h h
- rw [if_pos h, max_eq_right h.le, add_lt_add_iff_left, add_assoc]
- exact h.trans_le (self_le_add_right n _)
- rw [if_neg h.not_lt, max_eq_left h, add_lt_add_iff_left, add_assoc, add_lt_add_iff_left]
- exact lt_succ_of_le h
+ simp only [pair, Nat.pow_two, Nat.mul_add, Nat.add_mul, Nat.mul_one, Nat.one_mul, Nat.add_assoc]
+ split_ifs <;> simp [Nat.max_eq_left, Nat.max_eq_right, Nat.le_of_lt, not_lt.1, *] <;> omega
#align nat.mkpair_lt_max_add_one_sq Nat.pair_lt_max_add_one_sq
theorem max_sq_add_min_le_pair (m n : ℕ) : max m n ^ 2 + min m n ≤ pair m n := by
rw [pair]
cases' lt_or_le m n with h h
- rw [if_pos h, max_eq_right h.le, min_eq_left h.le, sq]
- rw [if_neg h.not_lt, max_eq_left h, min_eq_right h, sq, add_assoc, add_le_add_iff_left]
- exact le_add_self
+ rw [if_pos h, max_eq_right h.le, min_eq_left h.le, Nat.pow_two]
+ rw [if_neg h.not_lt, max_eq_left h, min_eq_right h, Nat.pow_two, Nat.add_assoc,
+ Nat.add_le_add_iff_left]
+ exact Nat.le_add_left _ _
#align nat.max_sq_add_min_le_mkpair Nat.max_sq_add_min_le_pair
-theorem add_le_pair (m n : ℕ) : m + n ≤ pair m n :=
- (max_sq_add_min_le_pair _ _).trans' <| by
- rw [sq, ← min_add_max, add_comm, add_le_add_iff_right]
- exact le_mul_self _
+theorem add_le_pair (m n : ℕ) : m + n ≤ pair m n := by
+ simp only [pair, Nat.add_assoc]
+ split_ifs
+ · have := le_mul_self n
+ omega
+ · exact Nat.le_add_left _ _
#align nat.add_le_mkpair Nat.add_le_pair
theorem unpair_add_le (n : ℕ) : (unpair n).1 + (unpair n).2 ≤ n :=
@@ -32,14 +32,14 @@ open Prod Decidable Function
namespace Nat
/-- Pairing function for the natural numbers. -/
--- porting notes: no pp_nodot
+-- Porting note: no pp_nodot
--@[pp_nodot]
def pair (a b : ℕ) : ℕ :=
if a < b then b * b + a else a * a + a + b
#align nat.mkpair Nat.pair
/-- Unpairing function for the natural numbers. -/
--- porting notes: no pp_nodot
+-- Porting note: no pp_nodot
--@[pp_nodot]
def unpair (n : ℕ) : ℕ × ℕ :=
let s := sqrt n
@@ -127,7 +127,7 @@ theorem unpair_right_le (n : ℕ) : (unpair n).2 ≤ n := by
theorem pair_lt_pair_left {a₁ a₂} (b) (h : a₁ < a₂) : pair a₁ b < pair a₂ b := by
by_cases h₁ : a₁ < b <;> simp [pair, h₁, add_assoc]
· by_cases h₂ : a₂ < b <;> simp [pair, h₂, h]
- simp at h₂
+ simp? at h₂ says simp only [not_lt] at h₂
apply add_lt_add_of_le_of_lt
exact mul_self_le_mul_self h₂
exact Nat.lt_add_right _ h
@@ -143,7 +143,7 @@ theorem pair_lt_pair_right (a) {b₁ b₂} (h : b₁ < b₂) : pair a b₁ < pai
· simp [pair, lt_trans h₁ h, h]
exact mul_self_lt_mul_self h
· by_cases h₂ : a < b₂ <;> simp [pair, h₂, h]
- simp at h₁
+ simp? at h₁ says simp only [not_lt] at h₁
rw [add_comm, add_comm _ a, add_assoc, add_lt_add_iff_left]
rwa [add_comm, ← sqrt_lt, sqrt_add_eq]
exact le_trans h₁ (Nat.le_add_left _ _)
@@ -130,7 +130,7 @@ theorem pair_lt_pair_left {a₁ a₂} (b) (h : a₁ < a₂) : pair a₁ b < pair
simp at h₂
apply add_lt_add_of_le_of_lt
exact mul_self_le_mul_self h₂
- exact Nat.lt_add_right _ _ _ h
+ exact Nat.lt_add_right _ h
· simp at h₁
simp only [not_lt_of_gt (lt_of_le_of_lt h₁ h), ite_false]
apply add_lt_add
Use .asFn
and .lemmasOnly
as simps
configuration options.
For reference, these are defined here:
@@ -75,7 +75,7 @@ theorem unpair_pair (a b : ℕ) : unpair (pair a b) = (a, b) := by
#align nat.unpair_mkpair Nat.unpair_pair
/-- An equivalence between `ℕ × ℕ` and `ℕ`. -/
-@[simps (config := { fullyApplied := false })]
+@[simps (config := .asFn)]
def pairEquiv : ℕ × ℕ ≃ ℕ :=
⟨uncurry pair, unpair, fun ⟨a, b⟩ => unpair_pair a b, pair_unpair⟩
#align nat.mkpair_equiv Nat.pairEquiv
Removes nonterminal simps on lines looking like simp [...]
@@ -93,7 +93,7 @@ theorem pair_eq_pair {a b c d : ℕ} : pair a b = pair c d ↔ a = c ∧ b = d :
theorem unpair_lt {n : ℕ} (n1 : 1 ≤ n) : (unpair n).1 < n := by
let s := sqrt n
- simp [unpair]
+ simp only [unpair, ge_iff_le, tsub_le_iff_right, gt_iff_lt]
by_cases h : n - s * s < s <;> simp [h]
· exact lt_of_lt_of_le h (sqrt_le_self _)
· simp at h
@@ -132,7 +132,7 @@ theorem pair_lt_pair_left {a₁ a₂} (b) (h : a₁ < a₂) : pair a₁ b < pair
exact mul_self_le_mul_self h₂
exact Nat.lt_add_right _ _ _ h
· simp at h₁
- simp [not_lt_of_gt (lt_of_le_of_lt h₁ h)]
+ simp only [not_lt_of_gt (lt_of_le_of_lt h₁ h), ite_false]
apply add_lt_add
exact mul_self_lt_mul_self h
apply add_lt_add_right; assumption
@@ -2,17 +2,14 @@
Copyright (c) 2015 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Leonardo de Moura, Mario Carneiro
-
-! This file was ported from Lean 3 source module data.nat.pairing
-! leanprover-community/mathlib commit 207cfac9fcd06138865b5d04f7091e46d9320432
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Data.Nat.Sqrt
import Mathlib.Data.Set.Lattice
import Mathlib.Algebra.Group.Prod
import Mathlib.Algebra.Order.Monoid.MinMax
+#align_import data.nat.pairing from "leanprover-community/mathlib"@"207cfac9fcd06138865b5d04f7091e46d9320432"
+
/-!
# Naturals pairing function
Alongside any necessary spacing/flow changes to accommodate their removal.
@@ -96,7 +96,7 @@ theorem pair_eq_pair {a b c d : ℕ} : pair a b = pair c d ↔ a = c ∧ b = d :
theorem unpair_lt {n : ℕ} (n1 : 1 ≤ n) : (unpair n).1 < n := by
let s := sqrt n
- simp [unpair];
+ simp [unpair]
by_cases h : n - s * s < s <;> simp [h]
· exact lt_of_lt_of_le h (sqrt_le_self _)
· simp at h
This is the second half of the changes originally in #5699, removing all occurrences of ;
after a space and implementing a linter rule to enforce it.
In most cases this 2-character substring has a space after it, so the following command was run first:
find . -type f -name "*.lean" -exec sed -i -E 's/ ; /; /g' {} \;
The remaining cases were few enough in number that they were done manually.
@@ -56,7 +56,7 @@ theorem pair_unpair (n : ℕ) : pair (unpair n).1 (unpair n).2 = n := by
split_ifs with h
· simp [pair, h, sm]
· have hl : n - s * s - s ≤ s :=
- tsub_le_iff_left.mpr (tsub_le_iff_left.mpr <| by rw [← add_assoc] ; apply sqrt_le_add)
+ tsub_le_iff_left.mpr (tsub_le_iff_left.mpr <| by rw [← add_assoc]; apply sqrt_le_add)
simp [pair, hl.not_lt, add_assoc, add_tsub_cancel_of_le (le_of_not_gt h), sm]
#align nat.mkpair_unpair Nat.pair_unpair
@@ -138,7 +138,7 @@ theorem pair_lt_pair_left {a₁ a₂} (b) (h : a₁ < a₂) : pair a₁ b < pair
simp [not_lt_of_gt (lt_of_le_of_lt h₁ h)]
apply add_lt_add
exact mul_self_lt_mul_self h
- apply add_lt_add_right ; assumption
+ apply add_lt_add_right; assumption
#align nat.mkpair_lt_mkpair_left Nat.pair_lt_pair_left
theorem pair_lt_pair_right (a) {b₁ b₂} (h : b₁ < b₂) : pair a b₁ < pair a b₂ := by
@@ -187,13 +187,13 @@ section CompleteLattice
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (i j) -/
theorem iSup_unpair {α} [CompleteLattice α] (f : ℕ → ℕ → α) :
- (⨆ n : ℕ, f n.unpair.1 n.unpair.2) = ⨆ (i : ℕ) (j : ℕ), f i j := by
- rw [← (iSup_prod : (⨆ i : ℕ × ℕ, f i.1 i.2) = _), ← Nat.surjective_unpair.iSup_comp]
+ ⨆ n : ℕ, f n.unpair.1 n.unpair.2 = ⨆ (i : ℕ) (j : ℕ), f i j := by
+ rw [← (iSup_prod : ⨆ i : ℕ × ℕ, f i.1 i.2 = _), ← Nat.surjective_unpair.iSup_comp]
#align supr_unpair iSup_unpair
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (i j) -/
theorem iInf_unpair {α} [CompleteLattice α] (f : ℕ → ℕ → α) :
- (⨅ n : ℕ, f n.unpair.1 n.unpair.2) = ⨅ (i : ℕ) (j : ℕ), f i j :=
+ ⨅ n : ℕ, f n.unpair.1 n.unpair.2 = ⨅ (i : ℕ) (j : ℕ), f i j :=
iSup_unpair (show ℕ → ℕ → αᵒᵈ from f)
#align infi_unpair iInf_unpair
@@ -204,20 +204,20 @@ namespace Set
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
theorem iUnion_unpair_prod {α β} {s : ℕ → Set α} {t : ℕ → Set β} :
- (⋃ n : ℕ, s n.unpair.fst ×ˢ t n.unpair.snd) = (⋃ n, s n) ×ˢ ⋃ n, t n := by
+ ⋃ n : ℕ, s n.unpair.fst ×ˢ t n.unpair.snd = (⋃ n, s n) ×ˢ ⋃ n, t n := by
rw [← Set.iUnion_prod]
exact surjective_unpair.iUnion_comp (fun x => s x.fst ×ˢ t x.snd)
#align set.Union_unpair_prod Set.iUnion_unpair_prod
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (i j) -/
theorem iUnion_unpair {α} (f : ℕ → ℕ → Set α) :
- (⋃ n : ℕ, f n.unpair.1 n.unpair.2) = ⋃ (i : ℕ) (j : ℕ), f i j :=
+ ⋃ n : ℕ, f n.unpair.1 n.unpair.2 = ⋃ (i : ℕ) (j : ℕ), f i j :=
iSup_unpair f
#align set.Union_unpair Set.iUnion_unpair
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (i j) -/
theorem iInter_unpair {α} (f : ℕ → ℕ → Set α) :
- (⋂ n : ℕ, f n.unpair.1 n.unpair.2) = ⋂ (i : ℕ) (j : ℕ), f i j :=
+ ⋂ n : ℕ, f n.unpair.1 n.unpair.2 = ⋂ (i : ℕ) (j : ℕ), f i j :=
iInf_unpair f
#align set.Inter_unpair Set.iInter_unpair
sSup
/iSup
(#3938)
As discussed on Zulip
supₛ
→ sSup
infₛ
→ sInf
supᵢ
→ iSup
infᵢ
→ iInf
bsupₛ
→ bsSup
binfₛ
→ bsInf
bsupᵢ
→ biSup
binfᵢ
→ biInf
csupₛ
→ csSup
cinfₛ
→ csInf
csupᵢ
→ ciSup
cinfᵢ
→ ciInf
unionₛ
→ sUnion
interₛ
→ sInter
unionᵢ
→ iUnion
interᵢ
→ iInter
bunionₛ
→ bsUnion
binterₛ
→ bsInter
bunionᵢ
→ biUnion
binterᵢ
→ biInter
Co-authored-by: Parcly Taxel <reddeloostw@gmail.com>
@@ -186,16 +186,16 @@ open Nat
section CompleteLattice
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (i j) -/
-theorem supᵢ_unpair {α} [CompleteLattice α] (f : ℕ → ℕ → α) :
+theorem iSup_unpair {α} [CompleteLattice α] (f : ℕ → ℕ → α) :
(⨆ n : ℕ, f n.unpair.1 n.unpair.2) = ⨆ (i : ℕ) (j : ℕ), f i j := by
- rw [← (supᵢ_prod : (⨆ i : ℕ × ℕ, f i.1 i.2) = _), ← Nat.surjective_unpair.supᵢ_comp]
-#align supr_unpair supᵢ_unpair
+ rw [← (iSup_prod : (⨆ i : ℕ × ℕ, f i.1 i.2) = _), ← Nat.surjective_unpair.iSup_comp]
+#align supr_unpair iSup_unpair
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (i j) -/
-theorem infᵢ_unpair {α} [CompleteLattice α] (f : ℕ → ℕ → α) :
+theorem iInf_unpair {α} [CompleteLattice α] (f : ℕ → ℕ → α) :
(⨅ n : ℕ, f n.unpair.1 n.unpair.2) = ⨅ (i : ℕ) (j : ℕ), f i j :=
- supᵢ_unpair (show ℕ → ℕ → αᵒᵈ from f)
-#align infi_unpair infᵢ_unpair
+ iSup_unpair (show ℕ → ℕ → αᵒᵈ from f)
+#align infi_unpair iInf_unpair
end CompleteLattice
@@ -203,22 +203,22 @@ namespace Set
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
-theorem unionᵢ_unpair_prod {α β} {s : ℕ → Set α} {t : ℕ → Set β} :
+theorem iUnion_unpair_prod {α β} {s : ℕ → Set α} {t : ℕ → Set β} :
(⋃ n : ℕ, s n.unpair.fst ×ˢ t n.unpair.snd) = (⋃ n, s n) ×ˢ ⋃ n, t n := by
- rw [← Set.unionᵢ_prod]
- exact surjective_unpair.unionᵢ_comp (fun x => s x.fst ×ˢ t x.snd)
-#align set.Union_unpair_prod Set.unionᵢ_unpair_prod
+ rw [← Set.iUnion_prod]
+ exact surjective_unpair.iUnion_comp (fun x => s x.fst ×ˢ t x.snd)
+#align set.Union_unpair_prod Set.iUnion_unpair_prod
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (i j) -/
-theorem unionᵢ_unpair {α} (f : ℕ → ℕ → Set α) :
+theorem iUnion_unpair {α} (f : ℕ → ℕ → Set α) :
(⋃ n : ℕ, f n.unpair.1 n.unpair.2) = ⋃ (i : ℕ) (j : ℕ), f i j :=
- supᵢ_unpair f
-#align set.Union_unpair Set.unionᵢ_unpair
+ iSup_unpair f
+#align set.Union_unpair Set.iUnion_unpair
/- ./././Mathport/Syntax/Translate/Expr.lean:107:6: warning: expanding binder group (i j) -/
-theorem interᵢ_unpair {α} (f : ℕ → ℕ → Set α) :
+theorem iInter_unpair {α} (f : ℕ → ℕ → Set α) :
(⋂ n : ℕ, f n.unpair.1 n.unpair.2) = ⋂ (i : ℕ) (j : ℕ), f i j :=
- infᵢ_unpair f
-#align set.Inter_unpair Set.interᵢ_unpair
+ iInf_unpair f
+#align set.Inter_unpair Set.iInter_unpair
end Set
@@ -37,9 +37,9 @@ namespace Nat
/-- Pairing function for the natural numbers. -/
-- porting notes: no pp_nodot
--@[pp_nodot]
-def mkpair (a b : ℕ) : ℕ :=
+def pair (a b : ℕ) : ℕ :=
if a < b then b * b + a else a * a + a + b
-#align nat.mkpair Nat.mkpair
+#align nat.mkpair Nat.pair
/-- Unpairing function for the natural numbers. -/
-- porting notes: no pp_nodot
@@ -50,23 +50,23 @@ def unpair (n : ℕ) : ℕ × ℕ :=
#align nat.unpair Nat.unpair
@[simp]
-theorem mkpair_unpair (n : ℕ) : mkpair (unpair n).1 (unpair n).2 = n := by
+theorem pair_unpair (n : ℕ) : pair (unpair n).1 (unpair n).2 = n := by
dsimp only [unpair]; let s := sqrt n
have sm : s * s + (n - s * s) = n := add_tsub_cancel_of_le (sqrt_le _)
split_ifs with h
- · simp [mkpair, h, sm]
+ · simp [pair, h, sm]
· have hl : n - s * s - s ≤ s :=
tsub_le_iff_left.mpr (tsub_le_iff_left.mpr <| by rw [← add_assoc] ; apply sqrt_le_add)
- simp [mkpair, hl.not_lt, add_assoc, add_tsub_cancel_of_le (le_of_not_gt h), sm]
-#align nat.mkpair_unpair Nat.mkpair_unpair
+ simp [pair, hl.not_lt, add_assoc, add_tsub_cancel_of_le (le_of_not_gt h), sm]
+#align nat.mkpair_unpair Nat.pair_unpair
-theorem mkpair_unpair' {n a b} (H : unpair n = (a, b)) : mkpair a b = n := by
- simpa [H] using mkpair_unpair n
-#align nat.mkpair_unpair' Nat.mkpair_unpair'
+theorem pair_unpair' {n a b} (H : unpair n = (a, b)) : pair a b = n := by
+ simpa [H] using pair_unpair n
+#align nat.mkpair_unpair' Nat.pair_unpair'
@[simp]
-theorem unpair_mkpair (a b : ℕ) : unpair (mkpair a b) = (a, b) := by
- dsimp only [mkpair]; split_ifs with h
+theorem unpair_pair (a b : ℕ) : unpair (pair a b) = (a, b) := by
+ dsimp only [pair]; split_ifs with h
· show unpair (b * b + a) = (a, b)
have be : sqrt (b * b + a) = b := sqrt_add_eq _ (le_trans (le_of_lt h) (Nat.le_add_left _ _))
simp [unpair, be, add_tsub_cancel_right, h]
@@ -75,24 +75,24 @@ theorem unpair_mkpair (a b : ℕ) : unpair (mkpair a b) = (a, b) := by
rw [sqrt_add_eq]
exact add_le_add_left (le_of_not_gt h) _
simp [unpair, ae, Nat.not_lt_zero, add_assoc]
-#align nat.unpair_mkpair Nat.unpair_mkpair
+#align nat.unpair_mkpair Nat.unpair_pair
/-- An equivalence between `ℕ × ℕ` and `ℕ`. -/
@[simps (config := { fullyApplied := false })]
-def mkpairEquiv : ℕ × ℕ ≃ ℕ :=
- ⟨uncurry mkpair, unpair, fun ⟨a, b⟩ => unpair_mkpair a b, mkpair_unpair⟩
-#align nat.mkpair_equiv Nat.mkpairEquiv
-#align nat.mkpair_equiv_apply Nat.mkpairEquiv_apply
-#align nat.mkpair_equiv_symm_apply Nat.mkpairEquiv_symm_apply
+def pairEquiv : ℕ × ℕ ≃ ℕ :=
+ ⟨uncurry pair, unpair, fun ⟨a, b⟩ => unpair_pair a b, pair_unpair⟩
+#align nat.mkpair_equiv Nat.pairEquiv
+#align nat.mkpair_equiv_apply Nat.pairEquiv_apply
+#align nat.mkpair_equiv_symm_apply Nat.pairEquiv_symm_apply
theorem surjective_unpair : Surjective unpair :=
- mkpairEquiv.symm.surjective
+ pairEquiv.symm.surjective
#align nat.surjective_unpair Nat.surjective_unpair
@[simp]
-theorem mkpair_eq_mkpair {a b c d : ℕ} : mkpair a b = mkpair c d ↔ a = c ∧ b = d :=
- mkpairEquiv.injective.eq_iff.trans (@Prod.ext_iff ℕ ℕ (a, b) (c, d))
-#align nat.mkpair_eq_mkpair Nat.mkpair_eq_mkpair
+theorem pair_eq_pair {a b c d : ℕ} : pair a b = pair c d ↔ a = c ∧ b = d :=
+ pairEquiv.injective.eq_iff.trans (@Prod.ext_iff ℕ ℕ (a, b) (c, d))
+#align nat.mkpair_eq_mkpair Nat.pair_eq_pair
theorem unpair_lt {n : ℕ} (n1 : 1 ≤ n) : (unpair n).1 < n := by
let s := sqrt n
@@ -115,21 +115,21 @@ theorem unpair_left_le : ∀ n : ℕ, (unpair n).1 ≤ n
| n + 1 => le_of_lt (unpair_lt (Nat.succ_pos _))
#align nat.unpair_left_le Nat.unpair_left_le
-theorem left_le_mkpair (a b : ℕ) : a ≤ mkpair a b := by simpa using unpair_left_le (mkpair a b)
-#align nat.left_le_mkpair Nat.left_le_mkpair
+theorem left_le_pair (a b : ℕ) : a ≤ pair a b := by simpa using unpair_left_le (pair a b)
+#align nat.left_le_mkpair Nat.left_le_pair
-theorem right_le_mkpair (a b : ℕ) : b ≤ mkpair a b := by
- by_cases h : a < b <;> simp [mkpair, h]
+theorem right_le_pair (a b : ℕ) : b ≤ pair a b := by
+ by_cases h : a < b <;> simp [pair, h]
exact le_trans (le_mul_self _) (Nat.le_add_right _ _)
-#align nat.right_le_mkpair Nat.right_le_mkpair
+#align nat.right_le_mkpair Nat.right_le_pair
theorem unpair_right_le (n : ℕ) : (unpair n).2 ≤ n := by
- simpa using right_le_mkpair n.unpair.1 n.unpair.2
+ simpa using right_le_pair n.unpair.1 n.unpair.2
#align nat.unpair_right_le Nat.unpair_right_le
-theorem mkpair_lt_mkpair_left {a₁ a₂} (b) (h : a₁ < a₂) : mkpair a₁ b < mkpair a₂ b := by
- by_cases h₁ : a₁ < b <;> simp [mkpair, h₁, add_assoc]
- · by_cases h₂ : a₂ < b <;> simp [mkpair, h₂, h]
+theorem pair_lt_pair_left {a₁ a₂} (b) (h : a₁ < a₂) : pair a₁ b < pair a₂ b := by
+ by_cases h₁ : a₁ < b <;> simp [pair, h₁, add_assoc]
+ · by_cases h₂ : a₂ < b <;> simp [pair, h₂, h]
simp at h₂
apply add_lt_add_of_le_of_lt
exact mul_self_le_mul_self h₂
@@ -139,44 +139,44 @@ theorem mkpair_lt_mkpair_left {a₁ a₂} (b) (h : a₁ < a₂) : mkpair a₁ b
apply add_lt_add
exact mul_self_lt_mul_self h
apply add_lt_add_right ; assumption
-#align nat.mkpair_lt_mkpair_left Nat.mkpair_lt_mkpair_left
+#align nat.mkpair_lt_mkpair_left Nat.pair_lt_pair_left
-theorem mkpair_lt_mkpair_right (a) {b₁ b₂} (h : b₁ < b₂) : mkpair a b₁ < mkpair a b₂ := by
- by_cases h₁ : a < b₁ <;> simp [mkpair, h₁, add_assoc]
- · simp [mkpair, lt_trans h₁ h, h]
+theorem pair_lt_pair_right (a) {b₁ b₂} (h : b₁ < b₂) : pair a b₁ < pair a b₂ := by
+ by_cases h₁ : a < b₁ <;> simp [pair, h₁, add_assoc]
+ · simp [pair, lt_trans h₁ h, h]
exact mul_self_lt_mul_self h
- · by_cases h₂ : a < b₂ <;> simp [mkpair, h₂, h]
+ · by_cases h₂ : a < b₂ <;> simp [pair, h₂, h]
simp at h₁
rw [add_comm, add_comm _ a, add_assoc, add_lt_add_iff_left]
rwa [add_comm, ← sqrt_lt, sqrt_add_eq]
exact le_trans h₁ (Nat.le_add_left _ _)
-#align nat.mkpair_lt_mkpair_right Nat.mkpair_lt_mkpair_right
+#align nat.mkpair_lt_mkpair_right Nat.pair_lt_pair_right
-theorem mkpair_lt_max_add_one_sq (m n : ℕ) : mkpair m n < (max m n + 1) ^ 2 := by
- rw [mkpair, add_sq, mul_one, two_mul, sq, add_assoc, add_assoc]
+theorem pair_lt_max_add_one_sq (m n : ℕ) : pair m n < (max m n + 1) ^ 2 := by
+ rw [pair, add_sq, mul_one, two_mul, sq, add_assoc, add_assoc]
cases' (lt_or_le m n) with h h
rw [if_pos h, max_eq_right h.le, add_lt_add_iff_left, add_assoc]
exact h.trans_le (self_le_add_right n _)
rw [if_neg h.not_lt, max_eq_left h, add_lt_add_iff_left, add_assoc, add_lt_add_iff_left]
exact lt_succ_of_le h
-#align nat.mkpair_lt_max_add_one_sq Nat.mkpair_lt_max_add_one_sq
+#align nat.mkpair_lt_max_add_one_sq Nat.pair_lt_max_add_one_sq
-theorem max_sq_add_min_le_mkpair (m n : ℕ) : max m n ^ 2 + min m n ≤ mkpair m n := by
- rw [mkpair]
+theorem max_sq_add_min_le_pair (m n : ℕ) : max m n ^ 2 + min m n ≤ pair m n := by
+ rw [pair]
cases' lt_or_le m n with h h
rw [if_pos h, max_eq_right h.le, min_eq_left h.le, sq]
rw [if_neg h.not_lt, max_eq_left h, min_eq_right h, sq, add_assoc, add_le_add_iff_left]
exact le_add_self
-#align nat.max_sq_add_min_le_mkpair Nat.max_sq_add_min_le_mkpair
+#align nat.max_sq_add_min_le_mkpair Nat.max_sq_add_min_le_pair
-theorem add_le_mkpair (m n : ℕ) : m + n ≤ mkpair m n :=
- (max_sq_add_min_le_mkpair _ _).trans' <| by
+theorem add_le_pair (m n : ℕ) : m + n ≤ pair m n :=
+ (max_sq_add_min_le_pair _ _).trans' <| by
rw [sq, ← min_add_max, add_comm, add_le_add_iff_right]
exact le_mul_self _
-#align nat.add_le_mkpair Nat.add_le_mkpair
+#align nat.add_le_mkpair Nat.add_le_pair
theorem unpair_add_le (n : ℕ) : (unpair n).1 + (unpair n).2 ≤ n :=
- (add_le_mkpair _ _).trans_eq (mkpair_unpair _)
+ (add_le_pair _ _).trans_eq (pair_unpair _)
#align nat.unpair_add_le Nat.unpair_add_le
end Nat
This PR is the result of a slight variant on the following "algorithm"
_
and make all uppercase letters into lowercase_
and make all uppercase letters into lowercase(original_lean3_name, OriginalLean4Name)
#align
statement just before the next empty line#align
statement to have been inserted too early)@@ -82,6 +82,8 @@ theorem unpair_mkpair (a b : ℕ) : unpair (mkpair a b) = (a, b) := by
def mkpairEquiv : ℕ × ℕ ≃ ℕ :=
⟨uncurry mkpair, unpair, fun ⟨a, b⟩ => unpair_mkpair a b, mkpair_unpair⟩
#align nat.mkpair_equiv Nat.mkpairEquiv
+#align nat.mkpair_equiv_apply Nat.mkpairEquiv_apply
+#align nat.mkpair_equiv_symm_apply Nat.mkpairEquiv_symm_apply
theorem surjective_unpair : Surjective unpair :=
mkpairEquiv.symm.surjective
The unported dependencies are