Skip to content

Commit

Permalink
fix: remove a bad Algebra instance in FractionRing (#6724)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisHughes24 committed Sep 2, 2023
1 parent 40f72b5 commit 8953aea
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 8 deletions.
7 changes: 7 additions & 0 deletions Mathlib/FieldTheory/IsAlgClosed/Basic.lean
Expand Up @@ -362,8 +362,11 @@ variable {M}

private theorem FractionRing.isAlgebraic :
letI : IsDomain R := (NoZeroSMulDivisors.algebraMap_injective R S).isDomain _
letI : Algebra (FractionRing R) (FractionRing S) := FractionRing.liftAlgebra R _
Algebra.IsAlgebraic (FractionRing R) (FractionRing S) := by
letI : IsDomain R := (NoZeroSMulDivisors.algebraMap_injective R S).isDomain _
letI : Algebra (FractionRing R) (FractionRing S) := FractionRing.liftAlgebra R _
have := FractionRing.isScalarTower_liftAlgebra R (FractionRing S)
intro
exact
(IsFractionRing.isAlgebraic_iff R (FractionRing R) (FractionRing S)).1
Expand All @@ -373,6 +376,10 @@ private theorem FractionRing.isAlgebraic :
closed extension of R. -/
noncomputable irreducible_def lift : S →ₐ[R] M := by
letI : IsDomain R := (NoZeroSMulDivisors.algebraMap_injective R S).isDomain _
letI := FractionRing.liftAlgebra R M
letI := FractionRing.liftAlgebra R (FractionRing S)
have := FractionRing.isScalarTower_liftAlgebra R M
have := FractionRing.isScalarTower_liftAlgebra R (FractionRing S)
have : Algebra.IsAlgebraic (FractionRing R) (FractionRing S) :=
FractionRing.isAlgebraic hS
let f : FractionRing S →ₐ[FractionRing R] M := lift_aux (FractionRing R) (FractionRing S) M this
Expand Down
2 changes: 2 additions & 0 deletions Mathlib/FieldTheory/Minpoly/IsIntegrallyClosed.lean
Expand Up @@ -80,6 +80,8 @@ theorem isIntegrallyClosed_dvd [Nontrivial R] {s : S} (hs : IsIntegral R s) {p :
(hp : Polynomial.aeval s p = 0) : minpoly R s ∣ p := by
let K := FractionRing R
let L := FractionRing S
let _ : Algebra K L := FractionRing.liftAlgebra R L
have := FractionRing.isScalarTower_liftAlgebra R L
have : minpoly K (algebraMap S L s) ∣ map (algebraMap R K) (p %ₘ minpoly R s) := by
rw [map_modByMonic _ (minpoly.monic hs), modByMonic_eq_sub_mul_div]
refine' dvd_sub (minpoly.dvd K (algebraMap S L s) _) _
Expand Down
16 changes: 11 additions & 5 deletions Mathlib/RingTheory/Localization/FractionRing.lean
Expand Up @@ -310,14 +310,20 @@ theorem mk_eq_div {r s} :
by rw [Localization.mk_eq_mk', IsFractionRing.mk'_eq_div]
#align fraction_ring.mk_eq_div FractionRing.mk_eq_div

noncomputable instance [IsDomain R] [Field K] [Algebra R K] [NoZeroSMulDivisors R K] :
Algebra (FractionRing R) K :=
/-- This is not an instance because it creates a diamond when `K = FractionRing R`.
Should usually be introduced locally along with `isScalarTower_liftAlgebra`
See note [reducible non-instances]. -/
@[reducible]
noncomputable def liftAlgebra [IsDomain R] [Field K] [Algebra R K]
[NoZeroSMulDivisors R K] : Algebra (FractionRing R) K :=
RingHom.toAlgebra (IsFractionRing.lift (NoZeroSMulDivisors.algebraMap_injective R _))

-- Porting note: had to fill in the `_` by hand for this instance
instance [IsDomain R] [Field K] [Algebra R K] [NoZeroSMulDivisors R K] :
IsScalarTower R (FractionRing R) K :=
IsScalarTower.of_algebraMap_eq fun x =>
/-- Should be introduced locally after introducing `FractionRing.liftAlgebra` -/
theorem isScalarTower_liftAlgebra [IsDomain R] [Field K] [Algebra R K] [NoZeroSMulDivisors R K] :
by letI := liftAlgebra R K; exact IsScalarTower R (FractionRing R) K := by
letI := liftAlgebra R K
exact IsScalarTower.of_algebraMap_eq fun x =>
(IsFractionRing.lift_algebraMap (NoZeroSMulDivisors.algebraMap_injective R K ) x).symm

/-- Given an integral domain `A` and a localization map to a field of fractions
Expand Down
2 changes: 2 additions & 0 deletions Mathlib/RingTheory/Localization/Integral.lean
Expand Up @@ -389,6 +389,8 @@ theorem isAlgebraic_iff' [Field K] [IsDomain R] [IsDomain S] [Algebra R K] [Alge
simp only [Algebra.IsAlgebraic]
constructor
· intro h x
letI := FractionRing.liftAlgebra R K
have := FractionRing.isScalarTower_liftAlgebra R K
rw [IsFractionRing.isAlgebraic_iff R (FractionRing R) K, isAlgebraic_iff_isIntegral]
obtain ⟨a : S, b, ha, rfl⟩ := @div_surjective S _ _ _ _ _ _ x
obtain ⟨f, hf₁, hf₂⟩ := h b
Expand Down
3 changes: 0 additions & 3 deletions Mathlib/RingTheory/WittVector/Isocrystal.lean
Expand Up @@ -248,9 +248,6 @@ theorem isocrystal_classification (k : Type*) [Field k] [IsAlgClosed k] [CharP k
LinearEquiv.map_smulₛₗ, StandardOneDimIsocrystal.frobenius_apply, Algebra.id.smul_eq_mul]
simp only [← mul_smul]
congr 1
-- Porting note: added the next two lines
erw [smul_eq_mul]
simp only [map_zpow₀, map_natCast]
linear_combination φ(p, k) c * hmb
#align witt_vector.isocrystal_classification WittVector.isocrystal_classification

Expand Down

0 comments on commit 8953aea

Please sign in to comment.