ring_theory.coprime.lemmasMathlib.RingTheory.Coprime.Lemmas

This file has been ported!

Changes since the initial port

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.

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(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)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -5,7 +5,7 @@ Authors: Kenny Lau, Ken Lee, Chris Hughes
 -/
 import Algebra.BigOperators.Ring
 import Data.Fintype.Basic
-import Data.Int.Gcd
+import Data.Int.GCD
 import RingTheory.Coprime.Basic
 
 #align_import ring_theory.coprime.lemmas from "leanprover-community/mathlib"@"327c3c0d9232d80e250dc8f65e7835b82b266ea5"
@@ -38,11 +38,11 @@ open scoped Classical
 theorem Nat.isCoprime_iff_coprime {m n : ℕ} : IsCoprime (m : ℤ) n ↔ Nat.Coprime m n :=
   ⟨fun ⟨a, b, H⟩ =>
     Nat.eq_one_of_dvd_one <|
-      Int.coe_nat_dvd.1 <| by
+      Int.natCast_dvd_natCast.1 <| by
         rw [Int.ofNat_one, ← H]
         exact
-          dvd_add (dvd_mul_of_dvd_right (Int.coe_nat_dvd.2 <| Nat.gcd_dvd_left m n) _)
-            (dvd_mul_of_dvd_right (Int.coe_nat_dvd.2 <| Nat.gcd_dvd_right m n) _),
+          dvd_add (dvd_mul_of_dvd_right (Int.natCast_dvd_natCast.2 <| Nat.gcd_dvd_left m n) _)
+            (dvd_mul_of_dvd_right (Int.natCast_dvd_natCast.2 <| Nat.gcd_dvd_right m n) _),
     fun H =>
     ⟨Nat.gcdA m n, Nat.gcdB m n, by
       rw [mul_comm _ (m : ℤ), mul_comm _ (n : ℤ), ← Nat.gcd_eq_gcd_ab, show _ = _ from H,
Diff
@@ -57,7 +57,7 @@ alias ⟨IsCoprime.nat_coprime, Nat.Coprime.isCoprime⟩ := Nat.isCoprime_iff_co
 #print IsCoprime.prod_left /-
 theorem IsCoprime.prod_left : (∀ i ∈ t, IsCoprime (s i) x) → IsCoprime (∏ i in t, s i) x :=
   Finset.induction_on t (fun _ => isCoprime_one_left) fun b t hbt ih H => by
-    rw [Finset.prod_insert hbt]; rw [Finset.forall_mem_insert] at H ; exact H.1.hMul_left (ih H.2)
+    rw [Finset.prod_insert hbt]; rw [Finset.forall_mem_insert] at H; exact H.1.hMul_left (ih H.2)
 #align is_coprime.prod_left IsCoprime.prod_left
 -/
 
@@ -130,7 +130,7 @@ theorem exists_sum_eq_one_iff_pairwise_coprime [DecidableEq I] (h : t.Nonempty)
   · simp only [Pairwise, sum_singleton, Finset.sdiff_self, prod_empty, mul_one,
       exists_apply_eq_apply, Ne.def, true_iff_iff]
     rintro a ⟨i, hi⟩ ⟨j, hj⟩ h
-    rw [Finset.mem_singleton] at hi hj 
+    rw [Finset.mem_singleton] at hi hj
     simpa [hi, hj] using h
   intro a t hat h ih
   rw [pairwise_cons']
@@ -138,10 +138,10 @@ theorem exists_sum_eq_one_iff_pairwise_coprime [DecidableEq I] (h : t.Nonempty)
     exact ⟨mem_insert_self _ _, fun ha => hat (ha.symm.cases_on hx)⟩
   constructor
   · rintro ⟨μ, hμ⟩
-    rw [sum_cons, cons_eq_insert, sdiff_singleton_eq_erase, erase_insert hat] at hμ 
+    rw [sum_cons, cons_eq_insert, sdiff_singleton_eq_erase, erase_insert hat] at hμ
     refine' ⟨ih.mp ⟨Pi.single h.some (μ a * s h.some) + μ * fun _ => s a, _⟩, fun b hb => _⟩
     · rw [prod_eq_mul_prod_diff_singleton h.some_spec, ← mul_assoc, ←
-        @if_pos _ _ h.some_spec R (_ * _) 0, ← sum_pi_single', ← sum_add_distrib] at hμ 
+        @if_pos _ _ h.some_spec R (_ * _) 0, ← sum_pi_single', ← sum_add_distrib] at hμ
       rw [← hμ, sum_congr rfl]; intro x hx; convert @add_mul R _ _ _ _ _ _ using 2
       · by_cases hx : x = h.some
         · rw [hx, Pi.single_eq_same, Pi.single_eq_same]
@@ -185,7 +185,7 @@ theorem pairwise_coprime_iff_coprime_prod [DecidableEq I] :
     Pairwise (IsCoprime on fun i : t => s i) ↔ ∀ i ∈ t, IsCoprime (s i) (∏ j in t \ {i}, s j) :=
   by
   refine' ⟨fun hp i hi => is_coprime.prod_right_iff.mpr fun j hj => _, fun hp => _⟩
-  · rw [Finset.mem_sdiff, Finset.mem_singleton] at hj 
+  · rw [Finset.mem_sdiff, Finset.mem_singleton] at hj
     obtain ⟨hj, ji⟩ := hj
     exact @hp ⟨i, hi⟩ ⟨j, hj⟩ fun h => ji (congr_arg coe h).symm
   · rintro ⟨i, hi⟩ ⟨j, hj⟩ h
@@ -218,7 +218,7 @@ theorem IsCoprime.pow (H : IsCoprime x y) : IsCoprime (x ^ m) (y ^ n) :=
 theorem IsCoprime.pow_left_iff (hm : 0 < m) : IsCoprime (x ^ m) y ↔ IsCoprime x y :=
   by
   refine' ⟨fun h => _, IsCoprime.pow_left⟩
-  rw [← Finset.card_range m, ← Finset.prod_const] at h 
+  rw [← Finset.card_range m, ← Finset.prod_const] at h
   exact h.of_prod_left 0 (finset.mem_range.mpr hm)
 #align is_coprime.pow_left_iff IsCoprime.pow_left_iff
 -/
Diff
@@ -3,10 +3,10 @@ Copyright (c) 2020 Kenny Lau. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Kenny Lau, Ken Lee, Chris Hughes
 -/
-import Mathbin.Algebra.BigOperators.Ring
-import Mathbin.Data.Fintype.Basic
-import Mathbin.Data.Int.Gcd
-import Mathbin.RingTheory.Coprime.Basic
+import Algebra.BigOperators.Ring
+import Data.Fintype.Basic
+import Data.Int.Gcd
+import RingTheory.Coprime.Basic
 
 #align_import ring_theory.coprime.lemmas from "leanprover-community/mathlib"@"327c3c0d9232d80e250dc8f65e7835b82b266ea5"
 
Diff
@@ -35,7 +35,7 @@ section
 open scoped Classical
 
 #print Nat.isCoprime_iff_coprime /-
-theorem Nat.isCoprime_iff_coprime {m n : ℕ} : IsCoprime (m : ℤ) n ↔ Nat.coprime m n :=
+theorem Nat.isCoprime_iff_coprime {m n : ℕ} : IsCoprime (m : ℤ) n ↔ Nat.Coprime m n :=
   ⟨fun ⟨a, b, H⟩ =>
     Nat.eq_one_of_dvd_one <|
       Int.coe_nat_dvd.1 <| by
@@ -50,9 +50,9 @@ theorem Nat.isCoprime_iff_coprime {m n : ℕ} : IsCoprime (m : ℤ) n ↔ Nat.co
 #align nat.is_coprime_iff_coprime Nat.isCoprime_iff_coprime
 -/
 
-alias ⟨IsCoprime.nat_coprime, Nat.coprime.isCoprime⟩ := Nat.isCoprime_iff_coprime
+alias ⟨IsCoprime.nat_coprime, Nat.Coprime.isCoprime⟩ := Nat.isCoprime_iff_coprime
 #align is_coprime.nat_coprime IsCoprime.nat_coprime
-#align nat.coprime.is_coprime Nat.coprime.isCoprime
+#align nat.coprime.is_coprime Nat.Coprime.isCoprime
 
 #print IsCoprime.prod_left /-
 theorem IsCoprime.prod_left : (∀ i ∈ t, IsCoprime (s i) x) → IsCoprime (∏ i in t, s i) x :=
Diff
@@ -50,7 +50,7 @@ theorem Nat.isCoprime_iff_coprime {m n : ℕ} : IsCoprime (m : ℤ) n ↔ Nat.co
 #align nat.is_coprime_iff_coprime Nat.isCoprime_iff_coprime
 -/
 
-alias Nat.isCoprime_iff_coprime ↔ IsCoprime.nat_coprime Nat.coprime.isCoprime
+alias ⟨IsCoprime.nat_coprime, Nat.coprime.isCoprime⟩ := Nat.isCoprime_iff_coprime
 #align is_coprime.nat_coprime IsCoprime.nat_coprime
 #align nat.coprime.is_coprime Nat.coprime.isCoprime
 
Diff
@@ -57,7 +57,7 @@ alias Nat.isCoprime_iff_coprime ↔ IsCoprime.nat_coprime Nat.coprime.isCoprime
 #print IsCoprime.prod_left /-
 theorem IsCoprime.prod_left : (∀ i ∈ t, IsCoprime (s i) x) → IsCoprime (∏ i in t, s i) x :=
   Finset.induction_on t (fun _ => isCoprime_one_left) fun b t hbt ih H => by
-    rw [Finset.prod_insert hbt]; rw [Finset.forall_mem_insert] at H ; exact H.1.mul_left (ih H.2)
+    rw [Finset.prod_insert hbt]; rw [Finset.forall_mem_insert] at H ; exact H.1.hMul_left (ih H.2)
 #align is_coprime.prod_left IsCoprime.prod_left
 -/
 
Diff
@@ -2,17 +2,14 @@
 Copyright (c) 2020 Kenny Lau. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Kenny Lau, Ken Lee, Chris Hughes
-
-! This file was ported from Lean 3 source module ring_theory.coprime.lemmas
-! leanprover-community/mathlib commit 327c3c0d9232d80e250dc8f65e7835b82b266ea5
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Algebra.BigOperators.Ring
 import Mathbin.Data.Fintype.Basic
 import Mathbin.Data.Int.Gcd
 import Mathbin.RingTheory.Coprime.Basic
 
+#align_import ring_theory.coprime.lemmas from "leanprover-community/mathlib"@"327c3c0d9232d80e250dc8f65e7835b82b266ea5"
+
 /-!
 # Additional lemmas about elements of a ring satisfying `is_coprime`
 
Diff
@@ -37,6 +37,7 @@ section
 
 open scoped Classical
 
+#print Nat.isCoprime_iff_coprime /-
 theorem Nat.isCoprime_iff_coprime {m n : ℕ} : IsCoprime (m : ℤ) n ↔ Nat.coprime m n :=
   ⟨fun ⟨a, b, H⟩ =>
     Nat.eq_one_of_dvd_one <|
@@ -50,6 +51,7 @@ theorem Nat.isCoprime_iff_coprime {m n : ℕ} : IsCoprime (m : ℤ) n ↔ Nat.co
       rw [mul_comm _ (m : ℤ), mul_comm _ (n : ℤ), ← Nat.gcd_eq_gcd_ab, show _ = _ from H,
         Int.ofNat_one]⟩⟩
 #align nat.is_coprime_iff_coprime Nat.isCoprime_iff_coprime
+-/
 
 alias Nat.isCoprime_iff_coprime ↔ IsCoprime.nat_coprime Nat.coprime.isCoprime
 #align is_coprime.nat_coprime IsCoprime.nat_coprime
@@ -122,6 +124,7 @@ end
 
 open Finset
 
+#print exists_sum_eq_one_iff_pairwise_coprime /-
 theorem exists_sum_eq_one_iff_pairwise_coprime [DecidableEq I] (h : t.Nonempty) :
     (∃ μ : I → R, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔
       Pairwise (IsCoprime on fun i : t => s i) :=
@@ -168,7 +171,9 @@ theorem exists_sum_eq_one_iff_pairwise_coprime [DecidableEq I] (h : t.Nonempty)
     convert mul_assoc _ _ _; convert (prod_eq_prod_diff_singleton_mul (mem x hx) _).symm using 3
     convert sdiff_sdiff_comm; rw [sdiff_singleton_eq_erase, erase_insert hat]
 #align exists_sum_eq_one_iff_pairwise_coprime exists_sum_eq_one_iff_pairwise_coprime
+-/
 
+#print exists_sum_eq_one_iff_pairwise_coprime' /-
 theorem exists_sum_eq_one_iff_pairwise_coprime' [Fintype I] [Nonempty I] [DecidableEq I] :
     (∃ μ : I → R, ∑ i : I, μ i * ∏ j in {i}ᶜ, s j = 1) ↔ Pairwise (IsCoprime on s) :=
   by
@@ -176,6 +181,7 @@ theorem exists_sum_eq_one_iff_pairwise_coprime' [Fintype I] [Nonempty I] [Decida
   simp only [Function.onFun, pairwise_subtype_iff_pairwise_finset', coe_univ, Set.pairwise_univ]
   assumption
 #align exists_sum_eq_one_iff_pairwise_coprime' exists_sum_eq_one_iff_pairwise_coprime'
+-/
 
 #print pairwise_coprime_iff_coprime_prod /-
 theorem pairwise_coprime_iff_coprime_prod [DecidableEq I] :
Diff
@@ -97,7 +97,7 @@ theorem IsCoprime.of_prod_right (H1 : IsCoprime x (∏ i in t, s i)) (i : I) (hi
 
 #print Finset.prod_dvd_of_coprime /-
 theorem Finset.prod_dvd_of_coprime :
-    ∀ (Hs : (t : Set I).Pairwise (IsCoprime on s)) (Hs1 : ∀ i ∈ t, s i ∣ z), (∏ x in t, s x) ∣ z :=
+    ∀ (Hs : (t : Set I).Pairwise (IsCoprime on s)) (Hs1 : ∀ i ∈ t, s i ∣ z), ∏ x in t, s x ∣ z :=
   Finset.induction_on t (fun _ _ => one_dvd z)
     (by
       intro a r har ih Hs Hs1
@@ -113,7 +113,7 @@ theorem Finset.prod_dvd_of_coprime :
 
 #print Fintype.prod_dvd_of_coprime /-
 theorem Fintype.prod_dvd_of_coprime [Fintype I] (Hs : Pairwise (IsCoprime on s))
-    (Hs1 : ∀ i, s i ∣ z) : (∏ x, s x) ∣ z :=
+    (Hs1 : ∀ i, s i ∣ z) : ∏ x, s x ∣ z :=
   Finset.prod_dvd_of_coprime (Hs.set_pairwise _) fun i _ => Hs1 i
 #align fintype.prod_dvd_of_coprime Fintype.prod_dvd_of_coprime
 -/
@@ -123,7 +123,7 @@ end
 open Finset
 
 theorem exists_sum_eq_one_iff_pairwise_coprime [DecidableEq I] (h : t.Nonempty) :
-    (∃ μ : I → R, (∑ i in t, μ i * ∏ j in t \ {i}, s j) = 1) ↔
+    (∃ μ : I → R, ∑ i in t, μ i * ∏ j in t \ {i}, s j = 1) ↔
       Pairwise (IsCoprime on fun i : t => s i) :=
   by
   refine' h.cons_induction _ _ <;> clear t h
@@ -159,7 +159,7 @@ theorem exists_sum_eq_one_iff_pairwise_coprime [DecidableEq I] (h : t.Nonempty)
   · rintro ⟨hs, Hb⟩; obtain ⟨μ, hμ⟩ := ih.mpr hs
     obtain ⟨u, v, huv⟩ := IsCoprime.prod_left fun b hb => (Hb b hb).right
     use fun i => if i = a then u else v * μ i
-    have hμ' : (∑ i in t, v * ((μ i * ∏ j in t \ {i}, s j) * s a)) = v * s a := by
+    have hμ' : ∑ i in t, v * ((μ i * ∏ j in t \ {i}, s j) * s a) = v * s a := by
       rw [← mul_sum, ← sum_mul, hμ, one_mul]
     rw [sum_cons, cons_eq_insert, sdiff_singleton_eq_erase, erase_insert hat, if_pos rfl, ← huv, ←
       hμ', sum_congr rfl]
@@ -170,7 +170,7 @@ theorem exists_sum_eq_one_iff_pairwise_coprime [DecidableEq I] (h : t.Nonempty)
 #align exists_sum_eq_one_iff_pairwise_coprime exists_sum_eq_one_iff_pairwise_coprime
 
 theorem exists_sum_eq_one_iff_pairwise_coprime' [Fintype I] [Nonempty I] [DecidableEq I] :
-    (∃ μ : I → R, (∑ i : I, μ i * ∏ j in {i}ᶜ, s j) = 1) ↔ Pairwise (IsCoprime on s) :=
+    (∃ μ : I → R, ∑ i : I, μ i * ∏ j in {i}ᶜ, s j = 1) ↔ Pairwise (IsCoprime on s) :=
   by
   convert exists_sum_eq_one_iff_pairwise_coprime Finset.univ_nonempty using 1
   simp only [Function.onFun, pairwise_subtype_iff_pairwise_finset', coe_univ, Set.pairwise_univ]
Diff
@@ -142,11 +142,11 @@ theorem exists_sum_eq_one_iff_pairwise_coprime [DecidableEq I] (h : t.Nonempty)
     refine' ⟨ih.mp ⟨Pi.single h.some (μ a * s h.some) + μ * fun _ => s a, _⟩, fun b hb => _⟩
     · rw [prod_eq_mul_prod_diff_singleton h.some_spec, ← mul_assoc, ←
         @if_pos _ _ h.some_spec R (_ * _) 0, ← sum_pi_single', ← sum_add_distrib] at hμ 
-      rw [← hμ, sum_congr rfl]; intro x hx; convert@add_mul R _ _ _ _ _ _ using 2
+      rw [← hμ, sum_congr rfl]; intro x hx; convert @add_mul R _ _ _ _ _ _ using 2
       · by_cases hx : x = h.some
         · rw [hx, Pi.single_eq_same, Pi.single_eq_same]
         · rw [Pi.single_eq_of_ne hx, Pi.single_eq_of_ne hx, MulZeroClass.zero_mul]
-      · convert(mul_assoc _ _ _).symm
+      · convert (mul_assoc _ _ _).symm
         convert prod_eq_mul_prod_diff_singleton (mem x hx) _ using 3
         convert sdiff_sdiff_comm; rw [sdiff_singleton_eq_erase, erase_insert hat]
     · have : IsCoprime (s b) (s a) :=
@@ -165,7 +165,7 @@ theorem exists_sum_eq_one_iff_pairwise_coprime [DecidableEq I] (h : t.Nonempty)
       hμ', sum_congr rfl]
     intro x hx
     rw [mul_assoc, if_neg fun ha : x = a => hat (ha.casesOn hx)]
-    convert mul_assoc _ _ _; convert(prod_eq_prod_diff_singleton_mul (mem x hx) _).symm using 3
+    convert mul_assoc _ _ _; convert (prod_eq_prod_diff_singleton_mul (mem x hx) _).symm using 3
     convert sdiff_sdiff_comm; rw [sdiff_singleton_eq_erase, erase_insert hat]
 #align exists_sum_eq_one_iff_pairwise_coprime exists_sum_eq_one_iff_pairwise_coprime
 
Diff
@@ -58,7 +58,7 @@ alias Nat.isCoprime_iff_coprime ↔ IsCoprime.nat_coprime Nat.coprime.isCoprime
 #print IsCoprime.prod_left /-
 theorem IsCoprime.prod_left : (∀ i ∈ t, IsCoprime (s i) x) → IsCoprime (∏ i in t, s i) x :=
   Finset.induction_on t (fun _ => isCoprime_one_left) fun b t hbt ih H => by
-    rw [Finset.prod_insert hbt]; rw [Finset.forall_mem_insert] at H; exact H.1.mul_left (ih H.2)
+    rw [Finset.prod_insert hbt]; rw [Finset.forall_mem_insert] at H ; exact H.1.mul_left (ih H.2)
 #align is_coprime.prod_left IsCoprime.prod_left
 -/
 
@@ -130,7 +130,7 @@ theorem exists_sum_eq_one_iff_pairwise_coprime [DecidableEq I] (h : t.Nonempty)
   · simp only [Pairwise, sum_singleton, Finset.sdiff_self, prod_empty, mul_one,
       exists_apply_eq_apply, Ne.def, true_iff_iff]
     rintro a ⟨i, hi⟩ ⟨j, hj⟩ h
-    rw [Finset.mem_singleton] at hi hj
+    rw [Finset.mem_singleton] at hi hj 
     simpa [hi, hj] using h
   intro a t hat h ih
   rw [pairwise_cons']
@@ -138,10 +138,10 @@ theorem exists_sum_eq_one_iff_pairwise_coprime [DecidableEq I] (h : t.Nonempty)
     exact ⟨mem_insert_self _ _, fun ha => hat (ha.symm.cases_on hx)⟩
   constructor
   · rintro ⟨μ, hμ⟩
-    rw [sum_cons, cons_eq_insert, sdiff_singleton_eq_erase, erase_insert hat] at hμ
+    rw [sum_cons, cons_eq_insert, sdiff_singleton_eq_erase, erase_insert hat] at hμ 
     refine' ⟨ih.mp ⟨Pi.single h.some (μ a * s h.some) + μ * fun _ => s a, _⟩, fun b hb => _⟩
     · rw [prod_eq_mul_prod_diff_singleton h.some_spec, ← mul_assoc, ←
-        @if_pos _ _ h.some_spec R (_ * _) 0, ← sum_pi_single', ← sum_add_distrib] at hμ
+        @if_pos _ _ h.some_spec R (_ * _) 0, ← sum_pi_single', ← sum_add_distrib] at hμ 
       rw [← hμ, sum_congr rfl]; intro x hx; convert@add_mul R _ _ _ _ _ _ using 2
       · by_cases hx : x = h.some
         · rw [hx, Pi.single_eq_same, Pi.single_eq_same]
@@ -182,7 +182,7 @@ theorem pairwise_coprime_iff_coprime_prod [DecidableEq I] :
     Pairwise (IsCoprime on fun i : t => s i) ↔ ∀ i ∈ t, IsCoprime (s i) (∏ j in t \ {i}, s j) :=
   by
   refine' ⟨fun hp i hi => is_coprime.prod_right_iff.mpr fun j hj => _, fun hp => _⟩
-  · rw [Finset.mem_sdiff, Finset.mem_singleton] at hj
+  · rw [Finset.mem_sdiff, Finset.mem_singleton] at hj 
     obtain ⟨hj, ji⟩ := hj
     exact @hp ⟨i, hi⟩ ⟨j, hj⟩ fun h => ji (congr_arg coe h).symm
   · rintro ⟨i, hi⟩ ⟨j, hj⟩ h
@@ -215,7 +215,7 @@ theorem IsCoprime.pow (H : IsCoprime x y) : IsCoprime (x ^ m) (y ^ n) :=
 theorem IsCoprime.pow_left_iff (hm : 0 < m) : IsCoprime (x ^ m) y ↔ IsCoprime x y :=
   by
   refine' ⟨fun h => _, IsCoprime.pow_left⟩
-  rw [← Finset.card_range m, ← Finset.prod_const] at h
+  rw [← Finset.card_range m, ← Finset.prod_const] at h 
   exact h.of_prod_left 0 (finset.mem_range.mpr hm)
 #align is_coprime.pow_left_iff IsCoprime.pow_left_iff
 -/
Diff
@@ -31,11 +31,11 @@ universe u v
 
 variable {R : Type u} {I : Type v} [CommSemiring R] {x y z : R} {s : I → R} {t : Finset I}
 
-open BigOperators
+open scoped BigOperators
 
 section
 
-open Classical
+open scoped Classical
 
 theorem Nat.isCoprime_iff_coprime {m n : ℕ} : IsCoprime (m : ℤ) n ↔ Nat.coprime m n :=
   ⟨fun ⟨a, b, H⟩ =>
Diff
@@ -37,12 +37,6 @@ section
 
 open Classical
 
-/- warning: nat.is_coprime_iff_coprime -> Nat.isCoprime_iff_coprime is a dubious translation:
-lean 3 declaration is
-  forall {m : Nat} {n : Nat}, Iff (IsCoprime.{0} Int Int.commSemiring ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Int (HasLiftT.mk.{1, 1} Nat Int (CoeTCₓ.coe.{1, 1} Nat Int (coeBase.{1, 1} Nat Int Int.hasCoe))) m) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Int (HasLiftT.mk.{1, 1} Nat Int (CoeTCₓ.coe.{1, 1} Nat Int (coeBase.{1, 1} Nat Int Int.hasCoe))) n)) (Nat.coprime m n)
-but is expected to have type
-  forall {m : Nat} {n : Nat}, Iff (IsCoprime.{0} Int Int.instCommSemiringInt (Nat.cast.{0} Int instNatCastInt m) (Nat.cast.{0} Int instNatCastInt n)) (Nat.coprime m n)
-Case conversion may be inaccurate. Consider using '#align nat.is_coprime_iff_coprime Nat.isCoprime_iff_coprimeₓ'. -/
 theorem Nat.isCoprime_iff_coprime {m n : ℕ} : IsCoprime (m : ℤ) n ↔ Nat.coprime m n :=
   ⟨fun ⟨a, b, H⟩ =>
     Nat.eq_one_of_dvd_one <|
@@ -57,18 +51,6 @@ theorem Nat.isCoprime_iff_coprime {m n : ℕ} : IsCoprime (m : ℤ) n ↔ Nat.co
         Int.ofNat_one]⟩⟩
 #align nat.is_coprime_iff_coprime Nat.isCoprime_iff_coprime
 
-/- warning: is_coprime.nat_coprime -> IsCoprime.nat_coprime is a dubious translation:
-lean 3 declaration is
-  forall {m : Nat} {n : Nat}, (IsCoprime.{0} Int Int.commSemiring ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Int (HasLiftT.mk.{1, 1} Nat Int (CoeTCₓ.coe.{1, 1} Nat Int (coeBase.{1, 1} Nat Int Int.hasCoe))) m) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Int (HasLiftT.mk.{1, 1} Nat Int (CoeTCₓ.coe.{1, 1} Nat Int (coeBase.{1, 1} Nat Int Int.hasCoe))) n)) -> (Nat.coprime m n)
-but is expected to have type
-  forall {m : Nat} {n : Nat}, (IsCoprime.{0} Int Int.instCommSemiringInt (Nat.cast.{0} Int instNatCastInt m) (Nat.cast.{0} Int instNatCastInt n)) -> (Nat.coprime m n)
-Case conversion may be inaccurate. Consider using '#align is_coprime.nat_coprime IsCoprime.nat_coprimeₓ'. -/
-/- warning: nat.coprime.is_coprime -> Nat.coprime.isCoprime is a dubious translation:
-lean 3 declaration is
-  forall {m : Nat} {n : Nat}, (Nat.coprime m n) -> (IsCoprime.{0} Int Int.commSemiring ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Int (HasLiftT.mk.{1, 1} Nat Int (CoeTCₓ.coe.{1, 1} Nat Int (coeBase.{1, 1} Nat Int Int.hasCoe))) m) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Int (HasLiftT.mk.{1, 1} Nat Int (CoeTCₓ.coe.{1, 1} Nat Int (coeBase.{1, 1} Nat Int Int.hasCoe))) n))
-but is expected to have type
-  forall {m : Nat} {n : Nat}, (Nat.coprime m n) -> (IsCoprime.{0} Int Int.instCommSemiringInt (Nat.cast.{0} Int instNatCastInt m) (Nat.cast.{0} Int instNatCastInt n))
-Case conversion may be inaccurate. Consider using '#align nat.coprime.is_coprime Nat.coprime.isCoprimeₓ'. -/
 alias Nat.isCoprime_iff_coprime ↔ IsCoprime.nat_coprime Nat.coprime.isCoprime
 #align is_coprime.nat_coprime IsCoprime.nat_coprime
 #align nat.coprime.is_coprime Nat.coprime.isCoprime
@@ -140,12 +122,6 @@ end
 
 open Finset
 
-/- warning: exists_sum_eq_one_iff_pairwise_coprime -> exists_sum_eq_one_iff_pairwise_coprime is a dubious translation:
-lean 3 declaration is
-  forall {R : Type.{u1}} {I : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] {s : I -> R} {t : Finset.{u2} I} [_inst_2 : DecidableEq.{succ u2} I], (Finset.Nonempty.{u2} I t) -> (Iff (Exists.{max (succ u2) (succ u1)} (I -> R) (fun (μ : I -> R) => Eq.{succ u1} R (Finset.sum.{u1, u2} R I (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))) t (fun (i : I) => HMul.hMul.{u1, u1, u1} R R R (instHMul.{u1} R (Distrib.toHasMul.{u1} R (NonUnitalNonAssocSemiring.toDistrib.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))))) (μ i) (Finset.prod.{u1, u2} R I (CommSemiring.toCommMonoid.{u1} R _inst_1) (SDiff.sdiff.{u2} (Finset.{u2} I) (Finset.hasSdiff.{u2} I (fun (a : I) (b : I) => _inst_2 a b)) t (Singleton.singleton.{u2, u2} I (Finset.{u2} I) (Finset.hasSingleton.{u2} I) i)) (fun (j : I) => s j)))) (OfNat.ofNat.{u1} R 1 (OfNat.mk.{u1} R 1 (One.one.{u1} R (AddMonoidWithOne.toOne.{u1} R (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} R (NonAssocSemiring.toAddCommMonoidWithOne.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))))))))) (Pairwise.{u2} (coeSort.{succ u2, succ (succ u2)} (Finset.{u2} I) Type.{u2} (Finset.hasCoeToSort.{u2} I) t) (Function.onFun.{succ u2, succ u1, 1} (coeSort.{succ u2, succ (succ u2)} (Finset.{u2} I) Type.{u2} (Finset.hasCoeToSort.{u2} I) t) R Prop (IsCoprime.{u1} R _inst_1) (fun (i : coeSort.{succ u2, succ (succ u2)} (Finset.{u2} I) Type.{u2} (Finset.hasCoeToSort.{u2} I) t) => s ((fun (a : Type.{u2}) (b : Type.{u2}) [self : HasLiftT.{succ u2, succ u2} a b] => self.0) (coeSort.{succ u2, succ (succ u2)} (Finset.{u2} I) Type.{u2} (Finset.hasCoeToSort.{u2} I) t) I (HasLiftT.mk.{succ u2, succ u2} (coeSort.{succ u2, succ (succ u2)} (Finset.{u2} I) Type.{u2} (Finset.hasCoeToSort.{u2} I) t) I (CoeTCₓ.coe.{succ u2, succ u2} (coeSort.{succ u2, succ (succ u2)} (Finset.{u2} I) Type.{u2} (Finset.hasCoeToSort.{u2} I) t) I (coeBase.{succ u2, succ u2} (coeSort.{succ u2, succ (succ u2)} (Finset.{u2} I) Type.{u2} (Finset.hasCoeToSort.{u2} I) t) I (coeSubtype.{succ u2} I (fun (x : I) => Membership.Mem.{u2, u2} I (Finset.{u2} I) (Finset.hasMem.{u2} I) x t))))) i)))))
-but is expected to have type
-  forall {R : Type.{u1}} {I : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] {s : I -> R} {t : Finset.{u2} I} [_inst_2 : DecidableEq.{succ u2} I], (Finset.Nonempty.{u2} I t) -> (Iff (Exists.{max (succ u1) (succ u2)} (I -> R) (fun (μ : I -> R) => Eq.{succ u1} R (Finset.sum.{u1, u2} R I (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))) t (fun (i : I) => HMul.hMul.{u1, u1, u1} R R R (instHMul.{u1} R (NonUnitalNonAssocSemiring.toMul.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))))) (μ i) (Finset.prod.{u1, u2} R I (CommSemiring.toCommMonoid.{u1} R _inst_1) (SDiff.sdiff.{u2} (Finset.{u2} I) (Finset.instSDiffFinset.{u2} I (fun (a : I) (b : I) => _inst_2 a b)) t (Singleton.singleton.{u2, u2} I (Finset.{u2} I) (Finset.instSingletonFinset.{u2} I) i)) (fun (j : I) => s j)))) (OfNat.ofNat.{u1} R 1 (One.toOfNat1.{u1} R (Semiring.toOne.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))))) (Pairwise.{u2} (Subtype.{succ u2} I (fun (x : I) => Membership.mem.{u2, u2} I (Finset.{u2} I) (Finset.instMembershipFinset.{u2} I) x t)) (Function.onFun.{succ u2, succ u1, 1} (Subtype.{succ u2} I (fun (x : I) => Membership.mem.{u2, u2} I (Finset.{u2} I) (Finset.instMembershipFinset.{u2} I) x t)) R Prop (IsCoprime.{u1} R _inst_1) (fun (i : Subtype.{succ u2} I (fun (x : I) => Membership.mem.{u2, u2} I (Finset.{u2} I) (Finset.instMembershipFinset.{u2} I) x t)) => s (Subtype.val.{succ u2} I (fun (x : I) => Membership.mem.{u2, u2} I (Finset.{u2} I) (Finset.instMembershipFinset.{u2} I) x t) i)))))
-Case conversion may be inaccurate. Consider using '#align exists_sum_eq_one_iff_pairwise_coprime exists_sum_eq_one_iff_pairwise_coprimeₓ'. -/
 theorem exists_sum_eq_one_iff_pairwise_coprime [DecidableEq I] (h : t.Nonempty) :
     (∃ μ : I → R, (∑ i in t, μ i * ∏ j in t \ {i}, s j) = 1) ↔
       Pairwise (IsCoprime on fun i : t => s i) :=
