import Mathlib import Definitions.Def_Deformations_ProartinianCat set_option autoImplicit false universe u open CategoryTheory IsLocalRing TrivSqZeroExt open scoped DualNumber namespace Deformation local notation3:max "𝓴" π“ž:max => (IsLocalRing.ResidueField π“ž) namespace ProartinianCat variable (π“ž : Type u) [CommRing π“ž] [IsLocalRing π“ž] instance : Module.Finite (𝓴 π“ž) ((𝓴 π“ž)[Ξ΅]) := inferInstanceAs (Module.Finite (𝓴 π“ž) ((𝓴 π“ž) Γ— (𝓴 π“ž))) instance : IsArtinianRing ((𝓴 π“ž)[Ξ΅]) := IsArtinianRing.of_finite (𝓴 π“ž) ((𝓴 π“ž)[Ξ΅]) instance : TopologicalSpace ((𝓴 π“ž)[Ξ΅]) := βŠ₯ instance : DiscreteTopology ((𝓴 π“ž)[Ξ΅]) := ⟨rfl⟩ instance : IsLocalHom (algebraMap π“ž ((𝓴 π“ž)[Ξ΅])) where map_nonunit a ha := by rw [show algebraMap π“ž ((𝓴 π“ž)[Ξ΅]) a = TrivSqZeroExt.inl (algebraMap π“ž (𝓴 π“ž) a) from rfl, TrivSqZeroExt.isUnit_inl_iff] at ha exact (isUnit_map_iff (algebraMap π“ž (𝓴 π“ž)) a).mp ha lemma residue_inl_fst_eq (y : (𝓴 π“ž)[Ξ΅]) : residue ((𝓴 π“ž)[Ξ΅]) (TrivSqZeroExt.inl y.fst) = residue ((𝓴 π“ž)[Ξ΅]) y := by refine Ideal.Quotient.eq.mpr ?_ have h3 : TrivSqZeroExt.inl y.fst - y = -TrivSqZeroExt.inr y.snd := by ext <;> simp rw [h3] refine neg_mem (IsLocalRing.mem_maximalIdeal _ |>.mpr ?_) rw [mem_nonunits_iff, TrivSqZeroExt.isUnit_inr_iff] exact fun h => (not_subsingleton (𝓴 π“ž)) h instance : IsResidueAlgebra π“ž ((𝓴 π“ž)[Ξ΅]) where isSurjective' := by intro x obtain ⟨y, rfl⟩ := Ideal.Quotient.mk_surjective x obtain ⟨a, ha⟩ := IsLocalRing.residue_surjective (R := π“ž) y.fst refine ⟨a, ?_⟩ have h1 : algebraMap π“ž ((𝓴 π“ž)[Ξ΅]) a = TrivSqZeroExt.inl y.fst := by rw [show algebraMap π“ž ((𝓴 π“ž)[Ξ΅]) a = TrivSqZeroExt.inl (algebraMap π“ž (𝓴 π“ž) a) from rfl, show algebraMap π“ž (𝓴 π“ž) a = residue π“ž a from rfl, ha] calc algebraMap π“ž (𝓴 ((𝓴 π“ž)[Ξ΅])) a = residue ((𝓴 π“ž)[Ξ΅]) (algebraMap π“ž ((𝓴 π“ž)[Ξ΅]) a) := rfl _ = residue ((𝓴 π“ž)[Ξ΅]) (TrivSqZeroExt.inl y.fst) := by rw [h1] _ = (Ideal.Quotient.mk (maximalIdeal ((𝓴 π“ž)[Ξ΅]))) y := residue_inl_fst_eq π“ž y instance : IsLocalProartinianAlgebra π“ž ((𝓴 π“ž)[Ξ΅]) := ⟨⟩ noncomputable def dualNumbers : ProartinianCat π“ž := .of π“ž ((𝓴 π“ž)[Ξ΅]) instance : DiscreteTopology (dualNumbers π“ž) := inferInstanceAs (DiscreteTopology ((𝓴 π“ž)[Ξ΅])) noncomputable def dualNumbersFst : dualNumbers π“ž ⟢ residueField where hom := ⟨TrivSqZeroExt.fstHom π“ž (𝓴 π“ž) (𝓴 π“ž), continuous_of_discreteTopology⟩ lemma eq_dualNumbersFst (f : dualNumbers π“ž ⟢ residueField) : f = dualNumbersFst π“ž := Subsingleton.elim _ _ end ProartinianCat end Deformation