ring_theory.integrally_closedMathlib.RingTheory.IntegrallyClosed

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)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -32,7 +32,6 @@ open scoped nonZeroDivisors Polynomial
 
 open Polynomial
 
-#print IsIntegrallyClosed /-
 /-- `R` is integrally closed if all integral elements of `Frac(R)` are also elements of `R`.
 
 This definition uses `fraction_ring R` to denote `Frac(R)`. See `is_integrally_closed_iff`
@@ -41,8 +40,7 @@ if you want to choose another field of fractions for `R`.
 class IsIntegrallyClosed (R : Type _) [CommRing R] [IsDomain R] : Prop where
   algebraMap_eq_of_integral :
     ∀ {x : FractionRing R}, IsIntegral R x → ∃ y, algebraMap R (FractionRing R) y = x
-#align is_integrally_closed IsIntegrallyClosed
--/
+#align is_integrally_closed IsIntegrallyClosedₓ
 
 section Iff
 
Diff
@@ -106,7 +106,7 @@ theorem isIntegral_iff {x : K} : IsIntegral R x ↔ ∃ y : R, algebraMap R K y
 #print IsIntegrallyClosed.exists_algebraMap_eq_of_isIntegral_pow /-
 theorem exists_algebraMap_eq_of_isIntegral_pow {x : K} {n : ℕ} (hn : 0 < n)
     (hx : IsIntegral R <| x ^ n) : ∃ y : R, algebraMap R K y = x :=
-  isIntegral_iff.mp <| isIntegral_of_pow hn hx
+  isIntegral_iff.mp <| IsIntegral.of_pow hn hx
 #align is_integrally_closed.exists_algebra_map_eq_of_is_integral_pow IsIntegrallyClosed.exists_algebraMap_eq_of_isIntegral_pow
 -/
 
Diff
@@ -3,8 +3,8 @@ Copyright (c) 2021 Anne Baanen. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Anne Baanen
 -/
-import Mathbin.RingTheory.IntegralClosure
-import Mathbin.RingTheory.Localization.Integral
+import RingTheory.IntegralClosure
+import RingTheory.Localization.Integral
 
 #align_import ring_theory.integrally_closed from "leanprover-community/mathlib"@"af471b9e3ce868f296626d33189b4ce730fa4c00"
 
Diff
@@ -2,15 +2,12 @@
 Copyright (c) 2021 Anne Baanen. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Anne Baanen
-
-! This file was ported from Lean 3 source module ring_theory.integrally_closed
-! leanprover-community/mathlib commit af471b9e3ce868f296626d33189b4ce730fa4c00
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.RingTheory.IntegralClosure
 import Mathbin.RingTheory.Localization.Integral
 
+#align_import ring_theory.integrally_closed from "leanprover-community/mathlib"@"af471b9e3ce868f296626d33189b4ce730fa4c00"
+
 /-!
 # Integrally closed rings
 
Diff
@@ -53,6 +53,7 @@ variable {R : Type _} [CommRing R] [IsDomain R]
 
 variable (K : Type _) [Field K] [Algebra R K] [IsFractionRing R K]
 
+#print isIntegrallyClosed_iff /-
 /-- `R` is integrally closed iff all integral elements of its fraction field `K`
 are also elements of `R`. -/
 theorem isIntegrallyClosed_iff :
@@ -69,7 +70,9 @@ theorem isIntegrallyClosed_iff :
     obtain ⟨y, hy⟩ := cl ((isIntegral_algEquiv e.symm).mpr hx)
     exact ⟨y, e.symm.algebra_map_eq_apply.mp hy⟩
 #align is_integrally_closed_iff isIntegrallyClosed_iff
+-/
 
+#print isIntegrallyClosed_iff_isIntegralClosure /-
 /-- `R` is integrally closed iff it is the integral closure of itself in its field of fractions. -/
 theorem isIntegrallyClosed_iff_isIntegralClosure : IsIntegrallyClosed R ↔ IsIntegralClosure R R K :=
   (isIntegrallyClosed_iff K).trans <|
@@ -84,6 +87,7 @@ theorem isIntegrallyClosed_iff_isIntegralClosure : IsIntegrallyClosed R ↔ IsIn
     · rintro ⟨-, cl⟩ x hx
       exact cl.mp hx
 #align is_integrally_closed_iff_is_integral_closure isIntegrallyClosed_iff_isIntegralClosure
+-/
 
 end Iff
 