@@ -193,12 +169,6 @@ theorem exists_sum_eq_one_iff_pairwise_coprime [DecidableEq I] (h : t.Nonempty)
     convert sdiff_sdiff_comm; rw [sdiff_singleton_eq_erase, erase_insert hat]
 #align exists_sum_eq_one_iff_pairwise_coprime exists_sum_eq_one_iff_pairwise_coprime
 
-/- warning: exists_sum_eq_one_iff_pairwise_coprime' -> exists_sum_eq_one_iff_pairwise_coprime' is a dubious translation:
-lean 3 declaration is
-  forall {R : Type.{u1}} {I : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] {s : I -> R} [_inst_2 : Fintype.{u2} I] [_inst_3 : Nonempty.{succ u2} I] [_inst_4 : DecidableEq.{succ u2} I], Iff (Exists.{max (succ u2) (succ u1)} (I -> R) (fun (μ : I -> R) => Eq.{succ u1} R (Finset.sum.{u1, u2} R I (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))) (Finset.univ.{u2} I _inst_2) (fun (i : I) => HMul.hMul.{u1, u1, u1} R R R (instHMul.{u1} R (Distrib.toHasMul.{u1} R (NonUnitalNonAssocSemiring.toDistrib.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))))) (μ i) (Finset.prod.{u1, u2} R I (CommSemiring.toCommMonoid.{u1} R _inst_1) (HasCompl.compl.{u2} (Finset.{u2} I) (BooleanAlgebra.toHasCompl.{u2} (Finset.{u2} I) (Finset.booleanAlgebra.{u2} I _inst_2 (fun (a : I) (b : I) => _inst_4 a b))) (Singleton.singleton.{u2, u2} I (Finset.{u2} I) (Finset.hasSingleton.{u2} I) i)) (fun (j : I) => s j)))) (OfNat.ofNat.{u1} R 1 (OfNat.mk.{u1} R 1 (One.one.{u1} R (AddMonoidWithOne.toOne.{u1} R (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} R (NonAssocSemiring.toAddCommMonoidWithOne.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))))))))) (Pairwise.{u2} I (Function.onFun.{succ u2, succ u1, 1} I R Prop (IsCoprime.{u1} R _inst_1) s))
-but is expected to have type
-  forall {R : Type.{u1}} {I : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] {s : I -> R} [_inst_2 : Fintype.{u2} I] [_inst_3 : Nonempty.{succ u2} I] [_inst_4 : DecidableEq.{succ u2} I], Iff (Exists.{max (succ u1) (succ u2)} (I -> R) (fun (μ : I -> R) => Eq.{succ u1} R (Finset.sum.{u1, u2} R I (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))) (Finset.univ.{u2} I _inst_2) (fun (i : I) => HMul.hMul.{u1, u1, u1} R R R (instHMul.{u1} R (NonUnitalNonAssocSemiring.toMul.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))))) (μ i) (Finset.prod.{u1, u2} R I (CommSemiring.toCommMonoid.{u1} R _inst_1) (HasCompl.compl.{u2} (Finset.{u2} I) (BooleanAlgebra.toHasCompl.{u2} (Finset.{u2} I) (Finset.booleanAlgebra.{u2} I _inst_2 (fun (a : I) (b : I) => _inst_4 a b))) (Singleton.singleton.{u2, u2} I (Finset.{u2} I) (Finset.instSingletonFinset.{u2} I) i)) (fun (j : I) => s j)))) (OfNat.ofNat.{u1} R 1 (One.toOfNat1.{u1} R (Semiring.toOne.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))))) (Pairwise.{u2} I (Function.onFun.{succ u2, succ u1, 1} I R Prop (IsCoprime.{u1} R _inst_1) s))
-Case conversion may be inaccurate. Consider using '#align exists_sum_eq_one_iff_pairwise_coprime' exists_sum_eq_one_iff_pairwise_coprime'ₓ'. -/
 theorem exists_sum_eq_one_iff_pairwise_coprime' [Fintype I] [Nonempty I] [DecidableEq I] :
     (∃ μ : I → R, (∑ i : I, μ i * ∏ j in {i}ᶜ, s j) = 1) ↔ Pairwise (IsCoprime on s) :=
   by
