import Mathlib.Algebra.Module.LocalizedModule.Basic import Mathlib.Algebra.MvPolynomial.CommRing import Mathlib.RingTheory.Ideal.Maps import Mathlib.Algebra.Algebra.Subalgebra.Lattice set_option autoImplicit false noncomputable section namespace CohCarrier universe u v w structure HeckeData (π’ͺ : Type u) [CommRing π’ͺ] (V : Type v) [AddCommGroup V] [Module π’ͺ V] (k : Type w) [Field k] [Algebra π’ͺ k] where Gen : Type op : Gen β†’ Module.End π’ͺ V comm : βˆ€ g h : Gen, op g * op h = op h * op g ΞΈbar : Gen β†’ k namespace HeckeData variable {π’ͺ : Type u} [CommRing π’ͺ] {V : Type v} [AddCommGroup V] [Module π’ͺ V] {k : Type w} [Field k] [Algebra π’ͺ k] (D : HeckeData π’ͺ V k) abbrev FreeAlg : Type u := MvPolynomial D.Gen π’ͺ noncomputable def thetaTilde : D.FreeAlg →ₐ[π’ͺ] k := MvPolynomial.aeval D.ΞΈbar def mTheta : Ideal D.FreeAlg := RingHom.ker D.thetaTilde.toRingHom instance mTheta_isPrime : D.mTheta.IsPrime := RingHom.ker_isPrime _ noncomputable def opSubalgebra : Subalgebra π’ͺ (Module.End π’ͺ V) := Algebra.adjoin π’ͺ (Set.range D.op) theorem op_comm_of_mem : βˆ€ a ∈ Set.range D.op, βˆ€ b ∈ Set.range D.op, a * b = b * a := by rintro _ ⟨g, rfl⟩ _ ⟨h, rfl⟩ exact D.comm g h instance opSubalgebra_isMulCommutative : IsMulCommutative β†₯D.opSubalgebra := Algebra.isMulCommutative_adjoin π’ͺ D.op_comm_of_mem open scoped IsMulCommutative noncomputable def opAlgHom : D.FreeAlg →ₐ[π’ͺ] Module.End π’ͺ V := (D.opSubalgebra.val).comp (MvPolynomial.aeval fun g => (⟨D.op g, Algebra.subset_adjoin (Set.mem_range_self g)⟩ : β†₯D.opSubalgebra)) @[simp] theorem opAlgHom_X (g : D.Gen) : D.opAlgHom (MvPolynomial.X g) = D.op g := by simp [opAlgHom] @[reducible] noncomputable def moduleFreeAlg : Module D.FreeAlg V := Module.compHom V D.opAlgHom.toRingHom attribute [local instance] moduleFreeAlg noncomputable abbrev ML : Type (max u v) := LocalizedModule D.mTheta.primeCompl V example : AddCommGroup D.ML := inferInstance example : Module (Localization D.mTheta.primeCompl) D.ML := inferInstance example : Module D.FreeAlg D.ML := inferInstance noncomputable def toML : V β†’β‚—[D.FreeAlg] D.ML := LocalizedModule.mkLinearMap D.mTheta.primeCompl V theorem algebraMap_freeAlg_smul (r : π’ͺ) (v : V) : (algebraMap π’ͺ D.FreeAlg r) β€’ v = r β€’ v := by show D.opAlgHom (algebraMap π’ͺ D.FreeAlg r) v = r β€’ v rw [AlgHom.commutes] rfl instance V_isScalarTower : IsScalarTower π’ͺ D.FreeAlg V := ⟨fun r a v => by rw [Algebra.smul_def, mul_smul, algebraMap_freeAlg_smul]⟩ example : Module π’ͺ D.ML := inferInstance example : IsScalarTower π’ͺ (Localization D.mTheta.primeCompl) D.ML := inferInstance example : IsScalarTower π’ͺ D.FreeAlg D.ML := inferInstance noncomputable def toMLβ‚’ : V β†’β‚—[π’ͺ] D.ML := D.toML.restrictScalars π’ͺ @[simp] theorem toMLβ‚’_apply (v : V) : D.toMLβ‚’ v = D.toML v := rfl end HeckeData end CohCarrier end