88public import Mathlib.Algebra.Polynomial.AlgebraMap
99public import Mathlib.FieldTheory.Minpoly.IsIntegrallyClosed
1010public import Mathlib.RingTheory.PowerBasis
11+ public import Mathlib.LinearAlgebra.Charpoly.Basic
1112
1213/-!
1314# A predicate on adjoining roots of polynomial
@@ -591,10 +592,10 @@ end lift
591592section mkOfAdjoinEqTop
592593
593594variable [IsDomain R] [IsDomain S] [IsTorsionFree R S] [IsIntegrallyClosed R]
594- {α : S} { hα : IsIntegral R α} { hα₂ : Algebra.adjoin R {α} = ⊤}
595+ {α : S} ( hα : IsIntegral R α) ( hα₂ : Algebra.adjoin R {α} = ⊤)
595596
596- variable (hα hα₂) in
597597/-- If `α` generates `S` as an algebra, then `S` is given by adjoining a root of `minpoly R α`. -/
598+ @[simps]
598599def mkOfAdjoinEqTop : IsAdjoinRoot S (minpoly R α) where
599600 map := aeval α
600601 map_surjective := by
@@ -604,15 +605,14 @@ def mkOfAdjoinEqTop : IsAdjoinRoot S (minpoly R α) where
604605 ext
605606 simpa [Ideal.mem_span_singleton] using minpoly.isIntegrallyClosed_dvd_iff hα _
606607
607- variable (hα hα₂) in
608608/-- If `α` generates `S` as an algebra, then `S` is given by adjoining a root of `minpoly R α`. -/
609609abbrev _root_.IsAdjoinRootMonic.mkOfAdjoinEqTop : IsAdjoinRootMonic S (minpoly R α) where
610610 __ := IsAdjoinRoot.mkOfAdjoinEqTop hα hα₂
611611 monic := minpoly.monic hα
612612
613613@[simp]
614614theorem mkOfAdjoinEqTop_root : (IsAdjoinRoot.mkOfAdjoinEqTop hα hα₂).root = α := by
615- simp [IsAdjoinRoot.mkOfAdjoinEqTop, IsAdjoinRoot. root]
615+ simp [IsAdjoinRoot.root]
616616
617617end mkOfAdjoinEqTop
618618
@@ -647,6 +647,44 @@ theorem minpoly_eq [IsDomain R] [IsDomain S] [IsTorsionFree R S] [IsIntegrallyCl
647647 (hirr.isUnit_or_isUnit hq).resolve_left <| minpoly.not_isUnit R h.root
648648 rw [mul_one]
649649
650+ /-- If `α` generates `S` as an algebra and `S` is free and finite,
651+ then `S` is given by adjoining a root of `minpoly R α`.
652+ Does not require that `R` is an integral domain, unlike `mkOfAdjoinEqTop`. -/
653+ @[simps]
654+ def mkOfAdjoinEqTop'
655+ [Module.Finite R S] [Module.Free R S]
656+ {α : S} (hα : Algebra.adjoin R {α} = ⊤) :
657+ IsAdjoinRootMonic S (minpoly R α) where
658+ __ : IsAdjoinRoot S (minpoly R α) :=
659+ let f := minpoly R α
660+ have hf := minpoly.monic (Algebra.IsIntegral.isIntegral (R := R) α)
661+ let φ : AdjoinRoot f →ₐ[R] S :=
662+ AdjoinRoot.liftAlgHom f (Algebra.ofId R S) α (minpoly.aeval R α)
663+ IsAdjoinRoot.ofAdjoinRootEquiv <| AlgEquiv.ofBijective φ <| by
664+ have hφ : Function.Surjective φ := by
665+ rw [Algebra.adjoin_singleton_eq_range_aeval, AlgHom.range_eq_top] at hα
666+ intro s; obtain ⟨p, hp⟩ := hα s
667+ exact ⟨AdjoinRoot.mk f p, by simp [φ, ← aeval_def, hp]⟩
668+ haveI := hf.free_adjoinRoot; haveI := hf.finite_adjoinRoot
669+ by_cases h : Nontrivial R
670+ · letI e := LinearEquiv.ofFinrankEq (R := R) (AdjoinRoot f) S <|
671+ le_antisymm (finrank_quotient_span_eq_natDegree' hf ▸ minpoly.natDegree_le α)
672+ (LinearMap.finrank_le_finrank_of_surjective (f := φ.toLinearMap) hφ)
673+ exact OrzechProperty.bijective_of_surjective_of_injective
674+ e.toLinearMap φ e.injective hφ
675+ · apply not_nontrivial_iff_subsingleton.mp at h
676+ haveI := Module.subsingleton R (AdjoinRoot f)
677+ exact ⟨Function.injective_of_subsingleton φ, hφ⟩
678+ map := aeval α
679+ monic := minpoly.monic (Algebra.IsIntegral.isIntegral α)
680+
681+ @[simp]
682+ theorem mkOfAdjoinEqTop'_root
683+ [Module.Finite R S] [Module.Free R S]
684+ {α : S} (hα : Algebra.adjoin R {α} = ⊤) :
685+ (mkOfAdjoinEqTop' hα).root = α := by
686+ simp [IsAdjoinRoot.root]
687+
650688end IsAdjoinRootMonic
651689
652690section Algebra
0 commit comments