Diff
@@ -75,11 +75,8 @@ alias Nat.isCoprime_iff_coprime ↔ IsCoprime.nat_coprime Nat.coprime.isCoprime
 
 #print IsCoprime.prod_left /-
 theorem IsCoprime.prod_left : (∀ i ∈ t, IsCoprime (s i) x) → IsCoprime (∏ i in t, s i) x :=
-  Finset.induction_on t (fun _ => isCoprime_one_left) fun b t hbt ih H =>
-    by
-    rw [Finset.prod_insert hbt]
-    rw [Finset.forall_mem_insert] at H
-    exact H.1.mul_left (ih H.2)
+  Finset.induction_on t (fun _ => isCoprime_one_left) fun b t hbt ih H => by
+    rw [Finset.prod_insert hbt]; rw [Finset.forall_mem_insert] at H; exact H.1.mul_left (ih H.2)
 #align is_coprime.prod_left IsCoprime.prod_left
 -/
 
@@ -126,10 +123,7 @@ theorem Finset.prod_dvd_of_coprime :
       have aux1 : a ∈ (↑(insert a r) : Set I) := Finset.mem_insert_self a r
       refine'
         (IsCoprime.prod_right fun i hir =>
-              Hs aux1 (Finset.mem_insert_of_mem hir) <|
-                by
-                rintro rfl
-                exact har hir).mul_dvd
+              Hs aux1 (Finset.mem_insert_of_mem hir) <| by rintro rfl; exact har hir).mul_dvd
           (Hs1 a aux1) (ih (Hs.mono _) fun i hi => Hs1 i <| Finset.mem_insert_of_mem hi)
       simp only [Finset.coe_insert, Set.subset_insert])
 #align finset.prod_dvd_of_coprime Finset.prod_dvd_of_coprime
