number_theory.zsqrtd.gaussian_intMathlib.NumberTheory.Zsqrtd.GaussianInt

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)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -187,18 +187,18 @@ theorem toComplex_eq_zero {x : ℤ[i]} : (x : ℂ) = 0 ↔ x = 0 := by
 #align gaussian_int.to_complex_eq_zero GaussianInt.toComplex_eq_zero
 -/
 
-#print GaussianInt.int_cast_real_norm /-
+#print GaussianInt.intCast_real_norm /-
 @[simp]
-theorem int_cast_real_norm (x : ℤ[i]) : (x.norm : ℝ) = (x : ℂ).normSq := by
+theorem intCast_real_norm (x : ℤ[i]) : (x.norm : ℝ) = (x : ℂ).normSq := by
   rw [Zsqrtd.norm, norm_sq] <;> simp
-#align gaussian_int.nat_cast_real_norm GaussianInt.int_cast_real_norm
+#align gaussian_int.nat_cast_real_norm GaussianInt.intCast_real_norm
 -/
 
-#print GaussianInt.int_cast_complex_norm /-
+#print GaussianInt.intCast_complex_norm /-
 @[simp]
-theorem int_cast_complex_norm (x : ℤ[i]) : (x.norm : ℂ) = (x : ℂ).normSq := by
+theorem intCast_complex_norm (x : ℤ[i]) : (x.norm : ℂ) = (x : ℂ).normSq := by
   cases x <;> rw [Zsqrtd.norm, norm_sq] <;> simp
-#align gaussian_int.nat_cast_complex_norm GaussianInt.int_cast_complex_norm
+#align gaussian_int.nat_cast_complex_norm GaussianInt.intCast_complex_norm
 -/
 
 #print GaussianInt.norm_nonneg /-
@@ -225,11 +225,11 @@ theorem abs_natCast_norm (x : ℤ[i]) : (x.norm.natAbs : ℤ) = x.norm :=
 #align gaussian_int.abs_coe_nat_norm GaussianInt.abs_natCast_norm
 -/
 
-#print GaussianInt.nat_cast_natAbs_norm /-
+#print GaussianInt.natCast_natAbs_norm /-
 @[simp]
-theorem nat_cast_natAbs_norm {α : Type _} [Ring α] (x : ℤ[i]) : (x.norm.natAbs : α) = x.norm := by
+theorem natCast_natAbs_norm {α : Type _} [Ring α] (x : ℤ[i]) : (x.norm.natAbs : α) = x.norm := by
   rw [← Int.cast_natCast, abs_coe_nat_norm]
-#align gaussian_int.nat_cast_nat_abs_norm GaussianInt.nat_cast_natAbs_norm
+#align gaussian_int.nat_cast_nat_abs_norm GaussianInt.natCast_natAbs_norm
 -/
 
 #print GaussianInt.natAbs_norm_eq /-
Diff
@@ -219,10 +219,10 @@ theorem norm_pos {x : ℤ[i]} : 0 < norm x ↔ x ≠ 0 := by
 #align gaussian_int.norm_pos GaussianInt.norm_pos
 -/
 
-#print GaussianInt.abs_coe_nat_norm /-
-theorem abs_coe_nat_norm (x : ℤ[i]) : (x.norm.natAbs : ℤ) = x.norm :=
+#print GaussianInt.abs_natCast_norm /-
+theorem abs_natCast_norm (x : ℤ[i]) : (x.norm.natAbs : ℤ) = x.norm :=
   Int.natAbs_of_nonneg (norm_nonneg _)
-#align gaussian_int.abs_coe_nat_norm GaussianInt.abs_coe_nat_norm
+#align gaussian_int.abs_coe_nat_norm GaussianInt.abs_natCast_norm
 -/
 
 #print GaussianInt.nat_cast_natAbs_norm /-
Diff
@@ -228,7 +228,7 @@ theorem abs_coe_nat_norm (x : ℤ[i]) : (x.norm.natAbs : ℤ) = x.norm :=
 #print GaussianInt.nat_cast_natAbs_norm /-
 @[simp]
 theorem nat_cast_natAbs_norm {α : Type _} [Ring α] (x : ℤ[i]) : (x.norm.natAbs : α) = x.norm := by
-  rw [← Int.cast_ofNat, abs_coe_nat_norm]
+  rw [← Int.cast_natCast, abs_coe_nat_norm]
 #align gaussian_int.nat_cast_nat_abs_norm GaussianInt.nat_cast_natAbs_norm
 -/
 
Diff
@@ -313,7 +313,7 @@ theorem norm_mod_lt (x : ℤ[i]) {y : ℤ[i]} (hy : y ≠ 0) : (x % y).norm < y.
     calc
       ↑(Zsqrtd.norm (x % y)) = (x - y * (x / y : ℤ[i]) : ℂ).normSq := by simp [mod_def]
       _ = (y : ℂ).normSq * (x / y - (x / y : ℤ[i]) : ℂ).normSq := by
