Module

SmoothDifferentialGeneratorTwoParameters.lean

Nyll.SchemeTheory.RingTheory.Smooth.SmoothDifferentialGeneratorTwoParameters
1 declaration indexed from sourceView source ↗

Ring Hom exists Unique eq smul kaehler Differential D of formally Smooth of maximal Ideal

eq span pair

Imports5
  • Mathlib.RingTheory.DiscreteValuationRing.Basic
  • Mathlib.RingTheory.RingHom.Smooth
  • Mathlib.RingTheory.Unramified.LocalRing
  • Mathlib.Tactic.Abel
  • Mathlib.Tactic.Ring.RingNF
Imported by2

Declarations

RingHom.existsUnique_eq_smul_kaehlerDifferential_D_of_formallySmooth_of_maximalIdeal_eq_span_pair
Source context 4 commands

Surrounding namespaces, section variables, and local commands at this declaration.

@[expose] public section
section ProofImplementation
namespace RingHom
open _root_.IsLocalRing
theorem existsUnique_eq_smul_kaehlerDifferential_D_of_formallySmooth_of_maximalIdeal_eq_span_pair
    {A : Type} [CommRing A] [IsDomain A] [IsDiscreteValuationRing A]
    (ϖ : A) (hϖ : maximalIdeal A = Ideal.span {ϖ})
    {S : Type} [CommRing S] [IsDomain S] [IsLocalRing S]
    (i : A →+* S) (hi : i.FormallySmooth) (hif : i.EssFiniteType)
    (hres : Function.Surjective ((IsLocalRing.residue S).comp i))
    (t : S) (hm : maximalIdeal S = Ideal.span {i ϖ, t}) (ht : t ∉ Ideal.span {i ϖ}) :
    let : Algebra A S := i.toAlgebra
    ∀ ω : KaehlerDifferential A S, ∃! s : S, ω = s • KaehlerDifferential.D A S t := by
  intro instAS
  classical
  have : Algebra.FormallySmooth A S := hi
  have : Algebra.EssFiniteType A S := hif
  have halg : ∀ a : A, algebraMap A S a = i a := fun _ => rfl
  set dt := KaehlerDifferential.D A S t with hdt
  have hϖm : i ϖ ∈ maximalIdeal S := by
    rw [hm]
    exact Ideal.subset_span (Or.inl rfl)
  have htm : t ∈ maximalIdeal S := by
    rw [hm]
    exact Ideal.subset_span (Or.inr rfl)
  have hgen : ∀ s : S, KaehlerDifferential.D A S s ∈
      Submodule.span S {dt} ⊔ (maximalIdeal S) • (⊤ : Submodule S (KaehlerDifferential A S)) := by
    intro s
    obtain ⟨a, ha⟩ := hres (IsLocalRing.residue S s)
    have hm' : s - i a ∈ maximalIdeal S := by
      rw [← IsLocalRing.residue_eq_zero_iff, map_sub, sub_eq_zero]; exact ha.symm
    rw [hm] at hm'
    obtain ⟨u, v, huv⟩ := Ideal.mem_span_pair.mp hm'
    have hs : s = i a + (u * i ϖ + v * t) := by rw [huv]; ring
    have hD : KaehlerDifferential.D A S s = i ϖ • KaehlerDifferential.D A S u + v • dt + t •
      KaehlerDifferential.D A S v := by
      rw [hs]
      simp only [map_add, Derivation.leibniz]
      rw [show i a = algebraMap A S a from rfl, show i ϖ = algebraMap A S ϖ from rfl,
        Derivation.map_algebraMap,
        Derivation.map_algebraMap]
      simp only [zero_add, smul_zero, hdt]
      abel
    rw [hD]
    refine Submodule.add_mem _ (Submodule.add_mem _ ?_ ?_) ?_
    · exact Submodule.mem_sup_right (Submodule.smul_mem_smul hϖm Submodule.mem_top)
    · exact Submodule.mem_sup_left (Submodule.smul_mem _ _ (Submodule.mem_span_singleton_self _))
    · exact Submodule.mem_sup_right (Submodule.smul_mem_smul htm Submodule.mem_top)
  have hspan : Submodule.span S {dt} = ⊤ := by
    apply le_antisymm le_top
    have hfg : (⊤ : Submodule S (KaehlerDifferential A S)).FG := Module.Finite.fg_top
    have hjac : maximalIdeal S ≤ Ring.jacobson S := by
      rw [IsLocalRing.ringJacobson_eq_maximalIdeal]
    apply Submodule.le_of_le_smul_of_le_jacobson hfg hjac
    intro ω _
    have hω : ω ∈ Submodule.span S (Set.range (KaehlerDifferential.D A S)) := by
      rw [KaehlerDifferential.span_range_derivation]; trivial
    exact (Submodule.span_le.mpr (by rintro _ ⟨s, rfl⟩; exact hgen s)) hω
  have hsurj : ∀ ω : KaehlerDifferential A S, ∃ s : S, ω = s • dt := by
    intro ω
    have : ω ∈ Submodule.span S {dt} := by rw [hspan]; trivial
    obtain ⟨s, hs⟩ := Submodule.mem_span_singleton.mp this
    exact ⟨s, hs.symm⟩
  have : IsLocalHom (algebraMap A S) := by
    refine ⟨fun a ha => ?_⟩
    by_contra hna
    have : a ∈ maximalIdeal A := (IsLocalRing.mem_maximalIdeal _).mpr hna
    rw [hϖ] at this
    obtain ⟨c, rfl⟩ := Ideal.mem_span_singleton'.mp this
    apply (IsLocalRing.mem_maximalIdeal _).mp (Ideal.mul_mem_left _ (i c) hϖm)
    rw [← map_mul]; exact ha
  have hnon : Nontrivial (KaehlerDifferential A S) := by
    by_contra hsub
    rw [not_nontrivial_iff_subsingleton] at hsub
    have : Algebra.FormallyUnramified A S := (Algebra.formallyUnramified_iff A S).mpr hsub
    have hmax := Algebra.FormallyUnramified.map_maximalIdeal (R := A) (S := S)
    apply ht
    have h1 := htm
    rw [← hmax, hϖ, Ideal.map_span, Set.image_singleton] at h1
    exact h1
  have : Module.Free S (KaehlerDifferential A S) := Module.free_of_flat_of_isLocalRing
  have hinj : ∀ s : S, s • dt = 0 → s = 0 := by
    let b := Module.Free.chooseBasis S (KaehlerDifferential A S)
    have : Nonempty (Module.Free.ChooseBasisIndex S (KaehlerDifferential A S)) := by
      by_contra hne
      rw [not_nonempty_iff] at hne
      apply not_subsingleton (KaehlerDifferential A S)
      exact b.repr.toEquiv.subsingleton_congr.mpr inferInstance
    obtain ⟨j⟩ := this
    obtain ⟨s₀, hs₀⟩ := hsurj (b j)
    let f : S →ₗ[S] S := (b.coord j).comp (LinearMap.toSpanSingleton S _ dt)
    have hf : ∀ s, f s = b.coord j (s • dt) := fun s => rfl
    have hfsurj : Function.Surjective f := by
      intro c
      refine ⟨c * s₀, ?_⟩
      rw [hf, mul_smul, ← hs₀, map_smul, Module.Basis.coord_apply, Module.Basis.repr_self,
        Finsupp.single_eq_same,
        smul_eq_mul, mul_one]
    have hfinj := OrzechProperty.injective_of_surjective_endomorphism f hfsurj
    intro s hs
    apply hfinj
    rw [hf, hs, map_zero, map_zero]
  intro ω
  obtain ⟨s, hs⟩ := hsurj ω
  refine ⟨s, hs, fun s' hs' => ?_⟩
  have : (s' - s) • dt = 0 := by rw [sub_smul, ← hs, ← hs', sub_self]
  exact sub_eq_zero.mp (hinj _ this)