@@ -164,9 +158,7 @@ theorem exists_sum_eq_one_iff_pairwise_coprime [DecidableEq I] (h : t.Nonempty)
     simpa [hi, hj] using h
   intro a t hat h ih
   rw [pairwise_cons']
-  have mem : ∀ x ∈ t, a ∈ insert a t \ {x} := fun x hx =>
-    by
-    rw [mem_sdiff, mem_singleton]
+  have mem : ∀ x ∈ t, a ∈ insert a t \ {x} := fun x hx => by rw [mem_sdiff, mem_singleton];
     exact ⟨mem_insert_self _ _, fun ha => hat (ha.symm.cases_on hx)⟩
   constructor
   · rintro ⟨μ, hμ⟩
@@ -174,27 +166,21 @@ theorem exists_sum_eq_one_iff_pairwise_coprime [DecidableEq I] (h : t.Nonempty)
     refine' ⟨ih.mp ⟨Pi.single h.some (μ a * s h.some) + μ * fun _ => s a, _⟩, fun b hb => _⟩
     · rw [prod_eq_mul_prod_diff_singleton h.some_spec, ← mul_assoc, ←
         @if_pos _ _ h.some_spec R (_ * _) 0, ← sum_pi_single', ← sum_add_distrib] at hμ
-      rw [← hμ, sum_congr rfl]
-      intro x hx
-      convert@add_mul R _ _ _ _ _ _ using 2
+      rw [← hμ, sum_congr rfl]; intro x hx; convert@add_mul R _ _ _ _ _ _ using 2
       · by_cases hx : x = h.some
         · rw [hx, Pi.single_eq_same, Pi.single_eq_same]
         · rw [Pi.single_eq_of_ne hx, Pi.single_eq_of_ne hx, MulZeroClass.zero_mul]
       · convert(mul_assoc _ _ _).symm
         convert prod_eq_mul_prod_diff_singleton (mem x hx) _ using 3
-        convert sdiff_sdiff_comm
-        rw [sdiff_singleton_eq_erase, erase_insert hat]
+        convert sdiff_sdiff_comm; rw [sdiff_singleton_eq_erase, erase_insert hat]
     · have : IsCoprime (s b) (s a) :=
         ⟨μ a * ∏ i in t \ {b}, s i, ∑ i in t, μ i * ∏ j in t \ {i}, s j, _⟩
       · exact ⟨this.symm, this⟩
       rw [mul_assoc, ← prod_eq_prod_diff_singleton_mul hb, sum_mul, ← hμ, sum_congr rfl]
-      intro x hx
-      convert mul_assoc _ _ _
+      intro x hx; convert mul_assoc _ _ _
       convert prod_eq_prod_diff_singleton_mul (mem x hx) _ using 3
-      convert sdiff_sdiff_comm
-      rw [sdiff_singleton_eq_erase, erase_insert hat]
-  · rintro ⟨hs, Hb⟩
-    obtain ⟨μ, hμ⟩ := ih.mpr hs
+      convert sdiff_sdiff_comm; rw [sdiff_singleton_eq_erase, erase_insert hat]
+  · rintro ⟨hs, Hb⟩; obtain ⟨μ, hμ⟩ := ih.mpr hs
     obtain ⟨u, v, huv⟩ := IsCoprime.prod_left fun b hb => (Hb b hb).right
     use fun i => if i = a then u else v * μ i
     have hμ' : (∑ i in t, v * ((μ i * ∏ j in t \ {i}, s j) * s a)) = v * s a := by
@@ -203,10 +189,8 @@ theorem exists_sum_eq_one_iff_pairwise_coprime [DecidableEq I] (h : t.Nonempty)
       hμ', sum_congr rfl]
     intro x hx
     rw [mul_assoc, if_neg fun ha : x = a => hat (ha.casesOn hx)]
-    convert mul_assoc _ _ _
-    convert(prod_eq_prod_diff_singleton_mul (mem x hx) _).symm using 3
-    convert sdiff_sdiff_comm
-    rw [sdiff_singleton_eq_erase, erase_insert hat]
+    convert mul_assoc _ _ _; convert(prod_eq_prod_diff_singleton_mul (mem x hx) _).symm using 3
+    convert sdiff_sdiff_comm; rw [sdiff_singleton_eq_erase, erase_insert hat]
 #align exists_sum_eq_one_iff_pairwise_coprime exists_sum_eq_one_iff_pairwise_coprime
 
 /- warning: exists_sum_eq_one_iff_pairwise_coprime' -> exists_sum_eq_one_iff_pairwise_coprime' is a dubious translation:
@@ -240,18 +224,14 @@ theorem pairwise_coprime_iff_coprime_prod [DecidableEq I] :
 variable {m n : ℕ}
 
 #print IsCoprime.pow_left /-
-theorem IsCoprime.pow_left (H : IsCoprime x y) : IsCoprime (x ^ m) y :=
-  by
-  rw [← Finset.card_range m, ← Finset.prod_const]
-  exact IsCoprime.prod_left fun _ _ => H
+theorem IsCoprime.pow_left (H : IsCoprime x y) : IsCoprime (x ^ m) y := by
+  rw [← Finset.card_range m, ← Finset.prod_const]; exact IsCoprime.prod_left fun _ _ => H
 #align is_coprime.pow_left IsCoprime.pow_left
 -/
 
 #print IsCoprime.pow_right /-
-theorem IsCoprime.pow_right (H : IsCoprime x y) : IsCoprime x (y ^ n) :=
-  by
-  rw [← Finset.card_range n, ← Finset.prod_const]
-  exact IsCoprime.prod_right fun _ _ => H
+theorem IsCoprime.pow_right (H : IsCoprime x y) : IsCoprime x (y ^ n) := by
+  rw [← Finset.card_range n, ← Finset.prod_const]; exact IsCoprime.prod_right fun _ _ => H
 #align is_coprime.pow_right IsCoprime.pow_right
 -/
 
Diff
@@ -41,7 +41,7 @@ open Classical
 lean 3 declaration is
   forall {m : Nat} {n : Nat}, Iff (IsCoprime.{0} Int Int.commSemiring ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Int (HasLiftT.mk.{1, 1} Nat Int (CoeTCₓ.coe.{1, 1} Nat Int (coeBase.{1, 1} Nat Int Int.hasCoe))) m) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Int (HasLiftT.mk.{1, 1} Nat Int (CoeTCₓ.coe.{1, 1} Nat Int (coeBase.{1, 1} Nat Int Int.hasCoe))) n)) (Nat.coprime m n)
 but is expected to have type
-  forall {m : Nat} {n : Nat}, Iff (IsCoprime.{0} Int Int.instCommSemiringInt (Nat.cast.{0} Int Int.instNatCastInt m) (Nat.cast.{0} Int Int.instNatCastInt n)) (Nat.coprime m n)
+  forall {m : Nat} {n : Nat}, Iff (IsCoprime.{0} Int Int.instCommSemiringInt (Nat.cast.{0} Int instNatCastInt m) (Nat.cast.{0} Int instNatCastInt n)) (Nat.coprime m n)
 Case conversion may be inaccurate. Consider using '#align nat.is_coprime_iff_coprime Nat.isCoprime_iff_coprimeₓ'. -/
 theorem Nat.isCoprime_iff_coprime {m n : ℕ} : IsCoprime (m : ℤ) n ↔ Nat.coprime m n :=
   ⟨fun ⟨a, b, H⟩ =>
@@ -61,13 +61,13 @@ theorem Nat.isCoprime_iff_coprime {m n : ℕ} : IsCoprime (m : ℤ) n ↔ Nat.co
 lean 3 declaration is
   forall {m : Nat} {n : Nat}, (IsCoprime.{0} Int Int.commSemiring ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Int (HasLiftT.mk.{1, 1} Nat Int (CoeTCₓ.coe.{1, 1} Nat Int (coeBase.{1, 1} Nat Int Int.hasCoe))) m) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Int (HasLiftT.mk.{1, 1} Nat Int (CoeTCₓ.coe.{1, 1} Nat Int (coeBase.{1, 1} Nat Int Int.hasCoe))) n)) -> (Nat.coprime m n)
 but is expected to have type
-  forall {m : Nat} {n : Nat}, (IsCoprime.{0} Int Int.instCommSemiringInt (Nat.cast.{0} Int Int.instNatCastInt m) (Nat.cast.{0} Int Int.instNatCastInt n)) -> (Nat.coprime m n)
+  forall {m : Nat} {n : Nat}, (IsCoprime.{0} Int Int.instCommSemiringInt (Nat.cast.{0} Int instNatCastInt m) (Nat.cast.{0} Int instNatCastInt n)) -> (Nat.coprime m n)
 Case conversion may be inaccurate. Consider using '#align is_coprime.nat_coprime IsCoprime.nat_coprimeₓ'. -/
 /- warning: nat.coprime.is_coprime -> Nat.coprime.isCoprime is a dubious translation:
 lean 3 declaration is
   forall {m : Nat} {n : Nat}, (Nat.coprime m n) -> (IsCoprime.{0} Int Int.commSemiring ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Int (HasLiftT.mk.{1, 1} Nat Int (CoeTCₓ.coe.{1, 1} Nat Int (coeBase.{1, 1} Nat Int Int.hasCoe))) m) ((fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) Nat Int (HasLiftT.mk.{1, 1} Nat Int (CoeTCₓ.coe.{1, 1} Nat Int (coeBase.{1, 1} Nat Int Int.hasCoe))) n))
 but is expected to have type
-  forall {m : Nat} {n : Nat}, (Nat.coprime m n) -> (IsCoprime.{0} Int Int.instCommSemiringInt (Nat.cast.{0} Int Int.instNatCastInt m) (Nat.cast.{0} Int Int.instNatCastInt n))
+  forall {m : Nat} {n : Nat}, (Nat.coprime m n) -> (IsCoprime.{0} Int Int.instCommSemiringInt (Nat.cast.{0} Int instNatCastInt m) (Nat.cast.{0} Int instNatCastInt n))
 Case conversion may be inaccurate. Consider using '#align nat.coprime.is_coprime Nat.coprime.isCoprimeₓ'. -/
 alias Nat.isCoprime_iff_coprime ↔ IsCoprime.nat_coprime Nat.coprime.isCoprime
 #align is_coprime.nat_coprime IsCoprime.nat_coprime
Diff
@@ -176,11 +176,11 @@ theorem exists_sum_eq_one_iff_pairwise_coprime [DecidableEq I] (h : t.Nonempty)
         @if_pos _ _ h.some_spec R (_ * _) 0, ← sum_pi_single', ← sum_add_distrib] at hμ
       rw [← hμ, sum_congr rfl]
       intro x hx
-      convert @add_mul R _ _ _ _ _ _ using 2
+      convert@add_mul R _ _ _ _ _ _ using 2
       · by_cases hx : x = h.some
         · rw [hx, Pi.single_eq_same, Pi.single_eq_same]
         · rw [Pi.single_eq_of_ne hx, Pi.single_eq_of_ne hx, MulZeroClass.zero_mul]
-      · convert (mul_assoc _ _ _).symm
+      · convert(mul_assoc _ _ _).symm
         convert prod_eq_mul_prod_diff_singleton (mem x hx) _ using 3
         convert sdiff_sdiff_comm
         rw [sdiff_singleton_eq_erase, erase_insert hat]