-        rw [← norm_sq_mul, mul_sub, mul_div_cancel' _ this]
+        rw [← norm_sq_mul, mul_sub, mul_div_cancel₀ _ this]
       _ < (y : ℂ).normSq * 1 :=
         (mul_lt_mul_of_pos_left (normSq_div_sub_div_lt_one _ _) (normSq_pos.2 this))
       _ = Zsqrtd.norm y := by simp
@@ -366,7 +366,7 @@ theorem sq_add_sq_of_nat_prime_of_not_irreducible (p : ℕ) [hp : Fact p.Prime]
   let ⟨a, b, hpab, hau, hbu⟩ := hab
   have hnap : (norm a).natAbs = p :=
     ((hp.1.mul_eq_prime_sq_iff (mt norm_eq_one_iff.1 hau) (mt norm_eq_one_iff.1 hbu)).1 <| by
-        rw [← Int.coe_nat_inj', Int.coe_nat_pow, sq, ← @norm_nat_cast (-1), hpab] <;> simp).1
+        rw [← Int.natCast_inj, Int.coe_nat_pow, sq, ← @norm_nat_cast (-1), hpab] <;> simp).1
   ⟨a.re.natAbs, a.im.natAbs, by simpa [nat_abs_norm_eq, sq] using hnap⟩
 #align gaussian_int.sq_add_sq_of_nat_prime_of_not_irreducible GaussianInt.sq_add_sq_of_nat_prime_of_not_irreducible
 -/
Diff
@@ -362,7 +362,7 @@ theorem sq_add_sq_of_nat_prime_of_not_irreducible (p : ℕ) [hp : Fact p.Prime]
       rw [norm_nat_cast, Int.natAbs_mul, mul_eq_one] <;>
         exact fun h => (ne_of_lt hp.1.one_lt).symm h.1
   have hab : ∃ a b, (p : ℤ[i]) = a * b ∧ ¬IsUnit a ∧ ¬IsUnit b := by
-    simpa [irreducible_iff, hpu, not_forall, not_or] using hpi
+    simpa [irreducible_iff, hpu, Classical.not_forall, not_or] using hpi
   let ⟨a, b, hpab, hau, hbu⟩ := hab
   have hnap : (norm a).natAbs = p :=
     ((hp.1.mul_eq_prime_sq_iff (mt norm_eq_one_iff.1 hau) (mt norm_eq_one_iff.1 hbu)).1 <| by
Diff
@@ -3,9 +3,9 @@ Copyright (c) 2019 Chris Hughes. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Chris Hughes
 -/
-import Mathbin.NumberTheory.Zsqrtd.Basic
-import Mathbin.Data.Complex.Basic
-import Mathbin.RingTheory.PrincipalIdealDomain
+import NumberTheory.Zsqrtd.Basic
+import Data.Complex.Basic
+import RingTheory.PrincipalIdealDomain
 
 #align_import number_theory.zsqrtd.gaussian_int from "leanprover-community/mathlib"@"5d0c76894ada7940957143163d7b921345474cbc"
 
Diff
@@ -132,7 +132,7 @@ theorem toComplex_add (x y : ℤ[i]) : ((x + y : ℤ[i]) : ℂ) = x + y :=
 #print GaussianInt.toComplex_mul /-
 @[simp]
 theorem toComplex_mul (x y : ℤ[i]) : ((x * y : ℤ[i]) : ℂ) = x * y :=
-  toComplex.map_mul _ _
+  toComplex.map_hMul _ _
 #align gaussian_int.to_complex_mul GaussianInt.toComplex_mul
 -/
 
Diff
@@ -2,16 +2,13 @@
 Copyright (c) 2019 Chris Hughes. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Chris Hughes
-
-! This file was ported from Lean 3 source module number_theory.zsqrtd.gaussian_int
-! leanprover-community/mathlib commit 5d0c76894ada7940957143163d7b921345474cbc
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.NumberTheory.Zsqrtd.Basic
 import Mathbin.Data.Complex.Basic
 import Mathbin.RingTheory.PrincipalIdealDomain
 
+#align_import number_theory.zsqrtd.gaussian_int from "leanprover-community/mathlib"@"5d0c76894ada7940957143163d7b921345474cbc"
+
 /-!
 # Gaussian integers
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Chris Hughes
 
 ! This file was ported from Lean 3 source module number_theory.zsqrtd.gaussian_int
-! leanprover-community/mathlib commit 5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9
+! leanprover-community/mathlib commit 5d0c76894ada7940957143163d7b921345474cbc
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -15,6 +15,9 @@ import Mathbin.RingTheory.PrincipalIdealDomain
 /-!
 # Gaussian integers
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 The Gaussian integers are complex integer, complex numbers whose real and imaginary parts are both
 integers.
 
Diff
@@ -46,11 +46,13 @@ open Zsqrtd Complex
 
 open scoped ComplexConjugate
 
+#print GaussianInt /-
 /-- The Gaussian integers, defined as `ℤ√(-1)`. -/
 @[reducible]
 def GaussianInt : Type :=
   Zsqrtd (-1)
 #align gaussian_int GaussianInt
+-/
 
 local notation "ℤ[i]" => GaussianInt
 
@@ -64,128 +66,178 @@ instance : CommRing ℤ[i] :=
 
 section
 
-attribute [-instance] Complex.field
+attribute [-instance] Complex.instField
 
+#print GaussianInt.toComplex /-
 -- Avoid making things noncomputable unnecessarily.
 /-- The embedding of the Gaussian integers into the complex numbers, as a ring homomorphism. -/
 def toComplex : ℤ[i] →+* ℂ :=
   Zsqrtd.lift ⟨I, by simp⟩
 #align gaussian_int.to_complex GaussianInt.toComplex
+-/
 
 end
 
 instance : Coe ℤ[i] ℂ :=
   ⟨toComplex⟩
 
-theorem to_complex_def (x : ℤ[i]) : (x : ℂ) = x.re + x.im * I :=
+#print GaussianInt.toComplex_def /-
+theorem toComplex_def (x : ℤ[i]) : (x : ℂ) = x.re + x.im * I :=
   rfl
-#align gaussian_int.to_complex_def GaussianInt.to_complex_def
+#align gaussian_int.to_complex_def GaussianInt.toComplex_def
+-/
 
-theorem to_complex_def' (x y : ℤ) : ((⟨x, y⟩ : ℤ[i]) : ℂ) = x + y * I := by simp [to_complex_def]
-#align gaussian_int.to_complex_def' GaussianInt.to_complex_def'
+#print GaussianInt.toComplex_def' /-
+theorem toComplex_def' (x y : ℤ) : ((⟨x, y⟩ : ℤ[i]) : ℂ) = x + y * I := by simp [to_complex_def]
+#align gaussian_int.to_complex_def' GaussianInt.toComplex_def'
+-/
 
-theorem to_complex_def₂ (x : ℤ[i]) : (x : ℂ) = ⟨x.re, x.im⟩ := by
+#print GaussianInt.toComplex_def₂ /-
+theorem toComplex_def₂ (x : ℤ[i]) : (x : ℂ) = ⟨x.re, x.im⟩ := by
   apply Complex.ext <;> simp [to_complex_def]
-#align gaussian_int.to_complex_def₂ GaussianInt.to_complex_def₂
+#align gaussian_int.to_complex_def₂ GaussianInt.toComplex_def₂
+-/
 
+#print GaussianInt.to_real_re /-
 @[simp]
 theorem to_real_re (x : ℤ[i]) : ((x.re : ℤ) : ℝ) = (x : ℂ).re := by simp [to_complex_def]
 #align gaussian_int.to_real_re GaussianInt.to_real_re
+-/
 
+#print GaussianInt.to_real_im /-
 @[simp]
 theorem to_real_im (x : ℤ[i]) : ((x.im : ℤ) : ℝ) = (x : ℂ).im := by simp [to_complex_def]
 #align gaussian_int.to_real_im GaussianInt.to_real_im
+-/
 
+#print GaussianInt.toComplex_re /-
 @[simp]
-theorem to_complex_re (x y : ℤ) : ((⟨x, y⟩ : ℤ[i]) : ℂ).re = x := by simp [to_complex_def]
-#align gaussian_int.to_complex_re GaussianInt.to_complex_re
+theorem toComplex_re (x y : ℤ) : ((⟨x, y⟩ : ℤ[i]) : ℂ).re = x := by simp [to_complex_def]
+#align gaussian_int.to_complex_re GaussianInt.toComplex_re
+-/
 
+#print GaussianInt.toComplex_im /-
 @[simp]
-theorem to_complex_im (x y : ℤ) : ((⟨x, y⟩ : ℤ[i]) : ℂ).im = y := by simp [to_complex_def]
-#align gaussian_int.to_complex_im GaussianInt.to_complex_im
+theorem toComplex_im (x y : ℤ) : ((⟨x, y⟩ : ℤ[i]) : ℂ).im = y := by simp [to_complex_def]
+#align gaussian_int.to_complex_im GaussianInt.toComplex_im
+-/
 
+#print GaussianInt.toComplex_add /-
 @[simp]
-theorem to_complex_add (x y : ℤ[i]) : ((x + y : ℤ[i]) : ℂ) = x + y :=
+theorem toComplex_add (x y : ℤ[i]) : ((x + y : ℤ[i]) : ℂ) = x + y :=
   toComplex.map_add _ _
-#align gaussian_int.to_complex_add GaussianInt.to_complex_add
+#align gaussian_int.to_complex_add GaussianInt.toComplex_add
+-/
 
+#print GaussianInt.toComplex_mul /-
 @[simp]
-theorem to_complex_mul (x y : ℤ[i]) : ((x * y : ℤ[i]) : ℂ) = x * y :=
+theorem toComplex_mul (x y : ℤ[i]) : ((x * y : ℤ[i]) : ℂ) = x * y :=
   toComplex.map_mul _ _
-#align gaussian_int.to_complex_mul GaussianInt.to_complex_mul
+#align gaussian_int.to_complex_mul GaussianInt.toComplex_mul
+-/
 
+#print GaussianInt.toComplex_one /-
 @[simp]
-theorem to_complex_one : ((1 : ℤ[i]) : ℂ) = 1 :=
+theorem toComplex_one : ((1 : ℤ[i]) : ℂ) = 1 :=
   toComplex.map_one
-#align gaussian_int.to_complex_one GaussianInt.to_complex_one
+#align gaussian_int.to_complex_one GaussianInt.toComplex_one
+-/
 
+#print GaussianInt.toComplex_zero /-
 @[simp]
-theorem to_complex_zero : ((0 : ℤ[i]) : ℂ) = 0 :=
+theorem toComplex_zero : ((0 : ℤ[i]) : ℂ) = 0 :=
   toComplex.map_zero
-#align gaussian_int.to_complex_zero GaussianInt.to_complex_zero
+#align gaussian_int.to_complex_zero GaussianInt.toComplex_zero
+-/
 
+#print GaussianInt.toComplex_neg /-
 @[simp]
-theorem to_complex_neg (x : ℤ[i]) : ((-x : ℤ[i]) : ℂ) = -x :=
+theorem toComplex_neg (x : ℤ[i]) : ((-x : ℤ[i]) : ℂ) = -x :=
   toComplex.map_neg _
-#align gaussian_int.to_complex_neg GaussianInt.to_complex_neg
+#align gaussian_int.to_complex_neg GaussianInt.toComplex_neg
+-/
 
+#print GaussianInt.toComplex_sub /-
 @[simp]
-theorem to_complex_sub (x y : ℤ[i]) : ((x - y : ℤ[i]) : ℂ) = x - y :=
+theorem toComplex_sub (x y : ℤ[i]) : ((x - y : ℤ[i]) : ℂ) = x - y :=
   toComplex.map_sub _ _
-#align gaussian_int.to_complex_sub GaussianInt.to_complex_sub
+#align gaussian_int.to_complex_sub GaussianInt.toComplex_sub
+-/
 
+#print GaussianInt.toComplex_star /-
 @[simp]
-theorem to_complex_star (x : ℤ[i]) : ((star x : ℤ[i]) : ℂ) = conj (x : ℂ) :=
+theorem toComplex_star (x : ℤ[i]) : ((star x : ℤ[i]) : ℂ) = conj (x : ℂ) :=
   by
   rw [to_complex_def₂, to_complex_def₂]
   exact congr_arg₂ _ rfl (Int.cast_neg _)
-#align gaussian_int.to_complex_star GaussianInt.to_complex_star
+#align gaussian_int.to_complex_star GaussianInt.toComplex_star
+-/
 
+#print GaussianInt.toComplex_inj /-
 @[simp]
-theorem to_complex_inj {x y : ℤ[i]} : (x : ℂ) = y ↔ x = y := by
+theorem toComplex_inj {x y : ℤ[i]} : (x : ℂ) = y ↔ x = y := by
   cases x <;> cases y <;> simp [to_complex_def₂]
-#align gaussian_int.to_complex_inj GaussianInt.to_complex_inj
+#align gaussian_int.to_complex_inj GaussianInt.toComplex_inj
+-/
 
+#print GaussianInt.toComplex_eq_zero /-
 @[simp]
-theorem to_complex_eq_zero {x : ℤ[i]} : (x : ℂ) = 0 ↔ x = 0 := by
+theorem toComplex_eq_zero {x : ℤ[i]} : (x : ℂ) = 0 ↔ x = 0 := by
   rw [← to_complex_zero, to_complex_inj]
-#align gaussian_int.to_complex_eq_zero GaussianInt.to_complex_eq_zero
+#align gaussian_int.to_complex_eq_zero GaussianInt.toComplex_eq_zero
+-/
 
+#print GaussianInt.int_cast_real_norm /-
 @[simp]
-theorem nat_cast_real_norm (x : ℤ[i]) : (x.norm : ℝ) = (x : ℂ).normSq := by
+theorem int_cast_real_norm (x : ℤ[i]) : (x.norm : ℝ) = (x : ℂ).normSq := by
   rw [Zsqrtd.norm, norm_sq] <;> simp
-#align gaussian_int.nat_cast_real_norm GaussianInt.nat_cast_real_norm
+#align gaussian_int.nat_cast_real_norm GaussianInt.int_cast_real_norm
+-/
 
+#print GaussianInt.int_cast_complex_norm /-
 @[simp]
-theorem nat_cast_complex_norm (x : ℤ[i]) : (x.norm : ℂ) = (x : ℂ).normSq := by
+theorem int_cast_complex_norm (x : ℤ[i]) : (x.norm : ℂ) = (x : ℂ).normSq := by
   cases x <;> rw [Zsqrtd.norm, norm_sq] <;> simp
-#align gaussian_int.nat_cast_complex_norm GaussianInt.nat_cast_complex_norm
+#align gaussian_int.nat_cast_complex_norm GaussianInt.int_cast_complex_norm
+-/
 
+#print GaussianInt.norm_nonneg /-
 theorem norm_nonneg (x : ℤ[i]) : 0 ≤ norm x :=
   norm_nonneg (by norm_num) _
 #align gaussian_int.norm_nonneg GaussianInt.norm_nonneg
+-/
 
+#print GaussianInt.norm_eq_zero /-
 @[simp]
 theorem norm_eq_zero {x : ℤ[i]} : norm x = 0 ↔ x = 0 := by rw [← @Int.cast_inj ℝ _ _ _] <;> simp
 #align gaussian_int.norm_eq_zero GaussianInt.norm_eq_zero
+-/
 
+#print GaussianInt.norm_pos /-
 theorem norm_pos {x : ℤ[i]} : 0 < norm x ↔ x ≠ 0 := by
   rw [lt_iff_le_and_ne, Ne.def, eq_comm, norm_eq_zero] <;> simp [norm_nonneg]
 #align gaussian_int.norm_pos GaussianInt.norm_pos
+-/
 
+#print GaussianInt.abs_coe_nat_norm /-
 theorem abs_coe_nat_norm (x : ℤ[i]) : (x.norm.natAbs : ℤ) = x.norm :=
   Int.natAbs_of_nonneg (norm_nonneg _)
 #align gaussian_int.abs_coe_nat_norm GaussianInt.abs_coe_nat_norm
+-/
 
+#print GaussianInt.nat_cast_natAbs_norm /-
 @[simp]
 theorem nat_cast_natAbs_norm {α : Type _} [Ring α] (x : ℤ[i]) : (x.norm.natAbs : α) = x.norm := by
   rw [← Int.cast_ofNat, abs_coe_nat_norm]
 #align gaussian_int.nat_cast_nat_abs_norm GaussianInt.nat_cast_natAbs_norm
+-/
 
+#print GaussianInt.natAbs_norm_eq /-
 theorem natAbs_norm_eq (x : ℤ[i]) :
     x.norm.natAbs = x.re.natAbs * x.re.natAbs + x.im.natAbs * x.im.natAbs :=
   Int.ofNat.inj <| by simp; simp [Zsqrtd.norm]
 #align gaussian_int.nat_abs_norm_eq GaussianInt.natAbs_norm_eq
+-/
 
 instance : Div ℤ[i] :=
   ⟨fun x y =>
@@ -193,21 +245,28 @@ instance : Div ℤ[i] :=
     let c := star y
     ⟨round ((x * c).re * n : ℚ), round ((x * c).im * n : ℚ)⟩⟩
 
+#print GaussianInt.div_def /-
 theorem div_def (x y : ℤ[i]) :
     x / y = ⟨round ((x * star y).re / norm y : ℚ), round ((x * star y).im / norm y : ℚ)⟩ :=
   show Zsqrtd.mk _ _ = _ by simp [div_eq_mul_inv]
 #align gaussian_int.div_def GaussianInt.div_def
+-/
 
-theorem to_complex_div_re (x y : ℤ[i]) : ((x / y : ℤ[i]) : ℂ).re = round (x / y : ℂ).re := by
+#print GaussianInt.toComplex_div_re /-
+theorem toComplex_div_re (x y : ℤ[i]) : ((x / y : ℤ[i]) : ℂ).re = round (x / y : ℂ).re := by
   rw [div_def, ← @Rat.round_cast ℝ _ _] <;>
     simp [-Rat.round_cast, mul_assoc, div_eq_mul_inv, mul_add, add_mul]
-#align gaussian_int.to_complex_div_re GaussianInt.to_complex_div_re
+#align gaussian_int.to_complex_div_re GaussianInt.toComplex_div_re
+-/
 
-theorem to_complex_div_im (x y : ℤ[i]) : ((x / y : ℤ[i]) : ℂ).im = round (x / y : ℂ).im := by
+#print GaussianInt.toComplex_div_im /-
+theorem toComplex_div_im (x y : ℤ[i]) : ((x / y : ℤ[i]) : ℂ).im = round (x / y : ℂ).im := by
   rw [div_def, ← @Rat.round_cast ℝ _ _, ← @Rat.round_cast ℝ _ _] <;>
     simp [-Rat.round_cast, mul_assoc, div_eq_mul_inv, mul_add, add_mul]
-#align gaussian_int.to_complex_div_im GaussianInt.to_complex_div_im
+#align gaussian_int.to_complex_div_im GaussianInt.toComplex_div_im
+-/
 
+#print GaussianInt.normSq_le_normSq_of_re_le_of_im_le /-
 theorem normSq_le_normSq_of_re_le_of_im_le {x y : ℂ} (hre : |x.re| ≤ |y.re|)
     (him : |x.im| ≤ |y.im|) : x.normSq ≤ y.normSq := by
   rw [norm_sq_apply, norm_sq_apply, ← _root_.abs_mul_self, _root_.abs_mul, ←
@@ -216,7 +275,9 @@ theorem normSq_le_normSq_of_re_le_of_im_le {x y : ℂ} (hre : |x.re| ≤ |y.re|)
     exact
       add_le_add (mul_self_le_mul_self (abs_nonneg _) hre) (mul_self_le_mul_self (abs_nonneg _) him)
 #align gaussian_int.norm_sq_le_norm_sq_of_re_le_of_im_le GaussianInt.normSq_le_normSq_of_re_le_of_im_le
+-/
 
+#print GaussianInt.normSq_div_sub_div_lt_one /-
 theorem normSq_div_sub_div_lt_one (x y : ℤ[i]) : ((x / y : ℂ) - ((x / y : ℤ[i]) : ℂ)).normSq < 1 :=
   calc
     ((x / y : ℂ) - ((x / y : ℤ[i]) : ℂ)).normSq =
@@ -234,14 +295,18 @@ theorem normSq_div_sub_div_lt_one (x y : ℤ[i]) : ((x / y : ℂ) - ((x / y : 
             simpa using abs_sub_round (x / y : ℂ).im))
     _ < 1 := by simp [norm_sq] <;> norm_num
 #align gaussian_int.norm_sq_div_sub_div_lt_one GaussianInt.normSq_div_sub_div_lt_one
+-/
 
 instance : Mod ℤ[i] :=
   ⟨fun x y => x - y * (x / y)⟩
 
+#print GaussianInt.mod_def /-
 theorem mod_def (x y : ℤ[i]) : x % y = x - y * (x / y) :=
   rfl
 #align gaussian_int.mod_def GaussianInt.mod_def
+-/
 
+#print GaussianInt.norm_mod_lt /-
 theorem norm_mod_lt (x : ℤ[i]) {y : ℤ[i]} (hy : y ≠ 0) : (x % y).norm < y.norm :=
   have : (y : ℂ) ≠ 0 := by rwa [Ne.def, ← to_complex_zero, to_complex_inj]
   (@Int.cast_lt ℝ _ _ _ _).1 <|
@@ -253,12 +318,16 @@ theorem norm_mod_lt (x : ℤ[i]) {y : ℤ[i]} (hy : y ≠ 0) : (x % y).norm < y.
         (mul_lt_mul_of_pos_left (normSq_div_sub_div_lt_one _ _) (normSq_pos.2 this))
       _ = Zsqrtd.norm y := by simp
 #align gaussian_int.norm_mod_lt GaussianInt.norm_mod_lt
+-/
 
+#print GaussianInt.natAbs_norm_mod_lt /-
 theorem natAbs_norm_mod_lt (x : ℤ[i]) {y : ℤ[i]} (hy : y ≠ 0) :
     (x % y).norm.natAbs < y.norm.natAbs :=
   Int.ofNat_lt.1 (by simp [-Int.ofNat_lt, norm_mod_lt x hy])
 #align gaussian_int.nat_abs_norm_mod_lt GaussianInt.natAbs_norm_mod_lt
+-/
 
+#print GaussianInt.norm_le_norm_mul_left /-
 theorem norm_le_norm_mul_left (x : ℤ[i]) {y : ℤ[i]} (hy : y ≠ 0) :
     (norm x).natAbs ≤ (norm (x * y)).natAbs := by
   rw [Zsqrtd.norm_mul, Int.natAbs_mul] <;>
@@ -266,13 +335,14 @@ theorem norm_le_norm_mul_left (x : ℤ[i]) {y : ℤ[i]} (hy : y ≠ 0) :
       le_mul_of_one_le_right (Nat.zero_le _)
         (Int.ofNat_le.1 (by rw [abs_coe_nat_norm] <;> exact Int.add_one_le_of_lt (norm_pos.2 hy)))
 #align gaussian_int.norm_le_norm_mul_left GaussianInt.norm_le_norm_mul_left
+-/
 
 instance : Nontrivial ℤ[i] :=
   ⟨⟨0, 1, by decide⟩⟩
 
 instance : EuclideanDomain ℤ[i] :=
-  { GaussianInt.commRing,
-    GaussianInt.nontrivial with
+  { GaussianInt.instCommRing,
+    GaussianInt.instNontrivial with
     Quotient := (· / ·)
     remainder := (· % ·)
     quotient_zero := by simp [div_def]; rfl
@@ -284,6 +354,7 @@ instance : EuclideanDomain ℤ[i] :=
 
 open PrincipalIdealRing
 
+#print GaussianInt.sq_add_sq_of_nat_prime_of_not_irreducible /-
 theorem sq_add_sq_of_nat_prime_of_not_irreducible (p : ℕ) [hp : Fact p.Prime]
     (hpi : ¬Irreducible (p : ℤ[i])) : ∃ a b, a ^ 2 + b ^ 2 = p :=
   have hpu : ¬IsUnit (p : ℤ[i]) :=
@@ -298,6 +369,7 @@ theorem sq_add_sq_of_nat_prime_of_not_irreducible (p : ℕ) [hp : Fact p.Prime]
         rw [← Int.coe_nat_inj', Int.coe_nat_pow, sq, ← @norm_nat_cast (-1), hpab] <;> simp).1
   ⟨a.re.natAbs, a.im.natAbs, by simpa [nat_abs_norm_eq, sq] using hnap⟩
 #align gaussian_int.sq_add_sq_of_nat_prime_of_not_irreducible GaussianInt.sq_add_sq_of_nat_prime_of_not_irreducible
+-/
 
 end GaussianInt
 
Diff
@@ -4,14 +4,13 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Chris Hughes
 
 ! This file was ported from Lean 3 source module number_theory.zsqrtd.gaussian_int
-! leanprover-community/mathlib commit e8638a0fcaf73e4500469f368ef9494e495099b3
+! leanprover-community/mathlib commit 5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
 import Mathbin.NumberTheory.Zsqrtd.Basic
 import Mathbin.Data.Complex.Basic
 import Mathbin.RingTheory.PrincipalIdealDomain
-import Mathbin.NumberTheory.LegendreSymbol.QuadraticReciprocity
 
 /-!
 # Gaussian integers
@@ -25,10 +24,11 @@ The Euclidean domain structure on `ℤ[i]` is defined in this file.
 
 The homomorphism `to_complex` into the complex numbers is also defined in this file.
 
-## Main statements
+## See also
 
-`prime_iff_mod_four_eq_three_of_nat_prime`
-A prime natural number is prime in `ℤ[i]` if and only if it is `3` mod `4`
+See `number_theory.zsqrtd.gaussian_int` for:
+* `prime_iff_mod_four_eq_three_of_nat_prime`:
+  A prime natural number is prime in `ℤ[i]` if and only if it is `3` mod `4`
 
 ## Notations
 
@@ -284,67 +284,6 @@ instance : EuclideanDomain ℤ[i] :=
 
 open PrincipalIdealRing
 
-theorem mod_four_eq_three_of_nat_prime_of_prime (p : ℕ) [hp : Fact p.Prime]
-    (hpi : Prime (p : ℤ[i])) : p % 4 = 3 :=
-  hp.1.eq_two_or_odd.elim
-    (fun hp2 =>
-      absurd hpi
-        (mt irreducible_iff_prime.2 fun ⟨hu, h⟩ =>
-          by
-          have := h ⟨1, 1⟩ ⟨1, -1⟩ (hp2.symm ▸ rfl)
-          rw [← norm_eq_one_iff, ← norm_eq_one_iff] at this 
-          exact absurd this (by decide)))
-    fun hp1 =>
-    by_contradiction fun hp3 : p % 4 ≠ 3 =>
-      by
-      have hp41 : p % 4 = 1 :=
-        by
-        rw [← Nat.mod_mul_left_mod p 2 2, show 2 * 2 = 4 from rfl] at hp1 
-        have := Nat.mod_lt p (show 0 < 4 by decide)
-        revert this hp3 hp1
-        generalize p % 4 = m; decide!
-      let ⟨k, hk⟩ := ZMod.exists_sq_eq_neg_one_iff.2 <| by rw [hp41] <;> exact by decide
-      obtain ⟨k, k_lt_p, rfl⟩ : ∃ (k' : ℕ) (h : k' < p), (k' : ZMod p) = k := by
-        refine' ⟨k.val, k.val_lt, ZMod.nat_cast_zmod_val k⟩
-      have hpk : p ∣ k ^ 2 + 1 := by
-        rw [pow_two, ← CharP.cast_eq_zero_iff (ZMod p) p, Nat.cast_add, Nat.cast_mul, Nat.cast_one,
-          ← hk, add_left_neg]
-      have hkmul : (k ^ 2 + 1 : ℤ[i]) = ⟨k, 1⟩ * ⟨k, -1⟩ := by simp [sq, Zsqrtd.ext]
-      have hpne1 : p ≠ 1 := ne_of_gt hp.1.one_lt
-      have hkltp : 1 + k * k < p * p :=
-        calc
-          1 + k * k ≤ k + k * k :=
-            add_le_add_right
-              (Nat.pos_of_ne_zero fun hk0 => by clear_aux_decl <;> simp_all [pow_succ']) _
-          _ = k * (k + 1) := by simp [add_comm, mul_add]
-          _ < p * p := mul_lt_mul k_lt_p k_lt_p (Nat.succ_pos _) (Nat.zero_le _)
-      have hpk₁ : ¬(p : ℤ[i]) ∣ ⟨k, -1⟩ := fun ⟨x, hx⟩ =>
-        lt_irrefl (p * x : ℤ[i]).norm.natAbs <|
-          calc
-            (norm (p * x : ℤ[i])).natAbs = (Zsqrtd.norm ⟨k, -1⟩).natAbs := by rw [hx]
-            _ < (norm (p : ℤ[i])).natAbs := by simpa [add_comm, Zsqrtd.norm] using hkltp
-            _ ≤ (norm (p * x : ℤ[i])).natAbs :=
-              norm_le_norm_mul_left _ fun hx0 =>
-                show (-1 : ℤ) ≠ 0 by decide <| by simpa [hx0] using congr_arg Zsqrtd.im hx
-      have hpk₂ : ¬(p : ℤ[i]) ∣ ⟨k, 1⟩ := fun ⟨x, hx⟩ =>
-        lt_irrefl (p * x : ℤ[i]).norm.natAbs <|
-          calc
-            (norm (p * x : ℤ[i])).natAbs = (Zsqrtd.norm ⟨k, 1⟩).natAbs := by rw [hx]
-            _ < (norm (p : ℤ[i])).natAbs := by simpa [add_comm, Zsqrtd.norm] using hkltp
-            _ ≤ (norm (p * x : ℤ[i])).natAbs :=
-              norm_le_norm_mul_left _ fun hx0 =>
-                show (1 : ℤ) ≠ 0 by decide <| by simpa [hx0] using congr_arg Zsqrtd.im hx
-      have hpu : ¬IsUnit (p : ℤ[i]) :=
-        mt norm_eq_one_iff.2
-          (by
-            rw [norm_nat_cast, Int.natAbs_mul, mul_eq_one] <;>
-              exact fun h => (ne_of_lt hp.1.one_lt).symm h.1)
-      obtain ⟨y, hy⟩ := hpk
-      have := hpi.2.2 ⟨k, 1⟩ ⟨k, -1⟩ ⟨y, by rw [← hkmul, ← Nat.cast_mul p, ← hy] <;> simp⟩
-      clear_aux_decl
-      tauto
-#align gaussian_int.mod_four_eq_three_of_nat_prime_of_prime GaussianInt.mod_four_eq_three_of_nat_prime_of_prime
-
 theorem sq_add_sq_of_nat_prime_of_not_irreducible (p : ℕ) [hp : Fact p.Prime]
     (hpi : ¬Irreducible (p : ℤ[i])) : ∃ a b, a ^ 2 + b ^ 2 = p :=
   have hpu : ¬IsUnit (p : ℤ[i]) :=
@@ -360,21 +299,5 @@ theorem sq_add_sq_of_nat_prime_of_not_irreducible (p : ℕ) [hp : Fact p.Prime]
   ⟨a.re.natAbs, a.im.natAbs, by simpa [nat_abs_norm_eq, sq] using hnap⟩
 #align gaussian_int.sq_add_sq_of_nat_prime_of_not_irreducible GaussianInt.sq_add_sq_of_nat_prime_of_not_irreducible
 
-theorem prime_of_nat_prime_of_mod_four_eq_three (p : ℕ) [hp : Fact p.Prime] (hp3 : p % 4 = 3) :
-    Prime (p : ℤ[i]) :=
-  irreducible_iff_prime.1 <|
-    by_contradiction fun hpi =>
-      let ⟨a, b, hab⟩ := sq_add_sq_of_nat_prime_of_not_irreducible p hpi
-      have : ∀ a b : ZMod 4, a ^ 2 + b ^ 2 ≠ p := by
-        erw [← ZMod.nat_cast_mod p 4, hp3] <;> exact by decide
-      this a b (hab ▸ by simp)
-#align gaussian_int.prime_of_nat_prime_of_mod_four_eq_three GaussianInt.prime_of_nat_prime_of_mod_four_eq_three
-
-/-- A prime natural number is prime in `ℤ[i]` if and only if it is `3` mod `4` -/
-theorem prime_iff_mod_four_eq_three_of_nat_prime (p : ℕ) [hp : Fact p.Prime] :
-    Prime (p : ℤ[i]) ↔ p % 4 = 3 :=
-  ⟨mod_four_eq_three_of_nat_prime_of_prime p, prime_of_nat_prime_of_mod_four_eq_three p⟩
-#align gaussian_int.prime_iff_mod_four_eq_three_of_nat_prime GaussianInt.prime_iff_mod_four_eq_three_of_nat_prime
-
 end GaussianInt
 
Diff
@@ -52,7 +52,6 @@ def GaussianInt : Type :=
   Zsqrtd (-1)
 #align gaussian_int GaussianInt
 
--- mathport name: «exprℤ[i]»
 local notation "ℤ[i]" => GaussianInt
 
 namespace GaussianInt
Diff
@@ -234,7 +234,6 @@ theorem normSq_div_sub_div_lt_one (x y : ℤ[i]) : ((x / y : ℂ) - ((x / y : 
           rw [to_complex_div_im] <;> simp [norm_sq, this] <;>
             simpa using abs_sub_round (x / y : ℂ).im))
     _ < 1 := by simp [norm_sq] <;> norm_num
-    
 #align gaussian_int.norm_sq_div_sub_div_lt_one GaussianInt.normSq_div_sub_div_lt_one
 
 instance : Mod ℤ[i] :=
@@ -254,7 +253,6 @@ theorem norm_mod_lt (x : ℤ[i]) {y : ℤ[i]} (hy : y ≠ 0) : (x % y).norm < y.
       _ < (y : ℂ).normSq * 1 :=
         (mul_lt_mul_of_pos_left (normSq_div_sub_div_lt_one _ _) (normSq_pos.2 this))
       _ = Zsqrtd.norm y := by simp
-      
 #align gaussian_int.norm_mod_lt GaussianInt.norm_mod_lt
 
 theorem natAbs_norm_mod_lt (x : ℤ[i]) {y : ℤ[i]} (hy : y ≠ 0) :
@@ -321,7 +319,6 @@ theorem mod_four_eq_three_of_nat_prime_of_prime (p : ℕ) [hp : Fact p.Prime]
               (Nat.pos_of_ne_zero fun hk0 => by clear_aux_decl <;> simp_all [pow_succ']) _
           _ = k * (k + 1) := by simp [add_comm, mul_add]
           _ < p * p := mul_lt_mul k_lt_p k_lt_p (Nat.succ_pos _) (Nat.zero_le _)
-          
       have hpk₁ : ¬(p : ℤ[i]) ∣ ⟨k, -1⟩ := fun ⟨x, hx⟩ =>
         lt_irrefl (p * x : ℤ[i]).norm.natAbs <|
           calc
@@ -330,7 +327,6 @@ theorem mod_four_eq_three_of_nat_prime_of_prime (p : ℕ) [hp : Fact p.Prime]
             _ ≤ (norm (p * x : ℤ[i])).natAbs :=
               norm_le_norm_mul_left _ fun hx0 =>
                 show (-1 : ℤ) ≠ 0 by decide <| by simpa [hx0] using congr_arg Zsqrtd.im hx
-            
       have hpk₂ : ¬(p : ℤ[i]) ∣ ⟨k, 1⟩ := fun ⟨x, hx⟩ =>
         lt_irrefl (p * x : ℤ[i]).norm.natAbs <|
           calc
@@ -339,7 +335,6 @@ theorem mod_four_eq_three_of_nat_prime_of_prime (p : ℕ) [hp : Fact p.Prime]
             _ ≤ (norm (p * x : ℤ[i])).natAbs :=
               norm_le_norm_mul_left _ fun hx0 =>
                 show (1 : ℤ) ≠ 0 by decide <| by simpa [hx0] using congr_arg Zsqrtd.im hx
-            
       have hpu : ¬IsUnit (p : ℤ[i]) :=
         mt norm_eq_one_iff.2
           (by
Diff
@@ -295,19 +295,19 @@ theorem mod_four_eq_three_of_nat_prime_of_prime (p : ℕ) [hp : Fact p.Prime]
         (mt irreducible_iff_prime.2 fun ⟨hu, h⟩ =>
           by
           have := h ⟨1, 1⟩ ⟨1, -1⟩ (hp2.symm ▸ rfl)
-          rw [← norm_eq_one_iff, ← norm_eq_one_iff] at this
+          rw [← norm_eq_one_iff, ← norm_eq_one_iff] at this 
           exact absurd this (by decide)))
     fun hp1 =>
     by_contradiction fun hp3 : p % 4 ≠ 3 =>
       by
       have hp41 : p % 4 = 1 :=
         by
-        rw [← Nat.mod_mul_left_mod p 2 2, show 2 * 2 = 4 from rfl] at hp1
+        rw [← Nat.mod_mul_left_mod p 2 2, show 2 * 2 = 4 from rfl] at hp1 
         have := Nat.mod_lt p (show 0 < 4 by decide)
         revert this hp3 hp1
         generalize p % 4 = m; decide!
       let ⟨k, hk⟩ := ZMod.exists_sq_eq_neg_one_iff.2 <| by rw [hp41] <;> exact by decide
-      obtain ⟨k, k_lt_p, rfl⟩ : ∃ (k' : ℕ)(h : k' < p), (k' : ZMod p) = k := by
+      obtain ⟨k, k_lt_p, rfl⟩ : ∃ (k' : ℕ) (h : k' < p), (k' : ZMod p) = k := by
         refine' ⟨k.val, k.val_lt, ZMod.nat_cast_zmod_val k⟩
       have hpk : p ∣ k ^ 2 + 1 := by
         rw [pow_two, ← CharP.cast_eq_zero_iff (ZMod p) p, Nat.cast_add, Nat.cast_mul, Nat.cast_one,
Diff
@@ -44,7 +44,7 @@ and definitions about `zsqrtd` can easily be used.
 
 open Zsqrtd Complex
 
-open ComplexConjugate
+open scoped ComplexConjugate
 
 /-- The Gaussian integers, defined as `ℤ√(-1)`. -/
 @[reducible]
Diff
@@ -278,9 +278,7 @@ instance : EuclideanDomain ℤ[i] :=
     GaussianInt.nontrivial with
     Quotient := (· / ·)
     remainder := (· % ·)
-    quotient_zero := by
-      simp [div_def]
-      rfl
+    quotient_zero := by simp [div_def]; rfl
     quotient_mul_add_remainder_eq := fun _ _ => by simp [mod_def]
     R := _
     r_wellFounded := measure_wf (Int.natAbs ∘ norm)
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Chris Hughes
 
 ! This file was ported from Lean 3 source module number_theory.zsqrtd.gaussian_int
-! leanprover-community/mathlib commit 2af0836443b4cfb5feda0df0051acdb398304931
+! leanprover-community/mathlib commit e8638a0fcaf73e4500469f368ef9494e495099b3
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -345,7 +345,7 @@ theorem mod_four_eq_three_of_nat_prime_of_prime (p : ℕ) [hp : Fact p.Prime]
       have hpu : ¬IsUnit (p : ℤ[i]) :=
         mt norm_eq_one_iff.2
           (by
-            rw [norm_nat_cast, Int.natAbs_mul, Nat.mul_eq_one_iff] <;>
+            rw [norm_nat_cast, Int.natAbs_mul, mul_eq_one] <;>
               exact fun h => (ne_of_lt hp.1.one_lt).symm h.1)
       obtain ⟨y, hy⟩ := hpk
       have := hpi.2.2 ⟨k, 1⟩ ⟨k, -1⟩ ⟨y, by rw [← hkmul, ← Nat.cast_mul p, ← hy] <;> simp⟩
@@ -357,7 +357,7 @@ theorem sq_add_sq_of_nat_prime_of_not_irreducible (p : ℕ) [hp : Fact p.Prime]
     (hpi : ¬Irreducible (p : ℤ[i])) : ∃ a b, a ^ 2 + b ^ 2 = p :=
   have hpu : ¬IsUnit (p : ℤ[i]) :=
     mt norm_eq_one_iff.2 <| by
-      rw [norm_nat_cast, Int.natAbs_mul, Nat.mul_eq_one_iff] <;>
+      rw [norm_nat_cast, Int.natAbs_mul, mul_eq_one] <;>
         exact fun h => (ne_of_lt hp.1.one_lt).symm h.1
   have hab : ∃ a b, (p : ℤ[i]) = a * b ∧ ¬IsUnit a ∧ ¬IsUnit b := by
     simpa [irreducible_iff, hpu, not_forall, not_or] using hpi
Diff
@@ -310,7 +310,7 @@ theorem mod_four_eq_three_of_nat_prime_of_prime (p : ℕ) [hp : Fact p.Prime]
         generalize p % 4 = m; decide!
       let ⟨k, hk⟩ := ZMod.exists_sq_eq_neg_one_iff.2 <| by rw [hp41] <;> exact by decide
       obtain ⟨k, k_lt_p, rfl⟩ : ∃ (k' : ℕ)(h : k' < p), (k' : ZMod p) = k := by
-        refine' ⟨k.val, k.val_lt, ZMod.nat_cast_zMod_val k⟩
+        refine' ⟨k.val, k.val_lt, ZMod.nat_cast_zmod_val k⟩
       have hpk : p ∣ k ^ 2 + 1 := by
         rw [pow_two, ← CharP.cast_eq_zero_iff (ZMod p) p, Nat.cast_add, Nat.cast_mul, Nat.cast_one,
           ← hk, add_left_neg]
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Chris Hughes
 
 ! This file was ported from Lean 3 source module number_theory.zsqrtd.gaussian_int
-! leanprover-community/mathlib commit e1bccd6e40ae78370f01659715d3c948716e3b7e
+! leanprover-community/mathlib commit 2af0836443b4cfb5feda0df0051acdb398304931
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -44,6 +44,8 @@ and definitions about `zsqrtd` can easily be used.
 
 open Zsqrtd Complex
 
+open ComplexConjugate
+
 /-- The Gaussian integers, defined as `ℤ√(-1)`. -/
 @[reducible]
 def GaussianInt : Type :=
@@ -133,6 +135,13 @@ theorem to_complex_sub (x y : ℤ[i]) : ((x - y : ℤ[i]) : ℂ) = x - y :=
   toComplex.map_sub _ _
 #align gaussian_int.to_complex_sub GaussianInt.to_complex_sub
 
+@[simp]
+theorem to_complex_star (x : ℤ[i]) : ((star x : ℤ[i]) : ℂ) = conj (x : ℂ) :=
+  by
+  rw [to_complex_def₂, to_complex_def₂]
+  exact congr_arg₂ _ rfl (Int.cast_neg _)
+#align gaussian_int.to_complex_star GaussianInt.to_complex_star
+
 @[simp]
 theorem to_complex_inj {x y : ℤ[i]} : (x : ℂ) = y ↔ x = y := by
   cases x <;> cases y <;> simp [to_complex_def₂]
@@ -182,11 +191,11 @@ theorem natAbs_norm_eq (x : ℤ[i]) :
 instance : Div ℤ[i] :=
   ⟨fun x y =>
     let n := (norm y : ℚ)⁻¹
-    let c := y.conj
+    let c := star y
     ⟨round ((x * c).re * n : ℚ), round ((x * c).im * n : ℚ)⟩⟩
 
 theorem div_def (x y : ℤ[i]) :
-    x / y = ⟨round ((x * conj y).re / norm y : ℚ), round ((x * conj y).im / norm y : ℚ)⟩ :=
+    x / y = ⟨round ((x * star y).re / norm y : ℚ), round ((x * star y).im / norm y : ℚ)⟩ :=
   show Zsqrtd.mk _ _ = _ by simp [div_eq_mul_inv]
 #align gaussian_int.div_def GaussianInt.div_def
 
Diff
@@ -68,7 +68,7 @@ attribute [-instance] Complex.field
 -- Avoid making things noncomputable unnecessarily.
 /-- The embedding of the Gaussian integers into the complex numbers, as a ring homomorphism. -/
 def toComplex : ℤ[i] →+* ℂ :=
-  Zsqrtd.lift ⟨i, by simp⟩
+  Zsqrtd.lift ⟨I, by simp⟩
 #align gaussian_int.to_complex GaussianInt.toComplex
 
 end
@@ -76,11 +76,11 @@ end
 instance : Coe ℤ[i] ℂ :=
   ⟨toComplex⟩
 
-theorem to_complex_def (x : ℤ[i]) : (x : ℂ) = x.re + x.im * i :=
+theorem to_complex_def (x : ℤ[i]) : (x : ℂ) = x.re + x.im * I :=
   rfl
 #align gaussian_int.to_complex_def GaussianInt.to_complex_def
 
-theorem to_complex_def' (x y : ℤ) : ((⟨x, y⟩ : ℤ[i]) : ℂ) = x + y * i := by simp [to_complex_def]
+theorem to_complex_def' (x y : ℤ) : ((⟨x, y⟩ : ℤ[i]) : ℂ) = x + y * I := by simp [to_complex_def]
 #align gaussian_int.to_complex_def' GaussianInt.to_complex_def'
 
 theorem to_complex_def₂ (x : ℤ[i]) : (x : ℂ) = ⟨x.re, x.im⟩ := by
@@ -212,10 +212,10 @@ theorem normSq_le_normSq_of_re_le_of_im_le {x y : ℂ} (hre : |x.re| ≤ |y.re|)
 theorem normSq_div_sub_div_lt_one (x y : ℤ[i]) : ((x / y : ℂ) - ((x / y : ℤ[i]) : ℂ)).normSq < 1 :=
   calc
     ((x / y : ℂ) - ((x / y : ℤ[i]) : ℂ)).normSq =
-        ((x / y : ℂ).re - ((x / y : ℤ[i]) : ℂ).re + ((x / y : ℂ).im - ((x / y : ℤ[i]) : ℂ).im) * i :
+        ((x / y : ℂ).re - ((x / y : ℤ[i]) : ℂ).re + ((x / y : ℂ).im - ((x / y : ℤ[i]) : ℂ).im) * I :
             ℂ).normSq :=
       congr_arg _ <| by apply Complex.ext <;> simp
-    _ ≤ (1 / 2 + 1 / 2 * i).normSq :=
+    _ ≤ (1 / 2 + 1 / 2 * I).normSq :=
       (have : |(2⁻¹ : ℝ)| = 2⁻¹ := abs_of_nonneg (by norm_num)
       normSq_le_normSq_of_re_le_of_im_le
         (by
Diff
@@ -216,14 +216,14 @@ theorem normSq_div_sub_div_lt_one (x y : ℤ[i]) : ((x / y : ℂ) - ((x / y : 
             ℂ).normSq :=
       congr_arg _ <| by apply Complex.ext <;> simp
     _ ≤ (1 / 2 + 1 / 2 * i).normSq :=
-      have : |(2⁻¹ : ℝ)| = 2⁻¹ := abs_of_nonneg (by norm_num)
+      (have : |(2⁻¹ : ℝ)| = 2⁻¹ := abs_of_nonneg (by norm_num)
       normSq_le_normSq_of_re_le_of_im_le
         (by
           rw [to_complex_div_re] <;> simp [norm_sq, this] <;>
             simpa using abs_sub_round (x / y : ℂ).re)
         (by
           rw [to_complex_div_im] <;> simp [norm_sq, this] <;>
-            simpa using abs_sub_round (x / y : ℂ).im)
+            simpa using abs_sub_round (x / y : ℂ).im))
     _ < 1 := by simp [norm_sq] <;> norm_num
     
 #align gaussian_int.norm_sq_div_sub_div_lt_one GaussianInt.normSq_div_sub_div_lt_one
@@ -243,7 +243,7 @@ theorem norm_mod_lt (x : ℤ[i]) {y : ℤ[i]} (hy : y ≠ 0) : (x % y).norm < y.
       _ = (y : ℂ).normSq * (x / y - (x / y : ℤ[i]) : ℂ).normSq := by
         rw [← norm_sq_mul, mul_sub, mul_div_cancel' _ this]
       _ < (y : ℂ).normSq * 1 :=
-        mul_lt_mul_of_pos_left (normSq_div_sub_div_lt_one _ _) (normSq_pos.2 this)
+        (mul_lt_mul_of_pos_left (normSq_div_sub_div_lt_one _ _) (normSq_pos.2 this))
       _ = Zsqrtd.norm y := by simp
       
 #align gaussian_int.norm_mod_lt GaussianInt.norm_mod_lt

Changes in mathlib4

mathlib3
mathlib4
chore: Rename nat_cast/int_cast/rat_cast to natCast/intCast/ratCast (#11486)

Now that I am defining NNRat.cast, I want a definitive answer to this naming issue. Plenty of lemmas in mathlib already use natCast/intCast/ratCast over nat_cast/int_cast/rat_cast, and this matches with the general expectation that underscore-separated name parts correspond to a single declaration.

Diff
@@ -149,14 +149,14 @@ theorem toComplex_eq_zero {x : ℤ[i]} : (x : ℂ) = 0 ↔ x = 0 := by
 #align gaussian_int.to_complex_eq_zero GaussianInt.toComplex_eq_zero
 
 @[simp]
-theorem int_cast_real_norm (x : ℤ[i]) : (x.norm : ℝ) = Complex.normSq (x : ℂ) := by
+theorem intCast_real_norm (x : ℤ[i]) : (x.norm : ℝ) = Complex.normSq (x : ℂ) := by
   rw [Zsqrtd.norm, normSq]; simp
-#align gaussian_int.nat_cast_real_norm GaussianInt.int_cast_real_norm
+#align gaussian_int.nat_cast_real_norm GaussianInt.intCast_real_norm
 
 @[simp]
-theorem int_cast_complex_norm (x : ℤ[i]) : (x.norm : ℂ) = Complex.normSq (x : ℂ) := by
+theorem intCast_complex_norm (x : ℤ[i]) : (x.norm : ℂ) = Complex.normSq (x : ℂ) := by
   cases x; rw [Zsqrtd.norm, normSq]; simp
-#align gaussian_int.nat_cast_complex_norm GaussianInt.int_cast_complex_norm
+#align gaussian_int.nat_cast_complex_norm GaussianInt.intCast_complex_norm
 
 theorem norm_nonneg (x : ℤ[i]) : 0 ≤ norm x :=
   Zsqrtd.norm_nonneg (by norm_num) _
@@ -178,9 +178,9 @@ theorem abs_natCast_norm (x : ℤ[i]) : (x.norm.natAbs : ℤ) = x.norm :=
 @[deprecated] alias abs_coe_nat_norm := abs_natCast_norm
 
 @[simp]
-theorem nat_cast_natAbs_norm {α : Type*} [Ring α] (x : ℤ[i]) : (x.norm.natAbs : α) = x.norm := by
+theorem natCast_natAbs_norm {α : Type*} [Ring α] (x : ℤ[i]) : (x.norm.natAbs : α) = x.norm := by
   rw [← Int.cast_natCast, abs_natCast_norm]
-#align gaussian_int.nat_cast_nat_abs_norm GaussianInt.nat_cast_natAbs_norm
+#align gaussian_int.nat_cast_nat_abs_norm GaussianInt.natCast_natAbs_norm
 
 theorem natAbs_norm_eq (x : ℤ[i]) :
     x.norm.natAbs = x.re.natAbs * x.re.natAbs + x.im.natAbs * x.im.natAbs :=
@@ -287,7 +287,7 @@ theorem sq_add_sq_of_nat_prime_of_not_irreducible (p : ℕ) [hp : Fact p.Prime]
     (hpi : ¬Irreducible (p : ℤ[i])) : ∃ a b, a ^ 2 + b ^ 2 = p :=
   have hpu : ¬IsUnit (p : ℤ[i]) :=
     mt norm_eq_one_iff.2 <| by
-      rw [norm_nat_cast, Int.natAbs_mul, mul_eq_one]
+      rw [norm_natCast, Int.natAbs_mul, mul_eq_one]
       exact fun h => (ne_of_lt hp.1.one_lt).symm h.1
   have hab : ∃ a b, (p : ℤ[i]) = a * b ∧ ¬IsUnit a ∧ ¬IsUnit b := by
     -- Porting note: was
@@ -297,7 +297,7 @@ theorem sq_add_sq_of_nat_prime_of_not_irreducible (p : ℕ) [hp : Fact p.Prime]
   let ⟨a, b, hpab, hau, hbu⟩ := hab
   have hnap : (norm a).natAbs = p :=
     ((hp.1.mul_eq_prime_sq_iff (mt norm_eq_one_iff.1 hau) (mt norm_eq_one_iff.1 hbu)).1 <| by
-        rw [← Int.natCast_inj, Int.coe_nat_pow, sq, ← @norm_nat_cast (-1), hpab]; simp).1
+        rw [← Int.natCast_inj, Int.coe_nat_pow, sq, ← @norm_natCast (-1), hpab]; simp).1
   ⟨a.re.natAbs, a.im.natAbs, by simpa [natAbs_norm_eq, sq] using hnap⟩
 #align gaussian_int.sq_add_sq_of_nat_prime_of_not_irreducible GaussianInt.sq_add_sq_of_nat_prime_of_not_irreducible
 
chore: Rename coe_nat/coe_int/coe_rat to natCast/intCast/ratCast (#11499)

This is less exhaustive than its sibling #11486 because edge cases are harder to classify. No fundamental difficulty, just me being a bit fast and lazy.

Reduce the diff of #11203

Diff
@@ -170,13 +170,16 @@ theorem norm_pos {x : ℤ[i]} : 0 < norm x ↔ x ≠ 0 := by
   rw [lt_iff_le_and_ne, Ne, eq_comm, norm_eq_zero]; simp [norm_nonneg]
 #align gaussian_int.norm_pos GaussianInt.norm_pos
 
-theorem abs_coe_nat_norm (x : ℤ[i]) : (x.norm.natAbs : ℤ) = x.norm :=
+theorem abs_natCast_norm (x : ℤ[i]) : (x.norm.natAbs : ℤ) = x.norm :=
   Int.natAbs_of_nonneg (norm_nonneg _)
-#align gaussian_int.abs_coe_nat_norm GaussianInt.abs_coe_nat_norm
+#align gaussian_int.abs_coe_nat_norm GaussianInt.abs_natCast_norm
+
+-- 2024-04-05
+@[deprecated] alias abs_coe_nat_norm := abs_natCast_norm
 
 @[simp]
 theorem nat_cast_natAbs_norm {α : Type*} [Ring α] (x : ℤ[i]) : (x.norm.natAbs : α) = x.norm := by
-  rw [← Int.cast_natCast, abs_coe_nat_norm]
+  rw [← Int.cast_natCast, abs_natCast_norm]
 #align gaussian_int.nat_cast_nat_abs_norm GaussianInt.nat_cast_natAbs_norm
 
 theorem natAbs_norm_eq (x : ℤ[i]) :
@@ -258,7 +261,7 @@ theorem norm_le_norm_mul_left (x : ℤ[i]) {y : ℤ[i]} (hy : y ≠ 0) :
     (norm x).natAbs ≤ (norm (x * y)).natAbs := by
   rw [Zsqrtd.norm_mul, Int.natAbs_mul]
   exact le_mul_of_one_le_right (Nat.zero_le _) (Int.ofNat_le.1 (by
-    rw [abs_coe_nat_norm]
+    rw [abs_natCast_norm]
     exact Int.add_one_le_of_lt (norm_pos.2 hy)))
 #align gaussian_int.norm_le_norm_mul_left GaussianInt.norm_le_norm_mul_left
 
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
@@ -176,7 +176,7 @@ theorem abs_coe_nat_norm (x : ℤ[i]) : (x.norm.natAbs : ℤ) = x.norm :=
 
 @[simp]
 theorem nat_cast_natAbs_norm {α : Type*} [Ring α] (x : ℤ[i]) : (x.norm.natAbs : α) = x.norm := by
-  rw [← Int.cast_ofNat, abs_coe_nat_norm]
+  rw [← Int.cast_natCast, abs_coe_nat_norm]
 #align gaussian_int.nat_cast_nat_abs_norm GaussianInt.nat_cast_natAbs_norm
 
 theorem natAbs_norm_eq (x : ℤ[i]) :
chore(Data/Int): Rename coe_nat to natCast (#11637)

Reduce the diff of #11499

Renames

All in the Int namespace:

  • ofNat_eq_castofNat_eq_natCast
  • cast_eq_cast_iff_NatnatCast_inj
  • natCast_eq_ofNatofNat_eq_natCast
  • coe_nat_subnatCast_sub
  • coe_nat_nonnegnatCast_nonneg
  • sign_coe_add_onesign_natCast_add_one
  • nat_succ_eq_int_succnatCast_succ
  • succ_neg_nat_succsucc_neg_natCast_succ
  • coe_pred_of_posnatCast_pred_of_pos
  • coe_nat_divnatCast_div
  • coe_nat_edivnatCast_ediv
  • sign_coe_nat_of_nonzerosign_natCast_of_ne_zero
  • toNat_coe_nattoNat_natCast
  • toNat_coe_nat_add_onetoNat_natCast_add_one
  • coe_nat_dvdnatCast_dvd_natCast
  • coe_nat_dvd_leftnatCast_dvd
  • coe_nat_dvd_rightdvd_natCast
  • le_coe_nat_suble_natCast_sub
  • succ_coe_nat_possucc_natCast_pos
  • coe_nat_modEq_iffnatCast_modEq_iff
  • coe_natAbsnatCast_natAbs
  • coe_nat_eq_zeronatCast_eq_zero
  • coe_nat_ne_zeronatCast_ne_zero
  • coe_nat_ne_zero_iff_posnatCast_ne_zero_iff_pos
  • abs_coe_natabs_natCast
  • coe_nat_nonpos_iffnatCast_nonpos_iff

Also rename Nat.coe_nat_dvd to Nat.cast_dvd_cast

Diff
@@ -294,7 +294,7 @@ theorem sq_add_sq_of_nat_prime_of_not_irreducible (p : ℕ) [hp : Fact p.Prime]
   let ⟨a, b, hpab, hau, hbu⟩ := hab
   have hnap : (norm a).natAbs = p :=
     ((hp.1.mul_eq_prime_sq_iff (mt norm_eq_one_iff.1 hau) (mt norm_eq_one_iff.1 hbu)).1 <| by
-        rw [← Int.coe_nat_inj', Int.coe_nat_pow, sq, ← @norm_nat_cast (-1), hpab]; simp).1
+        rw [← Int.natCast_inj, Int.coe_nat_pow, sq, ← @norm_nat_cast (-1), hpab]; simp).1
   ⟨a.re.natAbs, a.im.natAbs, by simpa [natAbs_norm_eq, sq] using hnap⟩
 #align gaussian_int.sq_add_sq_of_nat_prime_of_not_irreducible GaussianInt.sq_add_sq_of_nat_prime_of_not_irreducible
 
chore: avoid Ne.def (adaptation for nightly-2024-03-27) (#11813)
Diff
@@ -167,7 +167,7 @@ theorem norm_eq_zero {x : ℤ[i]} : norm x = 0 ↔ x = 0 := by rw [← @Int.cast
 #align gaussian_int.norm_eq_zero GaussianInt.norm_eq_zero
 
 theorem norm_pos {x : ℤ[i]} : 0 < norm x ↔ x ≠ 0 := by
-  rw [lt_iff_le_and_ne, Ne.def, eq_comm, norm_eq_zero]; simp [norm_nonneg]
+  rw [lt_iff_le_and_ne, Ne, eq_comm, norm_eq_zero]; simp [norm_nonneg]
 #align gaussian_int.norm_pos GaussianInt.norm_pos
 
 theorem abs_coe_nat_norm (x : ℤ[i]) : (x.norm.natAbs : ℤ) = x.norm :=
@@ -238,7 +238,7 @@ theorem mod_def (x y : ℤ[i]) : x % y = x - y * (x / y) :=
 #align gaussian_int.mod_def GaussianInt.mod_def
 
 theorem norm_mod_lt (x : ℤ[i]) {y : ℤ[i]} (hy : y ≠ 0) : (x % y).norm < y.norm :=
-  have : (y : ℂ) ≠ 0 := by rwa [Ne.def, ← toComplex_zero, toComplex_inj]
+  have : (y : ℂ) ≠ 0 := by rwa [Ne, ← toComplex_zero, toComplex_inj]
   (@Int.cast_lt ℝ _ _ _ _).1 <|
     calc
       ↑(Zsqrtd.norm (x % y)) = Complex.normSq (x - y * (x / y : ℤ[i]) : ℂ) := by simp [mod_def]
chore: Rename mul-div cancellation lemmas (#11530)

Lemma names around cancellation of multiplication and division are a mess.

This PR renames a handful of them according to the following table (each big row contains the multiplicative statement, then the three rows contain the GroupWithZero lemma name, the Group lemma, the AddGroup lemma name).

| Statement | New name | Old name | |

Diff
@@ -243,7 +243,7 @@ theorem norm_mod_lt (x : ℤ[i]) {y : ℤ[i]} (hy : y ≠ 0) : (x % y).norm < y.
     calc
       ↑(Zsqrtd.norm (x % y)) = Complex.normSq (x - y * (x / y : ℤ[i]) : ℂ) := by simp [mod_def]
       _ = Complex.normSq (y : ℂ) * Complex.normSq (x / y - (x / y : ℤ[i]) : ℂ) := by
-        rw [← normSq_mul, mul_sub, mul_div_cancel' _ this]
+        rw [← normSq_mul, mul_sub, mul_div_cancel₀ _ this]
       _ < Complex.normSq (y : ℂ) * 1 :=
         (mul_lt_mul_of_pos_left (normSq_div_sub_div_lt_one _ _) (normSq_pos.2 this))
       _ = Zsqrtd.norm y := by simp
chore: classify "@[simp] can prove" porting notes (#11474)

Classifies by adding issue number #10618 to porting notes claiming

@[simp] can prove

Diff
@@ -102,32 +102,32 @@ theorem toComplex_re (x y : ℤ) : ((⟨x, y⟩ : ℤ[i]) : ℂ).re = x := by si
 theorem toComplex_im (x y : ℤ) : ((⟨x, y⟩ : ℤ[i]) : ℂ).im = y := by simp [toComplex_def]
 #align gaussian_int.to_complex_im GaussianInt.toComplex_im
 
--- Porting note: @[simp] can prove this
+-- Porting note (#10618): @[simp] can prove this
 theorem toComplex_add (x y : ℤ[i]) : ((x + y : ℤ[i]) : ℂ) = x + y :=
   toComplex.map_add _ _
 #align gaussian_int.to_complex_add GaussianInt.toComplex_add
 
--- Porting note: @[simp] can prove this
+-- Porting note (#10618): @[simp] can prove this
 theorem toComplex_mul (x y : ℤ[i]) : ((x * y : ℤ[i]) : ℂ) = x * y :=
   toComplex.map_mul _ _
 #align gaussian_int.to_complex_mul GaussianInt.toComplex_mul
 
--- Porting note: @[simp] can prove this
+-- Porting note (#10618): @[simp] can prove this
 theorem toComplex_one : ((1 : ℤ[i]) : ℂ) = 1 :=
   toComplex.map_one
 #align gaussian_int.to_complex_one GaussianInt.toComplex_one
 
--- Porting note: @[simp] can prove this
+-- Porting note (#10618): @[simp] can prove this
 theorem toComplex_zero : ((0 : ℤ[i]) : ℂ) = 0 :=
   toComplex.map_zero
 #align gaussian_int.to_complex_zero GaussianInt.toComplex_zero
 
--- Porting note: @[simp] can prove this
+-- Porting note (#10618): @[simp] can prove this
 theorem toComplex_neg (x : ℤ[i]) : ((-x : ℤ[i]) : ℂ) = -x :=
   toComplex.map_neg _
 #align gaussian_int.to_complex_neg GaussianInt.toComplex_neg
 
--- Porting note: @[simp] can prove this
+-- Porting note (#10618): @[simp] can prove this
 theorem toComplex_sub (x y : ℤ[i]) : ((x - y : ℤ[i]) : ℂ) = x - y :=
   toComplex.map_sub _ _
 #align gaussian_int.to_complex_sub GaussianInt.toComplex_sub
chore: reduce imports (#9830)

This uses the improved shake script from #9772 to reduce imports across mathlib. The corresponding noshake.json file has been added to #9772.

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

Diff
@@ -4,8 +4,9 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Chris Hughes
 -/
 import Mathlib.NumberTheory.Zsqrtd.Basic
-import Mathlib.Data.Complex.Abs
 import Mathlib.RingTheory.PrincipalIdealDomain
+import Mathlib.Data.Complex.Basic
+import Mathlib.Data.Real.Archimedean
 
 #align_import number_theory.zsqrtd.gaussian_int from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9"
 
chore: split Data.Complex.Basic (#8355)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Junyan Xu <junyanxu.math@gmail.com>

Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Chris Hughes
 -/
 import Mathlib.NumberTheory.Zsqrtd.Basic
-import Mathlib.Data.Complex.Basic
+import Mathlib.Data.Complex.Abs
 import Mathlib.RingTheory.PrincipalIdealDomain
 
 #align_import number_theory.zsqrtd.gaussian_int from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9"
chore: banish Type _ and Sort _ (#6499)

We remove all possible occurences of Type _ and Sort _ in favor of Type* and Sort*.

This has nice performance benefits.

Diff
@@ -174,7 +174,7 @@ theorem abs_coe_nat_norm (x : ℤ[i]) : (x.norm.natAbs : ℤ) = x.norm :=
 #align gaussian_int.abs_coe_nat_norm GaussianInt.abs_coe_nat_norm
 
 @[simp]
-theorem nat_cast_natAbs_norm {α : Type _} [Ring α] (x : ℤ[i]) : (x.norm.natAbs : α) = x.norm := by
+theorem nat_cast_natAbs_norm {α : Type*} [Ring α] (x : ℤ[i]) : (x.norm.natAbs : α) = x.norm := by
   rw [← Int.cast_ofNat, abs_coe_nat_norm]
 #align gaussian_int.nat_cast_nat_abs_norm GaussianInt.nat_cast_natAbs_norm
 
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,16 +2,13 @@
 Copyright (c) 2019 Chris Hughes. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Chris Hughes
-
-! This file was ported from Lean 3 source module number_theory.zsqrtd.gaussian_int
-! leanprover-community/mathlib commit 5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.NumberTheory.Zsqrtd.Basic
 import Mathlib.Data.Complex.Basic
 import Mathlib.RingTheory.PrincipalIdealDomain
 
+#align_import number_theory.zsqrtd.gaussian_int from "leanprover-community/mathlib"@"5b2fe80501ff327b9109fb09b7cc8c325cd0d7d9"
+
 /-!
 # Gaussian integers
 
fix: filenames with typos in doc (#5836)
Diff
@@ -26,7 +26,7 @@ The homomorphism `GaussianInt.toComplex` into the complex numbers is also define
 
 ## See also
 
-See `number_theory.zsqrtd.gaussian_int` for:
+See `NumberTheory.Zsqrtd.QuadraticReciprocity` for:
 * `prime_iff_mod_four_eq_three_of_nat_prime`:
   A prime natural number is prime in `ℤ[i]` if and only if it is `3` mod `4`
 
feat: port NumberTheory.Zsqrtd.GaussianInt (#5134)

Co-authored-by: Ruben Van de Velde <65514131+Ruben-VandeVelde@users.noreply.github.com> Co-authored-by: Moritz Firsching <firsching@google.com> Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com>

Dependencies 10 + 607

608 files ported (98.4%)
263131 lines ported (98.0%)
Show graph

The unported dependencies are

The following 1 dependencies have changed in mathlib3 since they were ported, which may complicate porting this file