data.pnat.prime
⟷
Mathlib.Data.PNat.Prime
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)
(last sync)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro, Neil Strickland
-/
import Data.Nat.Prime
-import Data.Pnat.Basic
+import Data.PNat.Basic
#align_import data.pnat.prime from "leanprover-community/mathlib"@"baba818b9acea366489e8ba32d2cc0fcaf50a1f7"
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -67,7 +67,7 @@ def gcd (n m : ℕ+) : ℕ+ :=
def lcm (n m : ℕ+) : ℕ+ :=
⟨Nat.lcm (n : ℕ) (m : ℕ), by
let h := mul_pos n.pos m.pos
- rw [← gcd_mul_lcm (n : ℕ) (m : ℕ), mul_comm] at h
+ rw [← gcd_mul_lcm (n : ℕ) (m : ℕ), mul_comm] at h
exact pos_of_dvd_of_pos (Dvd.intro (Nat.gcd (n : ℕ) (m : ℕ)) rfl) h⟩
#align pnat.lcm PNat.lcm
-/
@@ -132,7 +132,7 @@ theorem gcd_mul_lcm (n m : ℕ+) : gcd n m * lcm n m = n * m :=
theorem eq_one_of_lt_two {n : ℕ+} : n < 2 → n = 1 :=
by
intro h; apply le_antisymm; swap; apply PNat.one_le
- change n < 1 + 1 at h ; rw [PNat.lt_add_one_iff] at h ; apply h
+ change n < 1 + 1 at h; rw [PNat.lt_add_one_iff] at h; apply h
#align pnat.eq_one_of_lt_two PNat.eq_one_of_lt_two
-/
@@ -314,7 +314,7 @@ theorem Coprime.coprime_dvd_left {m k n : ℕ+} : m ∣ k → k.Coprime n → m.
#print PNat.Coprime.factor_eq_gcd_left /-
theorem Coprime.factor_eq_gcd_left {a b m n : ℕ+} (cop : m.Coprime n) (am : a ∣ m) (bn : b ∣ n) :
a = (a * b).gcd m := by
- rw [gcd_eq_left_iff_dvd] at am
+ rw [gcd_eq_left_iff_dvd] at am
conv_lhs => rw [← am]; symm
apply coprime.gcd_mul_right_cancel a
apply coprime.coprime_dvd_left bn cop.symm
@@ -343,7 +343,7 @@ theorem Coprime.factor_eq_gcd_right_right {a b m n : ℕ+} (cop : m.Coprime n) (
#print PNat.Coprime.gcd_mul /-
theorem Coprime.gcd_mul (k : ℕ+) {m n : ℕ+} (h : m.Coprime n) : k.gcd (m * n) = k.gcd m * k.gcd n :=
by
- rw [← coprime_coe] at h ; apply Eq
+ rw [← coprime_coe] at h; apply Eq
simp only [gcd_coe, mul_coe]; apply Nat.Coprime.gcd_mul k h
#align pnat.coprime.gcd_mul PNat.Coprime.gcd_mul
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,8 +3,8 @@ Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro, Neil Strickland
-/
-import Mathbin.Data.Nat.Prime
-import Mathbin.Data.Pnat.Basic
+import Data.Nat.Prime
+import Data.Pnat.Basic
#align_import data.pnat.prime from "leanprover-community/mathlib"@"baba818b9acea366489e8ba32d2cc0fcaf50a1f7"
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -209,20 +209,20 @@ def Coprime (m n : ℕ+) : Prop :=
#print PNat.coprime_coe /-
@[simp, norm_cast]
-theorem coprime_coe {m n : ℕ+} : Nat.coprime ↑m ↑n ↔ m.coprime n := by unfold coprime;
- unfold Nat.coprime; rw [← coe_inj]; simp
+theorem coprime_coe {m n : ℕ+} : Nat.Coprime ↑m ↑n ↔ m.Coprime n := by unfold coprime;
+ unfold Nat.Coprime; rw [← coe_inj]; simp
#align pnat.coprime_coe PNat.coprime_coe
-/
#print PNat.Coprime.mul /-
-theorem Coprime.mul {k m n : ℕ+} : m.coprime k → n.coprime k → (m * n).coprime k := by
- repeat' rw [← coprime_coe]; rw [mul_coe]; apply Nat.coprime.mul
+theorem Coprime.mul {k m n : ℕ+} : m.Coprime k → n.Coprime k → (m * n).Coprime k := by
+ repeat' rw [← coprime_coe]; rw [mul_coe]; apply Nat.Coprime.mul
#align pnat.coprime.mul PNat.Coprime.mul
-/
#print PNat.Coprime.mul_right /-
-theorem Coprime.mul_right {k m n : ℕ+} : k.coprime m → k.coprime n → k.coprime (m * n) := by
- repeat' rw [← coprime_coe]; rw [mul_coe]; apply Nat.coprime.mul_right
+theorem Coprime.mul_right {k m n : ℕ+} : k.Coprime m → k.Coprime n → k.Coprime (m * n) := by
+ repeat' rw [← coprime_coe]; rw [mul_coe]; apply Nat.Coprime.mul_right
#align pnat.coprime.mul_right PNat.Coprime.mul_right
-/
@@ -245,29 +245,29 @@ theorem gcd_eq_right_iff_dvd {m n : ℕ+} : m ∣ n ↔ n.gcd m = m := by rw [gc
-/
#print PNat.Coprime.gcd_mul_left_cancel /-
-theorem Coprime.gcd_mul_left_cancel (m : ℕ+) {n k : ℕ+} : k.coprime n → (k * m).gcd n = m.gcd n :=
+theorem Coprime.gcd_mul_left_cancel (m : ℕ+) {n k : ℕ+} : k.Coprime n → (k * m).gcd n = m.gcd n :=
by
intro h; apply Eq; simp only [gcd_coe, mul_coe]
- apply Nat.coprime.gcd_mul_left_cancel; simpa
+ apply Nat.Coprime.gcd_mul_left_cancel; simpa
#align pnat.coprime.gcd_mul_left_cancel PNat.Coprime.gcd_mul_left_cancel
-/
#print PNat.Coprime.gcd_mul_right_cancel /-
-theorem Coprime.gcd_mul_right_cancel (m : ℕ+) {n k : ℕ+} : k.coprime n → (m * k).gcd n = m.gcd n :=
+theorem Coprime.gcd_mul_right_cancel (m : ℕ+) {n k : ℕ+} : k.Coprime n → (m * k).gcd n = m.gcd n :=
by rw [mul_comm]; apply coprime.gcd_mul_left_cancel
#align pnat.coprime.gcd_mul_right_cancel PNat.Coprime.gcd_mul_right_cancel
-/
#print PNat.Coprime.gcd_mul_left_cancel_right /-
theorem Coprime.gcd_mul_left_cancel_right (m : ℕ+) {n k : ℕ+} :
- k.coprime m → m.gcd (k * n) = m.gcd n := by intro h; iterate 2 rw [gcd_comm]; symm;
+ k.Coprime m → m.gcd (k * n) = m.gcd n := by intro h; iterate 2 rw [gcd_comm]; symm;
apply coprime.gcd_mul_left_cancel _ h
#align pnat.coprime.gcd_mul_left_cancel_right PNat.Coprime.gcd_mul_left_cancel_right
-/
#print PNat.Coprime.gcd_mul_right_cancel_right /-
theorem Coprime.gcd_mul_right_cancel_right (m : ℕ+) {n k : ℕ+} :
- k.coprime m → m.gcd (n * k) = m.gcd n := by rw [mul_comm];
+ k.Coprime m → m.gcd (n * k) = m.gcd n := by rw [mul_comm];
apply coprime.gcd_mul_left_cancel_right
#align pnat.coprime.gcd_mul_right_cancel_right PNat.Coprime.gcd_mul_right_cancel_right
-/
@@ -286,33 +286,33 @@ theorem gcd_one {n : ℕ+} : gcd n 1 = 1 := by rw [gcd_comm]; apply one_gcd
#print PNat.Coprime.symm /-
@[symm]
-theorem Coprime.symm {m n : ℕ+} : m.coprime n → n.coprime m := by unfold coprime; rw [gcd_comm];
+theorem Coprime.symm {m n : ℕ+} : m.Coprime n → n.Coprime m := by unfold coprime; rw [gcd_comm];
simp
#align pnat.coprime.symm PNat.Coprime.symm
-/
#print PNat.one_coprime /-
@[simp]
-theorem one_coprime {n : ℕ+} : (1 : ℕ+).coprime n :=
+theorem one_coprime {n : ℕ+} : (1 : ℕ+).Coprime n :=
one_gcd
#align pnat.one_coprime PNat.one_coprime
-/
#print PNat.coprime_one /-
@[simp]
-theorem coprime_one {n : ℕ+} : n.coprime 1 :=
+theorem coprime_one {n : ℕ+} : n.Coprime 1 :=
Coprime.symm one_coprime
#align pnat.coprime_one PNat.coprime_one
-/
#print PNat.Coprime.coprime_dvd_left /-
-theorem Coprime.coprime_dvd_left {m k n : ℕ+} : m ∣ k → k.coprime n → m.coprime n := by
- rw [dvd_iff]; repeat' rw [← coprime_coe]; apply Nat.coprime.coprime_dvd_left
+theorem Coprime.coprime_dvd_left {m k n : ℕ+} : m ∣ k → k.Coprime n → m.Coprime n := by
+ rw [dvd_iff]; repeat' rw [← coprime_coe]; apply Nat.Coprime.coprime_dvd_left
#align pnat.coprime.coprime_dvd_left PNat.Coprime.coprime_dvd_left
-/
#print PNat.Coprime.factor_eq_gcd_left /-
-theorem Coprime.factor_eq_gcd_left {a b m n : ℕ+} (cop : m.coprime n) (am : a ∣ m) (bn : b ∣ n) :
+theorem Coprime.factor_eq_gcd_left {a b m n : ℕ+} (cop : m.Coprime n) (am : a ∣ m) (bn : b ∣ n) :
a = (a * b).gcd m := by
rw [gcd_eq_left_iff_dvd] at am
conv_lhs => rw [← am]; symm
@@ -322,29 +322,29 @@ theorem Coprime.factor_eq_gcd_left {a b m n : ℕ+} (cop : m.coprime n) (am : a
-/
#print PNat.Coprime.factor_eq_gcd_right /-
-theorem Coprime.factor_eq_gcd_right {a b m n : ℕ+} (cop : m.coprime n) (am : a ∣ m) (bn : b ∣ n) :
+theorem Coprime.factor_eq_gcd_right {a b m n : ℕ+} (cop : m.Coprime n) (am : a ∣ m) (bn : b ∣ n) :
a = (b * a).gcd m := by rw [mul_comm]; apply coprime.factor_eq_gcd_left cop am bn
#align pnat.coprime.factor_eq_gcd_right PNat.Coprime.factor_eq_gcd_right
-/
#print PNat.Coprime.factor_eq_gcd_left_right /-
-theorem Coprime.factor_eq_gcd_left_right {a b m n : ℕ+} (cop : m.coprime n) (am : a ∣ m)
+theorem Coprime.factor_eq_gcd_left_right {a b m n : ℕ+} (cop : m.Coprime n) (am : a ∣ m)
(bn : b ∣ n) : a = m.gcd (a * b) := by rw [gcd_comm]; apply coprime.factor_eq_gcd_left cop am bn
#align pnat.coprime.factor_eq_gcd_left_right PNat.Coprime.factor_eq_gcd_left_right
-/
#print PNat.Coprime.factor_eq_gcd_right_right /-
-theorem Coprime.factor_eq_gcd_right_right {a b m n : ℕ+} (cop : m.coprime n) (am : a ∣ m)
+theorem Coprime.factor_eq_gcd_right_right {a b m n : ℕ+} (cop : m.Coprime n) (am : a ∣ m)
(bn : b ∣ n) : a = m.gcd (b * a) := by rw [gcd_comm];
apply coprime.factor_eq_gcd_right cop am bn
#align pnat.coprime.factor_eq_gcd_right_right PNat.Coprime.factor_eq_gcd_right_right
-/
#print PNat.Coprime.gcd_mul /-
-theorem Coprime.gcd_mul (k : ℕ+) {m n : ℕ+} (h : m.coprime n) : k.gcd (m * n) = k.gcd m * k.gcd n :=
+theorem Coprime.gcd_mul (k : ℕ+) {m n : ℕ+} (h : m.Coprime n) : k.gcd (m * n) = k.gcd m * k.gcd n :=
by
rw [← coprime_coe] at h ; apply Eq
- simp only [gcd_coe, mul_coe]; apply Nat.coprime.gcd_mul k h
+ simp only [gcd_coe, mul_coe]; apply Nat.Coprime.gcd_mul k h
#align pnat.coprime.gcd_mul PNat.Coprime.gcd_mul
-/
@@ -355,8 +355,8 @@ theorem gcd_eq_left {m n : ℕ+} : m ∣ n → m.gcd n = m := by rw [dvd_iff]; i
-/
#print PNat.Coprime.pow /-
-theorem Coprime.pow {m n : ℕ+} (k l : ℕ) (h : m.coprime n) : (m ^ k).coprime (n ^ l) := by
- rw [← coprime_coe] at *; simp only [pow_coe]; apply Nat.coprime.pow; apply h
+theorem Coprime.pow {m n : ℕ+} (k l : ℕ) (h : m.Coprime n) : (m ^ k).Coprime (n ^ l) := by
+ rw [← coprime_coe] at *; simp only [pow_coe]; apply Nat.Coprime.pow; apply h
#align pnat.coprime.pow PNat.Coprime.pow
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,15 +2,12 @@
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro, Neil Strickland
-
-! This file was ported from Lean 3 source module data.pnat.prime
-! leanprover-community/mathlib commit baba818b9acea366489e8ba32d2cc0fcaf50a1f7
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Data.Nat.Prime
import Mathbin.Data.Pnat.Basic
+#align_import data.pnat.prime from "leanprover-community/mathlib"@"baba818b9acea366489e8ba32d2cc0fcaf50a1f7"
+
/-!
# Primality and GCD on pnat
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -125,15 +125,19 @@ theorem lcm_dvd {m n k : ℕ+} (hm : m ∣ k) (hn : n ∣ k) : lcm m n ∣ k :=
#align pnat.lcm_dvd PNat.lcm_dvd
-/
+#print PNat.gcd_mul_lcm /-
theorem gcd_mul_lcm (n m : ℕ+) : gcd n m * lcm n m = n * m :=
Subtype.eq (Nat.gcd_mul_lcm (n : ℕ) (m : ℕ))
#align pnat.gcd_mul_lcm PNat.gcd_mul_lcm
+-/
+#print PNat.eq_one_of_lt_two /-
theorem eq_one_of_lt_two {n : ℕ+} : n < 2 → n = 1 :=
by
intro h; apply le_antisymm; swap; apply PNat.one_le
change n < 1 + 1 at h ; rw [PNat.lt_add_one_iff] at h ; apply h
#align pnat.eq_one_of_lt_two PNat.eq_one_of_lt_two
+-/
section Prime
@@ -153,9 +157,11 @@ theorem Prime.one_lt {p : ℕ+} : p.Prime → 1 < p :=
#align pnat.prime.one_lt PNat.Prime.one_lt
-/
+#print PNat.prime_two /-
theorem prime_two : (2 : ℕ+).Prime :=
Nat.prime_two
#align pnat.prime_two PNat.prime_two
+-/
#print PNat.dvd_prime /-
theorem dvd_prime {p m : ℕ+} (pp : p.Prime) : m ∣ p ↔ m = 1 ∨ m = p := by rw [PNat.dvd_iff];
@@ -211,13 +217,17 @@ theorem coprime_coe {m n : ℕ+} : Nat.coprime ↑m ↑n ↔ m.coprime n := by u
#align pnat.coprime_coe PNat.coprime_coe
-/
+#print PNat.Coprime.mul /-
theorem Coprime.mul {k m n : ℕ+} : m.coprime k → n.coprime k → (m * n).coprime k := by
repeat' rw [← coprime_coe]; rw [mul_coe]; apply Nat.coprime.mul
#align pnat.coprime.mul PNat.Coprime.mul
+-/
+#print PNat.Coprime.mul_right /-
theorem Coprime.mul_right {k m n : ℕ+} : k.coprime m → k.coprime n → k.coprime (m * n) := by
repeat' rw [← coprime_coe]; rw [mul_coe]; apply Nat.coprime.mul_right
#align pnat.coprime.mul_right PNat.Coprime.mul_right
+-/
#print PNat.gcd_comm /-
theorem gcd_comm {m n : ℕ+} : m.gcd n = n.gcd m := by apply Eq; simp only [gcd_coe];
@@ -237,25 +247,33 @@ theorem gcd_eq_right_iff_dvd {m n : ℕ+} : m ∣ n ↔ n.gcd m = m := by rw [gc
#align pnat.gcd_eq_right_iff_dvd PNat.gcd_eq_right_iff_dvd
-/
+#print PNat.Coprime.gcd_mul_left_cancel /-
theorem Coprime.gcd_mul_left_cancel (m : ℕ+) {n k : ℕ+} : k.coprime n → (k * m).gcd n = m.gcd n :=
by
intro h; apply Eq; simp only [gcd_coe, mul_coe]
apply Nat.coprime.gcd_mul_left_cancel; simpa
#align pnat.coprime.gcd_mul_left_cancel PNat.Coprime.gcd_mul_left_cancel
+-/
+#print PNat.Coprime.gcd_mul_right_cancel /-
theorem Coprime.gcd_mul_right_cancel (m : ℕ+) {n k : ℕ+} : k.coprime n → (m * k).gcd n = m.gcd n :=
by rw [mul_comm]; apply coprime.gcd_mul_left_cancel
#align pnat.coprime.gcd_mul_right_cancel PNat.Coprime.gcd_mul_right_cancel
+-/
+#print PNat.Coprime.gcd_mul_left_cancel_right /-
theorem Coprime.gcd_mul_left_cancel_right (m : ℕ+) {n k : ℕ+} :
k.coprime m → m.gcd (k * n) = m.gcd n := by intro h; iterate 2 rw [gcd_comm]; symm;
apply coprime.gcd_mul_left_cancel _ h
#align pnat.coprime.gcd_mul_left_cancel_right PNat.Coprime.gcd_mul_left_cancel_right
+-/
+#print PNat.Coprime.gcd_mul_right_cancel_right /-
theorem Coprime.gcd_mul_right_cancel_right (m : ℕ+) {n k : ℕ+} :
k.coprime m → m.gcd (n * k) = m.gcd n := by rw [mul_comm];
apply coprime.gcd_mul_left_cancel_right
#align pnat.coprime.gcd_mul_right_cancel_right PNat.Coprime.gcd_mul_right_cancel_right
+-/
#print PNat.one_gcd /-
@[simp]
@@ -296,6 +314,7 @@ theorem Coprime.coprime_dvd_left {m k n : ℕ+} : m ∣ k → k.coprime n → m.
#align pnat.coprime.coprime_dvd_left PNat.Coprime.coprime_dvd_left
-/
+#print PNat.Coprime.factor_eq_gcd_left /-
theorem Coprime.factor_eq_gcd_left {a b m n : ℕ+} (cop : m.coprime n) (am : a ∣ m) (bn : b ∣ n) :
a = (a * b).gcd m := by
rw [gcd_eq_left_iff_dvd] at am
@@ -303,25 +322,34 @@ theorem Coprime.factor_eq_gcd_left {a b m n : ℕ+} (cop : m.coprime n) (am : a
apply coprime.gcd_mul_right_cancel a
apply coprime.coprime_dvd_left bn cop.symm
#align pnat.coprime.factor_eq_gcd_left PNat.Coprime.factor_eq_gcd_left
+-/
+#print PNat.Coprime.factor_eq_gcd_right /-
theorem Coprime.factor_eq_gcd_right {a b m n : ℕ+} (cop : m.coprime n) (am : a ∣ m) (bn : b ∣ n) :
a = (b * a).gcd m := by rw [mul_comm]; apply coprime.factor_eq_gcd_left cop am bn
#align pnat.coprime.factor_eq_gcd_right PNat.Coprime.factor_eq_gcd_right
+-/
+#print PNat.Coprime.factor_eq_gcd_left_right /-
theorem Coprime.factor_eq_gcd_left_right {a b m n : ℕ+} (cop : m.coprime n) (am : a ∣ m)
(bn : b ∣ n) : a = m.gcd (a * b) := by rw [gcd_comm]; apply coprime.factor_eq_gcd_left cop am bn
#align pnat.coprime.factor_eq_gcd_left_right PNat.Coprime.factor_eq_gcd_left_right
+-/
+#print PNat.Coprime.factor_eq_gcd_right_right /-
theorem Coprime.factor_eq_gcd_right_right {a b m n : ℕ+} (cop : m.coprime n) (am : a ∣ m)
(bn : b ∣ n) : a = m.gcd (b * a) := by rw [gcd_comm];
apply coprime.factor_eq_gcd_right cop am bn
#align pnat.coprime.factor_eq_gcd_right_right PNat.Coprime.factor_eq_gcd_right_right
+-/
+#print PNat.Coprime.gcd_mul /-
theorem Coprime.gcd_mul (k : ℕ+) {m n : ℕ+} (h : m.coprime n) : k.gcd (m * n) = k.gcd m * k.gcd n :=
by
rw [← coprime_coe] at h ; apply Eq
simp only [gcd_coe, mul_coe]; apply Nat.coprime.gcd_mul k h
#align pnat.coprime.gcd_mul PNat.Coprime.gcd_mul
+-/
#print PNat.gcd_eq_left /-
theorem gcd_eq_left {m n : ℕ+} : m ∣ n → m.gcd n = m := by rw [dvd_iff]; intro h; apply Eq;
@@ -329,9 +357,11 @@ theorem gcd_eq_left {m n : ℕ+} : m ∣ n → m.gcd n = m := by rw [dvd_iff]; i
#align pnat.gcd_eq_left PNat.gcd_eq_left
-/
+#print PNat.Coprime.pow /-
theorem Coprime.pow {m n : ℕ+} (k l : ℕ) (h : m.coprime n) : (m ^ k).coprime (n ^ l) := by
rw [← coprime_coe] at *; simp only [pow_coe]; apply Nat.coprime.pow; apply h
#align pnat.coprime.pow PNat.Coprime.pow
+-/
end Coprime
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -70,7 +70,7 @@ def gcd (n m : ℕ+) : ℕ+ :=
def lcm (n m : ℕ+) : ℕ+ :=
⟨Nat.lcm (n : ℕ) (m : ℕ), by
let h := mul_pos n.pos m.pos
- rw [← gcd_mul_lcm (n : ℕ) (m : ℕ), mul_comm] at h
+ rw [← gcd_mul_lcm (n : ℕ) (m : ℕ), mul_comm] at h
exact pos_of_dvd_of_pos (Dvd.intro (Nat.gcd (n : ℕ) (m : ℕ)) rfl) h⟩
#align pnat.lcm PNat.lcm
-/
@@ -132,7 +132,7 @@ theorem gcd_mul_lcm (n m : ℕ+) : gcd n m * lcm n m = n * m :=
theorem eq_one_of_lt_two {n : ℕ+} : n < 2 → n = 1 :=
by
intro h; apply le_antisymm; swap; apply PNat.one_le
- change n < 1 + 1 at h; rw [PNat.lt_add_one_iff] at h; apply h
+ change n < 1 + 1 at h ; rw [PNat.lt_add_one_iff] at h ; apply h
#align pnat.eq_one_of_lt_two PNat.eq_one_of_lt_two
section Prime
@@ -298,7 +298,7 @@ theorem Coprime.coprime_dvd_left {m k n : ℕ+} : m ∣ k → k.coprime n → m.
theorem Coprime.factor_eq_gcd_left {a b m n : ℕ+} (cop : m.coprime n) (am : a ∣ m) (bn : b ∣ n) :
a = (a * b).gcd m := by
- rw [gcd_eq_left_iff_dvd] at am
+ rw [gcd_eq_left_iff_dvd] at am
conv_lhs => rw [← am]; symm
apply coprime.gcd_mul_right_cancel a
apply coprime.coprime_dvd_left bn cop.symm
@@ -319,7 +319,7 @@ theorem Coprime.factor_eq_gcd_right_right {a b m n : ℕ+} (cop : m.coprime n) (
theorem Coprime.gcd_mul (k : ℕ+) {m n : ℕ+} (h : m.coprime n) : k.gcd (m * n) = k.gcd m * k.gcd n :=
by
- rw [← coprime_coe] at h; apply Eq
+ rw [← coprime_coe] at h ; apply Eq
simp only [gcd_coe, mul_coe]; apply Nat.coprime.gcd_mul k h
#align pnat.coprime.gcd_mul PNat.Coprime.gcd_mul
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -147,9 +147,11 @@ def Prime (p : ℕ+) : Prop :=
#align pnat.prime PNat.Prime
-/
+#print PNat.Prime.one_lt /-
theorem Prime.one_lt {p : ℕ+} : p.Prime → 1 < p :=
Nat.Prime.one_lt
#align pnat.prime.one_lt PNat.Prime.one_lt
+-/
theorem prime_two : (2 : ℕ+).Prime :=
Nat.prime_two
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -125,22 +125,10 @@ theorem lcm_dvd {m n k : ℕ+} (hm : m ∣ k) (hn : n ∣ k) : lcm m n ∣ k :=
#align pnat.lcm_dvd PNat.lcm_dvd
-/
-/- warning: pnat.gcd_mul_lcm -> PNat.gcd_mul_lcm is a dubious translation:
-lean 3 declaration is
- forall (n : PNat) (m : PNat), Eq.{1} PNat (HMul.hMul.{0, 0, 0} PNat PNat PNat (instHMul.{0} PNat PNat.hasMul) (PNat.gcd n m) (PNat.lcm n m)) (HMul.hMul.{0, 0, 0} PNat PNat PNat (instHMul.{0} PNat PNat.hasMul) n m)
-but is expected to have type
- forall (n : PNat) (m : PNat), Eq.{1} PNat (HMul.hMul.{0, 0, 0} PNat PNat PNat (instHMul.{0} PNat instPNatMul) (PNat.gcd n m) (PNat.lcm n m)) (HMul.hMul.{0, 0, 0} PNat PNat PNat (instHMul.{0} PNat instPNatMul) n m)
-Case conversion may be inaccurate. Consider using '#align pnat.gcd_mul_lcm PNat.gcd_mul_lcmₓ'. -/
theorem gcd_mul_lcm (n m : ℕ+) : gcd n m * lcm n m = n * m :=
Subtype.eq (Nat.gcd_mul_lcm (n : ℕ) (m : ℕ))
#align pnat.gcd_mul_lcm PNat.gcd_mul_lcm
-/- warning: pnat.eq_one_of_lt_two -> PNat.eq_one_of_lt_two is a dubious translation:
-lean 3 declaration is
- forall {n : PNat}, (LT.lt.{0} PNat (Preorder.toHasLt.{0} PNat (PartialOrder.toPreorder.{0} PNat (OrderedCancelCommMonoid.toPartialOrder.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat PNat.linearOrderedCancelCommMonoid)))) n (OfNat.ofNat.{0} PNat 2 (OfNat.mk.{0} PNat 2 (bit0.{0} PNat PNat.hasAdd (One.one.{0} PNat PNat.hasOne))))) -> (Eq.{1} PNat n (OfNat.ofNat.{0} PNat 1 (OfNat.mk.{0} PNat 1 (One.one.{0} PNat PNat.hasOne))))
-but is expected to have type
- forall {n : PNat}, (LT.lt.{0} PNat (Preorder.toLT.{0} PNat (PartialOrder.toPreorder.{0} PNat (OrderedCancelCommMonoid.toPartialOrder.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat instPNatLinearOrderedCancelCommMonoid)))) n (OfNat.ofNat.{0} PNat 2 (instOfNatPNatHAddNatInstHAddInstAddNatOfNat (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))) -> (Eq.{1} PNat n (OfNat.ofNat.{0} PNat 1 (instOfNatPNatHAddNatInstHAddInstAddNatOfNat (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)))))
-Case conversion may be inaccurate. Consider using '#align pnat.eq_one_of_lt_two PNat.eq_one_of_lt_twoₓ'. -/
theorem eq_one_of_lt_two {n : ℕ+} : n < 2 → n = 1 :=
by
intro h; apply le_antisymm; swap; apply PNat.one_le
@@ -159,22 +147,10 @@ def Prime (p : ℕ+) : Prop :=
#align pnat.prime PNat.Prime
-/
-/- warning: pnat.prime.one_lt -> PNat.Prime.one_lt is a dubious translation:
-lean 3 declaration is
- forall {p : PNat}, (PNat.Prime p) -> (LT.lt.{0} PNat (Preorder.toHasLt.{0} PNat (PartialOrder.toPreorder.{0} PNat (OrderedCancelCommMonoid.toPartialOrder.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat PNat.linearOrderedCancelCommMonoid)))) (OfNat.ofNat.{0} PNat 1 (OfNat.mk.{0} PNat 1 (One.one.{0} PNat PNat.hasOne))) p)
-but is expected to have type
- forall {p : PNat}, (PNat.Prime p) -> (LT.lt.{0} PNat (Preorder.toLT.{0} PNat (PartialOrder.toPreorder.{0} PNat (OrderedCancelCommMonoid.toPartialOrder.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat instPNatLinearOrderedCancelCommMonoid)))) (OfNat.ofNat.{0} PNat 1 (instOfNatPNatHAddNatInstHAddInstAddNatOfNat (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)))) p)
-Case conversion may be inaccurate. Consider using '#align pnat.prime.one_lt PNat.Prime.one_ltₓ'. -/
theorem Prime.one_lt {p : ℕ+} : p.Prime → 1 < p :=
Nat.Prime.one_lt
#align pnat.prime.one_lt PNat.Prime.one_lt
-/- warning: pnat.prime_two -> PNat.prime_two is a dubious translation:
-lean 3 declaration is
- PNat.Prime (OfNat.ofNat.{0} PNat 2 (OfNat.mk.{0} PNat 2 (bit0.{0} PNat PNat.hasAdd (One.one.{0} PNat PNat.hasOne))))
-but is expected to have type
- PNat.Prime (OfNat.ofNat.{0} PNat 2 (instOfNatPNatHAddNatInstHAddInstAddNatOfNat (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))
-Case conversion may be inaccurate. Consider using '#align pnat.prime_two PNat.prime_twoₓ'. -/
theorem prime_two : (2 : ℕ+).Prime :=
Nat.prime_two
#align pnat.prime_two PNat.prime_two
@@ -233,22 +209,10 @@ theorem coprime_coe {m n : ℕ+} : Nat.coprime ↑m ↑n ↔ m.coprime n := by u
#align pnat.coprime_coe PNat.coprime_coe
-/
-/- warning: pnat.coprime.mul -> PNat.Coprime.mul is a dubious translation:
-lean 3 declaration is
- forall {k : PNat} {m : PNat} {n : PNat}, (PNat.Coprime m k) -> (PNat.Coprime n k) -> (PNat.Coprime (HMul.hMul.{0, 0, 0} PNat PNat PNat (instHMul.{0} PNat PNat.hasMul) m n) k)
-but is expected to have type
- forall {k : PNat} {m : PNat} {n : PNat}, (PNat.Coprime m k) -> (PNat.Coprime n k) -> (PNat.Coprime (HMul.hMul.{0, 0, 0} PNat PNat PNat (instHMul.{0} PNat instPNatMul) m n) k)
-Case conversion may be inaccurate. Consider using '#align pnat.coprime.mul PNat.Coprime.mulₓ'. -/
theorem Coprime.mul {k m n : ℕ+} : m.coprime k → n.coprime k → (m * n).coprime k := by
repeat' rw [← coprime_coe]; rw [mul_coe]; apply Nat.coprime.mul
#align pnat.coprime.mul PNat.Coprime.mul
-/- warning: pnat.coprime.mul_right -> PNat.Coprime.mul_right is a dubious translation:
-lean 3 declaration is
- forall {k : PNat} {m : PNat} {n : PNat}, (PNat.Coprime k m) -> (PNat.Coprime k n) -> (PNat.Coprime k (HMul.hMul.{0, 0, 0} PNat PNat PNat (instHMul.{0} PNat PNat.hasMul) m n))
-but is expected to have type
- forall {k : PNat} {m : PNat} {n : PNat}, (PNat.Coprime k m) -> (PNat.Coprime k n) -> (PNat.Coprime k (HMul.hMul.{0, 0, 0} PNat PNat PNat (instHMul.{0} PNat instPNatMul) m n))
-Case conversion may be inaccurate. Consider using '#align pnat.coprime.mul_right PNat.Coprime.mul_rightₓ'. -/
theorem Coprime.mul_right {k m n : ℕ+} : k.coprime m → k.coprime n → k.coprime (m * n) := by
repeat' rw [← coprime_coe]; rw [mul_coe]; apply Nat.coprime.mul_right
#align pnat.coprime.mul_right PNat.Coprime.mul_right
@@ -271,45 +235,21 @@ theorem gcd_eq_right_iff_dvd {m n : ℕ+} : m ∣ n ↔ n.gcd m = m := by rw [gc
#align pnat.gcd_eq_right_iff_dvd PNat.gcd_eq_right_iff_dvd
-/
-/- warning: pnat.coprime.gcd_mul_left_cancel -> PNat.Coprime.gcd_mul_left_cancel is a dubious translation:
-lean 3 declaration is
- forall (m : PNat) {n : PNat} {k : PNat}, (PNat.Coprime k n) -> (Eq.{1} PNat (PNat.gcd (HMul.hMul.{0, 0, 0} PNat PNat PNat (instHMul.{0} PNat PNat.hasMul) k m) n) (PNat.gcd m n))
-but is expected to have type
- forall (m : PNat) {n : PNat} {k : PNat}, (PNat.Coprime k n) -> (Eq.{1} PNat (PNat.gcd (HMul.hMul.{0, 0, 0} PNat PNat PNat (instHMul.{0} PNat instPNatMul) k m) n) (PNat.gcd m n))
-Case conversion may be inaccurate. Consider using '#align pnat.coprime.gcd_mul_left_cancel PNat.Coprime.gcd_mul_left_cancelₓ'. -/
theorem Coprime.gcd_mul_left_cancel (m : ℕ+) {n k : ℕ+} : k.coprime n → (k * m).gcd n = m.gcd n :=
by
intro h; apply Eq; simp only [gcd_coe, mul_coe]
apply Nat.coprime.gcd_mul_left_cancel; simpa
#align pnat.coprime.gcd_mul_left_cancel PNat.Coprime.gcd_mul_left_cancel
-/- warning: pnat.coprime.gcd_mul_right_cancel -> PNat.Coprime.gcd_mul_right_cancel is a dubious translation:
-lean 3 declaration is
- forall (m : PNat) {n : PNat} {k : PNat}, (PNat.Coprime k n) -> (Eq.{1} PNat (PNat.gcd (HMul.hMul.{0, 0, 0} PNat PNat PNat (instHMul.{0} PNat PNat.hasMul) m k) n) (PNat.gcd m n))
-but is expected to have type
- forall (m : PNat) {n : PNat} {k : PNat}, (PNat.Coprime k n) -> (Eq.{1} PNat (PNat.gcd (HMul.hMul.{0, 0, 0} PNat PNat PNat (instHMul.{0} PNat instPNatMul) m k) n) (PNat.gcd m n))
-Case conversion may be inaccurate. Consider using '#align pnat.coprime.gcd_mul_right_cancel PNat.Coprime.gcd_mul_right_cancelₓ'. -/
theorem Coprime.gcd_mul_right_cancel (m : ℕ+) {n k : ℕ+} : k.coprime n → (m * k).gcd n = m.gcd n :=
by rw [mul_comm]; apply coprime.gcd_mul_left_cancel
#align pnat.coprime.gcd_mul_right_cancel PNat.Coprime.gcd_mul_right_cancel
-/- warning: pnat.coprime.gcd_mul_left_cancel_right -> PNat.Coprime.gcd_mul_left_cancel_right is a dubious translation:
-lean 3 declaration is
- forall (m : PNat) {n : PNat} {k : PNat}, (PNat.Coprime k m) -> (Eq.{1} PNat (PNat.gcd m (HMul.hMul.{0, 0, 0} PNat PNat PNat (instHMul.{0} PNat PNat.hasMul) k n)) (PNat.gcd m n))
-but is expected to have type
- forall (m : PNat) {n : PNat} {k : PNat}, (PNat.Coprime k m) -> (Eq.{1} PNat (PNat.gcd m (HMul.hMul.{0, 0, 0} PNat PNat PNat (instHMul.{0} PNat instPNatMul) k n)) (PNat.gcd m n))
-Case conversion may be inaccurate. Consider using '#align pnat.coprime.gcd_mul_left_cancel_right PNat.Coprime.gcd_mul_left_cancel_rightₓ'. -/
theorem Coprime.gcd_mul_left_cancel_right (m : ℕ+) {n k : ℕ+} :
k.coprime m → m.gcd (k * n) = m.gcd n := by intro h; iterate 2 rw [gcd_comm]; symm;
apply coprime.gcd_mul_left_cancel _ h
#align pnat.coprime.gcd_mul_left_cancel_right PNat.Coprime.gcd_mul_left_cancel_right
-/- warning: pnat.coprime.gcd_mul_right_cancel_right -> PNat.Coprime.gcd_mul_right_cancel_right is a dubious translation:
-lean 3 declaration is
- forall (m : PNat) {n : PNat} {k : PNat}, (PNat.Coprime k m) -> (Eq.{1} PNat (PNat.gcd m (HMul.hMul.{0, 0, 0} PNat PNat PNat (instHMul.{0} PNat PNat.hasMul) n k)) (PNat.gcd m n))
-but is expected to have type
- forall (m : PNat) {n : PNat} {k : PNat}, (PNat.Coprime k m) -> (Eq.{1} PNat (PNat.gcd m (HMul.hMul.{0, 0, 0} PNat PNat PNat (instHMul.{0} PNat instPNatMul) n k)) (PNat.gcd m n))
-Case conversion may be inaccurate. Consider using '#align pnat.coprime.gcd_mul_right_cancel_right PNat.Coprime.gcd_mul_right_cancel_rightₓ'. -/
theorem Coprime.gcd_mul_right_cancel_right (m : ℕ+) {n k : ℕ+} :
k.coprime m → m.gcd (n * k) = m.gcd n := by rw [mul_comm];
apply coprime.gcd_mul_left_cancel_right
@@ -354,12 +294,6 @@ theorem Coprime.coprime_dvd_left {m k n : ℕ+} : m ∣ k → k.coprime n → m.
#align pnat.coprime.coprime_dvd_left PNat.Coprime.coprime_dvd_left
-/
-/- warning: pnat.coprime.factor_eq_gcd_left -> PNat.Coprime.factor_eq_gcd_left is a dubious translation:
-lean 3 declaration is
- forall {a : PNat} {b : PNat} {m : PNat} {n : PNat}, (PNat.Coprime m n) -> (Dvd.Dvd.{0} PNat (semigroupDvd.{0} PNat (Monoid.toSemigroup.{0} PNat (RightCancelMonoid.toMonoid.{0} PNat (CancelMonoid.toRightCancelMonoid.{0} PNat (CancelCommMonoid.toCancelMonoid.{0} PNat (OrderedCancelCommMonoid.toCancelCommMonoid.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat PNat.linearOrderedCancelCommMonoid))))))) a m) -> (Dvd.Dvd.{0} PNat (semigroupDvd.{0} PNat (Monoid.toSemigroup.{0} PNat (RightCancelMonoid.toMonoid.{0} PNat (CancelMonoid.toRightCancelMonoid.{0} PNat (CancelCommMonoid.toCancelMonoid.{0} PNat (OrderedCancelCommMonoid.toCancelCommMonoid.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat PNat.linearOrderedCancelCommMonoid))))))) b n) -> (Eq.{1} PNat a (PNat.gcd (HMul.hMul.{0, 0, 0} PNat PNat PNat (instHMul.{0} PNat PNat.hasMul) a b) m))
-but is expected to have type
- forall {a : PNat} {b : PNat} {m : PNat} {n : PNat}, (PNat.Coprime m n) -> (Dvd.dvd.{0} PNat (semigroupDvd.{0} PNat (Monoid.toSemigroup.{0} PNat (RightCancelMonoid.toMonoid.{0} PNat (CancelMonoid.toRightCancelMonoid.{0} PNat (CancelCommMonoid.toCancelMonoid.{0} PNat (OrderedCancelCommMonoid.toCancelCommMonoid.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat instPNatLinearOrderedCancelCommMonoid))))))) a m) -> (Dvd.dvd.{0} PNat (semigroupDvd.{0} PNat (Monoid.toSemigroup.{0} PNat (RightCancelMonoid.toMonoid.{0} PNat (CancelMonoid.toRightCancelMonoid.{0} PNat (CancelCommMonoid.toCancelMonoid.{0} PNat (OrderedCancelCommMonoid.toCancelCommMonoid.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat instPNatLinearOrderedCancelCommMonoid))))))) b n) -> (Eq.{1} PNat a (PNat.gcd (HMul.hMul.{0, 0, 0} PNat PNat PNat (instHMul.{0} PNat instPNatMul) a b) m))
-Case conversion may be inaccurate. Consider using '#align pnat.coprime.factor_eq_gcd_left PNat.Coprime.factor_eq_gcd_leftₓ'. -/
theorem Coprime.factor_eq_gcd_left {a b m n : ℕ+} (cop : m.coprime n) (am : a ∣ m) (bn : b ∣ n) :
a = (a * b).gcd m := by
rw [gcd_eq_left_iff_dvd] at am
@@ -368,43 +302,19 @@ theorem Coprime.factor_eq_gcd_left {a b m n : ℕ+} (cop : m.coprime n) (am : a
apply coprime.coprime_dvd_left bn cop.symm
#align pnat.coprime.factor_eq_gcd_left PNat.Coprime.factor_eq_gcd_left
-/- warning: pnat.coprime.factor_eq_gcd_right -> PNat.Coprime.factor_eq_gcd_right is a dubious translation:
-lean 3 declaration is
- forall {a : PNat} {b : PNat} {m : PNat} {n : PNat}, (PNat.Coprime m n) -> (Dvd.Dvd.{0} PNat (semigroupDvd.{0} PNat (Monoid.toSemigroup.{0} PNat (RightCancelMonoid.toMonoid.{0} PNat (CancelMonoid.toRightCancelMonoid.{0} PNat (CancelCommMonoid.toCancelMonoid.{0} PNat (OrderedCancelCommMonoid.toCancelCommMonoid.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat PNat.linearOrderedCancelCommMonoid))))))) a m) -> (Dvd.Dvd.{0} PNat (semigroupDvd.{0} PNat (Monoid.toSemigroup.{0} PNat (RightCancelMonoid.toMonoid.{0} PNat (CancelMonoid.toRightCancelMonoid.{0} PNat (CancelCommMonoid.toCancelMonoid.{0} PNat (OrderedCancelCommMonoid.toCancelCommMonoid.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat PNat.linearOrderedCancelCommMonoid))))))) b n) -> (Eq.{1} PNat a (PNat.gcd (HMul.hMul.{0, 0, 0} PNat PNat PNat (instHMul.{0} PNat PNat.hasMul) b a) m))
-but is expected to have type
- forall {a : PNat} {b : PNat} {m : PNat} {n : PNat}, (PNat.Coprime m n) -> (Dvd.dvd.{0} PNat (semigroupDvd.{0} PNat (Monoid.toSemigroup.{0} PNat (RightCancelMonoid.toMonoid.{0} PNat (CancelMonoid.toRightCancelMonoid.{0} PNat (CancelCommMonoid.toCancelMonoid.{0} PNat (OrderedCancelCommMonoid.toCancelCommMonoid.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat instPNatLinearOrderedCancelCommMonoid))))))) a m) -> (Dvd.dvd.{0} PNat (semigroupDvd.{0} PNat (Monoid.toSemigroup.{0} PNat (RightCancelMonoid.toMonoid.{0} PNat (CancelMonoid.toRightCancelMonoid.{0} PNat (CancelCommMonoid.toCancelMonoid.{0} PNat (OrderedCancelCommMonoid.toCancelCommMonoid.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat instPNatLinearOrderedCancelCommMonoid))))))) b n) -> (Eq.{1} PNat a (PNat.gcd (HMul.hMul.{0, 0, 0} PNat PNat PNat (instHMul.{0} PNat instPNatMul) b a) m))
-Case conversion may be inaccurate. Consider using '#align pnat.coprime.factor_eq_gcd_right PNat.Coprime.factor_eq_gcd_rightₓ'. -/
theorem Coprime.factor_eq_gcd_right {a b m n : ℕ+} (cop : m.coprime n) (am : a ∣ m) (bn : b ∣ n) :
a = (b * a).gcd m := by rw [mul_comm]; apply coprime.factor_eq_gcd_left cop am bn
#align pnat.coprime.factor_eq_gcd_right PNat.Coprime.factor_eq_gcd_right
-/- warning: pnat.coprime.factor_eq_gcd_left_right -> PNat.Coprime.factor_eq_gcd_left_right is a dubious translation:
-lean 3 declaration is
- forall {a : PNat} {b : PNat} {m : PNat} {n : PNat}, (PNat.Coprime m n) -> (Dvd.Dvd.{0} PNat (semigroupDvd.{0} PNat (Monoid.toSemigroup.{0} PNat (RightCancelMonoid.toMonoid.{0} PNat (CancelMonoid.toRightCancelMonoid.{0} PNat (CancelCommMonoid.toCancelMonoid.{0} PNat (OrderedCancelCommMonoid.toCancelCommMonoid.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat PNat.linearOrderedCancelCommMonoid))))))) a m) -> (Dvd.Dvd.{0} PNat (semigroupDvd.{0} PNat (Monoid.toSemigroup.{0} PNat (RightCancelMonoid.toMonoid.{0} PNat (CancelMonoid.toRightCancelMonoid.{0} PNat (CancelCommMonoid.toCancelMonoid.{0} PNat (OrderedCancelCommMonoid.toCancelCommMonoid.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat PNat.linearOrderedCancelCommMonoid))))))) b n) -> (Eq.{1} PNat a (PNat.gcd m (HMul.hMul.{0, 0, 0} PNat PNat PNat (instHMul.{0} PNat PNat.hasMul) a b)))
-but is expected to have type
- forall {a : PNat} {b : PNat} {m : PNat} {n : PNat}, (PNat.Coprime m n) -> (Dvd.dvd.{0} PNat (semigroupDvd.{0} PNat (Monoid.toSemigroup.{0} PNat (RightCancelMonoid.toMonoid.{0} PNat (CancelMonoid.toRightCancelMonoid.{0} PNat (CancelCommMonoid.toCancelMonoid.{0} PNat (OrderedCancelCommMonoid.toCancelCommMonoid.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat instPNatLinearOrderedCancelCommMonoid))))))) a m) -> (Dvd.dvd.{0} PNat (semigroupDvd.{0} PNat (Monoid.toSemigroup.{0} PNat (RightCancelMonoid.toMonoid.{0} PNat (CancelMonoid.toRightCancelMonoid.{0} PNat (CancelCommMonoid.toCancelMonoid.{0} PNat (OrderedCancelCommMonoid.toCancelCommMonoid.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat instPNatLinearOrderedCancelCommMonoid))))))) b n) -> (Eq.{1} PNat a (PNat.gcd m (HMul.hMul.{0, 0, 0} PNat PNat PNat (instHMul.{0} PNat instPNatMul) a b)))
-Case conversion may be inaccurate. Consider using '#align pnat.coprime.factor_eq_gcd_left_right PNat.Coprime.factor_eq_gcd_left_rightₓ'. -/
theorem Coprime.factor_eq_gcd_left_right {a b m n : ℕ+} (cop : m.coprime n) (am : a ∣ m)
(bn : b ∣ n) : a = m.gcd (a * b) := by rw [gcd_comm]; apply coprime.factor_eq_gcd_left cop am bn
#align pnat.coprime.factor_eq_gcd_left_right PNat.Coprime.factor_eq_gcd_left_right
-/- warning: pnat.coprime.factor_eq_gcd_right_right -> PNat.Coprime.factor_eq_gcd_right_right is a dubious translation:
-lean 3 declaration is
- forall {a : PNat} {b : PNat} {m : PNat} {n : PNat}, (PNat.Coprime m n) -> (Dvd.Dvd.{0} PNat (semigroupDvd.{0} PNat (Monoid.toSemigroup.{0} PNat (RightCancelMonoid.toMonoid.{0} PNat (CancelMonoid.toRightCancelMonoid.{0} PNat (CancelCommMonoid.toCancelMonoid.{0} PNat (OrderedCancelCommMonoid.toCancelCommMonoid.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat PNat.linearOrderedCancelCommMonoid))))))) a m) -> (Dvd.Dvd.{0} PNat (semigroupDvd.{0} PNat (Monoid.toSemigroup.{0} PNat (RightCancelMonoid.toMonoid.{0} PNat (CancelMonoid.toRightCancelMonoid.{0} PNat (CancelCommMonoid.toCancelMonoid.{0} PNat (OrderedCancelCommMonoid.toCancelCommMonoid.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat PNat.linearOrderedCancelCommMonoid))))))) b n) -> (Eq.{1} PNat a (PNat.gcd m (HMul.hMul.{0, 0, 0} PNat PNat PNat (instHMul.{0} PNat PNat.hasMul) b a)))
-but is expected to have type
- forall {a : PNat} {b : PNat} {m : PNat} {n : PNat}, (PNat.Coprime m n) -> (Dvd.dvd.{0} PNat (semigroupDvd.{0} PNat (Monoid.toSemigroup.{0} PNat (RightCancelMonoid.toMonoid.{0} PNat (CancelMonoid.toRightCancelMonoid.{0} PNat (CancelCommMonoid.toCancelMonoid.{0} PNat (OrderedCancelCommMonoid.toCancelCommMonoid.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat instPNatLinearOrderedCancelCommMonoid))))))) a m) -> (Dvd.dvd.{0} PNat (semigroupDvd.{0} PNat (Monoid.toSemigroup.{0} PNat (RightCancelMonoid.toMonoid.{0} PNat (CancelMonoid.toRightCancelMonoid.{0} PNat (CancelCommMonoid.toCancelMonoid.{0} PNat (OrderedCancelCommMonoid.toCancelCommMonoid.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat instPNatLinearOrderedCancelCommMonoid))))))) b n) -> (Eq.{1} PNat a (PNat.gcd m (HMul.hMul.{0, 0, 0} PNat PNat PNat (instHMul.{0} PNat instPNatMul) b a)))
-Case conversion may be inaccurate. Consider using '#align pnat.coprime.factor_eq_gcd_right_right PNat.Coprime.factor_eq_gcd_right_rightₓ'. -/
theorem Coprime.factor_eq_gcd_right_right {a b m n : ℕ+} (cop : m.coprime n) (am : a ∣ m)
(bn : b ∣ n) : a = m.gcd (b * a) := by rw [gcd_comm];
apply coprime.factor_eq_gcd_right cop am bn
#align pnat.coprime.factor_eq_gcd_right_right PNat.Coprime.factor_eq_gcd_right_right
-/- warning: pnat.coprime.gcd_mul -> PNat.Coprime.gcd_mul is a dubious translation:
-lean 3 declaration is
- forall (k : PNat) {m : PNat} {n : PNat}, (PNat.Coprime m n) -> (Eq.{1} PNat (PNat.gcd k (HMul.hMul.{0, 0, 0} PNat PNat PNat (instHMul.{0} PNat PNat.hasMul) m n)) (HMul.hMul.{0, 0, 0} PNat PNat PNat (instHMul.{0} PNat PNat.hasMul) (PNat.gcd k m) (PNat.gcd k n)))
-but is expected to have type
- forall (k : PNat) {m : PNat} {n : PNat}, (PNat.Coprime m n) -> (Eq.{1} PNat (PNat.gcd k (HMul.hMul.{0, 0, 0} PNat PNat PNat (instHMul.{0} PNat instPNatMul) m n)) (HMul.hMul.{0, 0, 0} PNat PNat PNat (instHMul.{0} PNat instPNatMul) (PNat.gcd k m) (PNat.gcd k n)))
-Case conversion may be inaccurate. Consider using '#align pnat.coprime.gcd_mul PNat.Coprime.gcd_mulₓ'. -/
theorem Coprime.gcd_mul (k : ℕ+) {m n : ℕ+} (h : m.coprime n) : k.gcd (m * n) = k.gcd m * k.gcd n :=
by
rw [← coprime_coe] at h; apply Eq
@@ -417,12 +327,6 @@ theorem gcd_eq_left {m n : ℕ+} : m ∣ n → m.gcd n = m := by rw [dvd_iff]; i
#align pnat.gcd_eq_left PNat.gcd_eq_left
-/
-/- warning: pnat.coprime.pow -> PNat.Coprime.pow is a dubious translation:
-lean 3 declaration is
- forall {m : PNat} {n : PNat} (k : Nat) (l : Nat), (PNat.Coprime m n) -> (PNat.Coprime (HPow.hPow.{0, 0, 0} PNat Nat PNat (instHPow.{0, 0} PNat Nat (Monoid.Pow.{0} PNat (RightCancelMonoid.toMonoid.{0} PNat (CancelMonoid.toRightCancelMonoid.{0} PNat (CancelCommMonoid.toCancelMonoid.{0} PNat (OrderedCancelCommMonoid.toCancelCommMonoid.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat PNat.linearOrderedCancelCommMonoid))))))) m k) (HPow.hPow.{0, 0, 0} PNat Nat PNat (instHPow.{0, 0} PNat Nat (Monoid.Pow.{0} PNat (RightCancelMonoid.toMonoid.{0} PNat (CancelMonoid.toRightCancelMonoid.{0} PNat (CancelCommMonoid.toCancelMonoid.{0} PNat (OrderedCancelCommMonoid.toCancelCommMonoid.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat PNat.linearOrderedCancelCommMonoid))))))) n l))
-but is expected to have type
- forall {m : PNat} {n : PNat} (k : Nat) (l : Nat), (PNat.Coprime m n) -> (Nat.coprime (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (PNat.val m) k) (HPow.hPow.{0, 0, 0} Nat Nat Nat (instHPow.{0, 0} Nat Nat instPowNat) (PNat.val n) l))
-Case conversion may be inaccurate. Consider using '#align pnat.coprime.pow PNat.Coprime.powₓ'. -/
theorem Coprime.pow {m n : ℕ+} (k l : ℕ) (h : m.coprime n) : (m ^ k).coprime (n ^ l) := by
rw [← coprime_coe] at *; simp only [pow_coe]; apply Nat.coprime.pow; apply h
#align pnat.coprime.pow PNat.Coprime.pow
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -180,22 +180,14 @@ theorem prime_two : (2 : ℕ+).Prime :=
#align pnat.prime_two PNat.prime_two
#print PNat.dvd_prime /-
-theorem dvd_prime {p m : ℕ+} (pp : p.Prime) : m ∣ p ↔ m = 1 ∨ m = p :=
- by
- rw [PNat.dvd_iff]
- rw [Nat.dvd_prime pp]
- simp
+theorem dvd_prime {p m : ℕ+} (pp : p.Prime) : m ∣ p ↔ m = 1 ∨ m = p := by rw [PNat.dvd_iff];
+ rw [Nat.dvd_prime pp]; simp
#align pnat.dvd_prime PNat.dvd_prime
-/
#print PNat.Prime.ne_one /-
-theorem Prime.ne_one {p : ℕ+} : p.Prime → p ≠ 1 :=
- by
- intro pp
- intro contra
- apply Nat.Prime.ne_one pp
- rw [PNat.coe_eq_one_iff]
- apply contra
+theorem Prime.ne_one {p : ℕ+} : p.Prime → p ≠ 1 := by intro pp; intro contra;
+ apply Nat.Prime.ne_one pp; rw [PNat.coe_eq_one_iff]; apply contra
#align pnat.prime.ne_one PNat.Prime.ne_one
-/
@@ -207,9 +199,7 @@ theorem not_prime_one : ¬(1 : ℕ+).Prime :=
-/
#print PNat.Prime.not_dvd_one /-
-theorem Prime.not_dvd_one {p : ℕ+} : p.Prime → ¬p ∣ 1 := fun pp : p.Prime =>
- by
- rw [dvd_iff]
+theorem Prime.not_dvd_one {p : ℕ+} : p.Prime → ¬p ∣ 1 := fun pp : p.Prime => by rw [dvd_iff];
apply Nat.Prime.not_dvd_one pp
#align pnat.prime.not_dvd_one PNat.Prime.not_dvd_one
-/
@@ -238,12 +228,8 @@ def Coprime (m n : ℕ+) : Prop :=
#print PNat.coprime_coe /-
@[simp, norm_cast]
-theorem coprime_coe {m n : ℕ+} : Nat.coprime ↑m ↑n ↔ m.coprime n :=
- by
- unfold coprime
- unfold Nat.coprime
- rw [← coe_inj]
- simp
+theorem coprime_coe {m n : ℕ+} : Nat.coprime ↑m ↑n ↔ m.coprime n := by unfold coprime;
+ unfold Nat.coprime; rw [← coe_inj]; simp
#align pnat.coprime_coe PNat.coprime_coe
-/
@@ -253,11 +239,8 @@ lean 3 declaration is
but is expected to have type
forall {k : PNat} {m : PNat} {n : PNat}, (PNat.Coprime m k) -> (PNat.Coprime n k) -> (PNat.Coprime (HMul.hMul.{0, 0, 0} PNat PNat PNat (instHMul.{0} PNat instPNatMul) m n) k)
Case conversion may be inaccurate. Consider using '#align pnat.coprime.mul PNat.Coprime.mulₓ'. -/
-theorem Coprime.mul {k m n : ℕ+} : m.coprime k → n.coprime k → (m * n).coprime k :=
- by
- repeat' rw [← coprime_coe]
- rw [mul_coe]
- apply Nat.coprime.mul
+theorem Coprime.mul {k m n : ℕ+} : m.coprime k → n.coprime k → (m * n).coprime k := by
+ repeat' rw [← coprime_coe]; rw [mul_coe]; apply Nat.coprime.mul
#align pnat.coprime.mul PNat.Coprime.mul
/- warning: pnat.coprime.mul_right -> PNat.Coprime.mul_right is a dubious translation:
@@ -266,36 +249,24 @@ lean 3 declaration is
but is expected to have type
forall {k : PNat} {m : PNat} {n : PNat}, (PNat.Coprime k m) -> (PNat.Coprime k n) -> (PNat.Coprime k (HMul.hMul.{0, 0, 0} PNat PNat PNat (instHMul.{0} PNat instPNatMul) m n))
Case conversion may be inaccurate. Consider using '#align pnat.coprime.mul_right PNat.Coprime.mul_rightₓ'. -/
-theorem Coprime.mul_right {k m n : ℕ+} : k.coprime m → k.coprime n → k.coprime (m * n) :=
- by
- repeat' rw [← coprime_coe]
- rw [mul_coe]
- apply Nat.coprime.mul_right
+theorem Coprime.mul_right {k m n : ℕ+} : k.coprime m → k.coprime n → k.coprime (m * n) := by
+ repeat' rw [← coprime_coe]; rw [mul_coe]; apply Nat.coprime.mul_right
#align pnat.coprime.mul_right PNat.Coprime.mul_right
#print PNat.gcd_comm /-
-theorem gcd_comm {m n : ℕ+} : m.gcd n = n.gcd m :=
- by
- apply Eq
- simp only [gcd_coe]
+theorem gcd_comm {m n : ℕ+} : m.gcd n = n.gcd m := by apply Eq; simp only [gcd_coe];
apply Nat.gcd_comm
#align pnat.gcd_comm PNat.gcd_comm
-/
#print PNat.gcd_eq_left_iff_dvd /-
-theorem gcd_eq_left_iff_dvd {m n : ℕ+} : m ∣ n ↔ m.gcd n = m :=
- by
- rw [dvd_iff]
- rw [Nat.gcd_eq_left_iff_dvd]
- rw [← coe_inj]
- simp
+theorem gcd_eq_left_iff_dvd {m n : ℕ+} : m ∣ n ↔ m.gcd n = m := by rw [dvd_iff];
+ rw [Nat.gcd_eq_left_iff_dvd]; rw [← coe_inj]; simp
#align pnat.gcd_eq_left_iff_dvd PNat.gcd_eq_left_iff_dvd
-/
#print PNat.gcd_eq_right_iff_dvd /-
-theorem gcd_eq_right_iff_dvd {m n : ℕ+} : m ∣ n ↔ n.gcd m = m :=
- by
- rw [gcd_comm]
+theorem gcd_eq_right_iff_dvd {m n : ℕ+} : m ∣ n ↔ n.gcd m = m := by rw [gcd_comm];
apply gcd_eq_left_iff_dvd
#align pnat.gcd_eq_right_iff_dvd PNat.gcd_eq_right_iff_dvd
-/
@@ -346,27 +317,19 @@ theorem Coprime.gcd_mul_right_cancel_right (m : ℕ+) {n k : ℕ+} :
#print PNat.one_gcd /-
@[simp]
-theorem one_gcd {n : ℕ+} : gcd 1 n = 1 :=
- by
- rw [← gcd_eq_left_iff_dvd]
- apply one_dvd
+theorem one_gcd {n : ℕ+} : gcd 1 n = 1 := by rw [← gcd_eq_left_iff_dvd]; apply one_dvd
#align pnat.one_gcd PNat.one_gcd
-/
#print PNat.gcd_one /-
@[simp]
-theorem gcd_one {n : ℕ+} : gcd n 1 = 1 := by
- rw [gcd_comm]
- apply one_gcd
+theorem gcd_one {n : ℕ+} : gcd n 1 = 1 := by rw [gcd_comm]; apply one_gcd
#align pnat.gcd_one PNat.gcd_one
-/
#print PNat.Coprime.symm /-
@[symm]
-theorem Coprime.symm {m n : ℕ+} : m.coprime n → n.coprime m :=
- by
- unfold coprime
- rw [gcd_comm]
+theorem Coprime.symm {m n : ℕ+} : m.coprime n → n.coprime m := by unfold coprime; rw [gcd_comm];
simp
#align pnat.coprime.symm PNat.Coprime.symm
-/
@@ -386,11 +349,8 @@ theorem coprime_one {n : ℕ+} : n.coprime 1 :=
-/
#print PNat.Coprime.coprime_dvd_left /-
-theorem Coprime.coprime_dvd_left {m k n : ℕ+} : m ∣ k → k.coprime n → m.coprime n :=
- by
- rw [dvd_iff]
- repeat' rw [← coprime_coe]
- apply Nat.coprime.coprime_dvd_left
+theorem Coprime.coprime_dvd_left {m k n : ℕ+} : m ∣ k → k.coprime n → m.coprime n := by
+ rw [dvd_iff]; repeat' rw [← coprime_coe]; apply Nat.coprime.coprime_dvd_left
#align pnat.coprime.coprime_dvd_left PNat.Coprime.coprime_dvd_left
-/
@@ -452,13 +412,8 @@ theorem Coprime.gcd_mul (k : ℕ+) {m n : ℕ+} (h : m.coprime n) : k.gcd (m * n
#align pnat.coprime.gcd_mul PNat.Coprime.gcd_mul
#print PNat.gcd_eq_left /-
-theorem gcd_eq_left {m n : ℕ+} : m ∣ n → m.gcd n = m :=
- by
- rw [dvd_iff]
- intro h
- apply Eq
- simp only [gcd_coe]
- apply Nat.gcd_eq_left h
+theorem gcd_eq_left {m n : ℕ+} : m ∣ n → m.gcd n = m := by rw [dvd_iff]; intro h; apply Eq;
+ simp only [gcd_coe]; apply Nat.gcd_eq_left h
#align pnat.gcd_eq_left PNat.gcd_eq_left
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8
@@ -137,7 +137,7 @@ theorem gcd_mul_lcm (n m : ℕ+) : gcd n m * lcm n m = n * m :=
/- warning: pnat.eq_one_of_lt_two -> PNat.eq_one_of_lt_two is a dubious translation:
lean 3 declaration is
- forall {n : PNat}, (LT.lt.{0} PNat (Preorder.toLT.{0} PNat (PartialOrder.toPreorder.{0} PNat (OrderedCancelCommMonoid.toPartialOrder.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat PNat.linearOrderedCancelCommMonoid)))) n (OfNat.ofNat.{0} PNat 2 (OfNat.mk.{0} PNat 2 (bit0.{0} PNat PNat.hasAdd (One.one.{0} PNat PNat.hasOne))))) -> (Eq.{1} PNat n (OfNat.ofNat.{0} PNat 1 (OfNat.mk.{0} PNat 1 (One.one.{0} PNat PNat.hasOne))))
+ forall {n : PNat}, (LT.lt.{0} PNat (Preorder.toHasLt.{0} PNat (PartialOrder.toPreorder.{0} PNat (OrderedCancelCommMonoid.toPartialOrder.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat PNat.linearOrderedCancelCommMonoid)))) n (OfNat.ofNat.{0} PNat 2 (OfNat.mk.{0} PNat 2 (bit0.{0} PNat PNat.hasAdd (One.one.{0} PNat PNat.hasOne))))) -> (Eq.{1} PNat n (OfNat.ofNat.{0} PNat 1 (OfNat.mk.{0} PNat 1 (One.one.{0} PNat PNat.hasOne))))
but is expected to have type
forall {n : PNat}, (LT.lt.{0} PNat (Preorder.toLT.{0} PNat (PartialOrder.toPreorder.{0} PNat (OrderedCancelCommMonoid.toPartialOrder.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat instPNatLinearOrderedCancelCommMonoid)))) n (OfNat.ofNat.{0} PNat 2 (instOfNatPNatHAddNatInstHAddInstAddNatOfNat (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))) -> (Eq.{1} PNat n (OfNat.ofNat.{0} PNat 1 (instOfNatPNatHAddNatInstHAddInstAddNatOfNat (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)))))
Case conversion may be inaccurate. Consider using '#align pnat.eq_one_of_lt_two PNat.eq_one_of_lt_twoₓ'. -/
@@ -159,11 +159,15 @@ def Prime (p : ℕ+) : Prop :=
#align pnat.prime PNat.Prime
-/
-#print PNat.Prime.one_lt /-
+/- warning: pnat.prime.one_lt -> PNat.Prime.one_lt is a dubious translation:
+lean 3 declaration is
+ forall {p : PNat}, (PNat.Prime p) -> (LT.lt.{0} PNat (Preorder.toHasLt.{0} PNat (PartialOrder.toPreorder.{0} PNat (OrderedCancelCommMonoid.toPartialOrder.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat PNat.linearOrderedCancelCommMonoid)))) (OfNat.ofNat.{0} PNat 1 (OfNat.mk.{0} PNat 1 (One.one.{0} PNat PNat.hasOne))) p)
+but is expected to have type
+ forall {p : PNat}, (PNat.Prime p) -> (LT.lt.{0} PNat (Preorder.toLT.{0} PNat (PartialOrder.toPreorder.{0} PNat (OrderedCancelCommMonoid.toPartialOrder.{0} PNat (LinearOrderedCancelCommMonoid.toOrderedCancelCommMonoid.{0} PNat instPNatLinearOrderedCancelCommMonoid)))) (OfNat.ofNat.{0} PNat 1 (instOfNatPNatHAddNatInstHAddInstAddNatOfNat (OfNat.ofNat.{0} Nat 0 (instOfNatNat 0)))) p)
+Case conversion may be inaccurate. Consider using '#align pnat.prime.one_lt PNat.Prime.one_ltₓ'. -/
theorem Prime.one_lt {p : ℕ+} : p.Prime → 1 < p :=
Nat.Prime.one_lt
#align pnat.prime.one_lt PNat.Prime.one_lt
--/
/- warning: pnat.prime_two -> PNat.prime_two is a dubious translation:
lean 3 declaration is
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
@@ -101,8 +101,9 @@ theorem gcd_mul_lcm (n m : ℕ+) : gcd n m * lcm n m = n * m :=
#align pnat.gcd_mul_lcm PNat.gcd_mul_lcm
theorem eq_one_of_lt_two {n : ℕ+} : n < 2 → n = 1 := by
- intro h; apply le_antisymm; swap; apply PNat.one_le
- exact PNat.lt_add_one_iff.1 h
+ intro h; apply le_antisymm; swap
+ · apply PNat.one_le
+ · exact PNat.lt_add_one_iff.1 h
#align pnat.eq_one_of_lt_two PNat.eq_one_of_lt_two
section Prime
@@ -189,13 +190,13 @@ theorem coprime_coe {m n : ℕ+} : Nat.Coprime ↑m ↑n ↔ m.Coprime n := by
#align pnat.coprime_coe PNat.coprime_coe
theorem Coprime.mul {k m n : ℕ+} : m.Coprime k → n.Coprime k → (m * n).Coprime k := by
- repeat' rw [← coprime_coe]
+ repeat rw [← coprime_coe]
rw [mul_coe]
apply Nat.Coprime.mul
#align pnat.coprime.mul PNat.Coprime.mul
theorem Coprime.mul_right {k m n : ℕ+} : k.Coprime m → k.Coprime n → k.Coprime (m * n) := by
- repeat' rw [← coprime_coe]
+ repeat rw [← coprime_coe]
rw [mul_coe]
apply Nat.Coprime.mul_right
#align pnat.coprime.mul_right PNat.Coprime.mul_right
@@ -271,7 +272,7 @@ theorem coprime_one {n : ℕ+} : n.Coprime 1 :=
theorem Coprime.coprime_dvd_left {m k n : ℕ+} : m ∣ k → k.Coprime n → m.Coprime n := by
rw [dvd_iff]
- repeat' rw [← coprime_coe]
+ repeat rw [← coprime_coe]
apply Nat.Coprime.coprime_dvd_left
#align pnat.coprime.coprime_dvd_left PNat.Coprime.coprime_dvd_left
@@ -18,7 +18,7 @@ This file extends the theory of `ℕ+` with `gcd`, `lcm` and `Prime` functions,
namespace Nat.Primes
--- Porting note: new definition
+-- Porting note (#11445): new definition
/-- The canonical map from `Nat.Primes` to `ℕ+` -/
@[coe] def toPNat : Nat.Primes → ℕ+ :=
fun p => ⟨(p : ℕ), p.property.pos⟩
@@ -123,6 +123,23 @@ theorem prime_two : (2 : ℕ+).Prime :=
Nat.prime_two
#align pnat.prime_two PNat.prime_two
+instance {p : ℕ+} [h : Fact p.Prime] : Fact (p : ℕ).Prime := h
+
+instance fact_prime_two : Fact (2 : ℕ+).Prime :=
+ ⟨prime_two⟩
+
+theorem prime_three : (3 : ℕ+).Prime :=
+ Nat.prime_three
+
+instance fact_prime_three : Fact (3 : ℕ+).Prime :=
+ ⟨prime_three⟩
+
+theorem prime_five : (5 : ℕ+).Prime :=
+ Nat.prime_five
+
+instance fact_prime_five : Fact (5 : ℕ+).Prime :=
+ ⟨prime_five⟩
+
theorem dvd_prime {p m : ℕ+} (pp : p.Prime) : m ∣ p ↔ m = 1 ∨ m = p := by
rw [PNat.dvd_iff]
rw [Nat.dvd_prime pp]
This is the supremum of
along with some minor fixes from failures on nightly-testing as Mathlib master
is merged into it.
Note that some PRs for changes that are already compatible with the current toolchain and will be necessary have already been split out: #8380.
I am hopeful that in future we will be able to progressively merge adaptation PRs into a bump/v4.X.0
branch, so we never end up with a "big merge" like this. However one of these adaptation PRs (#8056) predates my new scheme for combined CI, and it wasn't possible to keep that PR viable in the meantime.
In particular this includes adjustments for the Lean PRs
We can get rid of all the
local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue [lean4#2220](https://github.com/leanprover/lean4/pull/2220)
macros across Mathlib (and in any projects that want to write natural number powers of reals).
Changes the default behaviour of simp
to (config := {decide := false})
. This makes simp
(and consequentially norm_num
) less powerful, but also more consistent, and less likely to blow up in long failures. This requires a variety of changes: changing some previously by simp
or norm_num
to decide
or rfl
, or adding (config := {decide := true})
.
This changed the behaviour of simp
so that simp [f]
will only unfold "fully applied" occurrences of f
. The old behaviour can be recovered with simp (config := { unfoldPartialApp := true })
. We may in future add a syntax for this, e.g. simp [!f]
; please provide feedback! In the meantime, we have made the following changes:
(config := { unfoldPartialApp := true })
in some places, to recover the old behaviour@[eqns]
to manually adjust the equation lemmas for a particular definition, recovering the old behaviour just for that definition. See #8371, where we do this for Function.comp
and Function.flip
.This change in Lean may require further changes down the line (e.g. adding the !f
syntax, and/or upstreaming the special treatment for Function.comp
and Function.flip
, and/or removing this special treatment). Please keep an open and skeptical mind about these changes!
Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Mauricio Collares <mauricio@collares.org>
@@ -295,7 +295,7 @@ theorem gcd_eq_left {m n : ℕ+} : m ∣ n → m.gcd n = m := by
apply Nat.gcd_eq_left h
#align pnat.gcd_eq_left PNat.gcd_eq_left
-theorem Coprime.pow {m n : ℕ+} (k l : ℕ) (h : m.Coprime n) : (m ^ k).Coprime (n ^ l) := by
+theorem Coprime.pow {m n : ℕ+} (k l : ℕ) (h : m.Coprime n) : (m ^ k : ℕ).Coprime (n ^ l) := by
rw [← coprime_coe] at *; apply Nat.Coprime.pow; apply h
#align pnat.coprime.pow PNat.Coprime.pow
@@ -165,8 +165,8 @@ def Coprime (m n : ℕ+) : Prop :=
#align pnat.coprime PNat.Coprime
@[simp, norm_cast]
-theorem coprime_coe {m n : ℕ+} : Nat.coprime ↑m ↑n ↔ m.Coprime n := by
- unfold coprime Coprime
+theorem coprime_coe {m n : ℕ+} : Nat.Coprime ↑m ↑n ↔ m.Coprime n := by
+ unfold Nat.Coprime Coprime
rw [← coe_inj]
simp
#align pnat.coprime_coe PNat.coprime_coe
@@ -174,13 +174,13 @@ theorem coprime_coe {m n : ℕ+} : Nat.coprime ↑m ↑n ↔ m.Coprime n := by
theorem Coprime.mul {k m n : ℕ+} : m.Coprime k → n.Coprime k → (m * n).Coprime k := by
repeat' rw [← coprime_coe]
rw [mul_coe]
- apply Nat.coprime.mul
+ apply Nat.Coprime.mul
#align pnat.coprime.mul PNat.Coprime.mul
theorem Coprime.mul_right {k m n : ℕ+} : k.Coprime m → k.Coprime n → k.Coprime (m * n) := by
repeat' rw [← coprime_coe]
rw [mul_coe]
- apply Nat.coprime.mul_right
+ apply Nat.Coprime.mul_right
#align pnat.coprime.mul_right PNat.Coprime.mul_right
theorem gcd_comm {m n : ℕ+} : m.gcd n = n.gcd m := by
@@ -204,7 +204,7 @@ theorem gcd_eq_right_iff_dvd {m n : ℕ+} : m ∣ n ↔ n.gcd m = m := by
theorem Coprime.gcd_mul_left_cancel (m : ℕ+) {n k : ℕ+} :
k.Coprime n → (k * m).gcd n = m.gcd n := by
intro h; apply eq; simp only [gcd_coe, mul_coe]
- apply Nat.coprime.gcd_mul_left_cancel; simpa
+ apply Nat.Coprime.gcd_mul_left_cancel; simpa
#align pnat.coprime.gcd_mul_left_cancel PNat.Coprime.gcd_mul_left_cancel
theorem Coprime.gcd_mul_right_cancel (m : ℕ+) {n k : ℕ+} : k.Coprime n → (m * k).gcd n = m.gcd n :=
@@ -255,7 +255,7 @@ theorem coprime_one {n : ℕ+} : n.Coprime 1 :=
theorem Coprime.coprime_dvd_left {m k n : ℕ+} : m ∣ k → k.Coprime n → m.Coprime n := by
rw [dvd_iff]
repeat' rw [← coprime_coe]
- apply Nat.coprime.coprime_dvd_left
+ apply Nat.Coprime.coprime_dvd_left
#align pnat.coprime.coprime_dvd_left PNat.Coprime.coprime_dvd_left
theorem Coprime.factor_eq_gcd_left {a b m n : ℕ+} (cop : m.Coprime n) (am : a ∣ m) (bn : b ∣ n) :
@@ -284,7 +284,7 @@ theorem Coprime.factor_eq_gcd_right_right {a b m n : ℕ+} (cop : m.Coprime n) (
theorem Coprime.gcd_mul (k : ℕ+) {m n : ℕ+} (h : m.Coprime n) :
k.gcd (m * n) = k.gcd m * k.gcd n := by
rw [← coprime_coe] at h; apply eq
- simp only [gcd_coe, mul_coe]; apply Nat.coprime.gcd_mul k h
+ simp only [gcd_coe, mul_coe]; apply Nat.Coprime.gcd_mul k h
#align pnat.coprime.gcd_mul PNat.Coprime.gcd_mul
theorem gcd_eq_left {m n : ℕ+} : m ∣ n → m.gcd n = m := by
@@ -295,8 +295,8 @@ theorem gcd_eq_left {m n : ℕ+} : m ∣ n → m.gcd n = m := by
apply Nat.gcd_eq_left h
#align pnat.gcd_eq_left PNat.gcd_eq_left
-theorem Coprime.pow {m n : ℕ+} (k l : ℕ) (h : m.Coprime n) : (m ^ k).coprime (n ^ l) := by
- rw [← coprime_coe] at *; apply Nat.coprime.pow; apply h
+theorem Coprime.pow {m n : ℕ+} (k l : ℕ) (h : m.Coprime n) : (m ^ k).Coprime (n ^ l) := by
+ rw [← coprime_coe] at *; apply Nat.Coprime.pow; apply h
#align pnat.coprime.pow PNat.Coprime.pow
end Coprime
@@ -165,8 +165,8 @@ def Coprime (m n : ℕ+) : Prop :=
#align pnat.coprime PNat.Coprime
@[simp, norm_cast]
-theorem coprime_coe {m n : ℕ+} : Nat.Coprime ↑m ↑n ↔ m.Coprime n := by
- unfold Nat.Coprime Coprime
+theorem coprime_coe {m n : ℕ+} : Nat.coprime ↑m ↑n ↔ m.Coprime n := by
+ unfold coprime Coprime
rw [← coe_inj]
simp
#align pnat.coprime_coe PNat.coprime_coe
@@ -174,13 +174,13 @@ theorem coprime_coe {m n : ℕ+} : Nat.Coprime ↑m ↑n ↔ m.Coprime n := by
theorem Coprime.mul {k m n : ℕ+} : m.Coprime k → n.Coprime k → (m * n).Coprime k := by
repeat' rw [← coprime_coe]
rw [mul_coe]
- apply Nat.Coprime.mul
+ apply Nat.coprime.mul
#align pnat.coprime.mul PNat.Coprime.mul
theorem Coprime.mul_right {k m n : ℕ+} : k.Coprime m → k.Coprime n → k.Coprime (m * n) := by
repeat' rw [← coprime_coe]
rw [mul_coe]
- apply Nat.Coprime.mul_right
+ apply Nat.coprime.mul_right
#align pnat.coprime.mul_right PNat.Coprime.mul_right
theorem gcd_comm {m n : ℕ+} : m.gcd n = n.gcd m := by
@@ -204,7 +204,7 @@ theorem gcd_eq_right_iff_dvd {m n : ℕ+} : m ∣ n ↔ n.gcd m = m := by
theorem Coprime.gcd_mul_left_cancel (m : ℕ+) {n k : ℕ+} :
k.Coprime n → (k * m).gcd n = m.gcd n := by
intro h; apply eq; simp only [gcd_coe, mul_coe]
- apply Nat.Coprime.gcd_mul_left_cancel; simpa
+ apply Nat.coprime.gcd_mul_left_cancel; simpa
#align pnat.coprime.gcd_mul_left_cancel PNat.Coprime.gcd_mul_left_cancel
theorem Coprime.gcd_mul_right_cancel (m : ℕ+) {n k : ℕ+} : k.Coprime n → (m * k).gcd n = m.gcd n :=
@@ -255,7 +255,7 @@ theorem coprime_one {n : ℕ+} : n.Coprime 1 :=
theorem Coprime.coprime_dvd_left {m k n : ℕ+} : m ∣ k → k.Coprime n → m.Coprime n := by
rw [dvd_iff]
repeat' rw [← coprime_coe]
- apply Nat.Coprime.coprime_dvd_left
+ apply Nat.coprime.coprime_dvd_left
#align pnat.coprime.coprime_dvd_left PNat.Coprime.coprime_dvd_left
theorem Coprime.factor_eq_gcd_left {a b m n : ℕ+} (cop : m.Coprime n) (am : a ∣ m) (bn : b ∣ n) :
@@ -284,7 +284,7 @@ theorem Coprime.factor_eq_gcd_right_right {a b m n : ℕ+} (cop : m.Coprime n) (
theorem Coprime.gcd_mul (k : ℕ+) {m n : ℕ+} (h : m.Coprime n) :
k.gcd (m * n) = k.gcd m * k.gcd n := by
rw [← coprime_coe] at h; apply eq
- simp only [gcd_coe, mul_coe]; apply Nat.Coprime.gcd_mul k h
+ simp only [gcd_coe, mul_coe]; apply Nat.coprime.gcd_mul k h
#align pnat.coprime.gcd_mul PNat.Coprime.gcd_mul
theorem gcd_eq_left {m n : ℕ+} : m ∣ n → m.gcd n = m := by
@@ -295,8 +295,8 @@ theorem gcd_eq_left {m n : ℕ+} : m ∣ n → m.gcd n = m := by
apply Nat.gcd_eq_left h
#align pnat.gcd_eq_left PNat.gcd_eq_left
-theorem Coprime.pow {m n : ℕ+} (k l : ℕ) (h : m.Coprime n) : (m ^ k).Coprime (n ^ l) := by
- rw [← coprime_coe] at *; apply Nat.Coprime.pow; apply h
+theorem Coprime.pow {m n : ℕ+} (k l : ℕ) (h : m.Coprime n) : (m ^ k).coprime (n ^ l) := by
+ rw [← coprime_coe] at *; apply Nat.coprime.pow; apply h
#align pnat.coprime.pow PNat.Coprime.pow
end Coprime
Some changes have already been review and delegated in #6910 and #7148.
The diff that needs looking at is https://github.com/leanprover-community/mathlib4/pull/7174/commits/64d6d07ee18163627c8f517eb31455411921c5ac
The std bump PR was insta-merged already!
Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -165,8 +165,8 @@ def Coprime (m n : ℕ+) : Prop :=
#align pnat.coprime PNat.Coprime
@[simp, norm_cast]
-theorem coprime_coe {m n : ℕ+} : Nat.coprime ↑m ↑n ↔ m.Coprime n := by
- unfold coprime Coprime
+theorem coprime_coe {m n : ℕ+} : Nat.Coprime ↑m ↑n ↔ m.Coprime n := by
+ unfold Nat.Coprime Coprime
rw [← coe_inj]
simp
#align pnat.coprime_coe PNat.coprime_coe
@@ -174,13 +174,13 @@ theorem coprime_coe {m n : ℕ+} : Nat.coprime ↑m ↑n ↔ m.Coprime n := by
theorem Coprime.mul {k m n : ℕ+} : m.Coprime k → n.Coprime k → (m * n).Coprime k := by
repeat' rw [← coprime_coe]
rw [mul_coe]
- apply Nat.coprime.mul
+ apply Nat.Coprime.mul
#align pnat.coprime.mul PNat.Coprime.mul
theorem Coprime.mul_right {k m n : ℕ+} : k.Coprime m → k.Coprime n → k.Coprime (m * n) := by
repeat' rw [← coprime_coe]
rw [mul_coe]
- apply Nat.coprime.mul_right
+ apply Nat.Coprime.mul_right
#align pnat.coprime.mul_right PNat.Coprime.mul_right
theorem gcd_comm {m n : ℕ+} : m.gcd n = n.gcd m := by
@@ -204,7 +204,7 @@ theorem gcd_eq_right_iff_dvd {m n : ℕ+} : m ∣ n ↔ n.gcd m = m := by
theorem Coprime.gcd_mul_left_cancel (m : ℕ+) {n k : ℕ+} :
k.Coprime n → (k * m).gcd n = m.gcd n := by
intro h; apply eq; simp only [gcd_coe, mul_coe]
- apply Nat.coprime.gcd_mul_left_cancel; simpa
+ apply Nat.Coprime.gcd_mul_left_cancel; simpa
#align pnat.coprime.gcd_mul_left_cancel PNat.Coprime.gcd_mul_left_cancel
theorem Coprime.gcd_mul_right_cancel (m : ℕ+) {n k : ℕ+} : k.Coprime n → (m * k).gcd n = m.gcd n :=
@@ -255,7 +255,7 @@ theorem coprime_one {n : ℕ+} : n.Coprime 1 :=
theorem Coprime.coprime_dvd_left {m k n : ℕ+} : m ∣ k → k.Coprime n → m.Coprime n := by
rw [dvd_iff]
repeat' rw [← coprime_coe]
- apply Nat.coprime.coprime_dvd_left
+ apply Nat.Coprime.coprime_dvd_left
#align pnat.coprime.coprime_dvd_left PNat.Coprime.coprime_dvd_left
theorem Coprime.factor_eq_gcd_left {a b m n : ℕ+} (cop : m.Coprime n) (am : a ∣ m) (bn : b ∣ n) :
@@ -284,7 +284,7 @@ theorem Coprime.factor_eq_gcd_right_right {a b m n : ℕ+} (cop : m.Coprime n) (
theorem Coprime.gcd_mul (k : ℕ+) {m n : ℕ+} (h : m.Coprime n) :
k.gcd (m * n) = k.gcd m * k.gcd n := by
rw [← coprime_coe] at h; apply eq
- simp only [gcd_coe, mul_coe]; apply Nat.coprime.gcd_mul k h
+ simp only [gcd_coe, mul_coe]; apply Nat.Coprime.gcd_mul k h
#align pnat.coprime.gcd_mul PNat.Coprime.gcd_mul
theorem gcd_eq_left {m n : ℕ+} : m ∣ n → m.gcd n = m := by
@@ -295,8 +295,8 @@ theorem gcd_eq_left {m n : ℕ+} : m ∣ n → m.gcd n = m := by
apply Nat.gcd_eq_left h
#align pnat.gcd_eq_left PNat.gcd_eq_left
-theorem Coprime.pow {m n : ℕ+} (k l : ℕ) (h : m.Coprime n) : (m ^ k).coprime (n ^ l) := by
- rw [← coprime_coe] at *; apply Nat.coprime.pow; apply h
+theorem Coprime.pow {m n : ℕ+} (k l : ℕ) (h : m.Coprime n) : (m ^ k).Coprime (n ^ l) := by
+ rw [← coprime_coe] at *; apply Nat.Coprime.pow; apply h
#align pnat.coprime.pow PNat.Coprime.pow
end Coprime
@@ -296,7 +296,7 @@ theorem gcd_eq_left {m n : ℕ+} : m ∣ n → m.gcd n = m := by
#align pnat.gcd_eq_left PNat.gcd_eq_left
theorem Coprime.pow {m n : ℕ+} (k l : ℕ) (h : m.Coprime n) : (m ^ k).coprime (n ^ l) := by
- rw [← coprime_coe] at *; simp only [pow_coe]; apply Nat.coprime.pow; apply h
+ rw [← coprime_coe] at *; apply Nat.coprime.pow; apply h
#align pnat.coprime.pow PNat.Coprime.pow
end Coprime
@@ -2,15 +2,12 @@
Copyright (c) 2017 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Mario Carneiro, Neil Strickland
-
-! This file was ported from Lean 3 source module data.pnat.prime
-! leanprover-community/mathlib commit 09597669f02422ed388036273d8848119699c22f
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Data.Nat.Prime
import Mathlib.Data.PNat.Basic
+#align_import data.pnat.prime from "leanprover-community/mathlib"@"09597669f02422ed388036273d8848119699c22f"
+
/-!
# Primality and GCD on pnat
fix-comments.py
on all files.@@ -14,7 +14,7 @@ import Mathlib.Data.PNat.Basic
/-!
# Primality and GCD on pnat
-This file extends the theory of `ℕ+` with `gcd`, `lcm` and `prime` functions, analogous to those on
+This file extends the theory of `ℕ+` with `gcd`, `lcm` and `Prime` functions, analogous to those on
`Nat`.
-/
@@ -172,7 +172,6 @@ theorem coprime_coe {m n : ℕ+} : Nat.coprime ↑m ↑n ↔ m.Coprime n := by
unfold coprime Coprime
rw [← coe_inj]
simp
- rfl
#align pnat.coprime_coe PNat.coprime_coe
theorem Coprime.mul {k m n : ℕ+} : m.Coprime k → n.Coprime k → (m * n).Coprime k := by
@@ -26,9 +26,9 @@ namespace Nat.Primes
@[coe] def toPNat : Nat.Primes → ℕ+ :=
fun p => ⟨(p : ℕ), p.property.pos⟩
-instance coePnat : Coe Nat.Primes ℕ+ :=
+instance coePNat : Coe Nat.Primes ℕ+ :=
⟨toPNat⟩
-#align nat.primes.coe_pnat Nat.Primes.coePnat
+#align nat.primes.coe_pnat Nat.Primes.coePNat
@[norm_cast]
theorem coe_pnat_nat (p : Nat.Primes) : ((p : ℕ+) : ℕ) = p :=
This was done semi-automatically with some regular expressions in vim in contrast to the fully automatic https://github.com/leanprover-community/mathlib4/pull/1523.
Co-authored-by: Moritz Firsching <firsching@google.com>
@@ -205,8 +205,8 @@ theorem gcd_eq_right_iff_dvd {m n : ℕ+} : m ∣ n ↔ n.gcd m = m := by
apply gcd_eq_left_iff_dvd
#align pnat.gcd_eq_right_iff_dvd PNat.gcd_eq_right_iff_dvd
-theorem Coprime.gcd_mul_left_cancel (m : ℕ+) {n k : ℕ+} : k.Coprime n → (k * m).gcd n = m.gcd n :=
- by
+theorem Coprime.gcd_mul_left_cancel (m : ℕ+) {n k : ℕ+} :
+ k.Coprime n → (k * m).gcd n = m.gcd n := by
intro h; apply eq; simp only [gcd_coe, mul_coe]
apply Nat.coprime.gcd_mul_left_cancel; simpa
#align pnat.coprime.gcd_mul_left_cancel PNat.Coprime.gcd_mul_left_cancel
@@ -285,8 +285,8 @@ theorem Coprime.factor_eq_gcd_right_right {a b m n : ℕ+} (cop : m.Coprime n) (
apply Coprime.factor_eq_gcd_right cop am bn
#align pnat.coprime.factor_eq_gcd_right_right PNat.Coprime.factor_eq_gcd_right_right
-theorem Coprime.gcd_mul (k : ℕ+) {m n : ℕ+} (h : m.Coprime n) : k.gcd (m * n) = k.gcd m * k.gcd n :=
- by
+theorem Coprime.gcd_mul (k : ℕ+) {m n : ℕ+} (h : m.Coprime n) :
+ k.gcd (m * n) = k.gcd m * k.gcd n := by
rw [← coprime_coe] at h; apply eq
simp only [gcd_coe, mul_coe]; apply Nat.coprime.gcd_mul k h
#align pnat.coprime.gcd_mul PNat.Coprime.gcd_mul
by
line breaks (#1523)
During porting, I usually fix the desired format we seem to want for the line breaks around by
with
awk '{do {{if (match($0, "^ by$") && length(p) < 98) {p=p " by";} else {if (NR!=1) {print p}; p=$0}}} while (getline == 1) if (getline==0) print p}' Mathlib/File/Im/Working/On.lean
I noticed there are some more files that slipped through.
This pull request is the result of running this command:
grep -lr "^ by\$" Mathlib | xargs -n 1 awk -i inplace '{do {{if (match($0, "^ by$") && length(p) < 98 && not (match(p, "^[ \t]*--"))) {p=p " by";} else {if (NR!=1) {print p}; p=$0}}} while (getline == 1) if (getline==0) print p}'
Co-authored-by: Moritz Firsching <firsching@google.com>
@@ -126,15 +126,13 @@ theorem prime_two : (2 : ℕ+).Prime :=
Nat.prime_two
#align pnat.prime_two PNat.prime_two
-theorem dvd_prime {p m : ℕ+} (pp : p.Prime) : m ∣ p ↔ m = 1 ∨ m = p :=
- by
+theorem dvd_prime {p m : ℕ+} (pp : p.Prime) : m ∣ p ↔ m = 1 ∨ m = p := by
rw [PNat.dvd_iff]
rw [Nat.dvd_prime pp]
simp
#align pnat.dvd_prime PNat.dvd_prime
-theorem Prime.ne_one {p : ℕ+} : p.Prime → p ≠ 1 :=
- by
+theorem Prime.ne_one {p : ℕ+} : p.Prime → p ≠ 1 := by
intro pp
intro contra
apply Nat.Prime.ne_one pp
@@ -147,14 +145,12 @@ theorem not_prime_one : ¬(1 : ℕ+).Prime :=
Nat.not_prime_one
#align pnat.not_prime_one PNat.not_prime_one
-theorem Prime.not_dvd_one {p : ℕ+} : p.Prime → ¬p ∣ 1 := fun pp : p.Prime =>
- by
+theorem Prime.not_dvd_one {p : ℕ+} : p.Prime → ¬p ∣ 1 := fun pp : p.Prime => by
rw [dvd_iff]
apply Nat.Prime.not_dvd_one pp
#align pnat.prime.not_dvd_one PNat.Prime.not_dvd_one
-theorem exists_prime_and_dvd {n : ℕ+} (hn : n ≠ 1) : ∃ p : ℕ+, p.Prime ∧ p ∣ n :=
- by
+theorem exists_prime_and_dvd {n : ℕ+} (hn : n ≠ 1) : ∃ p : ℕ+, p.Prime ∧ p ∣ n := by
obtain ⟨p, hp⟩ := Nat.exists_prime_and_dvd (mt coe_eq_one_iff.mp hn)
exists (⟨p, Nat.Prime.pos hp.left⟩ : ℕ+); rw [dvd_iff]; apply hp
#align pnat.exists_prime_and_dvd PNat.exists_prime_and_dvd
@@ -179,37 +175,32 @@ theorem coprime_coe {m n : ℕ+} : Nat.coprime ↑m ↑n ↔ m.Coprime n := by
rfl
#align pnat.coprime_coe PNat.coprime_coe
-theorem Coprime.mul {k m n : ℕ+} : m.Coprime k → n.Coprime k → (m * n).Coprime k :=
- by
+theorem Coprime.mul {k m n : ℕ+} : m.Coprime k → n.Coprime k → (m * n).Coprime k := by
repeat' rw [← coprime_coe]
rw [mul_coe]
apply Nat.coprime.mul
#align pnat.coprime.mul PNat.Coprime.mul
-theorem Coprime.mul_right {k m n : ℕ+} : k.Coprime m → k.Coprime n → k.Coprime (m * n) :=
- by
+theorem Coprime.mul_right {k m n : ℕ+} : k.Coprime m → k.Coprime n → k.Coprime (m * n) := by
repeat' rw [← coprime_coe]
rw [mul_coe]
apply Nat.coprime.mul_right
#align pnat.coprime.mul_right PNat.Coprime.mul_right
-theorem gcd_comm {m n : ℕ+} : m.gcd n = n.gcd m :=
- by
+theorem gcd_comm {m n : ℕ+} : m.gcd n = n.gcd m := by
apply eq
simp only [gcd_coe]
apply Nat.gcd_comm
#align pnat.gcd_comm PNat.gcd_comm
-theorem gcd_eq_left_iff_dvd {m n : ℕ+} : m ∣ n ↔ m.gcd n = m :=
- by
+theorem gcd_eq_left_iff_dvd {m n : ℕ+} : m ∣ n ↔ m.gcd n = m := by
rw [dvd_iff]
rw [Nat.gcd_eq_left_iff_dvd]
rw [← coe_inj]
simp
#align pnat.gcd_eq_left_iff_dvd PNat.gcd_eq_left_iff_dvd
-theorem gcd_eq_right_iff_dvd {m n : ℕ+} : m ∣ n ↔ n.gcd m = m :=
- by
+theorem gcd_eq_right_iff_dvd {m n : ℕ+} : m ∣ n ↔ n.gcd m = m := by
rw [gcd_comm]
apply gcd_eq_left_iff_dvd
#align pnat.gcd_eq_right_iff_dvd PNat.gcd_eq_right_iff_dvd
@@ -237,8 +228,7 @@ theorem Coprime.gcd_mul_right_cancel_right (m : ℕ+) {n k : ℕ+} :
#align pnat.coprime.gcd_mul_right_cancel_right PNat.Coprime.gcd_mul_right_cancel_right
@[simp]
-theorem one_gcd {n : ℕ+} : gcd 1 n = 1 :=
- by
+theorem one_gcd {n : ℕ+} : gcd 1 n = 1 := by
rw [← gcd_eq_left_iff_dvd]
apply one_dvd
#align pnat.one_gcd PNat.one_gcd
@@ -250,8 +240,7 @@ theorem gcd_one {n : ℕ+} : gcd n 1 = 1 := by
#align pnat.gcd_one PNat.gcd_one
@[symm]
-theorem Coprime.symm {m n : ℕ+} : m.Coprime n → n.Coprime m :=
- by
+theorem Coprime.symm {m n : ℕ+} : m.Coprime n → n.Coprime m := by
unfold Coprime
rw [gcd_comm]
simp
@@ -267,8 +256,7 @@ theorem coprime_one {n : ℕ+} : n.Coprime 1 :=
Coprime.symm one_coprime
#align pnat.coprime_one PNat.coprime_one
-theorem Coprime.coprime_dvd_left {m k n : ℕ+} : m ∣ k → k.Coprime n → m.Coprime n :=
- by
+theorem Coprime.coprime_dvd_left {m k n : ℕ+} : m ∣ k → k.Coprime n → m.Coprime n := by
rw [dvd_iff]
repeat' rw [← coprime_coe]
apply Nat.coprime.coprime_dvd_left
@@ -303,8 +291,7 @@ theorem Coprime.gcd_mul (k : ℕ+) {m n : ℕ+} (h : m.Coprime n) : k.gcd (m * n
simp only [gcd_coe, mul_coe]; apply Nat.coprime.gcd_mul k h
#align pnat.coprime.gcd_mul PNat.Coprime.gcd_mul
-theorem gcd_eq_left {m n : ℕ+} : m ∣ n → m.gcd n = m :=
- by
+theorem gcd_eq_left {m n : ℕ+} : m ∣ n → m.gcd n = m := by
rw [dvd_iff]
intro h
apply eq
The unported dependencies are