@@ -204,7 +204,7 @@ theorem exists_sum_eq_one_iff_pairwise_coprime [DecidableEq I] (h : t.Nonempty)
     intro x hx
     rw [mul_assoc, if_neg fun ha : x = a => hat (ha.casesOn hx)]
     convert mul_assoc _ _ _
-    convert (prod_eq_prod_diff_singleton_mul (mem x hx) _).symm using 3
+    convert(prod_eq_prod_diff_singleton_mul (mem x hx) _).symm using 3
     convert sdiff_sdiff_comm
     rw [sdiff_singleton_eq_erase, erase_insert hat]
 #align exists_sum_eq_one_iff_pairwise_coprime exists_sum_eq_one_iff_pairwise_coprime
Diff
@@ -213,7 +213,7 @@ theorem exists_sum_eq_one_iff_pairwise_coprime [DecidableEq I] (h : t.Nonempty)
 lean 3 declaration is
   forall {R : Type.{u1}} {I : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] {s : I -> R} [_inst_2 : Fintype.{u2} I] [_inst_3 : Nonempty.{succ u2} I] [_inst_4 : DecidableEq.{succ u2} I], Iff (Exists.{max (succ u2) (succ u1)} (I -> R) (fun (μ : I -> R) => Eq.{succ u1} R (Finset.sum.{u1, u2} R I (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))) (Finset.univ.{u2} I _inst_2) (fun (i : I) => HMul.hMul.{u1, u1, u1} R R R (instHMul.{u1} R (Distrib.toHasMul.{u1} R (NonUnitalNonAssocSemiring.toDistrib.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))))) (μ i) (Finset.prod.{u1, u2} R I (CommSemiring.toCommMonoid.{u1} R _inst_1) (HasCompl.compl.{u2} (Finset.{u2} I) (BooleanAlgebra.toHasCompl.{u2} (Finset.{u2} I) (Finset.booleanAlgebra.{u2} I _inst_2 (fun (a : I) (b : I) => _inst_4 a b))) (Singleton.singleton.{u2, u2} I (Finset.{u2} I) (Finset.hasSingleton.{u2} I) i)) (fun (j : I) => s j)))) (OfNat.ofNat.{u1} R 1 (OfNat.mk.{u1} R 1 (One.one.{u1} R (AddMonoidWithOne.toOne.{u1} R (AddCommMonoidWithOne.toAddMonoidWithOne.{u1} R (NonAssocSemiring.toAddCommMonoidWithOne.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))))))))) (Pairwise.{u2} I (Function.onFun.{succ u2, succ u1, 1} I R Prop (IsCoprime.{u1} R _inst_1) s))
 but is expected to have type
-  forall {R : Type.{u1}} {I : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] {s : I -> R} [_inst_2 : Fintype.{u2} I] [_inst_3 : Nonempty.{succ u2} I] [_inst_4 : DecidableEq.{succ u2} I], Iff (Exists.{max (succ u1) (succ u2)} (I -> R) (fun (μ : I -> R) => Eq.{succ u1} R (Finset.sum.{u1, u2} R I (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))) (Finset.univ.{u2} I _inst_2) (fun (i : I) => HMul.hMul.{u1, u1, u1} R R R (instHMul.{u1} R (NonUnitalNonAssocSemiring.toMul.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))))) (μ i) (Finset.prod.{u1, u2} R I (CommSemiring.toCommMonoid.{u1} R _inst_1) (HasCompl.compl.{u2} (Finset.{u2} I) (BooleanAlgebra.toHasCompl.{u2} (Finset.{u2} I) (Finset.instBooleanAlgebraFinset.{u2} I _inst_2 (fun (a : I) (b : I) => _inst_4 a b))) (Singleton.singleton.{u2, u2} I (Finset.{u2} I) (Finset.instSingletonFinset.{u2} I) i)) (fun (j : I) => s j)))) (OfNat.ofNat.{u1} R 1 (One.toOfNat1.{u1} R (Semiring.toOne.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))))) (Pairwise.{u2} I (Function.onFun.{succ u2, succ u1, 1} I R Prop (IsCoprime.{u1} R _inst_1) s))
+  forall {R : Type.{u1}} {I : Type.{u2}} [_inst_1 : CommSemiring.{u1} R] {s : I -> R} [_inst_2 : Fintype.{u2} I] [_inst_3 : Nonempty.{succ u2} I] [_inst_4 : DecidableEq.{succ u2} I], Iff (Exists.{max (succ u1) (succ u2)} (I -> R) (fun (μ : I -> R) => Eq.{succ u1} R (Finset.sum.{u1, u2} R I (NonUnitalNonAssocSemiring.toAddCommMonoid.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))) (Finset.univ.{u2} I _inst_2) (fun (i : I) => HMul.hMul.{u1, u1, u1} R R R (instHMul.{u1} R (NonUnitalNonAssocSemiring.toMul.{u1} R (NonAssocSemiring.toNonUnitalNonAssocSemiring.{u1} R (Semiring.toNonAssocSemiring.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1))))) (μ i) (Finset.prod.{u1, u2} R I (CommSemiring.toCommMonoid.{u1} R _inst_1) (HasCompl.compl.{u2} (Finset.{u2} I) (BooleanAlgebra.toHasCompl.{u2} (Finset.{u2} I) (Finset.booleanAlgebra.{u2} I _inst_2 (fun (a : I) (b : I) => _inst_4 a b))) (Singleton.singleton.{u2, u2} I (Finset.{u2} I) (Finset.instSingletonFinset.{u2} I) i)) (fun (j : I) => s j)))) (OfNat.ofNat.{u1} R 1 (One.toOfNat1.{u1} R (Semiring.toOne.{u1} R (CommSemiring.toSemiring.{u1} R _inst_1)))))) (Pairwise.{u2} I (Function.onFun.{succ u2, succ u1, 1} I R Prop (IsCoprime.{u1} R _inst_1) s))
 Case conversion may be inaccurate. Consider using '#align exists_sum_eq_one_iff_pairwise_coprime' exists_sum_eq_one_iff_pairwise_coprime'ₓ'. -/
 theorem exists_sum_eq_one_iff_pairwise_coprime' [Fintype I] [Nonempty I] [DecidableEq I] :
     (∃ μ : I → R, (∑ i : I, μ i * ∏ j in {i}ᶜ, s j) = 1) ↔ Pairwise (IsCoprime on s) :=
Diff
@@ -179,7 +179,7 @@ theorem exists_sum_eq_one_iff_pairwise_coprime [DecidableEq I] (h : t.Nonempty)
       convert @add_mul R _ _ _ _ _ _ using 2
       · by_cases hx : x = h.some
         · rw [hx, Pi.single_eq_same, Pi.single_eq_same]
-        · rw [Pi.single_eq_of_ne hx, Pi.single_eq_of_ne hx, zero_mul]
+        · rw [Pi.single_eq_of_ne hx, Pi.single_eq_of_ne hx, MulZeroClass.zero_mul]
       · convert (mul_assoc _ _ _).symm
         convert prod_eq_mul_prod_diff_singleton (mem x hx) _ using 3
         convert sdiff_sdiff_comm

Changes in mathlib4

mathlib3
mathlib4
chore: replace refine' that already have a ?_ (#12261)

Co-authored-by: Moritz Firsching <firsching@google.com>

Diff
@@ -136,7 +136,7 @@ theorem exists_sum_eq_one_iff_pairwise_coprime [DecidableEq I] (h : t.Nonempty)
   constructor
   · rintro ⟨μ, hμ⟩
     rw [sum_cons, cons_eq_insert, sdiff_singleton_eq_erase, erase_insert hat] at hμ
