Algebra.exists_smooth_surjective_localizationAway_basis_kaehlerDifferential_comap_eq_span
Source context 7 commands
Surrounding namespaces, section variables, and local commands at this declaration.
@[expose] public section
section
/-
Anthropic FLT upstream notice: Copyright 2026 Anthropic, PBC.
Released under Apache 2.0 license as described in the file LICENSE.
Adapted Anthropic FLT source (pinned revision):
https://github.com/anthropics/fermats-last-theorem/blob/6e837e75355538c7f80bab5b956861e86c4eacc2/P2M/Sol/S_Algebra_exists_smooth_surjective_localizationAway_basis_kaehlerDifferential_comap_eq_span.lean
Upstream NOTICE: https://github.com/anthropics/fermats-last-theorem/blob/6e837e75355538c7f80bab5b956861e86c4eacc2/NOTICE
Upstream per-file ATTRIBUTION: https://github.com/anthropics/fermats-last-theorem/blob/6e837e75355538c7f80bab5b956861e86c4eacc2/ATTRIBUTION.md
Copies of these notices are retained in the AbelianVarieties directory.
Existing upstream author/copyright comments in the source are retained below.
Local adaptation and maintenance: Naganori Yamaguchi (https://github.com/n-yamaguchi-0729).
AI assistance in local adaptation and maintenance: OpenAI Codex.
-/
namespace Algebra
open SchemeTheory.SmoothCharts
open _root_.KaehlerDifferential _root_.TensorProduct _root_.MvPolynomial
open scoped TensorProduct
universe u v
Lean source · full declarationtheorem exists_smooth_surjective_localizationAway_basis_kaehlerDifferential_comap_eq_span
{R : Type u} [CommRing R] [IsDomain R] [IsDiscreteValuationRing R]
(π : R) (hπ : IsLocalRing.maximalIdeal R = Ideal.span {π})
{A : Type u} [CommRing A] [Algebra R A] [Algebra.FiniteType R A]
(J : Ideal A) (hπJ : algebraMap R A π ∈ J)
[Algebra (IsLocalRing.ResidueField R) (A ⧸ J)] [IsScalarTower R (IsLocalRing.ResidueField R) (A
⧸ J)]
(𝔭 : Ideal A) [𝔭.IsPrime]
(𝔮 : Ideal (A ⧸ J)) [𝔮.IsPrime] (h𝔮 : 𝔮.comap (Ideal.Quotient.mk J) = 𝔭)
(hsmooth : Algebra.IsSmoothAt (IsLocalRing.ResidueField R) 𝔮)
(hfree : (⟨𝔮, ‹_›⟩ : PrimeSpectrum (A ⧸ J)) ∈ Module.freeLocus (A ⧸ J) ((A ⧸ J) ⊗[A] Ω[A⁄R])) :
∃ (g : A) (_ : g ∉ 𝔭) (r n : ℕ) (C : Type u) (_ : CommRing C) (_ : Algebra R C)
(_ : Algebra C (Localization.Away g)) (_ : IsScalarTower R C (Localization.Away g)),
Algebra.Smooth R C ∧ Function.Surjective (algebraMap C (Localization.Away g)) ∧
∃ (y : Fin r → C) (z : Fin n → C) (b : Module.Basis (Fin r ⊕ Fin n) C Ω[C⁄R]),
(∀ i, b (Sum.inl i) = D R C (y i)) ∧ (∀ j, b (Sum.inr j) = D R C (z j)) ∧
Ideal.comap (algebraMap C (Localization.Away g)) (J.map (algebraMap A (Localization.Away
g))) =
Ideal.span (insert (algebraMap R C π) (Set.range z)) ∧
LinearIndependent (C ⧸ Ideal.span (insert (algebraMap R C π) (Set.range z)))
fun j : Fin n => (1 : C ⧸ Ideal.span (insert (algebraMap R C π) (Set.range z))) ⊗ₜ[C]
D R (Localization.Away g) (algebraMap C (Localization.Away g) (z j)) := by
classical
set k : Type u := IsLocalRing.ResidueField R with hkdef
have : IsNoetherianRing R := inferInstance
have hAfp : Algebra.FinitePresentation R A := Algebra.FinitePresentation.of_finiteType.mp
inferInstance
have hk : Function.Surjective (algebraMap R k) := Ideal.Quotient.mk_surjective
have hJ𝔭 : J ≤ 𝔭 := by
intro x hx; rw [← h𝔮, Ideal.mem_comap]; rw [Ideal.Quotient.eq_zero_iff_mem.mpr hx]; exact
Ideal.zero_mem _
obtain ⟨r, n, yb, zb, hzb, ⟨b₀, hb₀⟩, ⟨b₁, hb₁⟩, hrank⟩ := ResidueBasis.fibreBasis k hk J 𝔭 𝔮 h𝔮
obtain ⟨g₁, hg₁, C, iC, iRC, iCA, iT, hCstd, hθ, W, b, hW, hb⟩ :=
MinimalAmbient.main
𝔭 (Sum.elim yb zb) b₀ hb₀
have : Module.FinitePresentation (A ⧸ J) ((A ⧸ J) ⊗[A] Ω[A⁄R]) := inferInstance
obtain ⟨t, ht, bM, hbM⟩ :=
Module.FinitePresentation.exists_notMem_basis_localizedModule_of_basis_residueField_tensor
𝔮 hfree (fun i => (1 : A ⧸ J) ⊗ₜ[A] D R A (Sum.elim yb zb i)) b₁ hb₁
obtain ⟨g₂, hg₂t⟩ := Ideal.Quotient.mk_surjective t
have hg₂ : g₂ ∉ 𝔭 := by rw [← h𝔮, Ideal.mem_comap, hg₂t]; exact ht
set A₁ : Type u := Localization.Away g₁ with hA₁
set JC : Ideal C := Ideal.span (insert (algebraMap R C π) (Set.range (W ∘ Sum.inr))) with hJCdef
set I₁ : Ideal C := Ideal.comap (algebraMap C A₁) (J.map (algebraMap A A₁)) with hI₁
have hJCI : JC ≤ I₁ := by
rw [hJCdef, Ideal.span_le]
rintro x (rfl | ⟨j, rfl⟩)
· change algebraMap R C π ∈ I₁
rw [hI₁, Ideal.mem_comap, ← IsScalarTower.algebraMap_apply, IsScalarTower.algebraMap_apply R A
A₁]
exact Ideal.mem_map_of_mem _ hπJ
· change W (Sum.inr j) ∈ I₁
rw [hI₁, Ideal.mem_comap, hW]
exact Ideal.mem_map_of_mem _ (hzb j)
set B : Type u := C ⧸ JC with hB
have hπB : ∀ x ∈ IsLocalRing.maximalIdeal R, algebraMap R B x = 0 := by
intro x hx
rw [hπ, Ideal.mem_span_singleton] at hx
obtain ⟨y, rfl⟩ := hx
change Ideal.Quotient.mk JC (algebraMap R C (π * y)) = 0
have hπJC : algebraMap R C π ∈ JC := Ideal.subset_span (Set.mem_insert _ _)
rw [map_mul, map_mul, Ideal.Quotient.eq_zero_iff_mem.mpr hπJC, zero_mul]
let iKB : Algebra k B := (Ideal.Quotient.lift (IsLocalRing.maximalIdeal R) (algebraMap R B)
hπB).toAlgebra
have : IsScalarTower R k B := IsScalarTower.of_algebraMap_eq' (by
ext x
exact (Ideal.Quotient.lift_mk (IsLocalRing.maximalIdeal R) (algebraMap R B) hπB).symm)
obtain ⟨hBft, hBsm, hBrank⟩ := ChartTransport.quot_smooth_and_rank π hπ hCstd W b hb JC hJCdef
set gb₁ : A ⧸ J := Ideal.Quotient.mk J g₁ with hgb₁
have hgb₁𝔮 : gb₁ ∉ 𝔮 := by rw [← h𝔮, Ideal.mem_comap] at hg₁; exact hg₁
set L : Type u := Localization.Away gb₁ with hL
have : Algebra.FiniteType R (A ⧸ J) := inferInstance
have : Algebra.FiniteType k (A ⧸ J) := Algebra.FiniteType.of_restrictScalars_finiteType R k (A ⧸
J)
obtain ⟨𝔮', i𝔮', h𝔮', hsm', hrank'⟩ :=
LocalizedCentre.centre_localized_smooth_and_rank k (A ⧸ J) 𝔮 hsmooth r hrank gb₁ hgb₁𝔮 L
have hunit : IsUnit (((algebraMap (A ⧸ J) L).comp (Ideal.Quotient.mk J)) g₁) :=
IsLocalization.Away.algebraMap_isUnit gb₁
set lam₁ : A₁ →+* L := IsLocalization.Away.lift g₁ hunit with hlam₁
have hlam₁ : ∀ x : A, lam₁ (algebraMap A A₁ x) = algebraMap (A ⧸ J) L (Ideal.Quotient.mk J x) :=
fun x => IsLocalization.Away.lift_eq g₁ hunit x
set ψ₀ : C →+* L := lam₁.comp (algebraMap C A₁) with hψ₀
have hlamJ : ∀ x ∈ J, lam₁ (algebraMap A A₁ x) = 0 := fun x hx => by
rw [hlam₁, Ideal.Quotient.eq_zero_iff_mem.mpr hx, map_zero]
have hψ₀J : ∀ x ∈ JC, ψ₀ x = 0 := by
have hle : JC ≤ RingHom.ker ψ₀ := by
rw [hJCdef, Ideal.span_le]
rintro x (rfl | ⟨j, rfl⟩)
· simp only [SetLike.mem_coe, RingHom.mem_ker, hψ₀, RingHom.comp_apply]
rw [← IsScalarTower.algebraMap_apply R C A₁, IsScalarTower.algebraMap_apply R A A₁]
exact hlamJ _ hπJ
· simp only [SetLike.mem_coe, RingHom.mem_ker, hψ₀, RingHom.comp_apply, Function.comp_apply]
rw [hW, Sum.elim_inr]
exact hlamJ _ (hzb j)
exact fun x hx => hle hx
set ψ₁ : B →+* L := Ideal.Quotient.lift JC ψ₀ hψ₀J with hψ₁
have hψ₁k : ∀ x : k, ψ₁ (algebraMap k B x) = algebraMap k L x := by
intro x
obtain ⟨r', rfl⟩ := hk x
rw [← IsScalarTower.algebraMap_apply R k B, IsScalarTower.algebraMap_apply R C B,
Ideal.Quotient.algebraMap_eq, hψ₁, Ideal.Quotient.lift_mk, hψ₀, RingHom.comp_apply,
← IsScalarTower.algebraMap_apply R C A₁, IsScalarTower.algebraMap_apply R A A₁, hlam₁,
IsScalarTower.algebraMap_apply k (A ⧸ J) L, ← IsScalarTower.algebraMap_apply R k (A ⧸ J),
IsScalarTower.algebraMap_apply R A (A ⧸ J), Ideal.Quotient.algebraMap_eq]
let ψ : B →ₐ[k] L := AlgHom.mk ψ₁ hψ₁k
have e1 : lam₁ (algebraMap A A₁ g₁) = algebraMap (A ⧸ J) L gb₁ :=
(hlam₁ g₁).trans (congrArg (algebraMap (A ⧸ J) L) hgb₁).symm
have hlam₁surj : Function.Surjective lam₁ := by
intro zL
obtain ⟨m, ā, hm⟩ := IsLocalization.Away.surj gb₁ zL
obtain ⟨a₀, rfl⟩ := Ideal.Quotient.mk_surjective ā
refine ⟨IsLocalization.mk' A₁ a₀ (⟨g₁ ^ m, m, rfl⟩ : Submonoid.powers g₁), ?_⟩
have hu : IsUnit (algebraMap (A ⧸ J) L gb₁ ^ m) := (IsLocalization.Away.algebraMap_isUnit
gb₁).pow m
apply hu.mul_left_injective
change lam₁ _ * algebraMap (A ⧸ J) L gb₁ ^ m = zL * algebraMap (A ⧸ J) L gb₁ ^ m
rw [hm, ← e1, ← map_pow, ← map_mul, ← map_pow]
erw [IsLocalization.mk'_spec]
rw [hlam₁]
have hψ : Function.Surjective ψ := by
intro zL
obtain ⟨y, hy⟩ := hlam₁surj zL
obtain ⟨c, rfl⟩ := hθ y
refine ⟨Ideal.Quotient.mk JC c, ?_⟩
change ψ₁ (Ideal.Quotient.mk JC c) = zL
rw [hψ₁, Ideal.Quotient.lift_mk, hψ₀, RingHom.comp_apply, hy]
set v : Ideal B := 𝔮'.comap ψ.toRingHom with hv
have : v.IsPrime := Ideal.comap_isPrime _ _
have : Algebra.FiniteType k B := hBft
have : Algebra.Smooth k B := hBsm
obtain ⟨t₃, ht₃, hker⟩ :=
Algebra.exists_notMem_map_ker_eq_bot_of_surjective_of_isSmoothAt_of_finrank_le
ψ hψ 𝔮' v rfl hsm' ((hBrank v).trans hrank'.symm.le)
have : ∃ (c : C) (a : A), a ∉ 𝔭 ∧ g₂ ∣ a ∧ algebraMap C A₁ c = algebraMap A A₁ a ∧
(I₁.map (algebraMap C (Localization.Away c)) = JC.map (algebraMap C (Localization.Away c)))
:= by
obtain ⟨c₃, rfl⟩ := Ideal.Quotient.mk_surjective t₃
obtain ⟨m, a₃, hm⟩ := IsLocalization.Away.surj g₁ (algebraMap C A₁ c₃)
obtain ⟨u₁, hu₁⟩ := hθ (algebraMap A A₁ (g₁ ^ m))
obtain ⟨u₂, hu₂⟩ := hθ (algebraMap A A₁ g₂)
have ha₃ : a₃ ∉ 𝔭 := by
intro ha₃
have h1 : lam₁ (algebraMap A A₁ a₃) ∈ 𝔮' := by
rw [hlam₁]
have : Ideal.Quotient.mk J a₃ ∈ 𝔮 := by rw [← h𝔮, Ideal.mem_comap] at ha₃; exact ha₃
rw [← h𝔮'] at this
exact this
rw [← hm, map_mul, map_pow] at h1
rcases (Ideal.IsPrime.mem_or_mem i𝔮' h1) with h2 | h2
· apply ht₃
rw [hv, Ideal.mem_comap]
change ψ₁ (Ideal.Quotient.mk JC c₃) ∈ 𝔮'
rwa [hψ₁, Ideal.Quotient.lift_mk, hψ₀, RingHom.comp_apply]
· have hu : IsUnit (lam₁ (algebraMap A A₁ g₁) ^ m) := by
rw [e1]; exact (IsLocalization.Away.algebraMap_isUnit gb₁).pow m
exact (Ideal.IsPrime.ne_top i𝔮') (Ideal.eq_top_of_isUnit_mem _ h2 hu)
refine ⟨c₃ * u₁ * u₂, a₃ * g₂, ?_, dvd_mul_left _ _, ?_, ?_⟩
· exact fun h => (Ideal.IsPrime.mem_or_mem ‹𝔭.IsPrime› h).elim ha₃ hg₂
· rw [map_mul, map_mul, hu₁, hu₂, map_mul, ← hm, map_pow]
· set Cc : Type u := Localization.Away (c₃ * u₁ * u₂) with hCc
apply le_antisymm
· rw [Ideal.map_le_iff_le_comap]
intro x hx
rw [Ideal.mem_comap]
have hxker : Ideal.Quotient.mk JC x ∈ RingHom.ker ψ.toRingHom := by
rw [RingHom.mem_ker]
change ψ₁ (Ideal.Quotient.mk JC x) = 0
rw [hψ₁, Ideal.Quotient.lift_mk, hψ₀, RingHom.comp_apply]
rw [hI₁, Ideal.mem_comap] at hx
have : J.map (algebraMap A A₁) ≤ RingHom.ker lam₁ := by
rw [Ideal.map_le_iff_le_comap]; intro y hy; exact hlamJ y hy
exact this hx
have h0 : algebraMap B (Localization.Away (Ideal.Quotient.mk JC c₃)) (Ideal.Quotient.mk JC
x) = 0 := by
have := Ideal.mem_map_of_mem (algebraMap B (Localization.Away (Ideal.Quotient.mk JC c₃)))
hxker
rwa [hker, Ideal.mem_bot] at this
rw [IsLocalization.map_eq_zero_iff (Submonoid.powers (Ideal.Quotient.mk JC c₃))] at h0
obtain ⟨⟨_, ⟨m', rfl⟩⟩, hm'⟩ := h0
have hmem : c₃ ^ m' * x ∈ JC := by
rw [← Ideal.Quotient.eq_zero_iff_mem, map_mul, map_pow]; exact hm'
have hc₃unit : IsUnit (algebraMap C Cc (c₃ ^ m')) := by
rw [map_pow]; refine IsUnit.pow _ ?_
exact IsLocalization.Away.isUnit_of_dvd (c₃ * u₁ * u₂) ⟨u₁ * u₂, by ring⟩
have := Ideal.mem_map_of_mem (algebraMap C Cc) hmem
rw [map_mul] at this
exact (Ideal.unit_mul_mem_iff_mem _ hc₃unit).mp this
· exact Ideal.map_mono hJCI
obtain ⟨c, a, ha, hg₂a, hca, hIdeal⟩ := this
exact ChartTransport.finalTransport π J 𝔭 yb zb g₁ hg₁ C hCstd hθ W b hW hb c a ha hca hIdeal g₂
hg₂a
(fun S _ _ _ _ M _ hu => LocalizedBasis.linIndep_of_basis_localizedModule J t (Sum.elim yb zb)
bM hbM S M (by
rw [← hg₂t]
exact hu.map (algebraMap S (S ⧸ J.map (algebraMap A S)))) |>.comp Sum.inr Sum.inr_injective)