Source context 6 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_NeronModelInfra_exists_opens_inter_closure_eq_setOf_isSmoothAt_and_mem_freeLocus.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 NeronModelInfra.SmootheningStrata
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry NeronModelInfra TensorProduct
universe u
open SpecialFibreStrata
Lean source · full declarationtheorem _root_.NeronModelInfra.exists_opens_inter_closure_eq_setOf_isSmoothAt_and_mem_freeLocus
{R : Type u} [CommRing R] [IsDomain R] [IsDiscreteValuationRing R]
{X : Scheme.{u}} (f : X ⟶ Spec (CommRingCat.of R)) [LocallyOfFiniteType f] (S : Set X)
(hS : ∀ s ∈ S, ∃ (R' : Type u) (_ : CommRing R') (_ : IsDomain R') (_ :
IsDiscreteValuationRing R') (_ : Algebra R R')
(_ : IsLocalHom (algebraMap R R')) (_ : IsIndexOneExtension R R')
(x : SchemeHomOver (Spec.map (CommRingCat.ofHom (algebraMap R R'))) f), x.1
(IsLocalRing.closedPoint R') = s)
(_hSk : ∀ s ∈ S, f s = IsLocalRing.closedPoint R)
(U : X.Opens) (hU : IsAffineOpen U) :
let : Algebra R Γ(X, U) := f.sectionsAlgebra U
let J : Ideal Γ(X, U) :=
PrimeSpectrum.vanishingIdeal ((fun z : U => hU.primeIdealOf z) '' {z : U | (z : X) ∈
closure S})
∃ W : X.Opens, (W : Set X) ⊆ U ∧
((closure S ∩ (U : Set X)).Nonempty → (closure S ∩ (W : Set X)).Nonempty) ∧
∀ (y : X) (hyU : y ∈ U), y ∈ closure S →
(y ∈ W ↔
∀ (𝔮 : Ideal (Γ(X, U) ⧸ J)) [𝔮.IsPrime],
𝔮.comap (Ideal.Quotient.mk J) = (hU.primeIdealOf ⟨y, hyU⟩).asIdeal →
(∀ [Algebra (IsLocalRing.ResidueField R) (Γ(X, U) ⧸ J)]
[IsScalarTower R (IsLocalRing.ResidueField R) (Γ(X, U) ⧸ J)],
Algebra.IsSmoothAt (IsLocalRing.ResidueField R) 𝔮) ∧
(⟨𝔮, ‹_›⟩ : PrimeSpectrum (Γ(X, U) ⧸ J)) ∈
Module.freeLocus (Γ(X, U) ⧸ J) ((Γ(X, U) ⧸ J) ⊗[Γ(X, U)] Ω[Γ(X, U)⁄R])) := by
intro iRA J
set S₀ : Set (PrimeSpectrum Γ(X, U)) := (fun z : U => hU.primeIdealOf z) '' {z : U | (z : X) ∈ S}
with hS₀def
have hT : (fun z : U => hU.primeIdealOf z) '' {z : U | (z : X) ∈ closure S} = closure S₀ :=
image_primeIdealOf_closure hU S
have hJ : J = PrimeSpectrum.vanishingIdeal S₀ := by
change PrimeSpectrum.vanishingIdeal _ = _
rw [hT, PrimeSpectrum.vanishingIdeal_closure]
have hZ : PrimeSpectrum.zeroLocus (J : Set Γ(X, U)) = closure S₀ := by
rw [hJ, PrimeSpectrum.zeroLocus_vanishingIdeal_eq_closure]
have hrange : Set.range (PrimeSpectrum.comap (Ideal.Quotient.mk J)) = closure S₀ := by
rw [range_comap_of_surjective _ _ Ideal.Quotient.mk_surjective, Ideal.mk_ker, hZ]
have key : ∀ p ∈ S₀, ∃ (R' : Type u) (_ : CommRing R') (_ : IsLocalRing R') (_ : Algebra R R')
(_ : IsLocalHom (algebraMap R R')),
Algebra.FormallySmooth (IsLocalRing.ResidueField R) (IsLocalRing.ResidueField R') ∧
∃ c : Γ(X, U) →ₐ[R] R', (IsLocalRing.maximalIdeal R').comap c = p.asIdeal := by
rintro p ⟨z, hz, rfl⟩
obtain ⟨R', _, _, _, _, _, hidx, x, hx⟩ := hS z hz
have hxU : x.1 (IsLocalRing.closedPoint R') ∈ U := by rw [hx]; exact z.2
obtain ⟨c₀, hc₀⟩ :=
NeronModelInfra.exists_algHom_comap_maximalIdeal_eq_primeIdealOf_of_apply_closedPoint_mem
f R' x U hU hxU
let c : Γ(X, U) →ₐ[R] R' := c₀
have hc : (IsLocalRing.maximalIdeal R').comap c =
(hU.primeIdealOf ⟨x.1 (IsLocalRing.closedPoint R'), hxU⟩).asIdeal := hc₀
have hz' : (⟨x.1 (IsLocalRing.closedPoint R'), hxU⟩ : U) = z := Subtype.ext hx
refine ⟨R', inferInstance, inferInstance, inferInstance, inferInstance,
hidx.formallySmooth_residueField, c, ?_⟩
rw [hc, hz']
have hmJ : ∀ r ∈ IsLocalRing.maximalIdeal R, algebraMap R Γ(X, U) r ∈ J := by
intro r hr
rw [hJ, PrimeSpectrum.mem_vanishingIdeal]
intro p hp
obtain ⟨R', _, _, _, _, -, c, hc⟩ := key p hp
rw [← hc, Ideal.mem_comap, AlgHom.commutes]
exact (IsLocalRing.mem_maximalIdeal _).2
((map_mem_nonunits_iff (algebraMap R R') r).2 ((IsLocalRing.mem_maximalIdeal r).1 hr))
have hmB : ∀ r ∈ IsLocalRing.maximalIdeal R, algebraMap R (Γ(X, U) ⧸ J) r = 0 := by
intro r hr
rw [← Ideal.Quotient.mk_algebraMap]
exact Ideal.Quotient.eq_zero_iff_mem.mpr (hmJ r hr)
let ikB : Algebra (IsLocalRing.ResidueField R) (Γ(X, U) ⧸ J) := residueFieldAlgebra hmB
have itow : IsScalarTower R (IsLocalRing.ResidueField R) (Γ(X, U) ⧸ J) :=
isScalarTower_residueFieldAlgebra hmB
have : IsReduced (Γ(X, U) ⧸ J) :=
(Ideal.isRadical_iff_quotient_reduced J).1 (PrimeSpectrum.isRadical_vanishingIdeal _)
have iFT : Algebra.FiniteType R Γ(X, U) := finiteType_chart f U hU
have : Algebra.FiniteType R (Γ(X, U) ⧸ J) := inferInstance
have : Algebra.FiniteType (IsLocalRing.ResidueField R) (Γ(X, U) ⧸ J) :=
Algebra.FiniteType.of_restrictScalars_finiteType R _ _
have : Algebra.FinitePresentation R Γ(X, U) := Algebra.FinitePresentation.of_finiteType.1 iFT
have : Module.FinitePresentation Γ(X, U) Ω[Γ(X, U)⁄R] := inferInstance
set S' : Set (PrimeSpectrum (Γ(X, U) ⧸ J)) := PrimeSpectrum.comap (Ideal.Quotient.mk J) ⁻¹' S₀
with hS'def
have hdense : ∀ g : Γ(X, U) ⧸ J, (∀ 𝔰 ∈ S', g ∈ 𝔰.asIdeal) → g = 0 := by
intro g hg
obtain ⟨a, rfl⟩ := Ideal.Quotient.mk_surjective g
refine Ideal.Quotient.eq_zero_iff_mem.2 ?_
rw [hJ, PrimeSpectrum.mem_vanishingIdeal]
intro p hp
obtain ⟨𝔰, rfl⟩ : p ∈ Set.range (PrimeSpectrum.comap (Ideal.Quotient.mk J)) := by
rw [hrange]; exact subset_closure hp
exact Ideal.mem_comap.1 (hg 𝔰 hp)
have hsep : ∀ 𝔰 ∈ S', ∃ (K : Type u) (_ : Field K) (_ : Algebra (IsLocalRing.ResidueField R) K),
Algebra.FormallySmooth (IsLocalRing.ResidueField R) K ∧
Nonempty (𝔰.asIdeal.ResidueField →ₐ[IsLocalRing.ResidueField R] K) := by
intro 𝔰 h𝔰
obtain ⟨R', _, _, _, _, hfs, c, hc⟩ := key _ h𝔰
have hc' : ∀ a : Γ(X, U), Ideal.Quotient.mk J a ∈ 𝔰.asIdeal ↔ c a ∈ IsLocalRing.maximalIdeal
R' := by
intro a
have h1 : a ∈ (IsLocalRing.maximalIdeal R').comap c ↔ c a ∈ IsLocalRing.maximalIdeal R' :=
Ideal.mem_comap
rw [← h1, hc]
exact Ideal.mem_comap.symm
let ψ₀ : Γ(X, U) ⧸ J →+* IsLocalRing.ResidueField R' :=
Ideal.Quotient.lift J ((IsLocalRing.residue R').comp c.toRingHom) fun a ha => by
have : Ideal.Quotient.mk J a ∈ 𝔰.asIdeal := by
rw [Ideal.Quotient.eq_zero_iff_mem.2 ha]; exact 𝔰.asIdeal.zero_mem
change IsLocalRing.residue R' (c a) = 0
exact (IsLocalRing.residue_eq_zero_iff _).2 ((hc' a).1 this)
have hψcomm : ∀ x, ψ₀ (algebraMap (IsLocalRing.ResidueField R) (Γ(X, U) ⧸ J) x) =
algebraMap (IsLocalRing.ResidueField R) (IsLocalRing.ResidueField R') x := by
intro x
obtain ⟨r, rfl⟩ := IsLocalRing.residue_surjective x
change IsLocalRing.residue R' (c (algebraMap R Γ(X, U) r)) = _
rw [AlgHom.commutes, IsLocalRing.ResidueField.algebraMap_residue]
let ψ : Γ(X, U) ⧸ J →ₐ[IsLocalRing.ResidueField R] IsLocalRing.ResidueField R' := AlgHom.mk
ψ₀ hψcomm
have hψ : ∀ a, ψ (Ideal.Quotient.mk J a) = IsLocalRing.residue R' (c a) := fun a => rfl
refine ⟨IsLocalRing.ResidueField R', inferInstance, inferInstance, hfs,
⟨Ideal.ResidueField.liftₐ 𝔰.asIdeal ψ ?_ ?_⟩⟩
· intro x hx
obtain ⟨a, rfl⟩ := Ideal.Quotient.mk_surjective x
rw [RingHom.mem_ker]
change ψ (Ideal.Quotient.mk J a) = 0
rw [hψ]
exact (IsLocalRing.residue_eq_zero_iff _).2 ((hc' a).1 hx)
· intro x hx
obtain ⟨a, rfl⟩ := Ideal.Quotient.mk_surjective x
rw [Submonoid.mem_comap, IsUnit.mem_submonoid_iff]
change IsUnit (ψ (Ideal.Quotient.mk J a))
rw [hψ]
exact isUnit_iff_ne_zero.2 fun h0 => hx ((hc' a).2 ((IsLocalRing.residue_eq_zero_iff _).1
h0))
obtain ⟨hopen, hmin⟩ :=
Algebra.isOpen_setOf_isSmoothAt_and_mem_freeLocus_and_minimalPrimes_subset
(k := IsLocalRing.ResidueField R) Ω[Γ(X, U)⁄R] J S' hdense hsep
obtain ⟨O, hO, hOG⟩ :=
((PrimeSpectrum.isClosedEmbedding_comap_of_surjective _ _
Ideal.Quotient.mk_surjective).isInducing.isOpen_iff).1 hopen
have hGiff : ∀ 𝔮 : PrimeSpectrum (Γ(X, U) ⧸ J), PrimeSpectrum.comap (Ideal.Quotient.mk J) 𝔮 ∈ O ↔
(Algebra.IsSmoothAt (IsLocalRing.ResidueField R) 𝔮.asIdeal ∧
𝔮 ∈ Module.freeLocus (Γ(X, U) ⧸ J) ((Γ(X, U) ⧸ J) ⊗[Γ(X, U)] Ω[Γ(X, U)⁄R])) := fun 𝔮 =>
Set.ext_iff.1 hOG 𝔮
let W : X.Opens := hU.fromSpec ''ᵁ ⟨O, hO⟩
have hWmem : ∀ (y : X) (hy : y ∈ U), y ∈ W ↔ hU.primeIdealOf ⟨y, hy⟩ ∈ O := by
intro y hy
have := hU.fromSpec.apply_mem_image_iff (U := ⟨O, hO⟩) (x := hU.primeIdealOf ⟨y, hy⟩)
rw [hU.fromSpec_primeIdealOf] at this
exact this
refine ⟨W, ?_, ?_, ?_⟩
· rintro x ⟨q, -, rfl⟩
have := hU.range_fromSpec
rw [Set.ext_iff] at this
exact (this _).1 ⟨q, rfl⟩
· rintro ⟨x, hxc, hxU⟩
obtain ⟨𝔮₁, h𝔮₁⟩ : hU.primeIdealOf ⟨x, hxU⟩ ∈ Set.range (PrimeSpectrum.comap
(Ideal.Quotient.mk J)) := by
rw [hrange, ← hT]; exact ⟨⟨x, hxU⟩, hxc, rfl⟩
obtain ⟨q, hqmin, -⟩ :=
Ideal.exists_minimalPrimes_le (I := (⊥ : Ideal (Γ(X, U) ⧸ J))) (J := 𝔮₁.asIdeal) bot_le
have hqprime : q.IsPrime := hqmin.1.1
have hqO : PrimeSpectrum.comap (Ideal.Quotient.mk J) ⟨q, hqprime⟩ ∈ O :=
(hGiff _).2 (hmin ⟨q, hqprime⟩ hqmin)
obtain ⟨z, hz, hzq⟩ : PrimeSpectrum.comap (Ideal.Quotient.mk J) ⟨q, hqprime⟩ ∈
(fun z : U => hU.primeIdealOf z) '' {z : U | (z : X) ∈ closure S} := by
rw [hT, ← hrange]; exact ⟨_, rfl⟩
refine ⟨z, hz, (hWmem z z.2).2 ?_⟩
have hzq' : hU.primeIdealOf z = _ := hzq
change hU.primeIdealOf z ∈ O
rw [hzq']; exact hqO
· intro y hyU hyc
obtain ⟨𝔮₁, h𝔮₁⟩ : hU.primeIdealOf ⟨y, hyU⟩ ∈ Set.range (PrimeSpectrum.comap
(Ideal.Quotient.mk J)) := by
rw [hrange, ← hT]; exact ⟨⟨y, hyU⟩, hyc, rfl⟩
rw [hWmem y hyU, ← h𝔮₁, hGiff]
constructor
· rintro ⟨hsm, hfr⟩ 𝔮 _ h𝔮
have e : (⟨𝔮, ‹_›⟩ : PrimeSpectrum (Γ(X, U) ⧸ J)) = 𝔮₁ := by
apply PrimeSpectrum.comap_injective_of_surjective _ Ideal.Quotient.mk_surjective
apply PrimeSpectrum.ext
change 𝔮.comap (Ideal.Quotient.mk J) = _
rw [h𝔮]
have e' : 𝔮 = 𝔮₁.asIdeal := congrArg PrimeSpectrum.asIdeal e
subst e'
refine ⟨?_, hfr⟩
intro inst tow
exact isSmoothAt_of_algebra_eq inst _ (algebra_residueField_ext inst _
(fun r => @algebraMap_residue_of_isScalarTower R _ _ _ _ _ inst tow r)
(residueFieldAlgebra_algebraMap_residue hmB)) _ hsm
· intro h
obtain ⟨hsm, hfr⟩ := h 𝔮₁.asIdeal rfl
exact ⟨hsm, hfr⟩