-    refine' ⟨ih.mp ⟨Pi.single h.choose (μ a * s h.choose) + μ * fun _ ↦ s a, ?_⟩, fun b hb ↦ ?_⟩
+    refine ⟨ih.mp ⟨Pi.single h.choose (μ a * s h.choose) + μ * fun _ ↦ s a, ?_⟩, fun b hb ↦ ?_⟩
     · rw [prod_eq_mul_prod_diff_singleton h.choose_spec, ← mul_assoc, ←
         @if_pos _ _ h.choose_spec R (_ * _) 0, ← sum_pi_single', ← sum_add_distrib] at hμ
       rw [← hμ, sum_congr rfl]
@@ -189,7 +189,7 @@ theorem exists_sum_eq_one_iff_pairwise_coprime' [Fintype I] [Nonempty I] [Decida
 -- Porting note: a lot of the capitalization wasn't working
 theorem pairwise_coprime_iff_coprime_prod [DecidableEq I] :
     Pairwise (IsCoprime on fun i : t ↦ s i) ↔ ∀ i ∈ t, IsCoprime (s i) (∏ j in t \ {i}, s j) := by
-  refine' ⟨fun hp i hi ↦ IsCoprime.prod_right_iff.mpr fun j hj ↦ ?_, fun hp ↦ ?_⟩
+  refine ⟨fun hp i hi ↦ IsCoprime.prod_right_iff.mpr fun j hj ↦ ?_, fun hp ↦ ?_⟩
   · rw [Finset.mem_sdiff, Finset.mem_singleton] at hj
     obtain ⟨hj, ji⟩ := hj
     refine @hp ⟨i, hi⟩ ⟨j, hj⟩ fun h ↦ ji (congrArg Subtype.val h).symm
@@ -285,7 +285,7 @@ theorem Fintype.prod_dvd_of_isRelPrime [Fintype I] (Hs : Pairwise (IsRelPrime on
 
 theorem pairwise_isRelPrime_iff_isRelPrime_prod [DecidableEq I] :
     Pairwise (IsRelPrime on fun i : t ↦ s i) ↔ ∀ i ∈ t, IsRelPrime (s i) (∏ j in t \ {i}, s j) := by
-  refine' ⟨fun hp i hi ↦ IsRelPrime.prod_right_iff.mpr fun j hj ↦ ?_, fun hp ↦ ?_⟩
+  refine ⟨fun hp i hi ↦ IsRelPrime.prod_right_iff.mpr fun j hj ↦ ?_, fun hp ↦ ?_⟩
   · rw [Finset.mem_sdiff, Finset.mem_singleton] at hj
     obtain ⟨hj, ji⟩ := hj
     exact @hp ⟨i, hi⟩ ⟨j, hj⟩ fun h ↦ ji (congrArg Subtype.val h).symm
chore(Data/Int/Cast): fix confusion between OfNat and Nat.cast lemmas (#11861)

This renames

  • Int.cast_ofNat to Int.cast_natCast
  • Int.int_cast_ofNat to Int.cast_ofNat

I think the history here is that this lemma was previously about Int.ofNat, before we globally fixed the simp-normal form to be Nat.cast.

Since the Int.cast_ofNat name is repurposed, it can't be deprecated. Int.int_cast_ofNat is such a wonky name that it was probably never used.

Diff
@@ -52,7 +52,7 @@ alias ⟨IsCoprime.nat_coprime, Nat.Coprime.isCoprime⟩ := Nat.isCoprime_iff_co
 theorem Nat.Coprime.cast {R : Type*} [CommRing R] {a b : ℕ} (h : Nat.Coprime a b) :
     IsCoprime (a : R) (b : R) := by
   rw [← isCoprime_iff_coprime] at h
-  rw [← Int.cast_ofNat a, ← Int.cast_ofNat b]
+  rw [← Int.cast_natCast a, ← Int.cast_natCast b]
   exact IsCoprime.intCast h
 
 theorem ne_zero_or_ne_zero_of_nat_coprime {A : Type u} [CommRing A] [Nontrivial A] {a b : ℕ}
chore: tidy various files (#11624)
Diff
@@ -18,7 +18,7 @@ These lemmas are in a separate file to the definition of `IsCoprime` or `IsRelPr
 as they require more imports.
 
 Notably, this includes lemmas about `Finset.prod` as this requires importing BigOperators, and
-lemmas about `HasPow` since these are easiest to prove via `Finset.prod`.
+lemmas about `Pow` since these are easiest to prove via `Finset.prod`.
 
 -/
 
chore: avoid Ne.def (adaptation for nightly-2024-03-27) (#11813)
Diff
@@ -124,7 +124,7 @@ theorem exists_sum_eq_one_iff_pairwise_coprime [DecidableEq I] (h : t.Nonempty)
       Pairwise (IsCoprime on fun i : t ↦ s i) := by
   refine' h.cons_induction _ _
   · simp only [sum_singleton, Finset.sdiff_self, prod_empty, mul_one, exists_apply_eq,
-               Pairwise, Ne.def, true_iff_iff]
+               Pairwise, Ne, true_iff_iff]
     rintro a ⟨i, hi⟩ ⟨j, hj⟩ h
     rw [Finset.mem_singleton] at hi hj
     simp [hi, hj] at h
style: homogenise porting notes (#11145)

Homogenises porting notes via capitalisation and addition of whitespace.

It makes the following changes:

  • converts "--porting note" into "-- Porting note";
  • converts "porting note" into "Porting note".
Diff
@@ -92,7 +92,7 @@ theorem IsCoprime.of_prod_right (H1 : IsCoprime x (∏ i in t, s i)) (i : I) (hi
   IsCoprime.prod_right_iff.1 H1 i hit
 #align is_coprime.of_prod_right IsCoprime.of_prod_right
 
--- porting note: removed names of things due to linter, but they seem helpful
+-- Porting note: removed names of things due to linter, but they seem helpful
 theorem Finset.prod_dvd_of_coprime :
     (t : Set I).Pairwise (IsCoprime on s) → (∀ i ∈ t, s i ∣ z) → (∏ x in t, s x) ∣ z := by
   classical
@@ -141,7 +141,7 @@ theorem exists_sum_eq_one_iff_pairwise_coprime [DecidableEq I] (h : t.Nonempty)
         @if_pos _ _ h.choose_spec R (_ * _) 0, ← sum_pi_single', ← sum_add_distrib] at hμ
       rw [← hμ, sum_congr rfl]
       intro x hx
-      dsimp -- porting note: terms were showing as sort of `HAdd.hadd` instead of `+`
+      dsimp -- Porting note: terms were showing as sort of `HAdd.hadd` instead of `+`
       -- this whole proof pretty much breaks and has to be rewritten from scratch
       rw [add_mul]
       congr 1
@@ -186,14 +186,14 @@ theorem exists_sum_eq_one_iff_pairwise_coprime' [Fintype I] [Nonempty I] [Decida
   simp only [Function.onFun, pairwise_subtype_iff_pairwise_finset', coe_univ, Set.pairwise_univ]
 #align exists_sum_eq_one_iff_pairwise_coprime' exists_sum_eq_one_iff_pairwise_coprime'
 
--- porting note: a lot of the capitalization wasn't working
+-- Porting note: a lot of the capitalization wasn't working
 theorem pairwise_coprime_iff_coprime_prod [DecidableEq I] :
     Pairwise (IsCoprime on fun i : t ↦ s i) ↔ ∀ i ∈ t, IsCoprime (s i) (∏ j in t \ {i}, s j) := by
   refine' ⟨fun hp i hi ↦ IsCoprime.prod_right_iff.mpr fun j hj ↦ ?_, fun hp ↦ ?_⟩
   · rw [Finset.mem_sdiff, Finset.mem_singleton] at hj
     obtain ⟨hj, ji⟩ := hj
     refine @hp ⟨i, hi⟩ ⟨j, hj⟩ fun h ↦ ji (congrArg Subtype.val h).symm
-    -- porting note: is there a better way compared to the old `congr_arg coe h`?
+    -- Porting note: is there a better way compared to the old `congr_arg coe h`?
   · rintro ⟨i, hi⟩ ⟨j, hj⟩ h
     apply IsCoprime.prod_right_iff.mp (hp i hi)
     exact Finset.mem_sdiff.mpr ⟨hj, fun f ↦ h <| Subtype.ext (Finset.mem_singleton.mp f).symm⟩
@@ -219,7 +219,7 @@ theorem IsCoprime.pow_left_iff (hm : 0 < m) : IsCoprime (x ^ m) y ↔ IsCoprime
   refine' ⟨fun h ↦ _, IsCoprime.pow_left⟩
   rw [← Finset.card_range m, ← Finset.prod_const] at h
   exact h.of_prod_left 0 (Finset.mem_range.mpr hm)
-  -- porting note: I'm not sure why `finset` didn't get corrected automatically to `Finset`
+  -- Porting note: I'm not sure why `finset` didn't get corrected automatically to `Finset`
   -- by Mathport, nor whether this is an issue
 #align is_coprime.pow_left_iff IsCoprime.pow_left_iff
 
chore: remove terminal, terminal refines (#10762)

I replaced a few "terminal" refine/refine's with exact.

The strategy was very simple-minded: essentially any refine whose following line had smaller indentation got replaced by exact and then I cleaned up the mess.

This PR certainly leaves some further terminal refines, but maybe the current change is beneficial.

Diff
@@ -132,7 +132,7 @@ theorem exists_sum_eq_one_iff_pairwise_coprime [DecidableEq I] (h : t.Nonempty)
   rw [pairwise_cons']
   have mem : ∀ x ∈ t, a ∈ insert a t \ {x} := fun x hx ↦ by
     rw [mem_sdiff, mem_singleton]
-    refine ⟨mem_insert_self _ _, fun ha ↦ hat (ha ▸ hx)⟩
+    exact ⟨mem_insert_self _ _, fun ha ↦ hat (ha ▸ hx)⟩
   constructor
   · rintro ⟨μ, hμ⟩
     rw [sum_cons, cons_eq_insert, sdiff_singleton_eq_erase, erase_insert hat] at hμ
@@ -288,7 +288,7 @@ theorem pairwise_isRelPrime_iff_isRelPrime_prod [DecidableEq I] :
   refine' ⟨fun hp i hi ↦ IsRelPrime.prod_right_iff.mpr fun j hj ↦ ?_, fun hp ↦ ?_⟩
   · rw [Finset.mem_sdiff, Finset.mem_singleton] at hj
     obtain ⟨hj, ji⟩ := hj
-    refine @hp ⟨i, hi⟩ ⟨j, hj⟩ fun h ↦ ji (congrArg Subtype.val h).symm
+    exact @hp ⟨i, hi⟩ ⟨j, hj⟩ fun h ↦ ji (congrArg Subtype.val h).symm
   · rintro ⟨i, hi⟩ ⟨j, hj⟩ h
     apply IsRelPrime.prod_right_iff.mp (hp i hi)
     exact Finset.mem_sdiff.mpr ⟨hj, fun f ↦ h <| Subtype.ext (Finset.mem_singleton.mp f).symm⟩
feat: introduce IsRelPrime and DecompositionMonoid and refactor (#10327)
  • Introduce typeclass DecompositionMonoid, which says every element in the monoid is primal, i.e., whenever an element divides a product b * c, it can be factored into a product such that the factors divides b and c respectively. A domain is called pre-Schreier if its multiplicative monoid is a decomposition monoid, and these are more general than GCD domains.

  • Show that any GCDMonoid is a DecompositionMonoid. In order for lemmas about DecompositionMonoids to automatically apply to UniqueFactorizationMonoids, we add instances from UniqueFactorizationMonoid α to Nonempty (NormalizedGCDMonoid α) to Nonempty (GCDMonoid α) to DecompositionMonoid α. (Zulip) See the bottom of message for an updated diagram of classes and instances.

  • Introduce binary predicate IsRelPrime which says that the only common divisors of the two elements are units. Replace previous occurrences in mathlib by this predicate.

  • Duplicate all lemmas about IsCoprime in Coprime/Basic (except three lemmas about smul) to IsRelPrime. Due to import constraints, they are spread into three files Algebra/Divisibility/Units (including key lemmas assuming DecompositionMonoid), GroupWithZero/Divisibility, and Coprime/Basic.

  • Show IsCoprime always imply IsRelPrime and is equivalent to it in Bezout rings. To reduce duplication, the definition of Bezout rings and the GCDMonoid instance are moved from RingTheory/Bezout to RingTheory/PrincipalIdealDomain, and some results in PrincipalIdealDomain are generalized to Bezout rings.

  • Remove the recently added file Squarefree/UniqueFactorizationMonoid and place the results appropriately within Squarefree/Basic. All results are generalized to DecompositionMonoid or weaker except the last one.

Zulip

With this PR, all the following instances (indicated by arrows) now work; this PR fills the central part.

                                                                          EuclideanDomain (bundled)
                                                                              ↙          ↖
                                                                 IsPrincipalIdealRing ← Field (bundled)
                                                                            ↓             ↓
         NormalizationMonoid ←          NormalizedGCDMonoid → GCDMonoid  IsBezout ← ValuationRing ← DiscreteValuationRing
                   ↓                             ↓                 ↘       ↙
Nonempty NormalizationMonoid ← Nonempty NormalizedGCDMonoid →  Nonempty GCDMonoid → IsIntegrallyClosed
                                                 ↑                    ↓
                    WfDvdMonoid ← UniqueFactorizationMonoid → DecompositionMonoid
                                                 ↑
                                       IsPrincipalIdealRing

Co-authored-by: Junyan Xu <junyanxu.math@gmail.com> Co-authored-by: Oliver Nash <github@olivernash.org>

Diff
@@ -12,23 +12,25 @@ import Mathlib.RingTheory.Coprime.Basic
 
 /-!
 # Additional lemmas about elements of a ring satisfying `IsCoprime`
+and elements of a monoid satisfying `IsRelPrime`
 
-These lemmas are in a separate file to the definition of `IsCoprime` as they require more imports.
+These lemmas are in a separate file to the definition of `IsCoprime` or `IsRelPrime`
+as they require more imports.
 
-Notably, this includes lemmas about `Finset.prod` as this requires importing big_operators, and
+Notably, this includes lemmas about `Finset.prod` as this requires importing BigOperators, and
 lemmas about `HasPow` since these are easiest to prove via `Finset.prod`.
 
 -/
 
 universe u v
 
-variable {R : Type u} {I : Type v} [CommSemiring R] {x y z : R} {s : I → R} {t : Finset I}
+open scoped BigOperators
 
-open BigOperators
+section IsCoprime
 
-section
+variable {R : Type u} {I : Type v} [CommSemiring R] {x y z : R} {s : I → R} {t : Finset I}
 
-open Classical
+section
 
 theorem Int.isCoprime_iff_gcd_eq_one {m n : ℤ} : IsCoprime m n ↔ Int.gcd m n = 1 := by
   constructor
@@ -58,20 +60,22 @@ theorem ne_zero_or_ne_zero_of_nat_coprime {A : Type u} [CommRing A] [Nontrivial
   IsCoprime.ne_zero_or_ne_zero (R := A) <| by
     simpa only [map_natCast] using IsCoprime.map (Nat.Coprime.isCoprime h) (Int.castRingHom A)
 
-theorem IsCoprime.prod_left : (∀ i ∈ t, IsCoprime (s i) x) → IsCoprime (∏ i in t, s i) x :=
-  Finset.induction_on t (fun _ ↦ isCoprime_one_left) fun b t hbt ih H ↦ by
-    rw [Finset.prod_insert hbt]
-    rw [Finset.forall_mem_insert] at H
-    exact H.1.mul_left (ih H.2)
+theorem IsCoprime.prod_left : (∀ i ∈ t, IsCoprime (s i) x) → IsCoprime (∏ i in t, s i) x := by
+  classical
+  refine Finset.induction_on t (fun _ ↦ isCoprime_one_left) fun b t hbt ih H ↦ ?_
+  rw [Finset.prod_insert hbt]
+  rw [Finset.forall_mem_insert] at H
+  exact H.1.mul_left (ih H.2)
 #align is_coprime.prod_left IsCoprime.prod_left
 
 theorem IsCoprime.prod_right : (∀ i ∈ t, IsCoprime x (s i)) → IsCoprime x (∏ i in t, s i) := by
   simpa only [isCoprime_comm] using IsCoprime.prod_left (R := R)
 #align is_coprime.prod_right IsCoprime.prod_right
 
-theorem IsCoprime.prod_left_iff : IsCoprime (∏ i in t, s i) x ↔ ∀ i ∈ t, IsCoprime (s i) x :=
-  Finset.induction_on t (iff_of_true isCoprime_one_left fun _ ↦ by simp) fun b t hbt ih ↦ by
-    rw [Finset.prod_insert hbt, IsCoprime.mul_left_iff, ih, Finset.forall_mem_insert]
+theorem IsCoprime.prod_left_iff : IsCoprime (∏ i in t, s i) x ↔ ∀ i ∈ t, IsCoprime (s i) x := by
+  classical
+  refine Finset.induction_on t (iff_of_true isCoprime_one_left fun _ ↦ by simp) fun b t hbt ih ↦ ?_
+  rw [Finset.prod_insert hbt, IsCoprime.mul_left_iff, ih, Finset.forall_mem_insert]
 #align is_coprime.prod_left_iff IsCoprime.prod_left_iff
 
 theorem IsCoprime.prod_right_iff : IsCoprime x (∏ i in t, s i) ↔ ∀ i ∈ t, IsCoprime x (s i) := by
@@ -90,8 +94,9 @@ theorem IsCoprime.of_prod_right (H1 : IsCoprime x (∏ i in t, s i)) (i : I) (hi
 
 -- porting note: removed names of things due to linter, but they seem helpful
 theorem Finset.prod_dvd_of_coprime :
-    ∀ (_ : (t : Set I).Pairwise (IsCoprime on s)) (_ : ∀ i ∈ t, s i ∣ z), (∏ x in t, s x) ∣ z :=
-  Finset.induction_on t (fun _ _ ↦ one_dvd z)
+    (t : Set I).Pairwise (IsCoprime on s) → (∀ i ∈ t, s i ∣ z) → (∏ x in t, s x) ∣ z := by
+  classical
+  exact Finset.induction_on t (fun _ _ ↦ one_dvd z)
     (by
       intro a r har ih Hs Hs1
       rw [Finset.prod_insert har]
@@ -225,3 +230,96 @@ theorem IsCoprime.pow_right_iff (hm : 0 < m) : IsCoprime x (y ^ m) ↔ IsCoprime
 theorem IsCoprime.pow_iff (hm : 0 < m) (hn : 0 < n) : IsCoprime (x ^ m) (y ^ n) ↔ IsCoprime x y :=
   (IsCoprime.pow_left_iff hm).trans <| IsCoprime.pow_right_iff hn
 #align is_coprime.pow_iff IsCoprime.pow_iff
+
+end IsCoprime
+
+section RelPrime
+
+variable {α I} [CommMonoid α] [DecompositionMonoid α] {x y z : α} {s : I → α} {t : Finset I}
+
+theorem IsRelPrime.prod_left : (∀ i ∈ t, IsRelPrime (s i) x) → IsRelPrime (∏ i in t, s i) x := by
+  classical
+  refine Finset.induction_on t (fun _ ↦ isRelPrime_one_left) fun b t hbt ih H ↦ ?_
+  rw [Finset.prod_insert hbt]
+  rw [Finset.forall_mem_insert] at H
+  exact H.1.mul_left (ih H.2)
+
+theorem IsRelPrime.prod_right : (∀ i ∈ t, IsRelPrime x (s i)) → IsRelPrime x (∏ i in t, s i) := by
+  simpa only [isRelPrime_comm] using IsRelPrime.prod_left (α := α)
+
+theorem IsRelPrime.prod_left_iff : IsRelPrime (∏ i in t, s i) x ↔ ∀ i ∈ t, IsRelPrime (s i) x := by
+  classical
+  refine Finset.induction_on t (iff_of_true isRelPrime_one_left fun _ ↦ by simp) fun b t hbt ih ↦ ?_
+  rw [Finset.prod_insert hbt, IsRelPrime.mul_left_iff, ih, Finset.forall_mem_insert]
+
+theorem IsRelPrime.prod_right_iff : IsRelPrime x (∏ i in t, s i) ↔ ∀ i ∈ t, IsRelPrime x (s i) := by
+  simpa only [isRelPrime_comm] using IsRelPrime.prod_left_iff (α := α)
+
+theorem IsRelPrime.of_prod_left (H1 : IsRelPrime (∏ i in t, s i) x) (i : I) (hit : i ∈ t) :
+    IsRelPrime (s i) x :=
+  IsRelPrime.prod_left_iff.1 H1 i hit
+
+theorem IsRelPrime.of_prod_right (H1 : IsRelPrime x (∏ i in t, s i)) (i : I) (hit : i ∈ t) :
+    IsRelPrime x (s i) :=
+  IsRelPrime.prod_right_iff.1 H1 i hit
+
+theorem Finset.prod_dvd_of_isRelPrime :
+    (t : Set I).Pairwise (IsRelPrime on s) → (∀ i ∈ t, s i ∣ z) → (∏ x in t, s x) ∣ z := by
+  classical
+  exact Finset.induction_on t (fun _ _ ↦ one_dvd z)
+    (by
+      intro a r har ih Hs Hs1
+      rw [Finset.prod_insert har]
+      have aux1 : a ∈ (↑(insert a r) : Set I) := Finset.mem_insert_self a r
+      refine'
+        (IsRelPrime.prod_right fun i hir ↦
+              Hs aux1 (Finset.mem_insert_of_mem hir) <| by
+                rintro rfl
+                exact har hir).mul_dvd
+          (Hs1 a aux1) (ih (Hs.mono _) fun i hi ↦ Hs1 i <| Finset.mem_insert_of_mem hi)
+      simp only [Finset.coe_insert, Set.subset_insert])
+
+theorem Fintype.prod_dvd_of_isRelPrime [Fintype I] (Hs : Pairwise (IsRelPrime on s))
+    (Hs1 : ∀ i, s i ∣ z) : (∏ x, s x) ∣ z :=
+  Finset.prod_dvd_of_isRelPrime (Hs.set_pairwise _) fun i _ ↦ Hs1 i
+
+theorem pairwise_isRelPrime_iff_isRelPrime_prod [DecidableEq I] :
+    Pairwise (IsRelPrime on fun i : t ↦ s i) ↔ ∀ i ∈ t, IsRelPrime (s i) (∏ j in t \ {i}, s j) := by
+  refine' ⟨fun hp i hi ↦ IsRelPrime.prod_right_iff.mpr fun j hj ↦ ?_, fun hp ↦ ?_⟩
+  · rw [Finset.mem_sdiff, Finset.mem_singleton] at hj
+    obtain ⟨hj, ji⟩ := hj
+    refine @hp ⟨i, hi⟩ ⟨j, hj⟩ fun h ↦ ji (congrArg Subtype.val h).symm
+  · rintro ⟨i, hi⟩ ⟨j, hj⟩ h
+    apply IsRelPrime.prod_right_iff.mp (hp i hi)
+    exact Finset.mem_sdiff.mpr ⟨hj, fun f ↦ h <| Subtype.ext (Finset.mem_singleton.mp f).symm⟩
+
+namespace IsRelPrime
+
+variable {m n : ℕ}
+
+theorem pow_left (H : IsRelPrime x y) : IsRelPrime (x ^ m) y := by
+  rw [← Finset.card_range m, ← Finset.prod_const]
+  exact IsRelPrime.prod_left fun _ _ ↦ H
+
+theorem pow_right (H : IsRelPrime x y) : IsRelPrime x (y ^ n) := by
+  rw [← Finset.card_range n, ← Finset.prod_const]
+  exact IsRelPrime.prod_right fun _ _ ↦ H
+
+theorem pow (H : IsRelPrime x y) : IsRelPrime (x ^ m) (y ^ n) :=
+  H.pow_left.pow_right
+
+theorem pow_left_iff (hm : 0 < m) : IsRelPrime (x ^ m) y ↔ IsRelPrime x y := by
+  refine' ⟨fun h ↦ _, IsRelPrime.pow_left⟩
+  rw [← Finset.card_range m, ← Finset.prod_const] at h
+  exact h.of_prod_left 0 (Finset.mem_range.mpr hm)
+
+theorem pow_right_iff (hm : 0 < m) : IsRelPrime x (y ^ m) ↔ IsRelPrime x y :=
+  isRelPrime_comm.trans <| (IsRelPrime.pow_left_iff hm).trans <| isRelPrime_comm
+
+theorem pow_iff (hm : 0 < m) (hn : 0 < n) :
+    IsRelPrime (x ^ m) (y ^ n) ↔ IsRelPrime x y :=
+  (IsRelPrime.pow_left_iff hm).trans (IsRelPrime.pow_right_iff hn)
+
+end IsRelPrime
+
+end RelPrime
feat: Chinese remainder for ZMod. (#7599)
Diff
@@ -47,6 +47,12 @@ alias ⟨IsCoprime.nat_coprime, Nat.Coprime.isCoprime⟩ := Nat.isCoprime_iff_co
 #align is_coprime.nat_coprime IsCoprime.nat_coprime
 #align nat.coprime.is_coprime Nat.Coprime.isCoprime
 
+theorem Nat.Coprime.cast {R : Type*} [CommRing R] {a b : ℕ} (h : Nat.Coprime a b) :
+    IsCoprime (a : R) (b : R) := by
+  rw [← isCoprime_iff_coprime] at h
+  rw [← Int.cast_ofNat a, ← Int.cast_ofNat b]
+  exact IsCoprime.intCast h
+
 theorem ne_zero_or_ne_zero_of_nat_coprime {A : Type u} [CommRing A] [Nontrivial A] {a b : ℕ}
     (h : Nat.Coprime a b) : (a : A) ≠ 0 ∨ (b : A) ≠ 0 :=
   IsCoprime.ne_zero_or_ne_zero (R := A) <| by
chore: bump to v4.1.0-rc1 (2nd attempt) (#7216)

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -39,18 +39,18 @@ theorem Int.isCoprime_iff_gcd_eq_one {m n : ℤ} : IsCoprime m n ↔ Int.gcd m n
     intro h
     exact ⟨_, _, h⟩
 
-theorem Nat.isCoprime_iff_coprime {m n : ℕ} : IsCoprime (m : ℤ) n ↔ Nat.coprime m n := by
+theorem Nat.isCoprime_iff_coprime {m n : ℕ} : IsCoprime (m : ℤ) n ↔ Nat.Coprime m n := by
   rw [Int.isCoprime_iff_gcd_eq_one, Int.coe_nat_gcd]
 #align nat.is_coprime_iff_coprime Nat.isCoprime_iff_coprime
 
-alias ⟨IsCoprime.nat_coprime, Nat.coprime.isCoprime⟩ := Nat.isCoprime_iff_coprime
+alias ⟨IsCoprime.nat_coprime, Nat.Coprime.isCoprime⟩ := Nat.isCoprime_iff_coprime
 #align is_coprime.nat_coprime IsCoprime.nat_coprime
-#align nat.coprime.is_coprime Nat.coprime.isCoprime
+#align nat.coprime.is_coprime Nat.Coprime.isCoprime
 
 theorem ne_zero_or_ne_zero_of_nat_coprime {A : Type u} [CommRing A] [Nontrivial A] {a b : ℕ}
-    (h : Nat.coprime a b) : (a : A) ≠ 0 ∨ (b : A) ≠ 0 :=
+    (h : Nat.Coprime a b) : (a : A) ≠ 0 ∨ (b : A) ≠ 0 :=
   IsCoprime.ne_zero_or_ne_zero (R := A) <| by
-    simpa only [map_natCast] using IsCoprime.map (Nat.coprime.isCoprime h) (Int.castRingHom A)
+    simpa only [map_natCast] using IsCoprime.map (Nat.Coprime.isCoprime h) (Int.castRingHom A)
 
 theorem IsCoprime.prod_left : (∀ i ∈ t, IsCoprime (s i) x) → IsCoprime (∏ i in t, s i) x :=
   Finset.induction_on t (fun _ ↦ isCoprime_one_left) fun b t hbt ih H ↦ by
Revert "chore: bump to v4.1.0-rc1 (#7174)" (#7198)

This reverts commit 6f8e8104. Unfortunately this bump was not linted correctly, as CI did not run runLinter Mathlib.

We can unrevert once that's fixed.

Diff
@@ -39,18 +39,18 @@ theorem Int.isCoprime_iff_gcd_eq_one {m n : ℤ} : IsCoprime m n ↔ Int.gcd m n
     intro h
     exact ⟨_, _, h⟩
 
-theorem Nat.isCoprime_iff_coprime {m n : ℕ} : IsCoprime (m : ℤ) n ↔ Nat.Coprime m n := by
+theorem Nat.isCoprime_iff_coprime {m n : ℕ} : IsCoprime (m : ℤ) n ↔ Nat.coprime m n := by
   rw [Int.isCoprime_iff_gcd_eq_one, Int.coe_nat_gcd]
 #align nat.is_coprime_iff_coprime Nat.isCoprime_iff_coprime
 
-alias ⟨IsCoprime.nat_coprime, Nat.Coprime.isCoprime⟩ := Nat.isCoprime_iff_coprime
+alias ⟨IsCoprime.nat_coprime, Nat.coprime.isCoprime⟩ := Nat.isCoprime_iff_coprime
 #align is_coprime.nat_coprime IsCoprime.nat_coprime
-#align nat.coprime.is_coprime Nat.Coprime.isCoprime
+#align nat.coprime.is_coprime Nat.coprime.isCoprime
 
 theorem ne_zero_or_ne_zero_of_nat_coprime {A : Type u} [CommRing A] [Nontrivial A] {a b : ℕ}
-    (h : Nat.Coprime a b) : (a : A) ≠ 0 ∨ (b : A) ≠ 0 :=
+    (h : Nat.coprime a b) : (a : A) ≠ 0 ∨ (b : A) ≠ 0 :=
   IsCoprime.ne_zero_or_ne_zero (R := A) <| by
-    simpa only [map_natCast] using IsCoprime.map (Nat.Coprime.isCoprime h) (Int.castRingHom A)
+    simpa only [map_natCast] using IsCoprime.map (Nat.coprime.isCoprime h) (Int.castRingHom A)
 
 theorem IsCoprime.prod_left : (∀ i ∈ t, IsCoprime (s i) x) → IsCoprime (∏ i in t, s i) x :=
   Finset.induction_on t (fun _ ↦ isCoprime_one_left) fun b t hbt ih H ↦ by
chore: bump to v4.1.0-rc1 (#7174)

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>

Diff
@@ -39,18 +39,18 @@ theorem Int.isCoprime_iff_gcd_eq_one {m n : ℤ} : IsCoprime m n ↔ Int.gcd m n
     intro h
     exact ⟨_, _, h⟩
 
-theorem Nat.isCoprime_iff_coprime {m n : ℕ} : IsCoprime (m : ℤ) n ↔ Nat.coprime m n := by
+theorem Nat.isCoprime_iff_coprime {m n : ℕ} : IsCoprime (m : ℤ) n ↔ Nat.Coprime m n := by
   rw [Int.isCoprime_iff_gcd_eq_one, Int.coe_nat_gcd]
 #align nat.is_coprime_iff_coprime Nat.isCoprime_iff_coprime
 
-alias ⟨IsCoprime.nat_coprime, Nat.coprime.isCoprime⟩ := Nat.isCoprime_iff_coprime
+alias ⟨IsCoprime.nat_coprime, Nat.Coprime.isCoprime⟩ := Nat.isCoprime_iff_coprime
 #align is_coprime.nat_coprime IsCoprime.nat_coprime
-#align nat.coprime.is_coprime Nat.coprime.isCoprime
+#align nat.coprime.is_coprime Nat.Coprime.isCoprime
 
 theorem ne_zero_or_ne_zero_of_nat_coprime {A : Type u} [CommRing A] [Nontrivial A] {a b : ℕ}
-    (h : Nat.coprime a b) : (a : A) ≠ 0 ∨ (b : A) ≠ 0 :=
+    (h : Nat.Coprime a b) : (a : A) ≠ 0 ∨ (b : A) ≠ 0 :=
   IsCoprime.ne_zero_or_ne_zero (R := A) <| by
-    simpa only [map_natCast] using IsCoprime.map (Nat.coprime.isCoprime h) (Int.castRingHom A)
+    simpa only [map_natCast] using IsCoprime.map (Nat.Coprime.isCoprime h) (Int.castRingHom A)
 
 theorem IsCoprime.prod_left : (∀ i ∈ t, IsCoprime (s i) x) → IsCoprime (∏ i in t, s i) x :=
   Finset.induction_on t (fun _ ↦ isCoprime_one_left) fun b t hbt ih H ↦ by
feat: patch for new alias command (#6172)
Diff
@@ -43,7 +43,7 @@ theorem Nat.isCoprime_iff_coprime {m n : ℕ} : IsCoprime (m : ℤ) n ↔ Nat.co
   rw [Int.isCoprime_iff_gcd_eq_one, Int.coe_nat_gcd]
 #align nat.is_coprime_iff_coprime Nat.isCoprime_iff_coprime
 
-alias Nat.isCoprime_iff_coprime ↔ IsCoprime.nat_coprime Nat.coprime.isCoprime
+alias ⟨IsCoprime.nat_coprime, Nat.coprime.isCoprime⟩ := Nat.isCoprime_iff_coprime
 #align is_coprime.nat_coprime IsCoprime.nat_coprime
 #align nat.coprime.is_coprime Nat.coprime.isCoprime
 
chore: remove unused simps (#6632)

Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -158,9 +158,8 @@ theorem exists_sum_eq_one_iff_pairwise_coprime [DecidableEq I] (h : t.Nonempty)
     use fun i ↦ if i = a then u else v * μ i
     have hμ' : (∑ i in t, v * ((μ i * ∏ j in t \ {i}, s j) * s a)) = v * s a := by
       rw [← mul_sum, ← sum_mul, hμ, one_mul]
-    rw [sum_cons, cons_eq_insert, sdiff_singleton_eq_erase, erase_insert hat]
-    dsimp
-    rw [if_pos rfl, ← huv, ← hμ', sum_congr rfl]
+    rw [sum_cons, cons_eq_insert, sdiff_singleton_eq_erase, erase_insert hat, if_pos rfl,
+      ← huv, ← hμ', sum_congr rfl]
     intro x hx
     rw [mul_assoc, if_neg fun ha : x = a ↦ hat (ha.casesOn hx)]
     rw [mul_assoc]
feat(AlgebraicGeometry/EllipticCurve/Weierstrass): elliptic curves with specified j-invariant (#5935)

Main changes:

  • Define specific Weierstrass curves, whose j-invariants should be 0, 1728, or ≠ 0 and 1728.
  • Prove the quantities c₄, Δ and j for them (whenever they are defined).
  • Define an elliptic curve from an element j in a field, whose j-invariant is equal to j.
  • Generalize Inhabited (EllipticCurve ℚ) to Inhabited (EllipticCurve F) for any field F (computable if F has DecidableEq).
Diff
@@ -47,6 +47,11 @@ alias Nat.isCoprime_iff_coprime ↔ IsCoprime.nat_coprime Nat.coprime.isCoprime
 #align is_coprime.nat_coprime IsCoprime.nat_coprime
 #align nat.coprime.is_coprime Nat.coprime.isCoprime
 
+theorem ne_zero_or_ne_zero_of_nat_coprime {A : Type u} [CommRing A] [Nontrivial A] {a b : ℕ}
+    (h : Nat.coprime a b) : (a : A) ≠ 0 ∨ (b : A) ≠ 0 :=
+  IsCoprime.ne_zero_or_ne_zero (R := A) <| by
+    simpa only [map_natCast] using IsCoprime.map (Nat.coprime.isCoprime h) (Int.castRingHom A)
+
 theorem IsCoprime.prod_left : (∀ i ∈ t, IsCoprime (s i) x) → IsCoprime (∏ i in t, s i) x :=
   Finset.induction_on t (fun _ ↦ isCoprime_one_left) fun b t hbt ih H ↦ by
     rw [Finset.prod_insert hbt]
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -2,17 +2,14 @@
 Copyright (c) 2020 Kenny Lau. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Kenny Lau, Ken Lee, Chris Hughes
-
-! This file was ported from Lean 3 source module ring_theory.coprime.lemmas
-! leanprover-community/mathlib commit 509de852e1de55e1efa8eacfa11df0823f26f226
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Algebra.BigOperators.Ring
 import Mathlib.Data.Fintype.Basic
 import Mathlib.Data.Int.GCD
 import Mathlib.RingTheory.Coprime.Basic
 
+#align_import ring_theory.coprime.lemmas from "leanprover-community/mathlib"@"509de852e1de55e1efa8eacfa11df0823f26f226"
+
 /-!
 # Additional lemmas about elements of a ring satisfying `IsCoprime`
 
feat: porting norm_num extensions for Nat.gcd, Nat.lcm, Int.gcd, Int.lcm, and IsCoprime (#3923)

This completes the porting of these norm_num extensions while adding a new extension for IsCoprime over Int. It also adds the norm_num extension testing file from mathlib3. Closes #3246.

Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -33,18 +33,17 @@ section
 
 open Classical
 
-theorem Nat.isCoprime_iff_coprime {m n : ℕ} : IsCoprime (m : ℤ) n ↔ Nat.coprime m n :=
-  ⟨fun ⟨a, b, H⟩ ↦
-    Nat.eq_one_of_dvd_one <|
-      Int.coe_nat_dvd.1 <| by
-        rw [Int.ofNat_one, ← H]
-        exact
-          dvd_add (dvd_mul_of_dvd_right (Int.coe_nat_dvd.2 <| Nat.gcd_dvd_left m n) _)
-            (dvd_mul_of_dvd_right (Int.coe_nat_dvd.2 <| Nat.gcd_dvd_right m n) _),
-    fun H ↦
-    ⟨Nat.gcdA m n, Nat.gcdB m n, by
-      rw [mul_comm _ (m : ℤ), mul_comm _ (n : ℤ), ← Nat.gcd_eq_gcd_ab, show _ = _ from H,
-        Int.ofNat_one]⟩⟩
+theorem Int.isCoprime_iff_gcd_eq_one {m n : ℤ} : IsCoprime m n ↔ Int.gcd m n = 1 := by
+  constructor
+  · rintro ⟨a, b, h⟩
+    have : 1 = m * a + n * b := by rwa [mul_comm m, mul_comm n, eq_comm]
+    exact Nat.dvd_one.mp (Int.gcd_dvd_iff.mpr ⟨a, b, this⟩)
+  · rw [← Int.ofNat_inj, IsCoprime, Int.gcd_eq_gcd_ab, mul_comm m, mul_comm n, Nat.cast_one]
+    intro h
+    exact ⟨_, _, h⟩
+
+theorem Nat.isCoprime_iff_coprime {m n : ℕ} : IsCoprime (m : ℤ) n ↔ Nat.coprime m n := by
+  rw [Int.isCoprime_iff_gcd_eq_one, Int.coe_nat_gcd]
 #align nat.is_coprime_iff_coprime Nat.isCoprime_iff_coprime
 
 alias Nat.isCoprime_iff_coprime ↔ IsCoprime.nat_coprime Nat.coprime.isCoprime
chore: bye-bye, solo bys! (#3825)

This PR puts, with one exception, every single remaining by that lies all by itself on its own line to the previous line, thus matching the current behaviour of start-port.sh. The exception is when the by begins the second or later argument to a tuple or anonymous constructor; see https://github.com/leanprover-community/mathlib4/pull/3825#discussion_r1186702599.

Essentially this is s/\n *by$/ by/g, but with manual editing to satisfy the linter's max-100-char-line requirement. The Python style linter is also modified to catch these "isolated bys".

Diff
@@ -52,8 +52,7 @@ alias Nat.isCoprime_iff_coprime ↔ IsCoprime.nat_coprime Nat.coprime.isCoprime
 #align nat.coprime.is_coprime Nat.coprime.isCoprime
 
 theorem IsCoprime.prod_left : (∀ i ∈ t, IsCoprime (s i) x) → IsCoprime (∏ i in t, s i) x :=
-  Finset.induction_on t (fun _ ↦ isCoprime_one_left) fun b t hbt ih H ↦
-    by
+  Finset.induction_on t (fun _ ↦ isCoprime_one_left) fun b t hbt ih H ↦ by
     rw [Finset.prod_insert hbt]
     rw [Finset.forall_mem_insert] at H
     exact H.1.mul_left (ih H.2)
@@ -92,8 +91,7 @@ theorem Finset.prod_dvd_of_coprime :
       have aux1 : a ∈ (↑(insert a r) : Set I) := Finset.mem_insert_self a r
       refine'
         (IsCoprime.prod_right fun i hir ↦
-              Hs aux1 (Finset.mem_insert_of_mem hir) <|
-                by
+              Hs aux1 (Finset.mem_insert_of_mem hir) <| by
                 rintro rfl
                 exact har hir).mul_dvd
           (Hs1 a aux1) (ih (Hs.mono _) fun i hi ↦ Hs1 i <| Finset.mem_insert_of_mem hi)
@@ -120,8 +118,7 @@ theorem exists_sum_eq_one_iff_pairwise_coprime [DecidableEq I] (h : t.Nonempty)
     simp [hi, hj] at h
   intro a t hat h ih
   rw [pairwise_cons']
-  have mem : ∀ x ∈ t, a ∈ insert a t \ {x} := fun x hx ↦
-    by
+  have mem : ∀ x ∈ t, a ∈ insert a t \ {x} := fun x hx ↦ by
     rw [mem_sdiff, mem_singleton]
     refine ⟨mem_insert_self _ _, fun ha ↦ hat (ha ▸ hx)⟩
   constructor
chore: scoped BigOperators notation (#1952)
Diff
@@ -27,7 +27,7 @@ universe u v
 
 variable {R : Type u} {I : Type v} [CommSemiring R] {x y z : R} {s : I → R} {t : Finset I}
 
--- open BigOperators porting note: commented out locale
+open BigOperators
 
 section
 
feat: add uppercase lean 3 linter (#1796)

Implements a linter for lean 3 declarations containing capital letters (as suggested on Zulip).

Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -45,7 +45,7 @@ theorem Nat.isCoprime_iff_coprime {m n : ℕ} : IsCoprime (m : ℤ) n ↔ Nat.co
     ⟨Nat.gcdA m n, Nat.gcdB m n, by
       rw [mul_comm _ (m : ℤ), mul_comm _ (n : ℤ), ← Nat.gcd_eq_gcd_ab, show _ = _ from H,
         Int.ofNat_one]⟩⟩
-#align nat.isCoprime_iff_coprime Nat.isCoprime_iff_coprime
+#align nat.is_coprime_iff_coprime Nat.isCoprime_iff_coprime
 
 alias Nat.isCoprime_iff_coprime ↔ IsCoprime.nat_coprime Nat.coprime.isCoprime
 #align is_coprime.nat_coprime IsCoprime.nat_coprime
feat: port RingTheory.Coprime.Lemmas (#1692)

Co-authored-by: Eric Rodriguez <37984851+ericrbg@users.noreply.github.com>

Dependencies 3 + 195

196 files ported (98.5%)
86329 lines ported (98.8%)
Show graph

The unported dependencies are