field_theory.is_alg_closed.algebraic_closureMathlib.FieldTheory.IsAlgClosed.AlgebraicClosure

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)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -102,7 +102,7 @@ theorem spanEval_ne_top : spanEval k ≠ ⊤ :=
     Finsupp.mem_span_image_iff_total]
   rintro ⟨v, _, hv⟩
   replace hv := congr_arg (to_splitting_field k v.support) hv
-  rw [AlgHom.map_one, Finsupp.total_apply, Finsupp.sum, AlgHom.map_sum, Finset.sum_eq_zero] at hv 
+  rw [AlgHom.map_one, Finsupp.total_apply, Finsupp.sum, AlgHom.map_sum, Finset.sum_eq_zero] at hv
   · exact zero_ne_one hv
   intro j hj
   rw [smul_eq_mul, AlgHom.map_mul, to_splitting_field_eval_X_self k hj, MulZeroClass.mul_zero]
@@ -348,7 +348,7 @@ theorem exists_root {f : Polynomial (AlgebraicClosureAux k)} (hfm : f.Monic) (hf
   have : ∃ n p, Polynomial.map (of_step k n) p = f := by
     convert Ring.DirectLimit.Polynomial.exists_of f
   obtain ⟨n, p, rfl⟩ := this
-  rw [monic_map_iff] at hfm 
+  rw [monic_map_iff] at hfm
   have := hfm.irreducible_of_irreducible_map (of_step k n) p hfi
   obtain ⟨x, hx⟩ := to_step_succ.exists_root k hfm this
   refine' ⟨of_step k (n + 1) x, _⟩
Diff
@@ -170,9 +170,9 @@ theorem AdjoinMonic.algebraMap : algebraMap k (AdjoinMonic k) = (Ideal.Quotient.
 theorem AdjoinMonic.isIntegral (z : AdjoinMonic k) : IsIntegral k z :=
   let ⟨p, hp⟩ := Ideal.Quotient.mk_surjective z
   hp ▸
-    MvPolynomial.induction_on p (fun x => isIntegral_algebraMap) (fun p q => isIntegral_add)
+    MvPolynomial.induction_on p (fun x => isIntegral_algebraMap) (fun p q => IsIntegral.add)
       fun p f ih =>
-      @isIntegral_mul _ _ _ _ _ _ (Ideal.Quotient.mk _ _) ih
+      @IsIntegral.mul _ _ _ _ _ _ (Ideal.Quotient.mk _ _) ih
         ⟨f, f.2.1,
           by
           erw [adjoin_monic.algebra_map, ← hom_eval₂, Ideal.Quotient.eq_zero_iff_mem]
@@ -383,7 +383,7 @@ def ofStepHom (n) : Step k n →ₐ[k] AlgebraicClosureAux k :=
 theorem isAlgebraic : Algebra.IsAlgebraic k (AlgebraicClosureAux k) := fun z =>
   isAlgebraic_iff_isIntegral.2 <|
     let ⟨n, x, hx⟩ := exists_ofStep k z
-    hx ▸ map_isIntegral (ofStepHom k n) (Step.isIntegral k n x)
+    hx ▸ IsIntegral.map (ofStepHom k n) (Step.isIntegral k n x)
 #align algebraic_closure.is_algebraic AlgebraicClosure.isAlgebraic
 -/
 
Diff
@@ -3,10 +3,10 @@ Copyright (c) 2020 Kenny Lau. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Kenny Lau
 -/
-import Mathbin.Algebra.DirectLimit
-import Mathbin.Algebra.CharP.Algebra
-import Mathbin.FieldTheory.IsAlgClosed.Basic
-import Mathbin.FieldTheory.SplittingField.Construction
+import Algebra.DirectLimit
+import Algebra.CharP.Algebra
+import FieldTheory.IsAlgClosed.Basic
+import FieldTheory.SplittingField.Construction
 
 #align_import field_theory.is_alg_closed.algebraic_closure from "leanprover-community/mathlib"@"f2ad3645af9effcdb587637dc28a6074edc813f9"
 
Diff
@@ -42,7 +42,7 @@ open Polynomial
 
 variable (k : Type u) [Field k]
 
-namespace AlgebraicClosure
+namespace AlgebraicClosureAux
 
 open MvPolynomial
 
@@ -297,55 +297,53 @@ instance toStepOfLE.directedSystem : DirectedSystem (Step k) fun i j h => toStep
 #align algebraic_closure.to_step_of_le.directed_system AlgebraicClosure.toStepOfLE.directedSystem
 -/
 
-end AlgebraicClosure
+end AlgebraicClosureAux
 
-#print AlgebraicClosure /-
+#print AlgebraicClosureAux /-
 /-- The canonical algebraic closure of a field, the direct limit of adding roots to the field for
 each polynomial over the field. -/
-def AlgebraicClosure : Type u :=
+def AlgebraicClosureAux : Type u :=
   Ring.DirectLimit (AlgebraicClosure.Step k) fun i j h => AlgebraicClosure.toStepOfLE k i j h
-#align algebraic_closure AlgebraicClosure
+#align algebraic_closure AlgebraicClosureAux
 -/
 
-namespace AlgebraicClosure
+namespace AlgebraicClosureAux
 
-instance : Field (AlgebraicClosure k) :=
+instance : Field (AlgebraicClosureAux k) :=
   Field.DirectLimit.field _ _
 
-instance : Inhabited (AlgebraicClosure k) :=
+instance : Inhabited (AlgebraicClosureAux k) :=
   ⟨37⟩
 
-#print AlgebraicClosure.ofStep /-
+#print AlgebraicClosureAux.ofStep /-
 /-- The canonical ring embedding from the `n`th step to the algebraic closure. -/
-def ofStep (n : ℕ) : Step k n →+* AlgebraicClosure k :=
+def ofStep (n : ℕ) : Step k n →+* AlgebraicClosureAux k :=
   Ring.DirectLimit.of _ _ _
-#align algebraic_closure.of_step AlgebraicClosure.ofStep
+#align algebraic_closure.of_step AlgebraicClosureAux.ofStep
 -/
 
-#print AlgebraicClosure.algebraOfStep /-
-instance algebraOfStep (n) : Algebra (Step k n) (AlgebraicClosure k) :=
+instance algebraOfStep (n) : Algebra (Step k n) (AlgebraicClosureAux k) :=
   (ofStep k n).toAlgebra
-#align algebraic_closure.algebra_of_step AlgebraicClosure.algebraOfStep
--/
+#align algebraic_closure.algebra_of_step AlgebraicClosureAux.algebraOfStep
 
-#print AlgebraicClosure.ofStep_succ /-
+#print AlgebraicClosureAux.ofStep_succ /-
 theorem ofStep_succ (n : ℕ) : (ofStep k (n + 1)).comp (toStepSucc k n) = ofStep k n :=
   RingHom.ext fun x =>
     show Ring.DirectLimit.of (Step k) (fun i j h => toStepOfLE k i j h) _ _ = _ by
       convert Ring.DirectLimit.of_f n.le_succ x; ext x; exact (Nat.leRecOn_succ' x).symm
-#align algebraic_closure.of_step_succ AlgebraicClosure.ofStep_succ
+#align algebraic_closure.of_step_succ AlgebraicClosureAux.ofStep_succ
 -/
 
-#print AlgebraicClosure.exists_ofStep /-
-theorem exists_ofStep (z : AlgebraicClosure k) : ∃ n x, ofStep k n x = z :=
+#print AlgebraicClosureAux.exists_ofStep /-
+theorem exists_ofStep (z : AlgebraicClosureAux k) : ∃ n x, ofStep k n x = z :=
   Ring.DirectLimit.exists_of z
-#align algebraic_closure.exists_of_step AlgebraicClosure.exists_ofStep
+#align algebraic_closure.exists_of_step AlgebraicClosureAux.exists_ofStep
 -/
 
-#print AlgebraicClosure.exists_root /-
+#print AlgebraicClosureAux.exists_root /-
 -- slow
-theorem exists_root {f : Polynomial (AlgebraicClosure k)} (hfm : f.Monic) (hfi : Irreducible f) :
-    ∃ x : AlgebraicClosure k, f.eval x = 0 :=
+theorem exists_root {f : Polynomial (AlgebraicClosureAux k)} (hfm : f.Monic) (hfi : Irreducible f) :
+    ∃ x : AlgebraicClosureAux k, f.eval x = 0 :=
   by
   have : ∃ n p, Polynomial.map (of_step k n) p = f := by
     convert Ring.DirectLimit.Polynomial.exists_of f
@@ -355,44 +353,42 @@ theorem exists_root {f : Polynomial (AlgebraicClosure k)} (hfm : f.Monic) (hfi :
   obtain ⟨x, hx⟩ := to_step_succ.exists_root k hfm this
   refine' ⟨of_step k (n + 1) x, _⟩
   rw [← of_step_succ k n, eval_map, ← hom_eval₂, hx, RingHom.map_zero]
-#align algebraic_closure.exists_root AlgebraicClosure.exists_root
+#align algebraic_closure.exists_root AlgebraicClosureAux.exists_root
 -/
 
-instance : IsAlgClosed (AlgebraicClosure k) :=
+instance : IsAlgClosed (AlgebraicClosureAux k) :=
   IsAlgClosed.of_exists_root _ fun f => exists_root k
 
-instance {R : Type _} [CommSemiring R] [alg : Algebra R k] : Algebra R (AlgebraicClosure k) :=
+instance {R : Type _} [CommSemiring R] [alg : Algebra R k] : Algebra R (AlgebraicClosureAux k) :=
   ((ofStep k 0).comp (@algebraMap _ _ _ _ alg)).toAlgebra
 
-#print AlgebraicClosure.algebraMap_def /-
 theorem algebraMap_def {R : Type _} [CommSemiring R] [alg : Algebra R k] :
-    algebraMap R (AlgebraicClosure k) = (ofStep k 0 : k →+* _).comp (@algebraMap _ _ _ _ alg) :=
+    algebraMap R (AlgebraicClosureAux k) = (ofStep k 0 : k →+* _).comp (@algebraMap _ _ _ _ alg) :=
   rfl
-#align algebraic_closure.algebra_map_def AlgebraicClosure.algebraMap_def
--/
+#align algebraic_closure.algebra_map_def AlgebraicClosureAux.algebraMap_def
 
 instance {R S : Type _} [CommSemiring R] [CommSemiring S] [Algebra R S] [Algebra S k] [Algebra R k]
-    [IsScalarTower R S k] : IsScalarTower R S (AlgebraicClosure k) :=
+    [IsScalarTower R S k] : IsScalarTower R S (AlgebraicClosureAux k) :=
   IsScalarTower.of_algebraMap_eq fun x =>
     RingHom.congr_arg _ (IsScalarTower.algebraMap_apply R S k x : _)
 
-#print AlgebraicClosure.ofStepHom /-
+#print AlgebraicClosureAux.ofStepHom /-
 /-- Canonical algebra embedding from the `n`th step to the algebraic closure. -/
-def ofStepHom (n) : Step k n →ₐ[k] AlgebraicClosure k :=
+def ofStepHom (n) : Step k n →ₐ[k] AlgebraicClosureAux k :=
   { ofStep k n with commutes' := fun x => Ring.DirectLimit.of_f n.zero_le x }
-#align algebraic_closure.of_step_hom AlgebraicClosure.ofStepHom
+#align algebraic_closure.of_step_hom AlgebraicClosureAux.ofStepHom
 -/
 
 #print AlgebraicClosure.isAlgebraic /-
-theorem isAlgebraic : Algebra.IsAlgebraic k (AlgebraicClosure k) := fun z =>
+theorem isAlgebraic : Algebra.IsAlgebraic k (AlgebraicClosureAux k) := fun z =>
   isAlgebraic_iff_isIntegral.2 <|
     let ⟨n, x, hx⟩ := exists_ofStep k z
     hx ▸ map_isIntegral (ofStepHom k n) (Step.isIntegral k n x)
 #align algebraic_closure.is_algebraic AlgebraicClosure.isAlgebraic
 -/
 
-instance : IsAlgClosure k (AlgebraicClosure k) :=
-  ⟨AlgebraicClosure.instIsAlgClosed k, isAlgebraic k⟩
+instance : IsAlgClosure k (AlgebraicClosureAux k) :=
+  ⟨AlgebraicClosure.isAlgClosed k, isAlgebraic k⟩
 
-end AlgebraicClosure
+end AlgebraicClosureAux
 
Diff
@@ -2,17 +2,14 @@
 Copyright (c) 2020 Kenny Lau. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Kenny Lau
-
-! This file was ported from Lean 3 source module field_theory.is_alg_closed.algebraic_closure
-! leanprover-community/mathlib commit f2ad3645af9effcdb587637dc28a6074edc813f9
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Algebra.DirectLimit
 import Mathbin.Algebra.CharP.Algebra
 import Mathbin.FieldTheory.IsAlgClosed.Basic
 import Mathbin.FieldTheory.SplittingField.Construction
 
+#align_import field_theory.is_alg_closed.algebraic_closure from "leanprover-community/mathlib"@"f2ad3645af9effcdb587637dc28a6074edc813f9"
+
 /-!
 # Algebraic Closure
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Kenny Lau
 
 ! This file was ported from Lean 3 source module field_theory.is_alg_closed.algebraic_closure
-! leanprover-community/mathlib commit df76f43357840485b9d04ed5dee5ab115d420e87
+! leanprover-community/mathlib commit f2ad3645af9effcdb587637dc28a6074edc813f9
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -16,6 +16,9 @@ import Mathbin.FieldTheory.SplittingField.Construction
 /-!
 # Algebraic Closure
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 In this file we construct the algebraic closure of a field
 
 ## Main Definitions
Diff
@@ -46,23 +46,30 @@ namespace AlgebraicClosure
 
 open MvPolynomial
 
+#print AlgebraicClosure.MonicIrreducible /-
 /-- The subtype of monic irreducible polynomials -/
 @[reducible]
 def MonicIrreducible : Type u :=
   { f : k[X] // Monic f ∧ Irreducible f }
 #align algebraic_closure.monic_irreducible AlgebraicClosure.MonicIrreducible
+-/
 
+#print AlgebraicClosure.evalXSelf /-
 /-- Sends a monic irreducible polynomial `f` to `f(x_f)` where `x_f` is a formal indeterminate. -/
 def evalXSelf (f : MonicIrreducible k) : MvPolynomial (MonicIrreducible k) k :=
   Polynomial.eval₂ MvPolynomial.C (X f) f
 #align algebraic_closure.eval_X_self AlgebraicClosure.evalXSelf
+-/
 
+#print AlgebraicClosure.spanEval /-
 /-- The span of `f(x_f)` across monic irreducible polynomials `f` where `x_f` is an
 indeterminate. -/
 def spanEval : Ideal (MvPolynomial (MonicIrreducible k) k) :=
   Ideal.span <| Set.range <| evalXSelf k
 #align algebraic_closure.span_eval AlgebraicClosure.spanEval
+-/
 
+#print AlgebraicClosure.toSplittingField /-
 /-- Given a finset of monic irreducible polynomials, construct an algebra homomorphism to the
 splitting field of the product of the polynomials sending each indeterminate `x_f` represented by
 the polynomial `f` in the finset to a root of `f`. -/
@@ -76,7 +83,9 @@ def toSplittingField (s : Finset (MonicIrreducible k)) :
         (mt isUnit_iff_degree_eq_zero.2 f.2.2.not_unit)
     else 37
 #align algebraic_closure.to_splitting_field AlgebraicClosure.toSplittingField
+-/
 
+#print AlgebraicClosure.toSplittingField_evalXSelf /-
 theorem toSplittingField_evalXSelf {s : Finset (MonicIrreducible k)} {f} (hf : f ∈ s) :
     toSplittingField k s (evalXSelf k f) = 0 :=
   by
@@ -84,7 +93,9 @@ theorem toSplittingField_evalXSelf {s : Finset (MonicIrreducible k)} {f} (hf : f
     MvPolynomial.aeval_X, dif_pos hf, ← algebra_map_eq, AlgHom.comp_algebraMap]
   exact map_root_of_splits _ _ _
 #align algebraic_closure.to_splitting_field_eval_X_self AlgebraicClosure.toSplittingField_evalXSelf
+-/
 
+#print AlgebraicClosure.spanEval_ne_top /-
 theorem spanEval_ne_top : spanEval k ≠ ⊤ :=
   by
   rw [Ideal.ne_top_iff_one, span_eval, Ideal.span, ← Set.image_univ,
@@ -96,46 +107,66 @@ theorem spanEval_ne_top : spanEval k ≠ ⊤ :=
   intro j hj
   rw [smul_eq_mul, AlgHom.map_mul, to_splitting_field_eval_X_self k hj, MulZeroClass.mul_zero]
 #align algebraic_closure.span_eval_ne_top AlgebraicClosure.spanEval_ne_top
+-/
 
+#print AlgebraicClosure.maxIdeal /-
 /-- A random maximal ideal that contains `span_eval k` -/
 def maxIdeal : Ideal (MvPolynomial (MonicIrreducible k) k) :=
   Classical.choose <| Ideal.exists_le_maximal _ <| spanEval_ne_top k
 #align algebraic_closure.max_ideal AlgebraicClosure.maxIdeal
+-/
 
+#print AlgebraicClosure.maxIdeal.isMaximal /-
 instance maxIdeal.isMaximal : (maxIdeal k).IsMaximal :=
   (Classical.choose_spec <| Ideal.exists_le_maximal _ <| spanEval_ne_top k).1
 #align algebraic_closure.max_ideal.is_maximal AlgebraicClosure.maxIdeal.isMaximal
+-/
 
+#print AlgebraicClosure.le_maxIdeal /-
 theorem le_maxIdeal : spanEval k ≤ maxIdeal k :=
   (Classical.choose_spec <| Ideal.exists_le_maximal _ <| spanEval_ne_top k).2
 #align algebraic_closure.le_max_ideal AlgebraicClosure.le_maxIdeal
+-/
 
+#print AlgebraicClosure.AdjoinMonic /-
 /-- The first step of constructing `algebraic_closure`: adjoin a root of all monic polynomials -/
 def AdjoinMonic : Type u :=
   MvPolynomial (MonicIrreducible k) k ⧸ maxIdeal k
 #align algebraic_closure.adjoin_monic AlgebraicClosure.AdjoinMonic
+-/
 
+#print AlgebraicClosure.AdjoinMonic.field /-
 instance AdjoinMonic.field : Field (AdjoinMonic k) :=
   Ideal.Quotient.field _
 #align algebraic_closure.adjoin_monic.field AlgebraicClosure.AdjoinMonic.field
+-/
 
+#print AlgebraicClosure.AdjoinMonic.inhabited /-
 instance AdjoinMonic.inhabited : Inhabited (AdjoinMonic k) :=
   ⟨37⟩
 #align algebraic_closure.adjoin_monic.inhabited AlgebraicClosure.AdjoinMonic.inhabited
+-/
 
+#print AlgebraicClosure.toAdjoinMonic /-
 /-- The canonical ring homomorphism to `adjoin_monic k`. -/
 def toAdjoinMonic : k →+* AdjoinMonic k :=
   (Ideal.Quotient.mk _).comp C
 #align algebraic_closure.to_adjoin_monic AlgebraicClosure.toAdjoinMonic
+-/
 
+#print AlgebraicClosure.AdjoinMonic.algebra /-
 instance AdjoinMonic.algebra : Algebra k (AdjoinMonic k) :=
   (toAdjoinMonic k).toAlgebra
 #align algebraic_closure.adjoin_monic.algebra AlgebraicClosure.AdjoinMonic.algebra
+-/
 
+#print AlgebraicClosure.AdjoinMonic.algebraMap /-
 theorem AdjoinMonic.algebraMap : algebraMap k (AdjoinMonic k) = (Ideal.Quotient.mk _).comp C :=
   rfl
 #align algebraic_closure.adjoin_monic.algebra_map AlgebraicClosure.AdjoinMonic.algebraMap
+-/
 
+#print AlgebraicClosure.AdjoinMonic.isIntegral /-
 theorem AdjoinMonic.isIntegral (z : AdjoinMonic k) : IsIntegral k z :=
   let ⟨p, hp⟩ := Ideal.Quotient.mk_surjective z
   hp ▸
@@ -147,7 +178,9 @@ theorem AdjoinMonic.isIntegral (z : AdjoinMonic k) : IsIntegral k z :=
           erw [adjoin_monic.algebra_map, ← hom_eval₂, Ideal.Quotient.eq_zero_iff_mem]
           exact le_max_ideal k (Ideal.subset_span ⟨f, rfl⟩)⟩
 #align algebraic_closure.adjoin_monic.is_integral AlgebraicClosure.AdjoinMonic.isIntegral
+-/
 
+#print AlgebraicClosure.AdjoinMonic.exists_root /-
 theorem AdjoinMonic.exists_root {f : k[X]} (hfm : f.Monic) (hfi : Irreducible f) :
     ∃ x : AdjoinMonic k, f.eval₂ (toAdjoinMonic k) x = 0 :=
   ⟨Ideal.Quotient.mk _ <| X (⟨f, hfm, hfi⟩ : MonicIrreducible k),
@@ -155,46 +188,64 @@ theorem AdjoinMonic.exists_root {f : k[X]} (hfm : f.Monic) (hfi : Irreducible f)
     rw [to_adjoin_monic, ← hom_eval₂, Ideal.Quotient.eq_zero_iff_mem]
     exact le_max_ideal k (Ideal.subset_span <| ⟨_, rfl⟩)⟩
 #align algebraic_closure.adjoin_monic.exists_root AlgebraicClosure.AdjoinMonic.exists_root
+-/
 
+#print AlgebraicClosure.stepAux /-
 /-- The `n`th step of constructing `algebraic_closure`, together with its `field` instance. -/
 def stepAux (n : ℕ) : Σ α : Type u, Field α :=
   Nat.recOn n ⟨k, inferInstance⟩ fun n ih => ⟨@AdjoinMonic ih.1 ih.2, @AdjoinMonic.field ih.1 ih.2⟩
 #align algebraic_closure.step_aux AlgebraicClosure.stepAux
+-/
 
+#print AlgebraicClosure.Step /-
 /-- The `n`th step of constructing `algebraic_closure`. -/
 def Step (n : ℕ) : Type u :=
   (stepAux k n).1
 #align algebraic_closure.step AlgebraicClosure.Step
+-/
 
+#print AlgebraicClosure.Step.field /-
 instance Step.field (n : ℕ) : Field (Step k n) :=
   (stepAux k n).2
 #align algebraic_closure.step.field AlgebraicClosure.Step.field
+-/
 
+#print AlgebraicClosure.Step.inhabited /-
 instance Step.inhabited (n) : Inhabited (Step k n) :=
   ⟨37⟩
 #align algebraic_closure.step.inhabited AlgebraicClosure.Step.inhabited
+-/
 
+#print AlgebraicClosure.toStepZero /-
 /-- The canonical inclusion to the `0`th step. -/
 def toStepZero : k →+* Step k 0 :=
   RingHom.id k
 #align algebraic_closure.to_step_zero AlgebraicClosure.toStepZero
+-/
 
+#print AlgebraicClosure.toStepSucc /-
 /-- The canonical ring homomorphism to the next step. -/
 def toStepSucc (n : ℕ) : Step k n →+* Step k (n + 1) :=
   @toAdjoinMonic (Step k n) (Step.field k n)
 #align algebraic_closure.to_step_succ AlgebraicClosure.toStepSucc
+-/
 
+#print AlgebraicClosure.Step.algebraSucc /-
 instance Step.algebraSucc (n) : Algebra (Step k n) (Step k (n + 1)) :=
   (toStepSucc k n).toAlgebra
 #align algebraic_closure.step.algebra_succ AlgebraicClosure.Step.algebraSucc
+-/
 
+#print AlgebraicClosure.toStepSucc.exists_root /-
 theorem toStepSucc.exists_root {n} {f : Polynomial (Step k n)} (hfm : f.Monic)
     (hfi : Irreducible f) : ∃ x : Step k (n + 1), f.eval₂ (toStepSucc k n) x = 0 :=
   @AdjoinMonic.exists_root _ (Step.field k n) _ hfm hfi
 #align algebraic_closure.to_step_succ.exists_root AlgebraicClosure.toStepSucc.exists_root
+-/
 
+#print AlgebraicClosure.toStepOfLE /-
 /-- The canonical ring homomorphism to a step with a greater index. -/
-def toStepOfLe (m n : ℕ) (h : m ≤ n) : Step k m →+* Step k n
+def toStepOfLE (m n : ℕ) (h : m ≤ n) : Step k m →+* Step k n
     where
   toFun := Nat.leRecOn h fun n => toStepSucc k n
   map_one' := by
@@ -209,39 +260,52 @@ def toStepOfLe (m n : ℕ) (h : m ≤ n) : Step k m →+* Step k n
   map_add' x y := by
     induction' h with n h ih; · simp_rw [Nat.leRecOn_self]
     simp_rw [Nat.leRecOn_succ h, ih, RingHom.map_add]
-#align algebraic_closure.to_step_of_le AlgebraicClosure.toStepOfLe
+#align algebraic_closure.to_step_of_le AlgebraicClosure.toStepOfLE
+-/
 
+#print AlgebraicClosure.coe_toStepOfLE /-
 @[simp]
-theorem coe_toStepOfLe (m n : ℕ) (h : m ≤ n) :
-    (toStepOfLe k m n h : Step k m → Step k n) = Nat.leRecOn h fun n => toStepSucc k n :=
+theorem coe_toStepOfLE (m n : ℕ) (h : m ≤ n) :
+    (toStepOfLE k m n h : Step k m → Step k n) = Nat.leRecOn h fun n => toStepSucc k n :=
   rfl
-#align algebraic_closure.coe_to_step_of_le AlgebraicClosure.coe_toStepOfLe
+#align algebraic_closure.coe_to_step_of_le AlgebraicClosure.coe_toStepOfLE
+-/
 
+#print AlgebraicClosure.Step.algebra /-
 instance Step.algebra (n) : Algebra k (Step k n) :=
-  (toStepOfLe k 0 n n.zero_le).toAlgebra
+  (toStepOfLE k 0 n n.zero_le).toAlgebra
 #align algebraic_closure.step.algebra AlgebraicClosure.Step.algebra
+-/
 
+#print AlgebraicClosure.Step.scalar_tower /-
 instance Step.scalar_tower (n) : IsScalarTower k (Step k n) (Step k (n + 1)) :=
   IsScalarTower.of_algebraMap_eq fun z =>
     @Nat.leRecOn_succ (Step k) 0 n n.zero_le (n + 1).zero_le (fun n => toStepSucc k n) z
 #align algebraic_closure.step.scalar_tower AlgebraicClosure.Step.scalar_tower
+-/
 
+#print AlgebraicClosure.Step.isIntegral /-
 theorem Step.isIntegral (n) : ∀ z : Step k n, IsIntegral k z :=
   Nat.recOn n (fun z => isIntegral_algebraMap) fun n ih z =>
     isIntegral_trans ih _ (AdjoinMonic.isIntegral (Step k n) z : _)
 #align algebraic_closure.step.is_integral AlgebraicClosure.Step.isIntegral
+-/
 
-instance toStepOfLe.directedSystem : DirectedSystem (Step k) fun i j h => toStepOfLe k i j h :=
+#print AlgebraicClosure.toStepOfLE.directedSystem /-
+instance toStepOfLE.directedSystem : DirectedSystem (Step k) fun i j h => toStepOfLE k i j h :=
   ⟨fun i x h => Nat.leRecOn_self x, fun i₁ i₂ i₃ h₁₂ h₂₃ x => (Nat.leRecOn_trans h₁₂ h₂₃ x).symm⟩
-#align algebraic_closure.to_step_of_le.directed_system AlgebraicClosure.toStepOfLe.directedSystem
+#align algebraic_closure.to_step_of_le.directed_system AlgebraicClosure.toStepOfLE.directedSystem
+-/
 
 end AlgebraicClosure
 
+#print AlgebraicClosure /-
 /-- The canonical algebraic closure of a field, the direct limit of adding roots to the field for
 each polynomial over the field. -/
 def AlgebraicClosure : Type u :=
-  Ring.DirectLimit (AlgebraicClosure.Step k) fun i j h => AlgebraicClosure.toStepOfLe k i j h
+  Ring.DirectLimit (AlgebraicClosure.Step k) fun i j h => AlgebraicClosure.toStepOfLE k i j h
 #align algebraic_closure AlgebraicClosure
+-/
 
 namespace AlgebraicClosure
 
@@ -251,25 +315,34 @@ instance : Field (AlgebraicClosure k) :=
 instance : Inhabited (AlgebraicClosure k) :=
   ⟨37⟩
 
+#print AlgebraicClosure.ofStep /-
 /-- The canonical ring embedding from the `n`th step to the algebraic closure. -/
 def ofStep (n : ℕ) : Step k n →+* AlgebraicClosure k :=
   Ring.DirectLimit.of _ _ _
 #align algebraic_closure.of_step AlgebraicClosure.ofStep
+-/
 
+#print AlgebraicClosure.algebraOfStep /-
 instance algebraOfStep (n) : Algebra (Step k n) (AlgebraicClosure k) :=
   (ofStep k n).toAlgebra
 #align algebraic_closure.algebra_of_step AlgebraicClosure.algebraOfStep
+-/
 
+#print AlgebraicClosure.ofStep_succ /-
 theorem ofStep_succ (n : ℕ) : (ofStep k (n + 1)).comp (toStepSucc k n) = ofStep k n :=
   RingHom.ext fun x =>
-    show Ring.DirectLimit.of (Step k) (fun i j h => toStepOfLe k i j h) _ _ = _ by
+    show Ring.DirectLimit.of (Step k) (fun i j h => toStepOfLE k i j h) _ _ = _ by
       convert Ring.DirectLimit.of_f n.le_succ x; ext x; exact (Nat.leRecOn_succ' x).symm
 #align algebraic_closure.of_step_succ AlgebraicClosure.ofStep_succ
+-/
 
+#print AlgebraicClosure.exists_ofStep /-
 theorem exists_ofStep (z : AlgebraicClosure k) : ∃ n x, ofStep k n x = z :=
   Ring.DirectLimit.exists_of z
 #align algebraic_closure.exists_of_step AlgebraicClosure.exists_ofStep
+-/
 
+#print AlgebraicClosure.exists_root /-
 -- slow
 theorem exists_root {f : Polynomial (AlgebraicClosure k)} (hfm : f.Monic) (hfi : Irreducible f) :
     ∃ x : AlgebraicClosure k, f.eval x = 0 :=
@@ -283,6 +356,7 @@ theorem exists_root {f : Polynomial (AlgebraicClosure k)} (hfm : f.Monic) (hfi :
   refine' ⟨of_step k (n + 1) x, _⟩
   rw [← of_step_succ k n, eval_map, ← hom_eval₂, hx, RingHom.map_zero]
 #align algebraic_closure.exists_root AlgebraicClosure.exists_root
+-/
 
 instance : IsAlgClosed (AlgebraicClosure k) :=
   IsAlgClosed.of_exists_root _ fun f => exists_root k
@@ -290,29 +364,35 @@ instance : IsAlgClosed (AlgebraicClosure k) :=
 instance {R : Type _} [CommSemiring R] [alg : Algebra R k] : Algebra R (AlgebraicClosure k) :=
   ((ofStep k 0).comp (@algebraMap _ _ _ _ alg)).toAlgebra
 
+#print AlgebraicClosure.algebraMap_def /-
 theorem algebraMap_def {R : Type _} [CommSemiring R] [alg : Algebra R k] :
     algebraMap R (AlgebraicClosure k) = (ofStep k 0 : k →+* _).comp (@algebraMap _ _ _ _ alg) :=
   rfl
 #align algebraic_closure.algebra_map_def AlgebraicClosure.algebraMap_def
+-/
 
 instance {R S : Type _} [CommSemiring R] [CommSemiring S] [Algebra R S] [Algebra S k] [Algebra R k]
     [IsScalarTower R S k] : IsScalarTower R S (AlgebraicClosure k) :=
   IsScalarTower.of_algebraMap_eq fun x =>
     RingHom.congr_arg _ (IsScalarTower.algebraMap_apply R S k x : _)
 
+#print AlgebraicClosure.ofStepHom /-
 /-- Canonical algebra embedding from the `n`th step to the algebraic closure. -/
 def ofStepHom (n) : Step k n →ₐ[k] AlgebraicClosure k :=
   { ofStep k n with commutes' := fun x => Ring.DirectLimit.of_f n.zero_le x }
 #align algebraic_closure.of_step_hom AlgebraicClosure.ofStepHom
+-/
 
+#print AlgebraicClosure.isAlgebraic /-
 theorem isAlgebraic : Algebra.IsAlgebraic k (AlgebraicClosure k) := fun z =>
   isAlgebraic_iff_isIntegral.2 <|
     let ⟨n, x, hx⟩ := exists_ofStep k z
     hx ▸ map_isIntegral (ofStepHom k n) (Step.isIntegral k n x)
 #align algebraic_closure.is_algebraic AlgebraicClosure.isAlgebraic
+-/
 
 instance : IsAlgClosure k (AlgebraicClosure k) :=
-  ⟨AlgebraicClosure.isAlgClosed k, isAlgebraic k⟩
+  ⟨AlgebraicClosure.instIsAlgClosed k, isAlgebraic k⟩
 
 end AlgebraicClosure
 
Diff
@@ -4,13 +4,14 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Kenny Lau
 
 ! This file was ported from Lean 3 source module field_theory.is_alg_closed.algebraic_closure
-! leanprover-community/mathlib commit 00f91228655eecdcd3ac97a7fd8dbcb139fe990a
+! leanprover-community/mathlib commit df76f43357840485b9d04ed5dee5ab115d420e87
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
 import Mathbin.Algebra.DirectLimit
 import Mathbin.Algebra.CharP.Algebra
 import Mathbin.FieldTheory.IsAlgClosed.Basic
+import Mathbin.FieldTheory.SplittingField.Construction
 
 /-!
 # Algebraic Closure
Diff
@@ -90,7 +90,7 @@ theorem spanEval_ne_top : spanEval k ≠ ⊤ :=
     Finsupp.mem_span_image_iff_total]
   rintro ⟨v, _, hv⟩
   replace hv := congr_arg (to_splitting_field k v.support) hv
-  rw [AlgHom.map_one, Finsupp.total_apply, Finsupp.sum, AlgHom.map_sum, Finset.sum_eq_zero] at hv
+  rw [AlgHom.map_one, Finsupp.total_apply, Finsupp.sum, AlgHom.map_sum, Finset.sum_eq_zero] at hv 
   · exact zero_ne_one hv
   intro j hj
   rw [smul_eq_mul, AlgHom.map_mul, to_splitting_field_eval_X_self k hj, MulZeroClass.mul_zero]
@@ -156,7 +156,7 @@ theorem AdjoinMonic.exists_root {f : k[X]} (hfm : f.Monic) (hfi : Irreducible f)
 #align algebraic_closure.adjoin_monic.exists_root AlgebraicClosure.AdjoinMonic.exists_root
 
 /-- The `n`th step of constructing `algebraic_closure`, together with its `field` instance. -/
-def stepAux (n : ℕ) : Σα : Type u, Field α :=
+def stepAux (n : ℕ) : Σ α : Type u, Field α :=
   Nat.recOn n ⟨k, inferInstance⟩ fun n ih => ⟨@AdjoinMonic ih.1 ih.2, @AdjoinMonic.field ih.1 ih.2⟩
 #align algebraic_closure.step_aux AlgebraicClosure.stepAux
 
@@ -276,7 +276,7 @@ theorem exists_root {f : Polynomial (AlgebraicClosure k)} (hfm : f.Monic) (hfi :
   have : ∃ n p, Polynomial.map (of_step k n) p = f := by
     convert Ring.DirectLimit.Polynomial.exists_of f
   obtain ⟨n, p, rfl⟩ := this
-  rw [monic_map_iff] at hfm
+  rw [monic_map_iff] at hfm 
   have := hfm.irreducible_of_irreducible_map (of_step k n) p hfi
   obtain ⟨x, hx⟩ := to_step_succ.exists_root k hfm this
   refine' ⟨of_step k (n + 1) x, _⟩
Diff
@@ -35,7 +35,7 @@ universe u v w
 
 noncomputable section
 
-open Classical BigOperators Polynomial
+open scoped Classical BigOperators Polynomial
 
 open Polynomial
 
Diff
@@ -261,11 +261,8 @@ instance algebraOfStep (n) : Algebra (Step k n) (AlgebraicClosure k) :=
 
 theorem ofStep_succ (n : ℕ) : (ofStep k (n + 1)).comp (toStepSucc k n) = ofStep k n :=
   RingHom.ext fun x =>
-    show Ring.DirectLimit.of (Step k) (fun i j h => toStepOfLe k i j h) _ _ = _
-      by
-      convert Ring.DirectLimit.of_f n.le_succ x
-      ext x
-      exact (Nat.leRecOn_succ' x).symm
+    show Ring.DirectLimit.of (Step k) (fun i j h => toStepOfLe k i j h) _ _ = _ by
+      convert Ring.DirectLimit.of_f n.le_succ x; ext x; exact (Nat.leRecOn_succ' x).symm
 #align algebraic_closure.of_step_succ AlgebraicClosure.ofStep_succ
 
 theorem exists_ofStep (z : AlgebraicClosure k) : ∃ n x, ofStep k n x = z :=
Diff
@@ -4,11 +4,12 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Kenny Lau
 
 ! This file was ported from Lean 3 source module field_theory.is_alg_closed.algebraic_closure
-! leanprover-community/mathlib commit 0ac3057eb6231d2c8dfcd46767cf4a166961c0f1
+! leanprover-community/mathlib commit 00f91228655eecdcd3ac97a7fd8dbcb139fe990a
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
 import Mathbin.Algebra.DirectLimit
+import Mathbin.Algebra.CharP.Algebra
 import Mathbin.FieldTheory.IsAlgClosed.Basic
 
 /-!
Diff
@@ -4,13 +4,12 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Kenny Lau
 
 ! This file was ported from Lean 3 source module field_theory.is_alg_closed.algebraic_closure
-! leanprover-community/mathlib commit 6a5a6494968741677358457a806f487c7e293d39
+! leanprover-community/mathlib commit 0ac3057eb6231d2c8dfcd46767cf4a166961c0f1
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
 import Mathbin.Algebra.DirectLimit
 import Mathbin.FieldTheory.IsAlgClosed.Basic
-import Mathbin.FieldTheory.SplittingField
 
 /-!
 # Algebraic Closure
Diff
@@ -53,7 +53,7 @@ def MonicIrreducible : Type u :=
 
 /-- Sends a monic irreducible polynomial `f` to `f(x_f)` where `x_f` is a formal indeterminate. -/
 def evalXSelf (f : MonicIrreducible k) : MvPolynomial (MonicIrreducible k) k :=
-  Polynomial.eval₂ MvPolynomial.c (x f) f
+  Polynomial.eval₂ MvPolynomial.C (X f) f
 #align algebraic_closure.eval_X_self AlgebraicClosure.evalXSelf
 
 /-- The span of `f(x_f)` across monic irreducible polynomials `f` where `x_f` is an
@@ -80,7 +80,7 @@ theorem toSplittingField_evalXSelf {s : Finset (MonicIrreducible k)} {f} (hf : f
     toSplittingField k s (evalXSelf k f) = 0 :=
   by
   rw [to_splitting_field, eval_X_self, ← AlgHom.coe_toRingHom, hom_eval₂, AlgHom.coe_toRingHom,
-    MvPolynomial.aeval_x, dif_pos hf, ← algebra_map_eq, AlgHom.comp_algebraMap]
+    MvPolynomial.aeval_X, dif_pos hf, ← algebra_map_eq, AlgHom.comp_algebraMap]
   exact map_root_of_splits _ _ _
 #align algebraic_closure.to_splitting_field_eval_X_self AlgebraicClosure.toSplittingField_evalXSelf
 
@@ -124,14 +124,14 @@ instance AdjoinMonic.inhabited : Inhabited (AdjoinMonic k) :=
 
 /-- The canonical ring homomorphism to `adjoin_monic k`. -/
 def toAdjoinMonic : k →+* AdjoinMonic k :=
-  (Ideal.Quotient.mk _).comp c
+  (Ideal.Quotient.mk _).comp C
 #align algebraic_closure.to_adjoin_monic AlgebraicClosure.toAdjoinMonic
 
 instance AdjoinMonic.algebra : Algebra k (AdjoinMonic k) :=
   (toAdjoinMonic k).toAlgebra
 #align algebraic_closure.adjoin_monic.algebra AlgebraicClosure.AdjoinMonic.algebra
 
-theorem AdjoinMonic.algebraMap : algebraMap k (AdjoinMonic k) = (Ideal.Quotient.mk _).comp c :=
+theorem AdjoinMonic.algebraMap : algebraMap k (AdjoinMonic k) = (Ideal.Quotient.mk _).comp C :=
   rfl
 #align algebraic_closure.adjoin_monic.algebra_map AlgebraicClosure.AdjoinMonic.algebraMap
 
@@ -149,7 +149,7 @@ theorem AdjoinMonic.isIntegral (z : AdjoinMonic k) : IsIntegral k z :=
 
 theorem AdjoinMonic.exists_root {f : k[X]} (hfm : f.Monic) (hfi : Irreducible f) :
     ∃ x : AdjoinMonic k, f.eval₂ (toAdjoinMonic k) x = 0 :=
-  ⟨Ideal.Quotient.mk _ <| x (⟨f, hfm, hfi⟩ : MonicIrreducible k),
+  ⟨Ideal.Quotient.mk _ <| X (⟨f, hfm, hfi⟩ : MonicIrreducible k),
     by
     rw [to_adjoin_monic, ← hom_eval₂, Ideal.Quotient.eq_zero_iff_mem]
     exact le_max_ideal k (Ideal.subset_span <| ⟨_, rfl⟩)⟩
Diff
@@ -93,7 +93,7 @@ theorem spanEval_ne_top : spanEval k ≠ ⊤ :=
   rw [AlgHom.map_one, Finsupp.total_apply, Finsupp.sum, AlgHom.map_sum, Finset.sum_eq_zero] at hv
   · exact zero_ne_one hv
   intro j hj
-  rw [smul_eq_mul, AlgHom.map_mul, to_splitting_field_eval_X_self k hj, mul_zero]
+  rw [smul_eq_mul, AlgHom.map_mul, to_splitting_field_eval_X_self k hj, MulZeroClass.mul_zero]
 #align algebraic_closure.span_eval_ne_top AlgebraicClosure.spanEval_ne_top
 
 /-- A random maximal ideal that contains `span_eval k` -/

Changes in mathlib4

mathlib3
mathlib4
feat: {Mv}Polynomial.algebraMap_apply simps (#11193)
  • Adds lemma Polynomial.algebraMap_eq analogous to MvPolynomial.algebraMap_eq
    • Adds some namespace disambiguations in various places to make this possible
  • Adds simp to these, and the related {Mv}Polynomial.algebraMap_apply lemmas.
    • Removes simp tag from later lemmas which linter says these additions now allow to be simp-proved

Co-authored-by: Floris van Doorn <fpvdoorn@gmail.com>

Diff
@@ -78,7 +78,7 @@ def toSplittingField (s : Finset (MonicIrreducible k)) :
 theorem toSplittingField_evalXSelf {s : Finset (MonicIrreducible k)} {f} (hf : f ∈ s) :
     toSplittingField k s (evalXSelf k f) = 0 := by
   rw [toSplittingField, evalXSelf, ← AlgHom.coe_toRingHom, hom_eval₂, AlgHom.coe_toRingHom,
-    MvPolynomial.aeval_X, dif_pos hf, ← algebraMap_eq, AlgHom.comp_algebraMap]
+    MvPolynomial.aeval_X, dif_pos hf, ← MvPolynomial.algebraMap_eq, AlgHom.comp_algebraMap]
   exact map_rootOfSplits _ _ _
 set_option linter.uppercaseLean3 false in
 #align algebraic_closure.to_splitting_field_eval_X_self AlgebraicClosure.toSplittingField_evalXSelf
feat: NNRat.cast (#11203)

Define the canonical coercion from the nonnegative rationals to any division semiring.

From LeanAPAP

Diff
@@ -433,10 +433,15 @@ instance instGroupWithZero : GroupWithZero (AlgebraicClosure k) :=
 instance instField : Field (AlgebraicClosure k) where
   __ := instCommRing _
   __ := instGroupWithZero _
-  ratCast q := algebraMap k _ q
+  nnqsmul := (· • ·)
   qsmul := (· • ·)
+  nnratCast q := algebraMap k _ q
+  ratCast q := algebraMap k _ q
+  nnratCast_def q := by change algebraMap k _ _ = _; simp_rw [NNRat.cast_def, map_div₀, map_natCast]
   ratCast_def q := by
     change algebraMap k _ _ = _; rw [Rat.cast_def, map_div₀, map_intCast, map_natCast]
+  nnqsmul_def q x := Quotient.inductionOn x fun p ↦ congr_arg Quotient.mk'' $ by
+    ext; simp [MvPolynomial.algebraMap_eq, NNRat.smul_def]
   qsmul_def q x := Quotient.inductionOn x fun p ↦ congr_arg Quotient.mk'' $ by
     ext; simp [MvPolynomial.algebraMap_eq, Rat.smul_def]
 
chore: Final cleanup before NNRat.cast (#12360)

This is the parts of the diff of #11203 which don't mention NNRat.cast.

  • Use more where notation.
  • Write qsmul := _ instead of qsmul := qsmulRec _ to make the instances more robust to definition changes.
  • Delete qsmulRec.
  • Move qsmul before ratCast_def in instance declarations.
  • Name more instances.
  • Rename rat_smul to qsmul.
Diff
@@ -434,9 +434,9 @@ instance instField : Field (AlgebraicClosure k) where
   __ := instCommRing _
   __ := instGroupWithZero _
   ratCast q := algebraMap k _ q
+  qsmul := (· • ·)
   ratCast_def q := by
     change algebraMap k _ _ = _; rw [Rat.cast_def, map_div₀, map_intCast, map_natCast]
-  qsmul := (· • ·)
   qsmul_def q x := Quotient.inductionOn x fun p ↦ congr_arg Quotient.mk'' $ by
     ext; simp [MvPolynomial.algebraMap_eq, Rat.smul_def]
 
refactor: Avoid Rat internals in the definition of Field (#11639)

Soon, there will be NNRat analogs of the Rat fields in the definition of Field. NNRat is less nicely a structure than Rat, hence there is a need to reduce the dependency of Field on the internals of Rat.

This PR achieves this by restating Field.ratCast_mk' in terms of Rat.num, Rat.den. This requires fixing a few downstream instances.

Reduce the diff of #11203.

Co-authored-by: Floris van Doorn <fpvdoorn@gmail.com>

Diff
@@ -401,11 +401,8 @@ def AlgebraicClosure : Type u :=
 
 namespace AlgebraicClosure
 
-instance commRing : CommRing (AlgebraicClosure k) :=
-  Ideal.Quotient.commRing _
-
-instance inhabited : Inhabited (AlgebraicClosure k) :=
-  ⟨37⟩
+instance instCommRing : CommRing (AlgebraicClosure k) := Ideal.Quotient.commRing _
+instance instInhabited : Inhabited (AlgebraicClosure k) := ⟨37⟩
 
 instance {S : Type*} [DistribSMul S k] [IsScalarTower S k k] : SMul S (AlgebraicClosure k) :=
   Submodule.Quotient.instSMul' _
@@ -425,28 +422,23 @@ def algEquivAlgebraicClosureAux :
   exact Ideal.quotientKerAlgEquivOfSurjective
     (fun x => ⟨MvPolynomial.X x, by simp⟩)
 
--- This instance is basically copied from the `Field` instance on `SplittingField`
-instance : Field (AlgebraicClosure k) :=
-  letI e := algEquivAlgebraicClosureAux k
-  { toCommRing := AlgebraicClosure.commRing k
-    ratCast := fun a => algebraMap k _ (a : k)
-    inv := fun a => e.symm (e a)⁻¹
-    qsmul := (· • ·)
-    qsmul_eq_mul' := fun a x =>
-      Quotient.inductionOn x (fun p => congr_arg Quotient.mk''
-        (by ext; simp [MvPolynomial.algebraMap_eq, Rat.smul_def]))
-    ratCast_mk := fun a b h1 h2 => by
-      apply_fun e
-      change e (algebraMap k _ _) = _
-      simp only [map_ratCast, map_natCast, map_mul, map_intCast, AlgEquiv.commutes,
-        AlgEquiv.apply_symm_apply]
-      apply Field.ratCast_mk
-    exists_pair_ne := ⟨e.symm 0, e.symm 1, fun w => zero_ne_one ((e.symm).injective w)⟩
-    mul_inv_cancel := fun a w => by
-      apply_fun e
-      simp_rw [map_mul, e.apply_symm_apply, map_one]
-      exact mul_inv_cancel ((AddEquivClass.map_ne_zero_iff e).mpr w)
-    inv_zero := by simp }
+-- Those two instances are copy-pasta from the analogous instances for `SplittingField`
+instance instGroupWithZero : GroupWithZero (AlgebraicClosure k) :=
+  let e := algEquivAlgebraicClosureAux k
+  { inv := fun a ↦ e.symm (e a)⁻¹
+    inv_zero := by simp
+    mul_inv_cancel := fun a ha ↦ e.injective $ by simp [(AddEquivClass.map_ne_zero_iff _).2 ha]
+    __ := e.surjective.nontrivial }
+
+instance instField : Field (AlgebraicClosure k) where
+  __ := instCommRing _
+  __ := instGroupWithZero _
+  ratCast q := algebraMap k _ q
+  ratCast_def q := by
+    change algebraMap k _ _ = _; rw [Rat.cast_def, map_div₀, map_intCast, map_natCast]
+  qsmul := (· • ·)
+  qsmul_def q x := Quotient.inductionOn x fun p ↦ congr_arg Quotient.mk'' $ by
+    ext; simp [MvPolynomial.algebraMap_eq, Rat.smul_def]
 
 instance isAlgClosed : IsAlgClosed (AlgebraicClosure k) :=
   IsAlgClosed.of_ringEquiv _ _ (algEquivAlgebraicClosureAux k).symm.toRingEquiv
style: homogenise porting notes (#11145)

Homogenises porting notes via capitalisation and addition of whitespace.

It makes the following changes:

  • converts "--porting note" into "-- Porting note";
  • converts "porting note" into "Porting note".
Diff
@@ -259,7 +259,7 @@ instance Step.scalar_tower (n) : IsScalarTower k (Step k n) (Step k (n + 1)) :=
     @Nat.leRecOn_succ (Step k) 0 n n.zero_le (n + 1).zero_le (@fun n => toStepSucc k n) z
 #align algebraic_closure.step.scalar_tower AlgebraicClosure.Step.scalar_tower
 
---Porting Note: Added to make `Step.isIntegral` faster
+-- Porting note: Added to make `Step.isIntegral` faster
 private theorem toStepOfLE.succ (n : ℕ) (h : 0 ≤ n) :
     toStepOfLE k 0 (n + 1) (h.trans n.le_succ) =
     (toStepSucc k n).comp (toStepOfLE k 0 n h) := by
@@ -289,7 +289,7 @@ theorem Step.isIntegral (n) : ∀ z : Step k n, IsIntegral k z := by
     · intro z
       have := AdjoinMonic.isIntegral (Step k a) (z : Step k (a + 1))
       convert this
-    · convert h --Porting Note: This times out at 500000
+    · convert h -- Porting note: This times out at 500000
 #align algebraic_closure.step.is_integral AlgebraicClosure.Step.isIntegral
 
 instance toStepOfLE.directedSystem : DirectedSystem (Step k) fun i j h => toStepOfLE k i j h :=
@@ -371,7 +371,7 @@ local instance instAlgebra : Algebra k (AlgebraicClosureAux k) :=
 def ofStepHom (n) : Step k n →ₐ[k] AlgebraicClosureAux k :=
   { ofStep k n with
     commutes' := by
-    --Porting Note: Originally `(fun x => Ring.DirectLimit.of_f n.zero_le x)`
+    -- Porting note: Originally `(fun x => Ring.DirectLimit.of_f n.zero_le x)`
     -- I think one problem was in recognizing that we want `toStepOfLE` in `of_f`
       intro x
       simp only [RingHom.toMonoidHom_eq_coe, OneHom.toFun_eq_coe, MonoidHom.toOneHom_coe,
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
@@ -140,7 +140,7 @@ theorem AdjoinMonic.isIntegral (z : AdjoinMonic k) : IsIntegral k z := by
   rw [← hp]
   induction p using MvPolynomial.induction_on generalizing z with
     | h_C => exact isIntegral_algebraMap
-    | h_add _ _ ha hb => exact IsIntegral.add (ha _ rfl) (hb _ rfl)
+    | h_add _ _ ha hb => exact (ha _ rfl).add (hb _ rfl)
     | h_X p f ih =>
       · refine @IsIntegral.mul k _ _ _ _ _ (Ideal.Quotient.mk (maxIdeal k) _) (ih _ rfl) ?_
         refine ⟨f, f.2.1, ?_⟩
@@ -284,7 +284,7 @@ theorem Step.isIntegral (n) : ∀ z : Step k n, IsIntegral k z := by
     unfold RingHom.toAlgebra'
     simp only
     rw [toStepOfLE.succ k a a.zero_le]
-    apply @RingHom.isIntegral_trans (Step k 0) (Step k a) (Step k (a + 1)) _ _ _
+    apply @RingHom.IsIntegral.trans (Step k 0) (Step k a) (Step k (a + 1)) _ _ _
         (toStepOfLE k 0 a (a.zero_le : 0 ≤ a)) (toStepSucc k a) _
     · intro z
       have := AdjoinMonic.isIntegral (Step k a) (z : Step k (a + 1))
@@ -381,9 +381,9 @@ def ofStepHom (n) : Step k n →ₐ[k] AlgebraicClosureAux k :=
 #noalign algebraic_closure.of_step_hom
 
 theorem isAlgebraic : Algebra.IsAlgebraic k (AlgebraicClosureAux k) := fun z =>
-  isAlgebraic_iff_isIntegral.2 <|
+  IsIntegral.isAlgebraic <|
     let ⟨n, x, hx⟩ := exists_ofStep k z
-    hx ▸ IsIntegral.map (ofStepHom k n) (Step.isIntegral k n x)
+    hx ▸ (Step.isIntegral k n x).map (ofStepHom k n)
 
 @[local instance] theorem isAlgClosure : IsAlgClosure k (AlgebraicClosureAux k) :=
   ⟨AlgebraicClosureAux.instIsAlgClosed k, isAlgebraic 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
@@ -140,9 +140,9 @@ theorem AdjoinMonic.isIntegral (z : AdjoinMonic k) : IsIntegral k z := by
   rw [← hp]
   induction p using MvPolynomial.induction_on generalizing z with
     | h_C => exact isIntegral_algebraMap
-    | h_add _ _ ha hb => exact isIntegral_add (ha _ rfl) (hb _ rfl)
+    | h_add _ _ ha hb => exact IsIntegral.add (ha _ rfl) (hb _ rfl)
     | h_X p f ih =>
-      · refine @isIntegral_mul k _ _ _ _ _ (Ideal.Quotient.mk (maxIdeal k) _) (ih _ rfl) ?_
+      · refine @IsIntegral.mul k _ _ _ _ _ (Ideal.Quotient.mk (maxIdeal k) _) (ih _ rfl) ?_
         refine ⟨f, f.2.1, ?_⟩
         erw [AdjoinMonic.algebraMap, ← hom_eval₂, Ideal.Quotient.eq_zero_iff_mem]
         exact le_maxIdeal k (Ideal.subset_span ⟨f, rfl⟩)
@@ -383,7 +383,7 @@ def ofStepHom (n) : Step k n →ₐ[k] AlgebraicClosureAux k :=
 theorem isAlgebraic : Algebra.IsAlgebraic k (AlgebraicClosureAux k) := fun z =>
   isAlgebraic_iff_isIntegral.2 <|
     let ⟨n, x, hx⟩ := exists_ofStep k z
-    hx ▸ map_isIntegral (ofStepHom k n) (Step.isIntegral k n x)
+    hx ▸ IsIntegral.map (ofStepHom k n) (Step.isIntegral k n x)
 
 @[local instance] theorem isAlgClosure : IsAlgClosure k (AlgebraicClosureAux k) :=
   ⟨AlgebraicClosureAux.instIsAlgClosed k, isAlgebraic k⟩
Revert "chore: revert #7703 (#7710)"

This reverts commit f3695eb2.

Diff
@@ -151,7 +151,8 @@ theorem AdjoinMonic.isIntegral (z : AdjoinMonic k) : IsIntegral k z := by
 theorem AdjoinMonic.exists_root {f : k[X]} (hfm : f.Monic) (hfi : Irreducible f) :
     ∃ x : AdjoinMonic k, f.eval₂ (toAdjoinMonic k) x = 0 :=
   ⟨Ideal.Quotient.mk _ <| X (⟨f, hfm, hfi⟩ : MonicIrreducible k), by
-    rw [toAdjoinMonic, ← hom_eval₂, Ideal.Quotient.eq_zero_iff_mem]
+    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+    erw [toAdjoinMonic, ← hom_eval₂, Ideal.Quotient.eq_zero_iff_mem]
     exact le_maxIdeal k (Ideal.subset_span <| ⟨_, rfl⟩)⟩
 #align algebraic_closure.adjoin_monic.exists_root AlgebraicClosure.AdjoinMonic.exists_root
 
chore: revert #7703 (#7710)

This reverts commit 26eb2b0a.

Diff
@@ -151,8 +151,7 @@ theorem AdjoinMonic.isIntegral (z : AdjoinMonic k) : IsIntegral k z := by
 theorem AdjoinMonic.exists_root {f : k[X]} (hfm : f.Monic) (hfi : Irreducible f) :
     ∃ x : AdjoinMonic k, f.eval₂ (toAdjoinMonic k) x = 0 :=
   ⟨Ideal.Quotient.mk _ <| X (⟨f, hfm, hfi⟩ : MonicIrreducible k), by
-    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
-    erw [toAdjoinMonic, ← hom_eval₂, Ideal.Quotient.eq_zero_iff_mem]
+    rw [toAdjoinMonic, ← hom_eval₂, Ideal.Quotient.eq_zero_iff_mem]
     exact le_maxIdeal k (Ideal.subset_span <| ⟨_, rfl⟩)⟩
 #align algebraic_closure.adjoin_monic.exists_root AlgebraicClosure.AdjoinMonic.exists_root
 
chore: bump toolchain to v4.2.0-rc2 (#7703)

This includes all the changes from #7606.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -151,7 +151,8 @@ theorem AdjoinMonic.isIntegral (z : AdjoinMonic k) : IsIntegral k z := by
 theorem AdjoinMonic.exists_root {f : k[X]} (hfm : f.Monic) (hfi : Irreducible f) :
     ∃ x : AdjoinMonic k, f.eval₂ (toAdjoinMonic k) x = 0 :=
   ⟨Ideal.Quotient.mk _ <| X (⟨f, hfm, hfi⟩ : MonicIrreducible k), by
-    rw [toAdjoinMonic, ← hom_eval₂, Ideal.Quotient.eq_zero_iff_mem]
+    -- This used to be `rw`, but we need `erw` after leanprover/lean4#2644
+    erw [toAdjoinMonic, ← hom_eval₂, Ideal.Quotient.eq_zero_iff_mem]
     exact le_maxIdeal k (Ideal.subset_span <| ⟨_, rfl⟩)⟩
 #align algebraic_closure.adjoin_monic.exists_root AlgebraicClosure.AdjoinMonic.exists_root
 
chore: cleanup some spaces (#7490)

Purely cosmetic PR

Diff
@@ -325,7 +325,7 @@ def ofStep (n : ℕ) : Step k n →+* AlgebraicClosureAux k :=
 
 theorem ofStep_succ (n : ℕ) : (ofStep k (n + 1)).comp (toStepSucc k n) = ofStep k n := by
   ext x
-  have hx : toStepOfLE' k n (n+1) n.le_succ x = toStepSucc k n x:= Nat.leRecOn_succ' x
+  have hx : toStepOfLE' k n (n+1) n.le_succ x = toStepSucc k n x := Nat.leRecOn_succ' x
   unfold ofStep
   rw [RingHom.comp_apply]
   dsimp [toStepOfLE]
chore: exactly 4 spaces in theorems (#7328)

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

Diff
@@ -132,7 +132,7 @@ instance AdjoinMonic.algebra : Algebra k (AdjoinMonic k) :=
 
 -- Porting note: In the statement, the type of `C` had to be made explicit.
 theorem AdjoinMonic.algebraMap : algebraMap k (AdjoinMonic k) = (Ideal.Quotient.mk _).comp
-  (C : k →+* MvPolynomial (MonicIrreducible k) k) := rfl
+    (C : k →+* MvPolynomial (MonicIrreducible k) k) := rfl
 #align algebraic_closure.adjoin_monic.algebra_map AlgebraicClosure.AdjoinMonic.algebraMap
 
 theorem AdjoinMonic.isIntegral (z : AdjoinMonic k) : IsIntegral k z := by
chore: redefine AlgebraicClosure to make certain instance diagrams commute (#6734)

A similar trick to the trick used in #4891 makes all the required type class diagrams commute.

I also added instances for CharP and CharZero and tests for the instance diagrams.

Co-authored-by: Chris Hughes <33847686+ChrisHughes24@users.noreply.github.com>

Diff
@@ -297,28 +297,31 @@ instance toStepOfLE.directedSystem : DirectedSystem (Step k) fun i j h => toStep
 
 end AlgebraicClosure
 
-/-- The canonical algebraic closure of a field, the direct limit of adding roots to the field for
-each polynomial over the field. -/
-def AlgebraicClosure : Type u :=
+/-- Auxiliary construction for `AlgebraicClosure`. Although `AlgebraicClosureAux` does define
+the algebraic closure of a field, it is redefined at `AlgebraicClosure` in order to make sure
+certain instance diamonds commute by definition.
+-/
+def AlgebraicClosureAux [Field k] : Type u :=
   Ring.DirectLimit (AlgebraicClosure.Step k) fun i j h => AlgebraicClosure.toStepOfLE k i j h
-#align algebraic_closure AlgebraicClosure
+#align algebraic_closure AlgebraicClosureAux
 
-namespace AlgebraicClosure
+namespace AlgebraicClosureAux
 
-instance : Field (AlgebraicClosure k) :=
+open AlgebraicClosure
+
+/-- `AlgebraicClosureAux k` is a `Field` -/
+local instance field : Field (AlgebraicClosureAux k) :=
   Field.DirectLimit.field _ _
 
-instance : Inhabited (AlgebraicClosure k) :=
+instance : Inhabited (AlgebraicClosureAux k) :=
   ⟨37⟩
 
 /-- The canonical ring embedding from the `n`th step to the algebraic closure. -/
-def ofStep (n : ℕ) : Step k n →+* AlgebraicClosure k :=
+def ofStep (n : ℕ) : Step k n →+* AlgebraicClosureAux k :=
   Ring.DirectLimit.of _ _ _
-#align algebraic_closure.of_step AlgebraicClosure.ofStep
+#noalign algebraic_closure.of_step
 
-instance algebraOfStep (n) : Algebra (Step k n) (AlgebraicClosure k) :=
-  (ofStep k n).toAlgebra
-#align algebraic_closure.algebra_of_step AlgebraicClosure.algebraOfStep
+#noalign algebraic_closure.algebra_of_step
 
 theorem ofStep_succ (n : ℕ) : (ofStep k (n + 1)).comp (toStepSucc k n) = ofStep k n := by
   ext x
@@ -336,14 +339,14 @@ theorem ofStep_succ (n : ℕ) : (ofStep k (n + 1)).comp (toStepSucc k n) = ofSte
   -- RingHom.ext fun x =>
   --   show Ring.DirectLimit.of (Step k) (fun i j h => toStepOfLE k i j h) _ _ = _ by
   --     convert Ring.DirectLimit.of_f n.le_succ x; ext x; exact (Nat.leRecOn_succ' x).symm
-#align algebraic_closure.of_step_succ AlgebraicClosure.ofStep_succ
+#noalign algebraic_closure.of_step_succ
 
-theorem exists_ofStep (z : AlgebraicClosure k) : ∃ n x, ofStep k n x = z :=
+theorem exists_ofStep (z : AlgebraicClosureAux k) : ∃ n x, ofStep k n x = z :=
   Ring.DirectLimit.exists_of z
-#align algebraic_closure.exists_of_step AlgebraicClosure.exists_ofStep
+#noalign algebraic_closure.exists_of_step
 
-theorem exists_root {f : Polynomial (AlgebraicClosure k)} (hfm : f.Monic) (hfi : Irreducible f) :
-    ∃ x : AlgebraicClosure k, f.eval x = 0 := by
+theorem exists_root {f : Polynomial (AlgebraicClosureAux k)}
+    (hfm : f.Monic) (hfi : Irreducible f) : ∃ x : AlgebraicClosureAux k, f.eval x = 0 := by
   have : ∃ n p, Polynomial.map (ofStep k n) p = f := by
     convert Ring.DirectLimit.Polynomial.exists_of f
   obtain ⟨n, p, rfl⟩ := this
@@ -352,36 +355,19 @@ theorem exists_root {f : Polynomial (AlgebraicClosure k)} (hfm : f.Monic) (hfi :
   obtain ⟨x, hx⟩ := toStepSucc.exists_root k hfm this
   refine' ⟨ofStep k (n + 1) x, _⟩
   rw [← ofStep_succ k n, eval_map, ← hom_eval₂, hx, RingHom.map_zero]
-#align algebraic_closure.exists_root AlgebraicClosure.exists_root
+#noalign algebraic_closure.exists_root
 
-instance instIsAlgClosed : IsAlgClosed (AlgebraicClosure k) :=
+@[local instance] theorem instIsAlgClosed : IsAlgClosed (AlgebraicClosureAux k) :=
   IsAlgClosed.of_exists_root _ fun _ => exists_root k
-#align algebraic_closure.is_alg_closed AlgebraicClosure.instIsAlgClosed
 
-instance instAlgebra {R : Type*} [CommSemiring R] [alg : Algebra R k] :
-    Algebra R (AlgebraicClosure k) :=
-  ((ofStep k 0).comp (@algebraMap _ _ _ _ alg)).toAlgebra
+/-- `AlgebraicClosureAux k` is a `k`-`Algebra` -/
+local instance instAlgebra : Algebra k (AlgebraicClosureAux k) :=
+  (ofStep k 0).toAlgebra
 
-theorem algebraMap_def {R : Type*} [CommSemiring R] [alg : Algebra R k] :
-    algebraMap R (AlgebraicClosure k) = (ofStep k 0 : k →+* _).comp (@algebraMap _ _ _ _ alg) :=
-  rfl
-#align algebraic_closure.algebra_map_def AlgebraicClosure.algebraMap_def
-
-
-instance {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S] [Algebra S k] [Algebra R k]
-    [IsScalarTower R S k] : IsScalarTower R S (AlgebraicClosure k) := by
-  apply IsScalarTower.of_algebraMap_eq _
-  intro x
-  simp only [algebraMap_def]
-  rw [RingHom.comp_apply, RingHom.comp_apply]
-  exact RingHom.congr_arg _ (IsScalarTower.algebraMap_apply R S k x : _)
-  -- Porting Note: Original proof (without `by`) didn't work anymore, I think it couldn't figure
-  -- out `algebraMap_def`. Orignally:
-  -- IsScalarTower.of_algebraMap_eq fun x =>
-  --   RingHom.congr_arg _ (IsScalarTower.algebraMap_apply R S k x : _)
+#noalign algebraic_closure.algebra_map_def
 
 /-- Canonical algebra embedding from the `n`th step to the algebraic closure. -/
-def ofStepHom (n) : Step k n →ₐ[k] AlgebraicClosure k :=
+def ofStepHom (n) : Step k n →ₐ[k] AlgebraicClosureAux k :=
   { ofStep k n with
     commutes' := by
     --Porting Note: Originally `(fun x => Ring.DirectLimit.of_f n.zero_le x)`
@@ -391,15 +377,107 @@ def ofStepHom (n) : Step k n →ₐ[k] AlgebraicClosure k :=
           MonoidHom.coe_coe]
       convert @Ring.DirectLimit.of_f ℕ _ (Step k) _ (fun m n h => (toStepOfLE k m n h : _ → _))
           0 n n.zero_le x }
-#align algebraic_closure.of_step_hom AlgebraicClosure.ofStepHom
+#noalign algebraic_closure.of_step_hom
 
-theorem isAlgebraic : Algebra.IsAlgebraic k (AlgebraicClosure k) := fun z =>
+theorem isAlgebraic : Algebra.IsAlgebraic k (AlgebraicClosureAux k) := fun z =>
   isAlgebraic_iff_isIntegral.2 <|
     let ⟨n, x, hx⟩ := exists_ofStep k z
     hx ▸ map_isIntegral (ofStepHom k n) (Step.isIntegral k n x)
+
+@[local instance] theorem isAlgClosure : IsAlgClosure k (AlgebraicClosureAux k) :=
+  ⟨AlgebraicClosureAux.instIsAlgClosed k, isAlgebraic k⟩
+
+end AlgebraicClosureAux
+
+attribute [local instance] AlgebraicClosureAux.field AlgebraicClosureAux.instAlgebra
+  AlgebraicClosureAux.instIsAlgClosed
+
+/-- The canonical algebraic closure of a field, the direct limit of adding roots to the field for
+each polynomial over the field. -/
+def AlgebraicClosure : Type u :=
+  MvPolynomial (AlgebraicClosureAux k) k ⧸
+    RingHom.ker (MvPolynomial.aeval (R := k) id).toRingHom
+
+namespace AlgebraicClosure
+
+instance commRing : CommRing (AlgebraicClosure k) :=
+  Ideal.Quotient.commRing _
+
+instance inhabited : Inhabited (AlgebraicClosure k) :=
+  ⟨37⟩
+
+instance {S : Type*} [DistribSMul S k] [IsScalarTower S k k] : SMul S (AlgebraicClosure k) :=
+  Submodule.Quotient.instSMul' _
+
+instance instAlgebra {R : Type*} [CommSemiring R] [Algebra R k] : Algebra R (AlgebraicClosure k) :=
+  Ideal.Quotient.algebra _
+
+instance {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S] [Algebra S k] [Algebra R k]
+    [IsScalarTower R S k] : IsScalarTower R S (AlgebraicClosure k) :=
+  Ideal.Quotient.isScalarTower _ _ _
+
+/-- The equivalence between `AlgebraicClosure` and `AlgebraicClosureAux`, which we use to transfer
+properties of `AlgebraicClosureAux` to `AlgebraicClosure` -/
+def algEquivAlgebraicClosureAux :
+    AlgebraicClosure k ≃ₐ[k] AlgebraicClosureAux k := by
+  delta AlgebraicClosure
+  exact Ideal.quotientKerAlgEquivOfSurjective
+    (fun x => ⟨MvPolynomial.X x, by simp⟩)
+
+-- This instance is basically copied from the `Field` instance on `SplittingField`
+instance : Field (AlgebraicClosure k) :=
+  letI e := algEquivAlgebraicClosureAux k
+  { toCommRing := AlgebraicClosure.commRing k
+    ratCast := fun a => algebraMap k _ (a : k)
+    inv := fun a => e.symm (e a)⁻¹
+    qsmul := (· • ·)
+    qsmul_eq_mul' := fun a x =>
+      Quotient.inductionOn x (fun p => congr_arg Quotient.mk''
+        (by ext; simp [MvPolynomial.algebraMap_eq, Rat.smul_def]))
+    ratCast_mk := fun a b h1 h2 => by
+      apply_fun e
+      change e (algebraMap k _ _) = _
+      simp only [map_ratCast, map_natCast, map_mul, map_intCast, AlgEquiv.commutes,
+        AlgEquiv.apply_symm_apply]
+      apply Field.ratCast_mk
+    exists_pair_ne := ⟨e.symm 0, e.symm 1, fun w => zero_ne_one ((e.symm).injective w)⟩
+    mul_inv_cancel := fun a w => by
+      apply_fun e
+      simp_rw [map_mul, e.apply_symm_apply, map_one]
+      exact mul_inv_cancel ((AddEquivClass.map_ne_zero_iff e).mpr w)
+    inv_zero := by simp }
+
+instance isAlgClosed : IsAlgClosed (AlgebraicClosure k) :=
+  IsAlgClosed.of_ringEquiv _ _ (algEquivAlgebraicClosureAux k).symm.toRingEquiv
+#align algebraic_closure.is_alg_closed AlgebraicClosure.isAlgClosed
+
+instance : IsAlgClosure k (AlgebraicClosure k) := by
+  rw [isAlgClosure_iff]
+  refine ⟨inferInstance, (algEquivAlgebraicClosureAux k).symm.isAlgebraic <|
+    AlgebraicClosureAux.isAlgebraic _⟩
+
+theorem isAlgebraic : Algebra.IsAlgebraic k (AlgebraicClosure k) :=
+  IsAlgClosure.algebraic
 #align algebraic_closure.is_algebraic AlgebraicClosure.isAlgebraic
 
-instance : IsAlgClosure k (AlgebraicClosure k) :=
-  ⟨AlgebraicClosure.instIsAlgClosed k, isAlgebraic k⟩
+instance [CharZero k] : CharZero (AlgebraicClosure k) :=
+  charZero_of_injective_algebraMap (RingHom.injective (algebraMap k (AlgebraicClosure k)))
+
+instance {p : ℕ} [CharP k p] : CharP (AlgebraicClosure k) p :=
+  charP_of_injective_algebraMap (RingHom.injective (algebraMap k (AlgebraicClosure k))) p
+
+example : (AddCommMonoid.natModule : Module ℕ (AlgebraicClosure k)) =
+      @Algebra.toModule _ _ _ _ (AlgebraicClosure.instAlgebra k) :=
+  rfl
+
+example : (AddCommGroup.intModule _ : Module ℤ (AlgebraicClosure k)) =
+      @Algebra.toModule _ _ _ _ (AlgebraicClosure.instAlgebra k) :=
+  rfl
+
+example [CharZero k] : AlgebraicClosure.instAlgebra k = algebraRat :=
+  rfl
+
+example : algebraInt (AlgebraicClosure ℚ) = AlgebraicClosure.instAlgebra ℚ :=
+  rfl
 
 end AlgebraicClosure
chore: drop MulZeroClass. in mul_zero/zero_mul (#6682)

Search&replace MulZeroClass.mul_zero -> mul_zero, MulZeroClass.zero_mul -> zero_mul.

These were introduced by Mathport, as the full name of mul_zero is actually MulZeroClass.mul_zero (it's exported with the short name).

Diff
@@ -92,7 +92,7 @@ theorem spanEval_ne_top : spanEval k ≠ ⊤ := by
   · exact zero_ne_one hv
   intro j hj
   rw [smul_eq_mul, AlgHom.map_mul, toSplittingField_evalXSelf (s := v.support) hj,
-    MulZeroClass.mul_zero]
+    mul_zero]
 #align algebraic_closure.span_eval_ne_top AlgebraicClosure.spanEval_ne_top
 
 /-- A random maximal ideal that contains `spanEval k` -/
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
@@ -358,17 +358,17 @@ instance instIsAlgClosed : IsAlgClosed (AlgebraicClosure k) :=
   IsAlgClosed.of_exists_root _ fun _ => exists_root k
 #align algebraic_closure.is_alg_closed AlgebraicClosure.instIsAlgClosed
 
-instance instAlgebra {R : Type _} [CommSemiring R] [alg : Algebra R k] :
+instance instAlgebra {R : Type*} [CommSemiring R] [alg : Algebra R k] :
     Algebra R (AlgebraicClosure k) :=
   ((ofStep k 0).comp (@algebraMap _ _ _ _ alg)).toAlgebra
 
-theorem algebraMap_def {R : Type _} [CommSemiring R] [alg : Algebra R k] :
+theorem algebraMap_def {R : Type*} [CommSemiring R] [alg : Algebra R k] :
     algebraMap R (AlgebraicClosure k) = (ofStep k 0 : k →+* _).comp (@algebraMap _ _ _ _ alg) :=
   rfl
 #align algebraic_closure.algebra_map_def AlgebraicClosure.algebraMap_def
 
 
-instance {R S : Type _} [CommSemiring R] [CommSemiring S] [Algebra R S] [Algebra S k] [Algebra R k]
+instance {R S : Type*} [CommSemiring R] [CommSemiring S] [Algebra R S] [Algebra S k] [Algebra R k]
     [IsScalarTower R S k] : IsScalarTower R S (AlgebraicClosure k) := by
   apply IsScalarTower.of_algebraMap_eq _
   intro x
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

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

Diff
@@ -2,17 +2,14 @@
 Copyright (c) 2020 Kenny Lau. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Kenny Lau
-
-! This file was ported from Lean 3 source module field_theory.is_alg_closed.algebraic_closure
-! leanprover-community/mathlib commit df76f43357840485b9d04ed5dee5ab115d420e87
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Algebra.DirectLimit
 import Mathlib.Algebra.CharP.Algebra
 import Mathlib.FieldTheory.IsAlgClosed.Basic
 import Mathlib.FieldTheory.SplittingField.Construction
 
+#align_import field_theory.is_alg_closed.algebraic_closure from "leanprover-community/mathlib"@"df76f43357840485b9d04ed5dee5ab115d420e87"
+
 /-!
 # Algebraic Closure
 
chore: tidy various files (#5355)
Diff
@@ -20,7 +20,7 @@ In this file we construct the algebraic closure of a field
 
 ## Main Definitions
 
-- `algebraic_closure k` is an algebraic closure of `k` (in the same universe).
+- `AlgebraicClosure k` is an algebraic closure of `k` (in the same universe).
   It is constructed by taking the polynomial ring generated by indeterminates `x_f`
   corresponding to monic irreducible polynomials `f` with coefficients in `k`, and quotienting
   out by a maximal ideal containing every `f(x_f)`, and then repeating this step countably
@@ -98,7 +98,7 @@ theorem spanEval_ne_top : spanEval k ≠ ⊤ := by
     MulZeroClass.mul_zero]
 #align algebraic_closure.span_eval_ne_top AlgebraicClosure.spanEval_ne_top
 
-/-- A random maximal ideal that contains `span_eval k` -/
+/-- A random maximal ideal that contains `spanEval k` -/
 def maxIdeal : Ideal (MvPolynomial (MonicIrreducible k) k) :=
   Classical.choose <| Ideal.exists_le_maximal _ <| spanEval_ne_top k
 #align algebraic_closure.max_ideal AlgebraicClosure.maxIdeal
@@ -111,7 +111,7 @@ theorem le_maxIdeal : spanEval k ≤ maxIdeal k :=
   (Classical.choose_spec <| Ideal.exists_le_maximal _ <| spanEval_ne_top k).2
 #align algebraic_closure.le_max_ideal AlgebraicClosure.le_maxIdeal
 
-/-- The first step of constructing `algebraic_closure`: adjoin a root of all monic polynomials -/
+/-- The first step of constructing `AlgebraicClosure`: adjoin a root of all monic polynomials -/
 def AdjoinMonic : Type u :=
   MvPolynomial (MonicIrreducible k) k ⧸ maxIdeal k
 #align algebraic_closure.adjoin_monic AlgebraicClosure.AdjoinMonic
@@ -124,7 +124,7 @@ instance AdjoinMonic.inhabited : Inhabited (AdjoinMonic k) :=
   ⟨37⟩
 #align algebraic_closure.adjoin_monic.inhabited AlgebraicClosure.AdjoinMonic.inhabited
 
-/-- The canonical ring homomorphism to `adjoin_monic k`. -/
+/-- The canonical ring homomorphism to `AdjoinMonic k`. -/
 def toAdjoinMonic : k →+* AdjoinMonic k :=
   (Ideal.Quotient.mk _).comp C
 #align algebraic_closure.to_adjoin_monic AlgebraicClosure.toAdjoinMonic
@@ -158,12 +158,12 @@ theorem AdjoinMonic.exists_root {f : k[X]} (hfm : f.Monic) (hfi : Irreducible f)
     exact le_maxIdeal k (Ideal.subset_span <| ⟨_, rfl⟩)⟩
 #align algebraic_closure.adjoin_monic.exists_root AlgebraicClosure.AdjoinMonic.exists_root
 
-/-- The `n`th step of constructing `algebraic_closure`, together with its `field` instance. -/
+/-- The `n`th step of constructing `AlgebraicClosure`, together with its `Field` instance. -/
 def stepAux (n : ℕ) : Σ α : Type u, Field α :=
   Nat.recOn n ⟨k, inferInstance⟩ fun _ ih => ⟨@AdjoinMonic ih.1 ih.2, @AdjoinMonic.field ih.1 ih.2⟩
 #align algebraic_closure.step_aux AlgebraicClosure.stepAux
 
-/-- The `n`th step of constructing `algebraic_closure`. -/
+/-- The `n`th step of constructing `AlgebraicClosure`. -/
 def Step (n : ℕ) : Type u :=
   (stepAux k n).1
 #align algebraic_closure.step AlgebraicClosure.Step
@@ -385,16 +385,15 @@ instance {R S : Type _} [CommSemiring R] [CommSemiring S] [Algebra R S] [Algebra
 
 /-- Canonical algebra embedding from the `n`th step to the algebraic closure. -/
 def ofStepHom (n) : Step k n →ₐ[k] AlgebraicClosure k :=
-  { ofStep k n with commutes' := by {
-  --Porting Note: Originally `(fun x => Ring.DirectLimit.of_f n.zero_le x)`
-  -- I think one problem was in recognizing that we want `toStepOfLE` in `of_f`
+  { ofStep k n with
+    commutes' := by
+    --Porting Note: Originally `(fun x => Ring.DirectLimit.of_f n.zero_le x)`
+    -- I think one problem was in recognizing that we want `toStepOfLE` in `of_f`
       intro x
       simp only [RingHom.toMonoidHom_eq_coe, OneHom.toFun_eq_coe, MonoidHom.toOneHom_coe,
           MonoidHom.coe_coe]
       convert @Ring.DirectLimit.of_f ℕ _ (Step k) _ (fun m n h => (toStepOfLE k m n h : _ → _))
-          0 n n.zero_le x
-    }
-  }
+          0 n n.zero_le x }
 #align algebraic_closure.of_step_hom AlgebraicClosure.ofStepHom
 
 theorem isAlgebraic : Algebra.IsAlgebraic k (AlgebraicClosure k) := fun z =>
feat: port NumberTheory.NumberField.Norm (#5353)
Diff
@@ -361,7 +361,8 @@ instance instIsAlgClosed : IsAlgClosed (AlgebraicClosure k) :=
   IsAlgClosed.of_exists_root _ fun _ => exists_root k
 #align algebraic_closure.is_alg_closed AlgebraicClosure.instIsAlgClosed
 
-instance {R : Type _} [CommSemiring R] [alg : Algebra R k] : Algebra R (AlgebraicClosure k) :=
+instance instAlgebra {R : Type _} [CommSemiring R] [alg : Algebra R k] :
+    Algebra R (AlgebraicClosure k) :=
   ((ofStep k 0).comp (@algebraMap _ _ _ _ alg)).toAlgebra
 
 theorem algebraMap_def {R : Type _} [CommSemiring R] [alg : Algebra R k] :
chore: change Field.toEuclideanDomain (#5266)

Modifying the definition of Field.toEuclideanDomain makes some declaration faster.

Co-authored-by: Sébastien Gouëzel

Diff
@@ -187,7 +187,6 @@ def toStepZero : k →+* Step k 0 :=
   RingHom.id k
 #align algebraic_closure.to_step_zero AlgebraicClosure.toStepZero
 
-set_option maxHeartbeats 210000 in
 /-- The canonical ring homomorphism to the next step. -/
 def toStepSucc (n : ℕ) : Step k n →+* (Step k (n + 1)) :=
   @toAdjoinMonic (Step k n) (Step.field k n)
@@ -272,9 +271,6 @@ private theorem toStepOfLE.succ (n : ℕ) (h : 0 ≤ n) :
     change _ = (_ ∘ _) x
     rw [toStepOfLE'.succ k 0 n h]
 
---Porting Note: Can probably still be optimized -
---Only the last `convert h` times out with 500000 Heartbeats
-set_option maxHeartbeats 700000 in
 theorem Step.isIntegral (n) : ∀ z : Step k n, IsIntegral k z := by
   induction' n with a h
   · intro z
@@ -349,9 +345,6 @@ theorem exists_ofStep (z : AlgebraicClosure k) : ∃ n x, ofStep k n x = z :=
   Ring.DirectLimit.exists_of z
 #align algebraic_closure.exists_of_step AlgebraicClosure.exists_ofStep
 
--- slow
---Porting Note: Timed out at 800000
-set_option maxHeartbeats 900000 in
 theorem exists_root {f : Polynomial (AlgebraicClosure k)} (hfm : f.Monic) (hfi : Irreducible f) :
     ∃ x : AlgebraicClosure k, f.eval x = 0 := by
   have : ∃ n p, Polynomial.map (ofStep k n) p = f := by
chore: use in in set_option maxHeartbeats (#5261)
Diff
@@ -274,7 +274,7 @@ private theorem toStepOfLE.succ (n : ℕ) (h : 0 ≤ n) :
 
 --Porting Note: Can probably still be optimized -
 --Only the last `convert h` times out with 500000 Heartbeats
-set_option maxHeartbeats 700000
+set_option maxHeartbeats 700000 in
 theorem Step.isIntegral (n) : ∀ z : Step k n, IsIntegral k z := by
   induction' n with a h
   · intro z
@@ -298,7 +298,6 @@ theorem Step.isIntegral (n) : ∀ z : Step k n, IsIntegral k z := by
     · convert h --Porting Note: This times out at 500000
 #align algebraic_closure.step.is_integral AlgebraicClosure.Step.isIntegral
 
-
 instance toStepOfLE.directedSystem : DirectedSystem (Step k) fun i j h => toStepOfLE k i j h :=
   ⟨fun _ x _ => Nat.leRecOn_self x, fun h₁₂ h₂₃ x => (Nat.leRecOn_trans h₁₂ h₂₃ x).symm⟩
 #align algebraic_closure.to_step_of_le.directed_system AlgebraicClosure.toStepOfLE.directedSystem
@@ -352,7 +351,7 @@ theorem exists_ofStep (z : AlgebraicClosure k) : ∃ n x, ofStep k n x = z :=
 
 -- slow
 --Porting Note: Timed out at 800000
-set_option maxHeartbeats 900000
+set_option maxHeartbeats 900000 in
 theorem exists_root {f : Polynomial (AlgebraicClosure k)} (hfm : f.Monic) (hfi : Irreducible f) :
     ∃ x : AlgebraicClosure k, f.eval x = 0 := by
   have : ∃ n p, Polynomial.map (ofStep k n) p = f := by
feat: port FieldTheory.IsAlgClosed.AlgebraicClosure (#5074)

Co-authored-by: Xavier-François Roblot <46200072+xroblot@users.noreply.github.com> Co-authored-by: Riccardo Brasca <riccardo.brasca@gmail.com> Co-authored-by: nick-kuhn <nikolaskuhn@gmx.de> Co-authored-by: nick-kuhn <46423253+nick-kuhn@users.noreply.github.com> Co-authored-by: Chris Hughes <33847686+ChrisHughes24@users.noreply.github.com>

Dependencies 10 + 667

668 files ported (98.5%)
277790 lines ported (98.8%)
Show graph

The unported dependencies are