@@ -93,32 +97,33 @@ variable {R : Type _} [CommRing R] [id : IsDomain R] [iic : IsIntegrallyClosed R
 
 variable {K : Type _} [Field K] [Algebra R K] [ifr : IsFractionRing R K]
 
-include iic ifr
-
 instance : IsIntegralClosure R R K :=
   (isIntegrallyClosed_iff_isIntegralClosure K).mp iic
 
+#print IsIntegrallyClosed.isIntegral_iff /-
 theorem isIntegral_iff {x : K} : IsIntegral R x ↔ ∃ y : R, algebraMap R K y = x :=
   IsIntegralClosure.isIntegral_iff
 #align is_integrally_closed.is_integral_iff IsIntegrallyClosed.isIntegral_iff
+-/
 
+#print IsIntegrallyClosed.exists_algebraMap_eq_of_isIntegral_pow /-
 theorem exists_algebraMap_eq_of_isIntegral_pow {x : K} {n : ℕ} (hn : 0 < n)
     (hx : IsIntegral R <| x ^ n) : ∃ y : R, algebraMap R K y = x :=
   isIntegral_iff.mp <| isIntegral_of_pow hn hx
 #align is_integrally_closed.exists_algebra_map_eq_of_is_integral_pow IsIntegrallyClosed.exists_algebraMap_eq_of_isIntegral_pow
+-/
 
-omit iic ifr
-
+#print IsIntegrallyClosed.exists_algebraMap_eq_of_pow_mem_subalgebra /-
 theorem exists_algebraMap_eq_of_pow_mem_subalgebra {K : Type _} [Field K] [Algebra R K]
     {S : Subalgebra R K} [IsIntegrallyClosed S] [IsFractionRing S K] {x : K} {n : ℕ} (hn : 0 < n)
     (hx : x ^ n ∈ S) : ∃ y : S, algebraMap S K y = x :=
   exists_algebraMap_eq_of_isIntegral_pow hn <| isIntegral_iff.mpr ⟨⟨x ^ n, hx⟩, rfl⟩
 #align is_integrally_closed.exists_algebra_map_eq_of_pow_mem_subalgebra IsIntegrallyClosed.exists_algebraMap_eq_of_pow_mem_subalgebra
-
-include id ifr
+-/
 
 variable {R} (K)
 
+#print IsIntegrallyClosed.integralClosure_eq_bot_iff /-
 theorem integralClosure_eq_bot_iff : integralClosure R K = ⊥ ↔ IsIntegrallyClosed R :=
   by
   refine' eq_bot_iff.trans _
@@ -131,15 +136,16 @@ theorem integralClosure_eq_bot_iff : integralClosure R K = ⊥ ↔ IsIntegrallyC
     rw [Algebra.mem_bot, Set.mem_range]
     exact is_integral_iff.mp hx
 #align is_integrally_closed.integral_closure_eq_bot_iff IsIntegrallyClosed.integralClosure_eq_bot_iff
-
-include iic
+-/
 
 variable (R K)
 
+#print IsIntegrallyClosed.integralClosure_eq_bot /-
 @[simp]
 theorem integralClosure_eq_bot : integralClosure R K = ⊥ :=
   (integralClosure_eq_bot_iff K).mpr ‹_›
 #align is_integrally_closed.integral_closure_eq_bot IsIntegrallyClosed.integralClosure_eq_bot
+-/
 
 end IsIntegrallyClosed
 
@@ -155,12 +161,14 @@ variable [IsDomain R] [IsFractionRing R K]
 
 variable {L : Type _} [Field L] [Algebra K L] [Algebra R L] [IsScalarTower R K L]
 
+#print integralClosure.isIntegrallyClosedOfFiniteExtension /-
 -- Can't be an instance because you need to supply `K`.
 theorem isIntegrallyClosedOfFiniteExtension [FiniteDimensional K L] :
     IsIntegrallyClosed (integralClosure R L) :=
   letI : IsFractionRing (integralClosure R L) L := is_fraction_ring_of_finite_extension K L
   (integral_closure_eq_bot_iff L).mp integralClosure_idem
 #align integral_closure.is_integrally_closed_of_finite_extension integralClosure.isIntegrallyClosedOfFiniteExtension
+-/
 
 end integralClosure
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Anne Baanen
 
 ! This file was ported from Lean 3 source module ring_theory.integrally_closed
-! leanprover-community/mathlib commit d35b4ff446f1421bd551fafa4b8efd98ac3ac408
+! leanprover-community/mathlib commit af471b9e3ce868f296626d33189b4ce730fa4c00
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -14,6 +14,9 @@ import Mathbin.RingTheory.Localization.Integral
 /-!
 # Integrally closed rings
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 An integrally closed domain `R` contains all the elements of `Frac(R)` that are
 integral over `R`. A special case of integrally closed domains are the Dedekind domains.
 
@@ -32,6 +35,7 @@ open scoped nonZeroDivisors Polynomial
 
 open Polynomial
 
+#print IsIntegrallyClosed /-
 /-- `R` is integrally closed if all integral elements of `Frac(R)` are also elements of `R`.
 
 This definition uses `fraction_ring R` to denote `Frac(R)`. See `is_integrally_closed_iff`
@@ -41,6 +45,7 @@ class IsIntegrallyClosed (R : Type _) [CommRing R] [IsDomain R] : Prop where
   algebraMap_eq_of_integral :
     ∀ {x : FractionRing R}, IsIntegral R x → ∃ y, algebraMap R (FractionRing R) y = x
 #align is_integrally_closed IsIntegrallyClosed
+-/
 
 section Iff
 
Diff
@@ -4,11 +4,10 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Anne Baanen
 
 ! This file was ported from Lean 3 source module ring_theory.integrally_closed
-! leanprover-community/mathlib commit 7a030ab8eb5d99f05a891dccc49c5b5b90c947d3
+! leanprover-community/mathlib commit d35b4ff446f1421bd551fafa4b8efd98ac3ac408
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
-import Mathbin.FieldTheory.SplittingField
 import Mathbin.RingTheory.IntegralClosure
 import Mathbin.RingTheory.Localization.Integral
 
@@ -26,8 +25,6 @@ integral over `R`. A special case of integrally closed domains are the Dedekind
 
 * `is_integrally_closed_iff K`, where `K` is a fraction field of `R`, states `R`
   is integrally closed iff it is the integral closure of `R` in `K`
-* `eq_map_mul_C_of_dvd`: if `K = Frac(R)` and `g : K[X]` divides a monic polynomial with
-  coefficients in `R`, then `g * (C g.leading_coeff⁻¹)` has coefficients in `R`
 -/
 
 
@@ -149,29 +146,6 @@ variable {R : Type _} [CommRing R]
 
 variable (K : Type _) [Field K] [Algebra R K]
 
-theorem mem_lifts_of_monic_of_dvd_map {f : R[X]} (hf : f.Monic) {g : K[X]} (hg : g.Monic)
-    (hd : g ∣ f.map (algebraMap R K)) : g ∈ lifts (algebraMap (integralClosure R K) K) :=
-  by
-  haveI : IsScalarTower R K g.splitting_field := splitting_field_aux.is_scalar_tower _ _ _
-  have :=
-    mem_lift_of_splits_of_roots_mem_range (integralClosure R g.splitting_field)
-      ((splits_id_iff_splits _).2 <| splitting_field.splits g) (hg.map _) fun a ha =>
-      (set_like.ext_iff.mp (integralClosure R g.splitting_field).range_algebraMap _).mpr <|
-        roots_mem_integralClosure hf _
-  · rw [lifts_iff_coeff_lifts, ← RingHom.coe_range, Subalgebra.range_algebraMap] at this 
-    refine' (lifts_iff_coeff_lifts _).2 fun n => _
-    rw [← RingHom.coe_range, Subalgebra.range_algebraMap]
-    obtain ⟨p, hp, he⟩ := set_like.mem_coe.mp (this n); use p, hp
-    rw [IsScalarTower.algebraMap_eq R K, coeff_map, ← eval₂_map, eval₂_at_apply] at he 
-    rw [eval₂_eq_eval_map]; apply (injective_iff_map_eq_zero _).1 _ _ he
-    · apply RingHom.injective
-  rw [IsScalarTower.algebraMap_eq R K _, ← map_map]
-  refine' Multiset.mem_of_le (roots.le_of_dvd ((hf.map _).map _).NeZero _) ha
-  · infer_instance
-  · exact map_dvd (algebraMap K g.splitting_field) hd
-  · apply splitting_field_aux.is_scalar_tower
-#align integral_closure.mem_lifts_of_monic_of_dvd_map integralClosure.mem_lifts_of_monic_of_dvd_map
-
 variable [IsDomain R] [IsFractionRing R K]
 
 variable {L : Type _} [Field L] [Algebra K L] [Algebra R L] [IsScalarTower R K L]
@@ -185,44 +159,3 @@ theorem isIntegrallyClosedOfFiniteExtension [FiniteDimensional K L] :
 
 end integralClosure
 
-namespace IsIntegrallyClosed
-
-open integralClosure
-
-variable {R : Type _} [CommRing R] [IsDomain R]
-
-variable (K : Type _) [Field K] [Algebra R K] [IsFractionRing R K]
-
-/-- If `K = Frac(R)` and `g : K[X]` divides a monic polynomial with coefficients in `R`, then
-    `g * (C g.leading_coeff⁻¹)` has coefficients in `R` -/
-theorem eq_map_mul_c_of_dvd [IsIntegrallyClosed R] {f : R[X]} (hf : f.Monic) {g : K[X]}
-    (hg : g ∣ f.map (algebraMap R K)) :
-    ∃ g' : R[X], g'.map (algebraMap R K) * (C <| leadingCoeff g) = g :=
-  by
-  have g_ne_0 : g ≠ 0 := ne_zero_of_dvd_ne_zero (monic.ne_zero <| hf.map (algebraMap R K)) hg
-  suffices lem : ∃ g' : R[X], g'.map (algebraMap R K) = g * C g.leading_coeff⁻¹
-  · obtain ⟨g', hg'⟩ := lem
-    use g'
-    rw [hg', mul_assoc, ← C_mul, inv_mul_cancel (leading_coeff_ne_zero.mpr g_ne_0), C_1, mul_one]
-  have g_mul_dvd : g * C g.leading_coeff⁻¹ ∣ f.map (algebraMap R K) :=
-    by
-    rwa [Associated.dvd_iff_dvd_left (show Associated (g * C g.leading_coeff⁻¹) g from _)]
-    rw [associated_mul_isUnit_left_iff]
-    exact is_unit_C.mpr (inv_ne_zero <| leading_coeff_ne_zero.mpr g_ne_0).IsUnit
-  let algeq :=
-    (Subalgebra.equivOfEq _ _ <| integral_closure_eq_bot R _).trans
-      (Algebra.botEquivOfInjective <| IsFractionRing.injective R <| K)
-  have :
-    (algebraMap R _).comp algeq.to_alg_hom.to_ring_hom = (integralClosure R _).toSubring.Subtype :=
-    by ext; conv_rhs => rw [← algeq.symm_apply_apply x]; rfl
-  have H :=
-    (mem_lifts _).1
-      (mem_lifts_of_monic_of_dvd_map K hf (monic_mul_leading_coeff_inv g_ne_0) g_mul_dvd)
-  refine' ⟨map algeq.to_alg_hom.to_ring_hom _, _⟩
-  use Classical.choose H
-  rw [map_map, this]
-  exact Classical.choose_spec H
-#align is_integrally_closed.eq_map_mul_C_of_dvd IsIntegrallyClosed.eq_map_mul_c_of_dvd
-
-end IsIntegrallyClosed
-
Diff
@@ -158,11 +158,11 @@ theorem mem_lifts_of_monic_of_dvd_map {f : R[X]} (hf : f.Monic) {g : K[X]} (hg :
       ((splits_id_iff_splits _).2 <| splitting_field.splits g) (hg.map _) fun a ha =>
       (set_like.ext_iff.mp (integralClosure R g.splitting_field).range_algebraMap _).mpr <|
         roots_mem_integralClosure hf _
-  · rw [lifts_iff_coeff_lifts, ← RingHom.coe_range, Subalgebra.range_algebraMap] at this
+  · rw [lifts_iff_coeff_lifts, ← RingHom.coe_range, Subalgebra.range_algebraMap] at this 
     refine' (lifts_iff_coeff_lifts _).2 fun n => _
     rw [← RingHom.coe_range, Subalgebra.range_algebraMap]
     obtain ⟨p, hp, he⟩ := set_like.mem_coe.mp (this n); use p, hp
-    rw [IsScalarTower.algebraMap_eq R K, coeff_map, ← eval₂_map, eval₂_at_apply] at he
+    rw [IsScalarTower.algebraMap_eq R K, coeff_map, ← eval₂_map, eval₂_at_apply] at he 
     rw [eval₂_eq_eval_map]; apply (injective_iff_map_eq_zero _).1 _ _ he
     · apply RingHom.injective
   rw [IsScalarTower.algebraMap_eq R K _, ← map_map]
Diff
@@ -31,7 +31,7 @@ integral over `R`. A special case of integrally closed domains are the Dedekind
 -/
 
 
-open nonZeroDivisors Polynomial
+open scoped nonZeroDivisors Polynomial
 
 open Polynomial
 
Diff
@@ -161,11 +161,9 @@ theorem mem_lifts_of_monic_of_dvd_map {f : R[X]} (hf : f.Monic) {g : K[X]} (hg :
   · rw [lifts_iff_coeff_lifts, ← RingHom.coe_range, Subalgebra.range_algebraMap] at this
     refine' (lifts_iff_coeff_lifts _).2 fun n => _
     rw [← RingHom.coe_range, Subalgebra.range_algebraMap]
-    obtain ⟨p, hp, he⟩ := set_like.mem_coe.mp (this n)
-    use p, hp
+    obtain ⟨p, hp, he⟩ := set_like.mem_coe.mp (this n); use p, hp
     rw [IsScalarTower.algebraMap_eq R K, coeff_map, ← eval₂_map, eval₂_at_apply] at he
-    rw [eval₂_eq_eval_map]
-    apply (injective_iff_map_eq_zero _).1 _ _ he
+    rw [eval₂_eq_eval_map]; apply (injective_iff_map_eq_zero _).1 _ _ he
     · apply RingHom.injective
   rw [IsScalarTower.algebraMap_eq R K _, ← map_map]
   refine' Multiset.mem_of_le (roots.le_of_dvd ((hf.map _).map _).NeZero _) ha
@@ -216,10 +214,7 @@ theorem eq_map_mul_c_of_dvd [IsIntegrallyClosed R] {f : R[X]} (hf : f.Monic) {g
       (Algebra.botEquivOfInjective <| IsFractionRing.injective R <| K)
   have :
     (algebraMap R _).comp algeq.to_alg_hom.to_ring_hom = (integralClosure R _).toSubring.Subtype :=
-    by
-    ext
-    conv_rhs => rw [← algeq.symm_apply_apply x]
-    rfl
+    by ext; conv_rhs => rw [← algeq.symm_apply_apply x]; rfl
   have H :=
     (mem_lifts _).1
       (mem_lifts_of_monic_of_dvd_map K hf (monic_mul_leading_coeff_inv g_ne_0) g_mul_dvd)
Diff
@@ -199,7 +199,7 @@ variable (K : Type _) [Field K] [Algebra R K] [IsFractionRing R K]
     `g * (C g.leading_coeff⁻¹)` has coefficients in `R` -/
 theorem eq_map_mul_c_of_dvd [IsIntegrallyClosed R] {f : R[X]} (hf : f.Monic) {g : K[X]}
     (hg : g ∣ f.map (algebraMap R K)) :
-    ∃ g' : R[X], g'.map (algebraMap R K) * (c <| leadingCoeff g) = g :=
+    ∃ g' : R[X], g'.map (algebraMap R K) * (C <| leadingCoeff g) = g :=
   by
   have g_ne_0 : g ≠ 0 := ne_zero_of_dvd_ne_zero (monic.ne_zero <| hf.map (algebraMap R K)) hg
   suffices lem : ∃ g' : R[X], g'.map (algebraMap R K) = g * C g.leading_coeff⁻¹

Changes in mathlib4

mathlib3
mathlib4
Feat: add fermatLastTheoremThree_of_three_dvd_only_c (#11767)

We add fermatLastTheoremThree_of_three_dvd_only_c: To prove FermatLastTheoremFor 3, we may assume that ¬ 3 ∣ a, ¬ 3 ∣ b, a and b are coprime and 3 ∣ c.

From the flt3 project in LFTCM2024.

Co-authored-by: Pietro Monticone <38562595+pitmonticone@users.noreply.github.com>

Diff
@@ -231,6 +231,25 @@ theorem integralClosure_eq_bot_iff : integralClosure R K = ⊥ ↔ IsIntegrallyC
     (isIntegrallyClosed_iff_isIntegrallyClosedIn _).symm
 #align is_integrally_closed.integral_closure_eq_bot_iff IsIntegrallyClosed.integralClosure_eq_bot_iff
 
+@[simp]
+theorem pow_dvd_pow_iff {n : ℕ} (hn : n ≠ 0) {a b : R} : a ^ n ∣ b ^ n ↔ a ∣ b  := by
+  refine ⟨fun ⟨x, hx⟩ ↦ ?_, fun h ↦ pow_dvd_pow_of_dvd h n⟩
+  by_cases ha : a = 0
+  · simpa [ha, hn] using hx
+  let K := FractionRing R
+  replace ha : algebraMap R K a ≠ 0 := fun h ↦
+    ha <| (injective_iff_map_eq_zero _).1 (IsFractionRing.injective R K) _ h
+  let y := (algebraMap R K b) / (algebraMap R K a)
+  have hy : IsIntegral R y := by
+    refine ⟨X ^ n - C x, monic_X_pow_sub_C _ hn, ?_⟩
+    simp only [y, map_pow, eval₂_sub, eval₂_X_pow, div_pow, eval₂_pow', eval₂_C]
+    replace hx := congr_arg (algebraMap R K) hx
+    rw [map_pow] at hx
+    field_simp [hx, ha]
+  obtain ⟨k, hk⟩ := algebraMap_eq_of_integral hy
+  refine ⟨k, IsFractionRing.injective R K ?_⟩
+  rw [map_mul, hk, mul_div_cancel₀ _ ha]
+
 variable (R)
 
 /-- This is almost a duplicate of `IsIntegrallyClosedIn.integralClosure_eq_bot`,
refactor(RingTheory/IntegrallyClosed): generalize to IsIntegrallyClosedIn (#7857)

This refactor adds a new definition IsIntegrallyClosedIn R A equal to IsIntegralClosure R A A, and redefines IsIntegrallyClosed R to equal IsIntegrallyClosed R (FractionRing A). This should make it possible and convenient to generalize away from the fraction fields.

This also more closely approximates the conventions of the Stacks project.

This is a second attempt at the refactor, after #7116 which was much more messy.

Diff
@@ -16,12 +16,41 @@ integral over `R`. A special case of integrally closed rings are the Dedekind do
 
 ## Main definitions
 
+* `IsIntegrallyClosedIn R A` states `R` contains all integral elements of `A`
 * `IsIntegrallyClosed R` states `R` contains all integral elements of `Frac(R)`
 
 ## Main results
 
 * `isIntegrallyClosed_iff K`, where `K` is a fraction field of `R`, states `R`
   is integrally closed iff it is the integral closure of `R` in `K`
+
+## TODO: Related notions
+
+The following definitions are closely related, especially in their applications in Mathlib.
+
+A *normal domain* is a domain that is integrally closed in its field of fractions.
+[Stacks: normal domain](https://stacks.math.columbia.edu/tag/037B#0309)
+Normal domains are the major use case of `IsIntegrallyClosed` at the time of writing, and we have
+quite a few results that can be moved wholesale to a new `NormalDomain` definition.
+In fact, before PR #6126 `IsIntegrallyClosed` was exactly defined to be a normal domain.
+(So you might want to copy some of its API when you define normal domains.)
+
+A normal ring means that localizations at all prime ideals are normal domains.
+[Stacks: normal ring](https://stacks.math.columbia.edu/tag/037B#00GV)
+This implies `IsIntegrallyClosed`,
+[Stacks: Tag 034M](https://stacks.math.columbia.edu/tag/037B#034M)
+but is equivalent to it only under some conditions (reduced + finitely many minimal primes),
+[Stacks: Tag 030C](https://stacks.math.columbia.edu/tag/037B#030C)
+in which case it's also equivalent to being a finite product of normal domains.
+
+We'd need to add these conditions if we want exactly the products of Dedekind domains.
+
+In fact noetherianity is sufficient to guarantee finitely many minimal primes, so `IsDedekindRing`
+could be defined as `IsReduced`, `IsNoetherian`, `Ring.DimensionLEOne`, and either
+`IsIntegrallyClosed` or `NormalDomain`. If we use `NormalDomain` then `IsReduced` is automatic,
+but we could also consider a version of `NormalDomain` that only requires the localizations are
+`IsIntegrallyClosed` but may not be domains, and that may not equivalent to the ring itself being
+`IsIntegallyClosed` (even for noetherian rings?).
 -/
 
 
@@ -29,101 +58,183 @@ open scoped nonZeroDivisors Polynomial
 
 open Polynomial
 
+/-- `R` is integrally closed in `A` if all integral elements of `A` are also elements of `R`.
+-/
+abbrev IsIntegrallyClosedIn (R A : Type*) [CommRing R] [CommRing A] [Algebra R A] :=
+  IsIntegralClosure R R A
+
 /-- `R` is integrally closed if all integral elements of `Frac(R)` are also elements of `R`.
 
 This definition uses `FractionRing R` to denote `Frac(R)`. See `isIntegrallyClosed_iff`
 if you want to choose another field of fractions for `R`.
 -/
-class IsIntegrallyClosed (R : Type*) [CommRing R] : Prop where
-  /-- All integral elements of `Frac(R)` are also elements of `R`. -/
-  algebraMap_eq_of_integral :
-    ∀ {x : FractionRing R}, IsIntegral R x → ∃ y, algebraMap R (FractionRing R) y = x
+abbrev IsIntegrallyClosed (R : Type*) [CommRing R] := IsIntegrallyClosedIn R (FractionRing R)
 #align is_integrally_closed IsIntegrallyClosed
 
 section Iff
 
 variable {R : Type*} [CommRing R]
+variable {A B : Type*} [CommRing A] [CommRing B] [Algebra R A] [Algebra R B]
+
+/-- Being integrally closed is preserved under injective algebra homomorphisms. -/
+theorem AlgHom.isIntegrallyClosedIn (f : A →ₐ[R] B) (hf : Function.Injective f) :
+    IsIntegrallyClosedIn R B → IsIntegrallyClosedIn R A := by
+  rintro ⟨inj, cl⟩
+  refine ⟨Function.Injective.of_comp (f := f) ?_, fun hx => ?_, ?_⟩
+  · convert inj
+    aesop
+  · obtain ⟨y, fx_eq⟩ := cl.mp ((isIntegral_algHom_iff f hf).mpr hx)
+    aesop
+  · rintro ⟨y, rfl⟩
+    apply (isIntegral_algHom_iff f hf).mp
+    aesop
+
+/-- Being integrally closed is preserved under algebra isomorphisms. -/
+theorem AlgEquiv.isIntegrallyClosedIn (e : A ≃ₐ[R] B) :
+    IsIntegrallyClosedIn R A ↔ IsIntegrallyClosedIn R B :=
+  ⟨AlgHom.isIntegrallyClosedIn e.symm e.symm.injective, AlgHom.isIntegrallyClosedIn e e.injective⟩
+
 variable (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
 
+/-- `R` is integrally closed iff it is the integral closure of itself in its field of fractions. -/
+theorem isIntegrallyClosed_iff_isIntegrallyClosedIn :
+    IsIntegrallyClosed R ↔ IsIntegrallyClosedIn R K :=
+  (IsLocalization.algEquiv R⁰ _ _).isIntegrallyClosedIn
+
+/-- `R` is integrally closed iff it is the integral closure of itself in its field of fractions. -/
+theorem isIntegrallyClosed_iff_isIntegralClosure : IsIntegrallyClosed R ↔ IsIntegralClosure R R K :=
+  isIntegrallyClosed_iff_isIntegrallyClosedIn K
+#align is_integrally_closed_iff_is_integral_closure isIntegrallyClosed_iff_isIntegralClosure
+
+/-- `R` is integrally closed in `A` iff all integral elements of `A` are also elements of `R`. -/
+theorem isIntegrallyClosedIn_iff {R A : Type*} [CommRing R] [CommRing A] [Algebra R A] :
+    IsIntegrallyClosedIn R A ↔
+      Function.Injective (algebraMap R A) ∧
+        ∀ {x : A}, IsIntegral R x → ∃ y, algebraMap R A y = x := by
+  constructor
+  · rintro ⟨_, cl⟩
+    aesop
+  · rintro ⟨inj, cl⟩
+    refine ⟨inj, by aesop, ?_⟩
+    rintro ⟨y, rfl⟩
+    apply isIntegral_algebraMap
+
 /-- `R` is integrally closed iff all integral elements of its fraction field `K`
 are also elements of `R`. -/
 theorem isIntegrallyClosed_iff :
     IsIntegrallyClosed R ↔ ∀ {x : K}, IsIntegral R x → ∃ y, algebraMap R K y = x := by
-  let e : K ≃ₐ[R] FractionRing R := IsLocalization.algEquiv R⁰ _ _
-  constructor
-  · rintro ⟨cl⟩
-    refine' fun hx => _
-    obtain ⟨y, hy⟩ := cl ((isIntegral_algEquiv e).mpr hx)
-    exact ⟨y, e.algebraMap_eq_apply.mp hy⟩
-  · rintro cl
-    refine' ⟨fun hx => _⟩
-    obtain ⟨y, hy⟩ := cl ((isIntegral_algEquiv e.symm).mpr hx)
-    exact ⟨y, e.symm.algebraMap_eq_apply.mp hy⟩
+  simp [isIntegrallyClosed_iff_isIntegrallyClosedIn K, isIntegrallyClosedIn_iff,
+        IsFractionRing.injective R K]
 #align is_integrally_closed_iff isIntegrallyClosed_iff
 
-/-- `R` is integrally closed iff it is the integral closure of itself in its field of fractions. -/
-theorem isIntegrallyClosed_iff_isIntegralClosure : IsIntegrallyClosed R ↔ IsIntegralClosure R R K :=
-  (isIntegrallyClosed_iff K).trans <| by
-    constructor
-    · intro cl
-      refine' ⟨IsFractionRing.injective R K, ⟨cl, _⟩⟩
-      rintro ⟨y, y_eq⟩
-      rw [← y_eq]
-      exact isIntegral_algebraMap
-    · rintro ⟨-, cl⟩ x hx
-      exact cl.mp hx
-#align is_integrally_closed_iff_is_integral_closure isIntegrallyClosed_iff_isIntegralClosure
-
 end Iff
 
+namespace IsIntegrallyClosedIn
+
+variable {R A : Type*} [CommRing R] [CommRing A] [Algebra R A] [iic : IsIntegrallyClosedIn R A]
+
+theorem algebraMap_eq_of_integral {x : A} : IsIntegral R x → ∃ y : R, algebraMap R A y = x :=
+  IsIntegralClosure.isIntegral_iff.mp
+
+theorem isIntegral_iff {x : A} : IsIntegral R x ↔ ∃ y : R, algebraMap R A y = x :=
+  IsIntegralClosure.isIntegral_iff
+
+theorem exists_algebraMap_eq_of_isIntegral_pow {x : A} {n : ℕ} (hn : 0 < n)
+    (hx : IsIntegral R <| x ^ n) : ∃ y : R, algebraMap R A y = x :=
+  isIntegral_iff.mp <| hx.of_pow hn
+
+theorem exists_algebraMap_eq_of_pow_mem_subalgebra {A : Type*} [CommRing A] [Algebra R A]
+    {S : Subalgebra R A} [IsIntegrallyClosedIn S A] {x : A} {n : ℕ} (hn : 0 < n)
+    (hx : x ^ n ∈ S) : ∃ y : S, algebraMap S A y = x :=
+  exists_algebraMap_eq_of_isIntegral_pow hn <| isIntegral_iff.mpr ⟨⟨x ^ n, hx⟩, rfl⟩
+
+variable (A)
+
+theorem integralClosure_eq_bot_iff (hRA : Function.Injective (algebraMap R A)) :
+    integralClosure R A = ⊥ ↔ IsIntegrallyClosedIn R A := by
+  refine eq_bot_iff.trans ?_
+  constructor
+  · intro h
+    refine ⟨ hRA, fun hx => Set.mem_range.mp (Algebra.mem_bot.mp (h hx)), ?_⟩
+    · rintro ⟨y, rfl⟩
+      apply isIntegral_algebraMap
+  · intro h x hx
+    rw [Algebra.mem_bot, Set.mem_range]
+    exact isIntegral_iff.mp hx
+
+variable (R)
+
+@[simp]
+theorem integralClosure_eq_bot [NoZeroSMulDivisors R A] [Nontrivial A] : integralClosure R A = ⊥ :=
+  (integralClosure_eq_bot_iff A (NoZeroSMulDivisors.algebraMap_injective _ _)).mpr ‹_›
+
+variable {A} {B : Type*} [CommRing B]
+
+/-- If `R` is the integral closure of `S` in `A`, then it is integrally closed in `A`. -/
+lemma of_isIntegralClosure [Algebra R B] [Algebra A B] [IsScalarTower R A B]
+    [IsIntegralClosure A R B] :
+    IsIntegrallyClosedIn A B :=
+  IsIntegralClosure.tower_top (IsIntegralClosure.isIntegral R B)
+
+variable {R}
+
+lemma _root_.IsIntegralClosure.of_isIntegrallyClosedIn
+    [Algebra R B] [Algebra A B] [IsScalarTower R A B]
+    [IsIntegrallyClosedIn A B] (hRA : Algebra.IsIntegral R A) :
+    IsIntegralClosure A R B := by
+  refine ⟨IsIntegralClosure.algebraMap_injective _ A _, fun {x} ↦
+    ⟨fun hx ↦ IsIntegralClosure.isIntegral_iff.mp (IsIntegral.tower_top (A := A) hx), ?_⟩⟩
+  rintro ⟨y, rfl⟩
+  exact IsIntegral.map (IsScalarTower.toAlgHom A A B) (hRA y)
+
+end IsIntegrallyClosedIn
+
 namespace IsIntegrallyClosed
 
 variable {R S : Type*} [CommRing R] [CommRing S] [id : IsDomain R] [iic : IsIntegrallyClosed R]
 variable {K : Type*} [CommRing K] [Algebra R K] [ifr : IsFractionRing R K]
 
+/-- Note that this is not a duplicate instance, since `IsIntegrallyClosed R` is instead defined
+as `IsIntegrallyClosed R R (FractionRing R)`. -/
 instance : IsIntegralClosure R R K :=
   (isIntegrallyClosed_iff_isIntegralClosure K).mp iic
 
+theorem algebraMap_eq_of_integral {x : K} : IsIntegral R x → ∃ y : R, algebraMap R K y = x :=
+  IsIntegralClosure.isIntegral_iff.mp
+
 theorem isIntegral_iff {x : K} : IsIntegral R x ↔ ∃ y : R, algebraMap R K y = x :=
-  IsIntegralClosure.isIntegral_iff
+  IsIntegrallyClosedIn.isIntegral_iff
 #align is_integrally_closed.is_integral_iff IsIntegrallyClosed.isIntegral_iff
 
 theorem exists_algebraMap_eq_of_isIntegral_pow {x : K} {n : ℕ} (hn : 0 < n)
     (hx : IsIntegral R <| x ^ n) : ∃ y : R, algebraMap R K y = x :=
-  isIntegral_iff.mp <| hx.of_pow hn
+  IsIntegrallyClosedIn.exists_algebraMap_eq_of_isIntegral_pow hn hx
 #align is_integrally_closed.exists_algebra_map_eq_of_is_integral_pow IsIntegrallyClosed.exists_algebraMap_eq_of_isIntegral_pow
 
 theorem exists_algebraMap_eq_of_pow_mem_subalgebra {K : Type*} [CommRing K] [Algebra R K]
     {S : Subalgebra R K} [IsIntegrallyClosed S] [IsFractionRing S K] {x : K} {n : ℕ} (hn : 0 < n)
     (hx : x ^ n ∈ S) : ∃ y : S, algebraMap S K y = x :=
-  exists_algebraMap_eq_of_isIntegral_pow hn <| isIntegral_iff.mpr ⟨⟨x ^ n, hx⟩, rfl⟩
+  IsIntegrallyClosedIn.exists_algebraMap_eq_of_pow_mem_subalgebra hn hx
 #align is_integrally_closed.exists_algebra_map_eq_of_pow_mem_subalgebra IsIntegrallyClosed.exists_algebraMap_eq_of_pow_mem_subalgebra
 
 variable (R S K)
 
 lemma _root_.IsIntegralClosure.of_isIntegrallyClosed
     [Algebra S R] [Algebra S K] [IsScalarTower S R K] (hRS : Algebra.IsIntegral S R) :
-    IsIntegralClosure R S K := by
-  refine ⟨IsLocalization.injective _ le_rfl, fun {x} ↦
-    ⟨fun hx ↦ IsIntegralClosure.isIntegral_iff.mp (IsIntegral.tower_top (A := R) hx), ?_⟩⟩
-  rintro ⟨y, rfl⟩
-  exact IsIntegral.map (IsScalarTower.toAlgHom S R K) (hRS y)
+    IsIntegralClosure R S K :=
+  IsIntegralClosure.of_isIntegrallyClosedIn hRS
 
 variable {R}
 
-theorem integralClosure_eq_bot_iff : integralClosure R K = ⊥ ↔ IsIntegrallyClosed R := by
-  refine' eq_bot_iff.trans _
-  constructor
-  · rw [isIntegrallyClosed_iff K]
-    intro h x hx
-    exact Set.mem_range.mp (Algebra.mem_bot.mp (h hx))
-  · intro h x hx
-    rw [Algebra.mem_bot, Set.mem_range]
-    exact isIntegral_iff.mp hx
+theorem integralClosure_eq_bot_iff : integralClosure R K = ⊥ ↔ IsIntegrallyClosed R :=
+  (IsIntegrallyClosedIn.integralClosure_eq_bot_iff _ (IsFractionRing.injective _ _)).trans
+    (isIntegrallyClosed_iff_isIntegrallyClosedIn _).symm
 #align is_integrally_closed.integral_closure_eq_bot_iff IsIntegrallyClosed.integralClosure_eq_bot_iff
 
 variable (R)
 
+/-- This is almost a duplicate of `IsIntegrallyClosedIn.integralClosure_eq_bot`,
+except the `NoZeroSMulDivisors` hypothesis isn't inferred automatically from `IsFractionRing`. -/
 @[simp]
 theorem integralClosure_eq_bot : integralClosure R K = ⊥ :=
   (integralClosure_eq_bot_iff K).mpr ‹_›
chore(*): remove empty lines between variable statements (#11418)

Empty lines were removed by executing the following Python script twice

import os
import re


# Loop through each file in the repository
for dir_path, dirs, files in os.walk('.'):
  for filename in files:
    if filename.endswith('.lean'):
      file_path = os.path.join(dir_path, filename)

      # Open the file and read its contents
      with open(file_path, 'r') as file:
        content = file.read()

      # Use a regular expression to replace sequences of "variable" lines separated by empty lines
      # with sequences without empty lines
      modified_content = re.sub(r'(variable.*\n)\n(variable(?! .* in))', r'\1\2', content)

      # Write the modified content back to the file
      with open(file_path, 'w') as file:
        file.write(modified_content)
Diff
@@ -43,7 +43,6 @@ class IsIntegrallyClosed (R : Type*) [CommRing R] : Prop where
 section Iff
 
 variable {R : Type*} [CommRing R]
-
 variable (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
 
 /-- `R` is integrally closed iff all integral elements of its fraction field `K`
@@ -80,7 +79,6 @@ end Iff
 namespace IsIntegrallyClosed
 
 variable {R S : Type*} [CommRing R] [CommRing S] [id : IsDomain R] [iic : IsIntegrallyClosed R]
-
 variable {K : Type*} [CommRing K] [Algebra R K] [ifr : IsFractionRing R K]
 
 instance : IsIntegralClosure R R K :=
@@ -138,11 +136,8 @@ namespace integralClosure
 open IsIntegrallyClosed
 
 variable {R : Type*} [CommRing R]
-
 variable (K : Type*) [Field K] [Algebra R K]
-
 variable [IsFractionRing R K]
-
 variable {L : Type*} [Field L] [Algebra K L] [Algebra R L] [IsScalarTower R K L]
 
 -- Can't be an instance because you need to supply `K`.
feat: Define the different ideal. (#9063)
Diff
@@ -79,7 +79,7 @@ end Iff
 
 namespace IsIntegrallyClosed
 
-variable {R : Type*} [CommRing R] [id : IsDomain R] [iic : IsIntegrallyClosed R]
+variable {R S : Type*} [CommRing R] [CommRing S] [id : IsDomain R] [iic : IsIntegrallyClosed R]
 
 variable {K : Type*} [CommRing K] [Algebra R K] [ifr : IsFractionRing R K]
 
@@ -101,7 +101,17 @@ theorem exists_algebraMap_eq_of_pow_mem_subalgebra {K : Type*} [CommRing K] [Alg
   exists_algebraMap_eq_of_isIntegral_pow hn <| isIntegral_iff.mpr ⟨⟨x ^ n, hx⟩, rfl⟩
 #align is_integrally_closed.exists_algebra_map_eq_of_pow_mem_subalgebra IsIntegrallyClosed.exists_algebraMap_eq_of_pow_mem_subalgebra
 
-variable (K)
+variable (R S K)
+
+lemma _root_.IsIntegralClosure.of_isIntegrallyClosed
+    [Algebra S R] [Algebra S K] [IsScalarTower S R K] (hRS : Algebra.IsIntegral S R) :
+    IsIntegralClosure R S K := by
+  refine ⟨IsLocalization.injective _ le_rfl, fun {x} ↦
+    ⟨fun hx ↦ IsIntegralClosure.isIntegral_iff.mp (IsIntegral.tower_top (A := R) hx), ?_⟩⟩
+  rintro ⟨y, rfl⟩
+  exact IsIntegral.map (IsScalarTower.toAlgHom S R K) (hRS y)
+
+variable {R}
 
 theorem integralClosure_eq_bot_iff : integralClosure R K = ⊥ ↔ IsIntegrallyClosed R := by
   refine' eq_bot_iff.trans _
chore(IntegralClosure): noncommutative generalizations and golfs (#8406)

Zulip

Initially I just wanted to add more dot notations for IsIntegral and IsAlgebraic (done in #8437); then I noticed near-duplicates Algebra.isIntegral_of_finite [Field R] [Ring A] and RingHom.IsIntegral.of_finite [CommRing R] [CommRing A] so I went on to generalize the latter to cover the former, and generalized everything in the IntegralClosure file to the noncommutative case whenever possible.

In the process I noticed more golfs, which result in this PR. Most notably, isIntegral_of_mem_of_FG is now proven using Cayley-Hamilton and doesn't depend on the Noetherian case isIntegral_of_noetherian; the latter is now proven using the former. In total the golfs makes mathlib 227 lines leaner (+487 -714).

The main changes are in the single file RingTheory/IntegralClosure:

  • Change the definition of Algebra.IsIntegral which makes it unfold to IsIntegral rather than RingHom.IsIntegralElem because the former has much more APIs.

  • Fix lemma names involving is_integral which are actually about IsIntegralElem: RingHom.is_integral_mapRingHom.isIntegralElem_map RingHom.is_integral_of_mem_closureRingHom.IsIntegralElem.of_mem_closure RingHom.is_integral_zero/oneRingHom.isIntegralElem_zero/one RingHom.is_integral_add/neg/sub/mul/of_mul_unitRingHom.IsIntegralElem.add/neg/sub/mul/of_mul_unit

  • Add a lemma Algebra.IsIntegral.of_injective.

  • Move isIntegral_of_(submodule_)noetherian down and golf them.

  • Remove (Algebra.)isIntegral_of_finite that work only over fields, in favor of the more general (Algebra.)isIntegral.of_finite.

  • Merge duplicate lemmas isIntegral_of_isScalarTower and isIntegral_tower_top_of_isIntegral into IsIntegral.tower_top.

  • Golf IsIntegral.of_mem_of_fg by first proving IsIntegral.of_finite using Cayley-Hamilton.

  • Add a docstring mentioning the Kurosh problem at Algebra.IsIntegral.finite. The negative solution to the problem means the theorem doesn't generalize to noncommutative algebras.

  • Golf IsIntegral.tmul and isField_of_isIntegral_of_isField(').

  • Combine isIntegral_trans_aux into isIntegral_trans and golf.

  • Add Algebra namespace to isIntegral_sup.

  • rename lemmas for dot notation: RingHom.isIntegral_transRingHom.IsIntegral.trans RingHom.isIntegral_quotient/tower_bot/top_of_isIntegralRingHom.IsIntegral.quotient/tower_bot/top isIntegral_of_mem_closure'IsIntegral.of_mem_closure' (and the '' version) isIntegral_of_surjectiveAlgebra.isIntegral_of_surjective

The next changed file is RingTheory/Algebraic:

  • Rename: of_larger_basetower_top (for consistency with IsIntegral) Algebra.isAlgebraic_of_finiteAlgebra.IsAlgebraic.of_finite Algebra.isAlgebraic_transAlgebra.IsAlgebraic.trans

  • Add new lemmasAlgebra.IsIntegral.isAlgebraic, isAlgebraic_algHom_iff, and Algebra.IsAlgebraic.of_injective to streamline some proofs.

The generalization from CommRing to Ring requires an additional lemma scaleRoots_eval₂_mul_of_commute in Polynomial/ScaleRoots.

A lemma Algebra.lmul_injective is added to Algebra/Bilinear (in order to golf the proof of IsIntegral.of_mem_of_fg).

In all other files, I merely fix the changed names, or use newly available dot notations.

Co-authored-by: Junyan Xu <junyanxu.math@gmail.com>

Diff
@@ -92,7 +92,7 @@ theorem isIntegral_iff {x : K} : IsIntegral R x ↔ ∃ y : R, algebraMap R K y
 
 theorem exists_algebraMap_eq_of_isIntegral_pow {x : K} {n : ℕ} (hn : 0 < n)
     (hx : IsIntegral R <| x ^ n) : ∃ y : R, algebraMap R K y = x :=
-  isIntegral_iff.mp <| IsIntegral.of_pow hn hx
+  isIntegral_iff.mp <| hx.of_pow hn
 #align is_integrally_closed.exists_algebra_map_eq_of_is_integral_pow IsIntegrallyClosed.exists_algebraMap_eq_of_isIntegral_pow
 
 theorem exists_algebraMap_eq_of_pow_mem_subalgebra {K : Type*} [CommRing K] [Algebra R K]
chore(RingTheory/{Algebraic, Localization/Integral}): rename decls to use dot notation (#8437)

This PR tests a string-based tool for renaming declarations.

Inspired by this Zulip thread, I am trying to reduce the diff of #8406.

This PR makes the following renames:

| From | To |

Diff
@@ -92,7 +92,7 @@ theorem isIntegral_iff {x : K} : IsIntegral R x ↔ ∃ y : R, algebraMap R K y
 
 theorem exists_algebraMap_eq_of_isIntegral_pow {x : K} {n : ℕ} (hn : 0 < n)
     (hx : IsIntegral R <| x ^ n) : ∃ y : R, algebraMap R K y = x :=
-  isIntegral_iff.mp <| isIntegral_of_pow hn hx
+  isIntegral_iff.mp <| IsIntegral.of_pow hn hx
 #align is_integrally_closed.exists_algebra_map_eq_of_is_integral_pow IsIntegrallyClosed.exists_algebraMap_eq_of_isIntegral_pow
 
 theorem exists_algebraMap_eq_of_pow_mem_subalgebra {K : Type*} [CommRing K] [Algebra R K]
feat: IsDedekindRing is IsDedekindDomain minus IsDomain (#6127)

This PR defines IsDedekindRing as IsDedekindDomain without the bundled IsDomain hypothesis.

Zulip thread: https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/Should.20.60IsDedekindDomain.60.20extend.20.60IsDomain.60.3F

Co-authored-by: Anne Baanen <Vierkantor@users.noreply.github.com>

Diff
@@ -44,7 +44,7 @@ section Iff
 
 variable {R : Type*} [CommRing R]
 
-variable (K : Type*) [Field K] [Algebra R K] [IsFractionRing R K]
+variable (K : Type*) [CommRing K] [Algebra R K] [IsFractionRing R K]
 
 /-- `R` is integrally closed iff all integral elements of its fraction field `K`
 are also elements of `R`. -/
@@ -81,7 +81,7 @@ namespace IsIntegrallyClosed
 
 variable {R : Type*} [CommRing R] [id : IsDomain R] [iic : IsIntegrallyClosed R]
 
-variable {K : Type*} [Field K] [Algebra R K] [ifr : IsFractionRing R K]
+variable {K : Type*} [CommRing K] [Algebra R K] [ifr : IsFractionRing R K]
 
 instance : IsIntegralClosure R R K :=
   (isIntegrallyClosed_iff_isIntegralClosure K).mp iic
@@ -95,7 +95,7 @@ theorem exists_algebraMap_eq_of_isIntegral_pow {x : K} {n : ℕ} (hn : 0 < n)
   isIntegral_iff.mp <| isIntegral_of_pow hn hx
 #align is_integrally_closed.exists_algebra_map_eq_of_is_integral_pow IsIntegrallyClosed.exists_algebraMap_eq_of_isIntegral_pow
 
-theorem exists_algebraMap_eq_of_pow_mem_subalgebra {K : Type*} [Field K] [Algebra R K]
+theorem exists_algebraMap_eq_of_pow_mem_subalgebra {K : Type*} [CommRing K] [Algebra R K]
     {S : Subalgebra R K} [IsIntegrallyClosed S] [IsFractionRing S K] {x : K} {n : ℕ} (hn : 0 < n)
     (hx : x ^ n ∈ S) : ∃ y : S, algebraMap S K y = x :=
   exists_algebraMap_eq_of_isIntegral_pow hn <| isIntegral_iff.mpr ⟨⟨x ^ n, hx⟩, rfl⟩
refactor: remove IsDomain hypothesis from IsIntegrallyClosed (#6126)

This PR modifies the definition of IsIntegrallyClosed to drop the IsDomain hypothesis. This change came out of the discussions of modifying IsDedekindDomain to either extend IsDomain or to drop IsDomain entirely and change it to IsDedekindRing. (The former being a dependency of this PR, the latter a follow-up.)

Zulip thread: https://leanprover.zulipchat.com/#narrow/stream/113488-general/topic/Should.20.60IsDedekindDomain.60.20extend.20.60IsDomain.60.3F

Diff
@@ -11,8 +11,8 @@ import Mathlib.RingTheory.Localization.Integral
 /-!
 # Integrally closed rings
 
-An integrally closed domain `R` contains all the elements of `Frac(R)` that are
-integral over `R`. A special case of integrally closed domains are the Dedekind domains.
+An integrally closed ring `R` contains all the elements of `Frac(R)` that are
+integral over `R`. A special case of integrally closed rings are the Dedekind domains.
 
 ## Main definitions
 
@@ -34,7 +34,7 @@ open Polynomial
 This definition uses `FractionRing R` to denote `Frac(R)`. See `isIntegrallyClosed_iff`
 if you want to choose another field of fractions for `R`.
 -/
-class IsIntegrallyClosed (R : Type*) [CommRing R] [IsDomain R] : Prop where
+class IsIntegrallyClosed (R : Type*) [CommRing R] : Prop where
   /-- All integral elements of `Frac(R)` are also elements of `R`. -/
   algebraMap_eq_of_integral :
     ∀ {x : FractionRing R}, IsIntegral R x → ∃ y, algebraMap R (FractionRing R) y = x
@@ -42,7 +42,7 @@ class IsIntegrallyClosed (R : Type*) [CommRing R] [IsDomain R] : Prop where
 
 section Iff
 
-variable {R : Type*} [CommRing R] [IsDomain R]
+variable {R : Type*} [CommRing R]
 
 variable (K : Type*) [Field K] [Algebra R K] [IsFractionRing R K]
 
@@ -131,12 +131,12 @@ variable {R : Type*} [CommRing R]
 
 variable (K : Type*) [Field K] [Algebra R K]
 
-variable [IsDomain R] [IsFractionRing R K]
+variable [IsFractionRing R K]
 
 variable {L : Type*} [Field L] [Algebra K L] [Algebra R L] [IsScalarTower R K L]
 
 -- Can't be an instance because you need to supply `K`.
-theorem isIntegrallyClosedOfFiniteExtension [FiniteDimensional K L] :
+theorem isIntegrallyClosedOfFiniteExtension [IsDomain R] [FiniteDimensional K L] :
     IsIntegrallyClosed (integralClosure R L) :=
   letI : IsFractionRing (integralClosure R L) L := isFractionRing_of_finite_extension K L
   (integralClosure_eq_bot_iff L).mp integralClosure_idem
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
@@ -34,7 +34,7 @@ open Polynomial
 This definition uses `FractionRing R` to denote `Frac(R)`. See `isIntegrallyClosed_iff`
 if you want to choose another field of fractions for `R`.
 -/
-class IsIntegrallyClosed (R : Type _) [CommRing R] [IsDomain R] : Prop where
+class IsIntegrallyClosed (R : Type*) [CommRing R] [IsDomain R] : Prop where
   /-- All integral elements of `Frac(R)` are also elements of `R`. -/
   algebraMap_eq_of_integral :
     ∀ {x : FractionRing R}, IsIntegral R x → ∃ y, algebraMap R (FractionRing R) y = x
@@ -42,9 +42,9 @@ class IsIntegrallyClosed (R : Type _) [CommRing R] [IsDomain R] : Prop where
 
 section Iff
 
-variable {R : Type _} [CommRing R] [IsDomain R]
+variable {R : Type*} [CommRing R] [IsDomain R]
 
-variable (K : Type _) [Field K] [Algebra R K] [IsFractionRing R K]
+variable (K : Type*) [Field K] [Algebra R K] [IsFractionRing R K]
 
 /-- `R` is integrally closed iff all integral elements of its fraction field `K`
 are also elements of `R`. -/
@@ -79,9 +79,9 @@ end Iff
 
 namespace IsIntegrallyClosed
 
-variable {R : Type _} [CommRing R] [id : IsDomain R] [iic : IsIntegrallyClosed R]
+variable {R : Type*} [CommRing R] [id : IsDomain R] [iic : IsIntegrallyClosed R]
 
-variable {K : Type _} [Field K] [Algebra R K] [ifr : IsFractionRing R K]
+variable {K : Type*} [Field K] [Algebra R K] [ifr : IsFractionRing R K]
 
 instance : IsIntegralClosure R R K :=
   (isIntegrallyClosed_iff_isIntegralClosure K).mp iic
@@ -95,7 +95,7 @@ theorem exists_algebraMap_eq_of_isIntegral_pow {x : K} {n : ℕ} (hn : 0 < n)
   isIntegral_iff.mp <| isIntegral_of_pow hn hx
 #align is_integrally_closed.exists_algebra_map_eq_of_is_integral_pow IsIntegrallyClosed.exists_algebraMap_eq_of_isIntegral_pow
 
-theorem exists_algebraMap_eq_of_pow_mem_subalgebra {K : Type _} [Field K] [Algebra R K]
+theorem exists_algebraMap_eq_of_pow_mem_subalgebra {K : Type*} [Field K] [Algebra R K]
     {S : Subalgebra R K} [IsIntegrallyClosed S] [IsFractionRing S K] {x : K} {n : ℕ} (hn : 0 < n)
     (hx : x ^ n ∈ S) : ∃ y : S, algebraMap S K y = x :=
   exists_algebraMap_eq_of_isIntegral_pow hn <| isIntegral_iff.mpr ⟨⟨x ^ n, hx⟩, rfl⟩
@@ -127,13 +127,13 @@ namespace integralClosure
 
 open IsIntegrallyClosed
 
-variable {R : Type _} [CommRing R]
+variable {R : Type*} [CommRing R]
 
-variable (K : Type _) [Field K] [Algebra R K]
+variable (K : Type*) [Field K] [Algebra R K]
 
 variable [IsDomain R] [IsFractionRing R K]
 
-variable {L : Type _} [Field L] [Algebra K L] [Algebra R L] [IsScalarTower R K L]
+variable {L : Type*} [Field L] [Algebra K L] [Algebra R L] [IsScalarTower R K L]
 
 -- Can't be an instance because you need to supply `K`.
 theorem isIntegrallyClosedOfFiniteExtension [FiniteDimensional K L] :
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,15 +2,12 @@
 Copyright (c) 2021 Anne Baanen. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Anne Baanen
-
-! This file was ported from Lean 3 source module ring_theory.integrally_closed
-! leanprover-community/mathlib commit d35b4ff446f1421bd551fafa4b8efd98ac3ac408
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.RingTheory.IntegralClosure
 import Mathlib.RingTheory.Localization.Integral
 
+#align_import ring_theory.integrally_closed from "leanprover-community/mathlib"@"d35b4ff446f1421bd551fafa4b8efd98ac3ac408"
+
 /-!
 # Integrally closed rings
 
feat: port RingTheory.IntegrallyClosed (#4574)

Dependencies 10 + 631

632 files ported (98.4%)
265206 lines ported (98.7%)
Show graph

The unported dependencies are