Module

DVRStalks.lean

Nyll.SchemeTheory.LocalGeometry.DVRStalks
82 declarations indexed from sourceView source ↗

Stalks and affine neighborhoods over a discrete valuation ring

Codimension-one points, smooth special-fibre stalks, specialization localizations, and simultaneous affine neighborhoods of finitely many DVR points.

Imports23
Imported by11

Declarations

AlgebraicGeometry.mem_of_ringKrullDim_stalk_le_one_of_isDiscreteValuationRing
Source context 5 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_AlgebraicGeometry_mem_of_ringKrullDim_stalk_le_one_of_isDiscreteValuationRing.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 SchemeTheory.DVRStalks.CodimensionOne
universe u
open AlgebraicGeometry CategoryTheory Topology
theorem _root_.AlgebraicGeometry.mem_of_ringKrullDim_stalk_le_one_of_isDiscreteValuationRing
    (R : Type u) [CommRing R] [IsDomain R] [IsDiscreteValuationRing R]
    {T : Scheme.{u}} (t : T ⟶ Spec (CommRingCat.of R)) [Flat t]
    (V : T.Opens) (hVη : ∀ x : T, t.base x ≠ IsLocalRing.closedPoint R → x ∈ V)
    (hVs : ∀ Z ∈ irreducibleComponents {x : T // t.base x = IsLocalRing.closedPoint R}, ∃ x ∈ Z,
      x.1 ∈ V)
    (x : T) (hx : ringKrullDim (T.presheaf.stalk x) ≤ 1) : x ∈ V
SchemeTheory.DVRStalks.SpecialFibre.SpecialPrime.isDomain_quot_of_smooth
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_AlgebraicGeometry_Smooth_algebraMap_stalk_ne_zero_and_isPrime_span_of_apply_eq_closedPoint.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 SchemeTheory.DVRStalks.SpecialFibre
open CategoryTheory AlgebraicGeometry TensorProduct
universe u
namespace SpecialPrime
theorem isDomain_quot_of_smooth
    {R : Type u} [CommRing R] [IsDomain R] [IsDiscreteValuationRing R]
    (ϖ : R) (hϖ : IsLocalRing.maximalIdeal R = Ideal.span {ϖ})
    {B : Type u} [CommRing B] [Algebra R B] [Algebra.Smooth R B]
    (𝔓 : Ideal B) [𝔓.IsPrime] (hϖ𝔓 : algebraMap R B ϖ ∈ 𝔓)
    (O : Type u) [CommRing O] [Algebra B O] [IsLocalization.AtPrime O 𝔓] :
    IsDomain (O ⧸ Ideal.map (algebraMap B O) (Ideal.span {algebraMap R B ϖ}))
SchemeTheory.DVRStalks.SpecialFibre.SpecialPrime.main
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_AlgebraicGeometry_Smooth_algebraMap_stalk_ne_zero_and_isPrime_span_of_apply_eq_closedPoint.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 SchemeTheory.DVRStalks.SpecialFibre
open CategoryTheory AlgebraicGeometry TensorProduct
universe u
namespace SpecialPrime
theorem main
    {R : Type u} [CommRing R] [IsDomain R] [IsDiscreteValuationRing R]
    (ϖ : R) (hϖ : IsLocalRing.maximalIdeal R = Ideal.span {ϖ})
    {Y : Scheme.{u}} (f : Y ⟶ Spec (CommRingCat.of R)) [Smooth f]
    (p : Y) (hp : f.base p = IsLocalRing.closedPoint R)
    [Algebra R (Y.presheaf.stalk p)]
    (halg : Y.fromSpecStalk p ≫ f = Spec.map (CommRingCat.ofHom (algebraMap R (Y.presheaf.stalk
      p)))) :
    algebraMap R (Y.presheaf.stalk p) ϖ ≠ 0 ∧
      (Ideal.span {algebraMap R (Y.presheaf.stalk p) ϖ}).IsPrime
AlgebraicGeometry.Smooth.algebraMap_stalk_ne_zero_and_isPrime_span_of_apply_eq_closedPoint
Source context 5 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_AlgebraicGeometry_Smooth_algebraMap_stalk_ne_zero_and_isPrime_span_of_apply_eq_closedPoint.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 SchemeTheory.DVRStalks.SpecialFibre
open CategoryTheory AlgebraicGeometry TensorProduct
universe u
theorem
_root_.AlgebraicGeometry.Smooth.algebraMap_stalk_ne_zero_and_isPrime_span_of_apply_eq_closedPoint
    {R : Type u} [CommRing R] [IsDomain R] [IsDiscreteValuationRing R]
    (ϖ : R) (hϖ : IsLocalRing.maximalIdeal R = Ideal.span {ϖ})
    {Y : Scheme.{u}} (f : Y ⟶ Spec (CommRingCat.of R)) [Smooth f]
    (p : Y) (hp : f.base p = IsLocalRing.closedPoint R)
    [Algebra R (Y.presheaf.stalk p)]
    (halg : Y.fromSpecStalk p ≫ f = Spec.map (CommRingCat.ofHom (algebraMap R (Y.presheaf.stalk
      p)))) :
    algebraMap R (Y.presheaf.stalk p) ϖ ≠ 0 ∧
      (Ideal.span {algebraMap R (Y.presheaf.stalk p) ϖ}).IsPrime
SchemeTheory.DVRStalks.BirationalFractionFields.Localizations.isFractionRing_of_localization_iso
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_AlgebraicGeometry_isFractionRing_stalk_fractionRing_stalk_of_isOpenImmersion_restrict.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 SchemeTheory.DVRStalks.BirationalFractionFields
open CategoryTheory AlgebraicGeometry
universe u
namespace Localizations
theorem isFractionRing_of_localization_iso
    {R S R' S' : Type*} [CommRing R] [IsDomain R] [CommRing S] [IsDomain S]
    [CommRing R'] [CommRing S'] [Nontrivial S'] [Algebra R R'] (M : Submonoid R) [IsLocalization M
      R']
    (φ : R →+* S) (β : S →+* S') (hβ : Function.Injective β) (e : R' ≃+* S')
    (he : ∀ r, e (algebraMap R R' r) = β (φ r)) :
    let : Algebra R (FractionRing S) := ((algebraMap S (FractionRing S)).comp φ).toAlgebra
    IsFractionRing R (FractionRing S) := by
  intro fractionAlgebra
  have hM0 : ∀ m : M, (m : R) ≠ 0 := by
    intro m hm
    have hu : IsUnit (algebraMap R R' m) := IsLocalization.map_units R' m
    rw [hm, map_zero, isUnit_zero_iff] at hu
    have : (0 : S') = 1 := by rw [← map_zero e, hu, map_one]
    exact zero_ne_one this
  have hinj : Function.Injective φ := by
    intro a b hab
    rw [← sub_eq_zero] at hab ⊢
    have h1 : algebraMap R R' (a - b) = 0 := by
      apply e.injective
      rw [he, map_sub φ, hab, map_zero, map_zero]
    obtain ⟨m, hm⟩ := (IsLocalization.map_eq_zero_iff M R' (a - b)).mp h1
    rcases mul_eq_zero.mp hm with h | h
    · exact absurd h (hM0 m)
    · exact h
  have hkey : ∀ s : S, ∃ r : R, ∃ m : M, s * φ m = φ r := by
    intro s
    obtain ⟨⟨r, m⟩, hrm⟩ := IsLocalization.surj M (e.symm (β s))
    refine ⟨r, m, hβ ?_⟩
    rw [map_mul, ← he, ← he, ← hrm, map_mul, RingEquiv.apply_symm_apply]
  have halg : ∀ r, algebraMap R (FractionRing S) r = algebraMap S (FractionRing S) (φ r) := fun _
    => rfl
  have : FaithfulSMul R (FractionRing S) := by
    rw [faithfulSMul_iff_algebraMap_injective]
    intro a b hab
    rw [halg, halg] at hab
    exact hinj (IsFractionRing.injective S (FractionRing S) hab)
  apply IsFractionRing.of_field
  intro z
  obtain ⟨s, t, ht, rfl⟩ := IsFractionRing.div_surjective (A := S) z
  obtain ⟨r₁, m₁, h₁⟩ := hkey s
  obtain ⟨r₂, m₂, h₂⟩ := hkey t
  have hm₁ : algebraMap S (FractionRing S) (φ m₁) ≠ 0 := fun h0 =>
    hM0 m₁ (hinj ((IsFractionRing.injective S (FractionRing S) (h0.trans (map_zero _).symm)).trans
      (map_zero φ).symm))
  have hm₂ : algebraMap S (FractionRing S) (φ m₂) ≠ 0 := fun h0 =>
    hM0 m₂ (hinj ((IsFractionRing.injective S (FractionRing S) (h0.trans (map_zero _).symm)).trans
      (map_zero φ).symm))
  have hs : algebraMap S (FractionRing S) s =
      algebraMap S (FractionRing S) (φ r₁) / algebraMap S (FractionRing S) (φ m₁) := by
    rw [eq_div_iff hm₁, ← map_mul, h₁]
  have ht' : algebraMap S (FractionRing S) t =
      algebraMap S (FractionRing S) (φ r₂) / algebraMap S (FractionRing S) (φ m₂) := by
    rw [eq_div_iff hm₂, ← map_mul, h₂]
  refine ⟨r₁ * m₂, m₁ * r₂, ?_⟩
  rw [halg, halg, hs, ht', map_mul, map_mul, map_mul, map_mul, div_div_eq_mul_div,
    div_mul_eq_mul_div,
    div_div]
SchemeTheory.DVRStalks.BirationalFractionFields.Localizations.exists_isLocalization_stalkSpecializes
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_AlgebraicGeometry_isFractionRing_stalk_fractionRing_stalk_of_isOpenImmersion_restrict.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 SchemeTheory.DVRStalks.BirationalFractionFields
open CategoryTheory AlgebraicGeometry
universe u
namespace Localizations
theorem exists_isLocalization_stalkSpecializes {X : Scheme.{u}} {x y : X} (h : x ⤳ y) :
    let : Algebra (X.presheaf.stalk y) (X.presheaf.stalk x) := (X.presheaf.stalkSpecializes
      h).hom.toAlgebra
    ∃ M : Submonoid (X.presheaf.stalk y), IsLocalization M (X.presheaf.stalk x) := by
  intro iyx
  obtain ⟨V, hV, hyV⟩ : ∃ V : X.Opens, IsAffineOpen V ∧ y ∈ V :=
    ⟨(X.affineCover.f (X.affineCover.idx y)).opensRange, isAffineOpen_opensRange _,
      X.affineCover.covers y⟩
  have hxV : x ∈ V := h.mem_open V.2 hyV
  let ay : Algebra Γ(X, V) (X.presheaf.stalk y) := TopCat.Presheaf.algebra_section_stalk
    X.presheaf ⟨y, hyV⟩
  let ax : Algebra Γ(X, V) (X.presheaf.stalk x) := TopCat.Presheaf.algebra_section_stalk
    X.presheaf ⟨x, hxV⟩
  have : IsScalarTower Γ(X, V) (X.presheaf.stalk y) (X.presheaf.stalk x) := by
    apply IsScalarTower.of_algebraMap_eq'
    change (X.presheaf.germ V x hxV).hom = (X.presheaf.stalkSpecializes h).hom.comp
      (X.presheaf.germ V y hyV).hom
    rw [← CommRingCat.hom_comp, TopCat.Presheaf.germ_stalkSpecializes]
  have hLy : IsLocalization.AtPrime (X.presheaf.stalk y) (hV.primeIdealOf ⟨y, hyV⟩).asIdeal :=
    hV.isLocalization_stalk ⟨y, hyV⟩
  have hLx : IsLocalization.AtPrime (X.presheaf.stalk x) (hV.primeIdealOf ⟨x, hxV⟩).asIdeal :=
    hV.isLocalization_stalk ⟨x, hxV⟩
  have hle : hV.primeIdealOf ⟨x, hxV⟩ ≤ hV.primeIdealOf ⟨y, hyV⟩ := by
    rw [PrimeSpectrum.le_iff_specializes]
    have h' : (⟨x, hxV⟩ : V) ⤳ ⟨y, hyV⟩ :=
      (V.isOpenEmbedding'.isInducing.specializes_iff).mp
        (show ((⟨x, hxV⟩ : V) : X) ⤳ ((⟨y, hyV⟩ : V) : X) from h)
    exact h'.map hV.isoSpec.hom.base.hom.continuous
  have hcompl : (hV.primeIdealOf ⟨y, hyV⟩).asIdeal.primeCompl ≤ (hV.primeIdealOf ⟨x,
    hxV⟩).asIdeal.primeCompl :=
    fun a ha hax => ha (hle hax)
  exact ⟨_, IsLocalization.isLocalization_of_submonoid_le (X.presheaf.stalk y) (X.presheaf.stalk
    x) _ _ hcompl⟩
AlgebraicGeometry.isFractionRing_stalk_fractionRing_stalk_of_isOpenImmersion_restrict
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_AlgebraicGeometry_isFractionRing_stalk_fractionRing_stalk_of_isOpenImmersion_restrict.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 SchemeTheory.DVRStalks.BirationalFractionFields
open CategoryTheory AlgebraicGeometry
universe u
open Localizations in
theorem _root_.AlgebraicGeometry.isFractionRing_stalk_fractionRing_stalk_of_isOpenImmersion_restrict
    {U W : Scheme.{u}} (v : U ⟶ W) (u : U)
    [IsDomain (U.presheaf.stalk u)] [IsDomain (W.presheaf.stalk (v.base u))]
    (U' : U.Opens) [IsOpenImmersion (U'.ι ≫ v)] (hU' : ∃ x : U, x ∈ U' ∧ x ⤳ u) :
    let : Algebra (W.presheaf.stalk (v.base u)) (FractionRing (U.presheaf.stalk u)) :=
      ((algebraMap (U.presheaf.stalk u) (FractionRing (U.presheaf.stalk u))).comp (v.stalkMap
        u).hom).toAlgebra
    IsFractionRing (W.presheaf.stalk (v.base u)) (FractionRing (U.presheaf.stalk u)) := by
  intro fractionAlgebra
  obtain ⟨x, hx, hxu⟩ := hU'
  have hvxu : v.base x ⤳ v.base u := v.base.hom.map_specializes hxu
  have : IsIso (v.stalkMap x) := by
    have hc : (U'.ι ≫ v).stalkMap ⟨x, hx⟩ = v.stalkMap x ≫ U'.ι.stalkMap ⟨x, hx⟩ :=
      Scheme.Hom.stalkMap_comp U'.ι v ⟨x, hx⟩
    have i1 : IsIso ((U'.ι ≫ v).stalkMap ⟨x, hx⟩) :=
      (IsOpenImmersion.iff_isIso_stalkMap.mp ‹IsOpenImmersion (U'.ι ≫ v)›).2 ⟨x, hx⟩
    have i2 : IsIso (U'.ι.stalkMap ⟨x, hx⟩) :=
      (IsOpenImmersion.iff_isIso_stalkMap.mp (inferInstance : IsOpenImmersion U'.ι)).2 ⟨x, hx⟩
    have i3 : IsIso (v.stalkMap x ≫ U'.ι.stalkMap ⟨x, hx⟩) := by rw [← hc]; exact i1
    exact @IsIso.of_isIso_comp_right _ _ _ _ _ (v.stalkMap x) (U'.ι.stalkMap ⟨x, hx⟩) i2 i3
  let aW : Algebra (W.presheaf.stalk (v.base u)) (W.presheaf.stalk (v.base x)) :=
    (W.presheaf.stalkSpecializes hvxu).hom.toAlgebra
  let aU : Algebra (U.presheaf.stalk u) (U.presheaf.stalk x) := (U.presheaf.stalkSpecializes
    hxu).hom.toAlgebra
  obtain ⟨M, hM⟩ := exists_isLocalization_stalkSpecializes (X := W) hvxu
  obtain ⟨N, hN⟩ := exists_isLocalization_stalkSpecializes (X := U) hxu
  have hN0 : N ≤ nonZeroDivisors (U.presheaf.stalk u) := by
    intro n hn
    rw [mem_nonZeroDivisors_iff_ne_zero]
    intro h0
    have hu' : IsUnit (algebraMap (U.presheaf.stalk u) (U.presheaf.stalk x) n) :=
      IsLocalization.map_units (M := N) (U.presheaf.stalk x) ⟨n, hn⟩
    rw [h0, map_zero, isUnit_zero_iff] at hu'
    exact zero_ne_one hu'
  have hβ : Function.Injective (U.presheaf.stalkSpecializes hxu).hom :=
    IsLocalization.injective (M := N) (U.presheaf.stalk x) hN0
  refine isFractionRing_of_localization_iso M (v.stalkMap u).hom (U.presheaf.stalkSpecializes
    hxu).hom hβ
    (asIso (v.stalkMap x)).commRingCatIsoToRingEquiv ?_
  intro r
  change (W.presheaf.stalkSpecializes hvxu ≫ v.stalkMap x).hom r =
    (v.stalkMap u ≫ U.presheaf.stalkSpecializes hxu).hom r
  rw [Scheme.Hom.stalkSpecializes_stalkMap]
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.genericPoint_mem
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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
lemma genericPoint_mem {U : X.Opens} {x : X} (hx : x ∈ U) : genericPoint X ∈ U
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.ιK

The canonical inclusion of a stalk into the function field.

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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
def ιK (x : X) : X.presheaf.stalk x →+* X.functionField
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.ιK_apply
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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
lemma ιK_apply (x : X) (w : X.presheaf.stalk x) :
    ιK x w = (X.presheaf.stalkSpecializes (genericPoint_specializes x)).hom w
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.ιK_injective
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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
lemma ιK_injective (x : X) : Function.Injective (ιK x)
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.O

The image of a stalk in the function field.

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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
def O (x : X) : Subring X.functionField
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.mem_O_iff
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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
lemma mem_O_iff {x : X} {k : X.functionField} : k ∈ O x ↔ ∃ w, ιK x w = k
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.ιK_mem_O
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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
lemma ιK_mem_O (x : X) (w : X.presheaf.stalk x) : ιK x w ∈ O x
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.toK

Map sections on a nonempty open into the function field.

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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
def toK (U : X.Opens) {x : X} (hx : x ∈ U) : Γ(X, U) →+* X.functionField
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.toK_irrel
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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
lemma toK_irrel (U : X.Opens) {x y : X} (hx : x ∈ U) (hy : y ∈ U) : toK U hx = toK U hy
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.ιK_germ
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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
lemma ιK_germ (U : X.Opens) {x : X} (hx : x ∈ U) (s : Γ(X, U)) :
    ιK x (X.presheaf.germ U x hx s) = toK U hx s
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.toK_mem_O
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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
lemma toK_mem_O (U : X.Opens) {x : X} (hx : x ∈ U) (s : Γ(X, U)) : toK U hx s ∈ O x
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.toK_injective
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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
lemma toK_injective (U : X.Opens) {x : X} (hx : x ∈ U) : Function.Injective (toK U hx)
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.toK_res
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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
lemma toK_res {U V : X.Opens} (h : U ≤ V) {x : X} (hx : x ∈ U) (s : Γ(X, V)) :
    toK U hx (X.presheaf.map (homOfLE h).op s) = toK V (h hx) s
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.UnitAt

A rational function represented by a unit in the given stalk.

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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
def UnitAt (p : X) (k : X.functionField) : Prop
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.UnitAt.mem
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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
lemma UnitAt.mem {p : X} {k : X.functionField} (h : UnitAt p k) : k ∈ O p
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.UnitAt.ne_zero
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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
lemma UnitAt.ne_zero {p : X} {k : X.functionField} (h : UnitAt p k) : k ≠ 0
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.UnitAt.inv_mem
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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
lemma UnitAt.inv_mem {p : X} {k : X.functionField} (h : UnitAt p k) : k⁻¹ ∈ O p
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.UnitAt.of_mem_of_inv_mem
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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
lemma UnitAt.of_mem_of_inv_mem {p : X} {k : X.functionField} (hk : k ∈ O p) (hk' : k⁻¹ ∈ O p)
    (hk0 : k ≠ 0) : UnitAt p k
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.UnitAt.mul
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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
lemma UnitAt.mul {p : X} {k l : X.functionField} (hk : UnitAt p k) (hl : UnitAt p l) :
    UnitAt p (k * l)
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.UnitAt.pow
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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
lemma UnitAt.pow {p : X} {k : X.functionField} (hk : UnitAt p k) (n : ℕ) : UnitAt p (k ^ n)
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.UnitAt.inv
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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
lemma UnitAt.inv {p : X} {k : X.functionField} (hk : UnitAt p k) : UnitAt p k⁻¹
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.unitAt_one
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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
lemma unitAt_one (p : X) : UnitAt p 1
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.UnitAt.of_isUnit_germ
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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
lemma UnitAt.of_isUnit_germ {U : X.Opens} {p : X} (hp : p ∈ U) {s : Γ(X, U)}
    (h : IsUnit (X.presheaf.germ U p hp s)) : UnitAt p (toK U hp s)
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.isUnit_germ_of_unitAt
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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
lemma isUnit_germ_of_unitAt {U : X.Opens} {p : X} (hp : p ∈ U) {s : Γ(X, U)}
    (h : UnitAt p (toK U hp s)) : IsUnit (X.presheaf.germ U p hp s)
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.UnitAt.of_subring_le
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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
lemma UnitAt.of_subring_le {p : X} {D : Subring X.functionField} (hD : D ≤ O p)
    {k : X.functionField} (hk : k ∈ D) (hk' : k⁻¹ ∈ D) (hk0 : k ≠ 0) : UnitAt p k
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.exists_eq_of_mem_O
Source context 10 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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
section Affine
variable {U : X.Opens} (hU : IsAffineOpen U)
include hU
lemma exists_eq_of_mem_O {p : X} (hp : p ∈ U) {z : X.functionField} (hz : z ∈ O p) :
    ∃ a b : Γ(X, U), IsUnit (X.presheaf.germ U p hp b) ∧ z * toK U hp b = toK U hp a
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.exists_point_of_prime
Source context 11 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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
section Affine
variable {U : X.Opens} (hU : IsAffineOpen U)
include hU
omit [IsIntegral X] in
lemma exists_point_of_prime (𝔮 : Ideal Γ(X, U)) [𝔮.IsPrime] :
    ∃ (p : X) (hp : p ∈ U), ∀ t : Γ(X, U), IsUnit (X.presheaf.germ U p hp t) ↔ t ∉ 𝔮
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.mem_range_toK_basicOpen_iff
Source context 10 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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
section Affine
variable {U : X.Opens} (hU : IsAffineOpen U)
include hU
lemma mem_range_toK_basicOpen_iff (τ : Γ(X, U)) {p : X} (hp : p ∈ U)
    (hτ : IsUnit (X.presheaf.germ U p hp τ)) (k : X.functionField) :
    k ∈ (toK (X.basicOpen τ) ((X.mem_basicOpen τ p hp).mpr hτ)).range ↔
      ∃ m : ℕ, k * toK U hp τ ^ m ∈ (toK U hp).range
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.stalkEquivO

Identify a stalk with its image inside the function field.

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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
def stalkEquivO (p : X) : X.presheaf.stalk p ≃+* O p
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.stalkEquivO_apply
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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
lemma stalkEquivO_apply (p : X) (w : X.presheaf.stalk p) : ((stalkEquivO p w : O p) :
    X.functionField) = ιK p w
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.ιK_stalkEquivO_symm
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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
lemma ιK_stalkEquivO_symm (p : X) (k : O p) : ιK p ((stalkEquivO p).symm k) = k
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.eq_of_O_eq
Source context 10 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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
section Separated
variable {R : Type u} [CommRing R] (f : X ⟶ Spec (CommRingCat.of R)) [IsSeparated f]
include f
lemma eq_of_O_eq {p p' : X} (h : O p = O p') : p = p'
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.adjInv

Adjoin the inverse of a single element to a subring.

Source context 9 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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
section FieldSubring
variable {K : Type*} [Field K]
def adjInv (C : Subring K) (s : K) : Subring K
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.le_adjInv
Source context 9 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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
section FieldSubring
variable {K : Type*} [Field K]
lemma le_adjInv (C : Subring K) (s : K) : C ≤ adjInv C s
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.inv_mem_adjInv
Source context 9 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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
section FieldSubring
variable {K : Type*} [Field K]
lemma inv_mem_adjInv (C : Subring K) (s : K) : s⁻¹ ∈ adjInv C s
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.adjInv_le
Source context 9 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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
section FieldSubring
variable {K : Type*} [Field K]
lemma adjInv_le {C D : Subring K} {s : K} (hCD : C ≤ D) (hs : s⁻¹ ∈ D) : adjInv C s ≤ D
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.mem_adjInv_iff
Source context 9 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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
section FieldSubring
variable {K : Type*} [Field K]
lemma mem_adjInv_iff {C : Subring K} {s : K} (hs : s ∈ C) (hs0 : s ≠ 0) (k : K) :
    k ∈ adjInv C s ↔ ∃ m : ℕ, k * s ^ m ∈ C
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.mul_pow_mem_of_le
Source context 9 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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
section FieldSubring
variable {K : Type*} [Field K]
lemma mul_pow_mem_of_le {C : Subring K} {s : K} (hs : s ∈ C) {k : K} {m n : ℕ} (hmn : m ≤ n)
    (hk : k * s ^ m ∈ C) : k * s ^ n ∈ C
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.adjInv_adjInv_eq
Source context 9 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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
section FieldSubring
variable {K : Type*} [Field K]
lemma adjInv_adjInv_eq {C : Subring K} {e c : K} (he : e ∈ C) (hc : c ∈ C) (he0 : e ≠ 0)
    (hc0 : c ≠ 0) : adjInv (adjInv C e) c = adjInv C (e * c)
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.mem_O_or_inv_mem
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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
lemma mem_O_or_inv_mem (x : X) [IsDiscreteValuationRing (X.presheaf.stalk x)]
    (k : X.functionField) : k ∈ O x ∨ k⁻¹ ∈ O x
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.Ov

The valuation subring determined by a discrete valuation stalk.

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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
def Ov (x : X) [IsDiscreteValuationRing (X.presheaf.stalk x)] :
    ValuationSubring X.functionField
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.mem_Ov_iff
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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
lemma mem_Ov_iff (x : X) [IsDiscreteValuationRing (X.presheaf.stalk x)] (k : X.functionField) :
    k ∈ Ov x ↔ k ∈ O x
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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
instance (x : X) [IsDiscreteValuationRing (X.presheaf.stalk x)] :
    IsDiscreteValuationRing (Ov x)
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.mem_nonunits_Ov_iff
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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
lemma mem_nonunits_Ov_iff (x : X) [IsDiscreteValuationRing (X.presheaf.stalk x)]
    (k : X.functionField) : k ∈ (Ov x).nonunits ↔ k ∈ O x ∧ ¬ UnitAt x k
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.valuationSubring_eq_of_le
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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
lemma valuationSubring_eq_of_le {L : Type*} [Field L] {A B : ValuationSubring L}
    [IsDiscreteValuationRing A] [IsDiscreteValuationRing B] (h : A ≤ B) : A = B
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.exists_forall_pow_mul_mem
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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
lemma exists_forall_pow_mul_mem (x : X) [IsDiscreteValuationRing (X.presheaf.stalk x)]
    {s : X.functionField} (hs : s ∈ O x) (hsu : ¬ UnitAt x s) (w : X.functionField) :
    ∃ N : ℕ, ∀ n : ℕ, N ≤ n → s ^ n * w ∈ O x
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.toStalkOfLE

Map sections to a stalk whose image contains their rational functions.

Source context 8 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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
section Endgame
def toStalkOfLE {W : X.Opens} {x : X} (hx : x ∈ W) {p : X}
    (h : (toK W hx).range ≤ O p) : Γ(X, W) →+* X.presheaf.stalk p
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.ιK_toStalkOfLE
Source context 8 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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
section Endgame
lemma ιK_toStalkOfLE {W : X.Opens} {x : X} (hx : x ∈ W) {p : X}
    (h : (toK W hx).range ≤ O p) (σ : Γ(X, W)) : ιK p (toStalkOfLE hx h σ) = toK W hx σ
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.isUnit_toStalkOfLE_iff
Source context 8 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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
section Endgame
lemma isUnit_toStalkOfLE_iff {W : X.Opens} {x : X} (hx : x ∈ W) {p : X}
    (h : (toK W hx).range ≤ O p) (σ : Γ(X, W)) :
    IsUnit (toStalkOfLE hx h σ) ↔ UnitAt p (toK W hx σ)
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.mem_chart_of_unitAt
Source context 10 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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
section Endgame
variable {R : Type u} [CommRing R] (f : X ⟶ Spec (CommRingCat.of R)) [IsSeparated f]
include f
lemma mem_chart_of_unitAt (C : Subring X.functionField)
    {W : X.Opens} (hW : IsAffineOpen W) {x : X} (hxW : x ∈ W) {ex c : X.functionField}
    (hc : c ∈ C) (hc0 : c ≠ 0)
    (hrange : (toK W hxW).range = adjInv C (ex * c))
    {W' : X.Opens} (hW' : IsAffineOpen W') {y : X} (hyW' : y ∈ W') {ey : X.functionField}
    (hey : ey ∈ C) (hey0 : ey ≠ 0) (hrange' : (toK W' hyW').range = adjInv C (ey * c))
    {p : X} (hp : p ∈ W') (hunit : UnitAt p ex) : p ∈ W
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.exists_section_of_mem_adjInv
Source context 11 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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
section Endgame
variable {R : Type u} [CommRing R] (f : X ⟶ Spec (CommRingCat.of R)) [IsSeparated f]
include f
omit f in
lemma exists_section_of_mem_adjInv (S : Finset X) (C : Subring X.functionField)
    (e : X → X.functionField) (c : X.functionField)
    (he : ∀ x ∈ S, e x ∈ C) (he0 : ∀ x ∈ S, e x ≠ 0) (hc0 : c ≠ 0)
    (W : X → X.Opens) (hxW : ∀ x ∈ S, x ∈ W x)
    (hrange : ∀ x (hx : x ∈ S), (toK (W x) (hxW x hx)).range = adjInv C (e x * c))
    {x₀ : X} (hx₀ : x₀ ∈ S) (k : X.functionField) (hk : k ∈ adjInv C c) :
    ∃ σ : Γ(X, ⨆ x ∈ S, W x),
      toK (⨆ x ∈ S, W x) (Opens.mem_iSup.mpr ⟨x₀, Opens.mem_iSup.mpr ⟨hx₀, hxW x₀ hx₀⟩⟩) σ = k
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.isAffineOpen_iSup_of_charts
Source context 10 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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
section Endgame
variable {R : Type u} [CommRing R] (f : X ⟶ Spec (CommRingCat.of R)) [IsSeparated f]
include f
lemma isAffineOpen_iSup_of_charts (S : Finset X) (hSne : S.Nonempty)
    (C : Subring X.functionField) (e : X → X.functionField) (c : X.functionField)
    (he : ∀ x ∈ S, e x ∈ C) (hc : c ∈ C) (he0 : ∀ x ∈ S, e x ≠ 0) (hc0 : c ≠ 0)
    (α : X → X.functionField) (hα : ∀ x ∈ S, α x ∈ C) (hsum : ∑ x ∈ S, α x * e x = c)
    (W : X → X.Opens) (hW : ∀ x ∈ S, IsAffineOpen (W x)) (hxW : ∀ x ∈ S, x ∈ W x)
    (hrange : ∀ x (hx : x ∈ S), (toK (W x) (hxW x hx)).range = adjInv C (e x * c)) :
    IsAffineOpen (⨆ x ∈ S, W x)
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.unitAt_prod
Source context 8 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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
section Main
lemma unitAt_prod {p : X} {ι : Type*} (s : Finset ι) (g : ι → X.functionField)
    (h : ∀ i ∈ s, UnitAt p (g i)) : UnitAt p (∏ i ∈ s, g i)
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.toStalk'

Map a subring of the function field to a stalk containing it.

Source context 8 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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
section Main
def toStalk' {p : X} {D : Subring X.functionField} (h : D ≤ O p) :
    D →+* X.presheaf.stalk p
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.ιK_toStalk'
Source context 8 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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
section Main
lemma ιK_toStalk' {p : X} {D : Subring X.functionField} (h : D ≤ O p) (d : D) :
    ιK p (toStalk' h d) = d
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.isUnit_toStalk'_iff
Source context 8 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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
section Main
lemma isUnit_toStalk'_iff {p : X} {D : Subring X.functionField} (h : D ≤ O p) (d : D) :
    IsUnit (toStalk' h d) ↔ UnitAt p d
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.exists_unit_mul_mem
Source context 10 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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
section Main
variable {R : Type u} [CommRing R] (f : X ⟶ Spec (CommRingCat.of R)) [IsSeparated f]
include f
lemma exists_unit_mul_mem (S : Finset X) (hS : ∀ x ∈ S, IsDiscreteValuationRing (X.presheaf.stalk
    x))
    {x : X} (hx : x ∈ S) {z : X.functionField} (hz : z ∈ O x) :
    ∃ s : X.functionField, UnitAt x s ∧ (∀ y ∈ S, s ∈ O y) ∧ ∀ y ∈ S, s * z ∈ O y
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.R0

The image of the base ring inside the function field.

Source context 11 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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
section Main
variable {R : Type u} [CommRing R] (f : X ⟶ Spec (CommRingCat.of R)) [IsSeparated f]
include f
variable [LocallyOfFiniteType f]
def R0 : Subring X.functionField
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.R0_le_range
Source context 12 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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
section Main
variable {R : Type u} [CommRing R] (f : X ⟶ Spec (CommRingCat.of R)) [IsSeparated f]
include f
variable [LocallyOfFiniteType f]
omit [IsSeparated f] [LocallyOfFiniteType f] in
lemma R0_le_range {U : X.Opens} {x : X} (hx : x ∈ U) : R0 f ≤ (toK U hx).range
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.R0_le_O
Source context 12 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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
section Main
variable {R : Type u} [CommRing R] (f : X ⟶ Spec (CommRingCat.of R)) [IsSeparated f]
include f
variable [LocallyOfFiniteType f]
omit [IsSeparated f] [LocallyOfFiniteType f] in
lemma R0_le_O (y : X) : R0 f ≤ O y
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.exists_finset_gen
Source context 12 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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
section Main
variable {R : Type u} [CommRing R] (f : X ⟶ Spec (CommRingCat.of R)) [IsSeparated f]
include f
variable [LocallyOfFiniteType f]
omit [IsSeparated f] in
lemma exists_finset_gen {U : X.Opens} (hU : IsAffineOpen U) {x : X} (hx : x ∈ U) :
    ∃ G : Finset X.functionField, (↑G : Set X.functionField) ⊆ (toK U hx).range ∧
      (toK U hx).range ≤ Subring.closure ((R0 f : Set X.functionField) ∪ ↑G)
SchemeTheory.DVRStalks.AffineNeighborhoods.AffineCharts.main
Source context 11 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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
namespace AffineCharts
variable {X : Scheme.{u}} [IsIntegral X]
section Main
variable {R : Type u} [CommRing R] (f : X ⟶ Spec (CommRingCat.of R)) [IsSeparated f]
include f
variable [LocallyOfFiniteType f]
theorem main (S : Finset X) (hS : ∀ x ∈ S, IsDiscreteValuationRing (X.presheaf.stalk x)) :
    ∃ U : X.Opens, IsAffineOpen U ∧ ∀ x ∈ S, x ∈ U
AlgebraicGeometry.exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk
Source context 5 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_AlgebraicGeometry_exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk.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 SchemeTheory.DVRStalks.AffineNeighborhoods
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry TopologicalSpace Opposite
universe u
theorem _root_.AlgebraicGeometry.exists_isAffineOpen_forall_mem_of_isDiscreteValuationRing_stalk
    {R : Type u} [CommRing R] {X : Scheme.{u}} [IsIntegral X]
    (f : X ⟶ Spec (CommRingCat.of R)) [LocallyOfFiniteType f] [IsSeparated f]
    (S : Finset X) (hS : ∀ x ∈ S, IsDiscreteValuationRing (X.presheaf.stalk x)) :
    ∃ U : X.Opens, IsAffineOpen U ∧ ∀ x ∈ S, x ∈ U
AlgebraicGeometry.Scheme.isLocalization_atPrime_stalk_of_specializes
Source context 5 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_AlgebraicGeometry_Scheme_isLocalization_atPrime_stalk_of_specializes.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 SchemeTheory.DVRStalks.Specializations
universe u
open CategoryTheory AlgebraicGeometry TopologicalSpace Topology
theorem _root_.AlgebraicGeometry.Scheme.isLocalization_atPrime_stalk_of_specializes
    {X : Scheme.{u}} {x y : ↥X} (h : y ⤳ x) :
    let : Algebra ↑(X.presheaf.stalk x) ↑(X.presheaf.stalk y) := (X.presheaf.stalkSpecializes
      h).hom.toAlgebra
    IsLocalization.AtPrime ↑(X.presheaf.stalk y)
      (Ideal.comap (X.presheaf.stalkSpecializes h).hom (IsLocalRing.maximalIdeal
        ↑(X.presheaf.stalk y))) := by
  classical
  intro instA
  have halg : ∀ a, algebraMap ↑(X.presheaf.stalk x) ↑(X.presheaf.stalk y) a =
    (X.presheaf.stalkSpecializes h).hom a := fun a => rfl
  obtain ⟨_, ⟨U, hU, rfl⟩, hxU, -⟩ := X.isBasis_affineOpens.exists_subset_of_mem_open
    (Set.mem_univ x) isOpen_univ
  have hyU : y ∈ U := h.mem_open U.2 hxU
  let algX : Algebra Γ(X, U) (X.presheaf.stalk x) :=
    TopCat.Presheaf.algebra_section_stalk X.presheaf (⟨x, hxU⟩ : U)
  let algY : Algebra Γ(X, U) (X.presheaf.stalk y) :=
    TopCat.Presheaf.algebra_section_stalk X.presheaf (⟨y, hyU⟩ : U)
  have hLx : IsLocalization.AtPrime (X.presheaf.stalk x)
      (hU.primeIdealOf ⟨x, hxU⟩).asIdeal := hU.isLocalization_stalk ⟨x, hxU⟩
  have halgX : ∀ r, algebraMap ↑(X.presheaf.obj (Opposite.op U)) ↑(X.presheaf.stalk x) r =
    (X.presheaf.germ U x hxU).hom r := fun r => rfl
  have halgY : ∀ r, algebraMap ↑(X.presheaf.obj (Opposite.op U)) ↑(X.presheaf.stalk y) r =
    (X.presheaf.germ U y hyU).hom r := fun r => rfl
  have hLy : IsLocalization.AtPrime (X.presheaf.stalk y)
      (hU.primeIdealOf ⟨y, hyU⟩).asIdeal := hU.isLocalization_stalk ⟨y, hyU⟩
  have hgerm : ∀ r : ↑(X.presheaf.obj (Opposite.op U)),
      (X.presheaf.stalkSpecializes h).hom ((X.presheaf.germ U x hxU).hom r) = (X.presheaf.germ U y
        hyU).hom r := by
    intro r
    exact TopCat.Presheaf.germ_stalkSpecializes_apply X.presheaf hxU h r
  have hunit : ∀ s : ↑(X.presheaf.stalk x),
      s ∈ (Ideal.comap (X.presheaf.stalkSpecializes h).hom (IsLocalRing.maximalIdeal
        ↑(X.presheaf.stalk y))).primeCompl ↔
        IsUnit ((X.presheaf.stalkSpecializes h).hom s) := by
    intro s
    rw [Ideal.mem_primeCompl_iff, Ideal.mem_comap, IsLocalRing.mem_maximalIdeal, mem_nonunits_iff,
      not_not]
  change IsLocalization _ _
  rw [isLocalization_iff]
  refine ⟨fun s => (hunit s.1).mp s.2, fun z => ?_, fun {a b} hab => ?_⟩
  · obtain ⟨⟨a₀, s₀⟩, e⟩ := IsLocalization.surj (M := (hU.primeIdealOf ⟨y,
    hyU⟩).asIdeal.primeCompl) z
    have hs₀ : IsUnit ((X.presheaf.germ U y hyU).hom s₀) :=
      IsLocalization.map_units (M := (hU.primeIdealOf ⟨y, hyU⟩).asIdeal.primeCompl)
        (X.presheaf.stalk y) s₀
    refine ⟨⟨(X.presheaf.germ U x hxU).hom a₀, ⟨(X.presheaf.germ U x hxU).hom s₀, (hunit _).mpr
      (by rw [hgerm]; exact hs₀)⟩⟩, ?_⟩
    simp only [halg, hgerm]
    simpa only [halgY] using e
  · obtain ⟨⟨a₀, ua⟩, ea⟩ := IsLocalization.surj (M := (hU.primeIdealOf ⟨x,
    hxU⟩).asIdeal.primeCompl) a
    obtain ⟨⟨b₀, ub⟩, eb⟩ := IsLocalization.surj (M := (hU.primeIdealOf ⟨x,
      hxU⟩).asIdeal.primeCompl) b
    have hua : IsUnit ((X.presheaf.germ U x hxU).hom ua) :=
      IsLocalization.map_units (M := (hU.primeIdealOf ⟨x, hxU⟩).asIdeal.primeCompl)
        (X.presheaf.stalk x) ua
    have hub : IsUnit ((X.presheaf.germ U x hxU).hom ub) :=
      IsLocalization.map_units (M := (hU.primeIdealOf ⟨x, hxU⟩).asIdeal.primeCompl)
        (X.presheaf.stalk x) ub
    simp only [halgX] at ea eb
    have key : (X.presheaf.germ U y hyU).hom (a₀ * ub) = (X.presheaf.germ U y hyU).hom (b₀ * ua)
      := by
      rw [map_mul, map_mul, ← hgerm, ← hgerm, ← hgerm, ← hgerm, ← ea, ← eb]
      rw [map_mul, map_mul, ← halg a, ← halg b, hab]
      ring
    have key' : algebraMap ↑(X.presheaf.obj (Opposite.op U)) ↑(X.presheaf.stalk y) (a₀ * ub) =
        algebraMap ↑(X.presheaf.obj (Opposite.op U)) ↑(X.presheaf.stalk y) (b₀ * ua) := key
    obtain ⟨⟨c₀, hc₀⟩, ec⟩ := (IsLocalization.eq_iff_exists (hU.primeIdealOf ⟨y,
      hyU⟩).asIdeal.primeCompl (X.presheaf.stalk y)).mp key'
    have hc₀u : IsUnit ((X.presheaf.germ U y hyU).hom c₀) :=
      IsLocalization.map_units (M := (hU.primeIdealOf ⟨y, hyU⟩).asIdeal.primeCompl)
        (X.presheaf.stalk y) ⟨c₀, hc₀⟩
    refine ⟨⟨(X.presheaf.germ U x hxU).hom c₀ * (X.presheaf.germ U x hxU).hom ua *
      (X.presheaf.germ U x hxU).hom ub,
      (hunit _).mpr ?_⟩, ?_⟩
    · rw [map_mul, map_mul, hgerm, hgerm, hgerm]
      exact (hc₀u.mul (by rw [← hgerm]; exact hua.map _)).mul (by rw [← hgerm]; exact hub.map _)
    · simp only
      calc
        (X.presheaf.germ U x hxU).hom c₀ * (X.presheaf.germ U x hxU).hom ua *
            (X.presheaf.germ U x hxU).hom ub * a
          = (X.presheaf.germ U x hxU).hom c₀ * ((a * (X.presheaf.germ U x hxU).hom ua) *
            (X.presheaf.germ U x hxU).hom ub) := by ring
        _ = (X.presheaf.germ U x hxU).hom c₀ * ((X.presheaf.germ U x hxU).hom a₀ *
          (X.presheaf.germ U x hxU).hom ub) := by rw [ea]
        _ = (X.presheaf.germ U x hxU).hom c₀ * ((X.presheaf.germ U x hxU).hom b₀ *
          (X.presheaf.germ U x hxU).hom ua) := by
              rw [← map_mul, ← map_mul, ← map_mul, ← map_mul, ec]
        _ = (X.presheaf.germ U x hxU).hom c₀ * ((b * (X.presheaf.germ U x hxU).hom ub) *
          (X.presheaf.germ U x hxU).hom ua) := by rw [eb]
        _ = (X.presheaf.germ U x hxU).hom c₀ * (X.presheaf.germ U x hxU).hom ua * (X.presheaf.germ
          U x hxU).hom ub * b := by ring
NeronModelInfra.isLocalizationAway_of_irreducible
Source context 9 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/Definitions/Def_AlgebraicGeometry_MazurRapoportAppendixGenericFibreOpenImmersionDVR.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.
-/
noncomputable section
universe u v
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry
namespace NeronModelInfra
section RingSide
variable {R : Type u} [CommRing R] [IsDomain R] [IsDiscreteValuationRing R]
variable (K : Type v) [Field K] [Algebra R K] [IsFractionRing R K]
theorem isLocalizationAway_of_irreducible {ϖ : R} (hϖ : Irreducible ϖ) :
    IsLocalization.Away ϖ K
NeronModelInfra.isLocalizationAway_uniformizer_zp
Source context 9 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/Definitions/Def_AlgebraicGeometry_MazurRapoportAppendixGenericFibreOpenImmersionDVR.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.
-/
noncomputable section
universe u v
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry
namespace NeronModelInfra
section RingSide
variable {R : Type u} [CommRing R] [IsDomain R] [IsDiscreteValuationRing R]
variable (K : Type v) [Field K] [Algebra R K] [IsFractionRing R K]
instance isLocalizationAway_uniformizer_zp (p : ℕ) [Fact p.Prime] :
    IsLocalization.Away (p : ℤ_[p]) ℚ_[p]
NeronModelInfra.isLocalizationAway_uniformizer_three
Source context 9 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/Definitions/Def_AlgebraicGeometry_MazurRapoportAppendixGenericFibreOpenImmersionDVR.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.
-/
noncomputable section
universe u v
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry
namespace NeronModelInfra
section RingSide
variable {R : Type u} [CommRing R] [IsDomain R] [IsDiscreteValuationRing R]
variable (K : Type v) [Field K] [Algebra R K] [IsFractionRing R K]
theorem isLocalizationAway_uniformizer_three :
    IsLocalization.Away (3 : ℤ_[3]) ℚ_[3]
NeronModelInfra.isOpenImmersion_specGenericFibreInclusion
Source context 9 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/Definitions/Def_AlgebraicGeometry_MazurRapoportAppendixGenericFibreOpenImmersionDVR.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.
-/
noncomputable section
universe u v
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry
namespace NeronModelInfra
section SchemeSide
variable (R K : Type u) [CommRing R] [IsDomain R] [IsDiscreteValuationRing R]
variable [Field K] [Algebra R K] [IsFractionRing R K]
instance isOpenImmersion_specGenericFibreInclusion :
    IsOpenImmersion (specGenericFibreInclusion R K)
NeronModelInfra.range_specGenericFibreInclusion_eq_basicOpen
Source context 9 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/Definitions/Def_AlgebraicGeometry_MazurRapoportAppendixGenericFibreOpenImmersionDVR.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.
-/
noncomputable section
universe u v
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry
namespace NeronModelInfra
section SchemeSide
variable (R K : Type u) [CommRing R] [IsDomain R] [IsDiscreteValuationRing R]
variable [Field K] [Algebra R K] [IsFractionRing R K]
theorem range_specGenericFibreInclusion_eq_basicOpen {ϖ : R} (hϖ : Irreducible ϖ) :
    Set.range (specGenericFibreInclusion R K).base =
      (PrimeSpectrum.basicOpen ϖ : Set (PrimeSpectrum R))
NeronModelInfra.mono_specGenericFibreInclusion_of_dvr
Source context 9 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/Definitions/Def_AlgebraicGeometry_MazurRapoportAppendixGenericFibreOpenImmersionDVR.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.
-/
noncomputable section
universe u v
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry
namespace NeronModelInfra
section SchemeSide
variable (R K : Type u) [CommRing R] [IsDomain R] [IsDiscreteValuationRing R]
variable [Field K] [Algebra R K] [IsFractionRing R K]
theorem mono_specGenericFibreInclusion_of_dvr :
    Mono (specGenericFibreInclusion R K)
NeronModelInfra.flat_specGenericFibreInclusion_of_dvr
Source context 9 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/Definitions/Def_AlgebraicGeometry_MazurRapoportAppendixGenericFibreOpenImmersionDVR.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.
-/
noncomputable section
universe u v
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry
namespace NeronModelInfra
section SchemeSide
variable (R K : Type u) [CommRing R] [IsDomain R] [IsDiscreteValuationRing R]
variable [Field K] [Algebra R K] [IsFractionRing R K]
theorem flat_specGenericFibreInclusion_of_dvr :
    Flat (specGenericFibreInclusion R K)
NeronModelInfra.not_isIso_specGenericFibreInclusion_zp
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/Definitions/Def_AlgebraicGeometry_MazurRapoportAppendixGenericFibreOpenImmersionDVR.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.
-/
noncomputable section
universe u v
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry
namespace NeronModelInfra
section PadicGates
theorem not_isIso_specGenericFibreInclusion_zp (p : ℕ) [Fact p.Prime] :
    ¬ IsIso (specGenericFibreInclusion ℤ_[p] ℚ_[p])
NeronModelInfra.not_isIso_specGenericFibreInclusion_three
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/Definitions/Def_AlgebraicGeometry_MazurRapoportAppendixGenericFibreOpenImmersionDVR.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.
-/
noncomputable section
universe u v
open CategoryTheory CategoryTheory.Limits AlgebraicGeometry
namespace NeronModelInfra
section PadicGates
theorem not_isIso_specGenericFibreInclusion_three :
    ¬ IsIso (specGenericFibreInclusion ℤ_[3] ℚ_[3])
SchemeTheory.DVRStalks.SmoothRegularity.isRegularLocalRing_of_isLocalization_atPrime
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_AlgebraicGeometry_Smooth_isRegularLocalRing_stalk_of_isDiscreteValuationRing.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 SchemeTheory.DVRStalks.SmoothRegularity
universe u
open _root_.CategoryTheory
open _root_.CategoryTheory.Limits
open _root_.AlgebraicGeometry
theorem isRegularLocalRing_of_isLocalization_atPrime
    (R : Type u) [CommRing R] [IsRegularRing R]
    (S : Type u) [CommRing S] [Algebra R S] [Algebra.Smooth R S]
    (p : Ideal S) [p.IsPrime] (Sₚ : Type u) [CommRing Sₚ] [Algebra S Sₚ] [IsLocalization.AtPrime
      Sₚ p] :
    IsRegularLocalRing Sₚ
AlgebraicGeometry.Smooth.isRegularLocalRing_stalk_of_isDiscreteValuationRing
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_AlgebraicGeometry_Smooth_isRegularLocalRing_stalk_of_isDiscreteValuationRing.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 SchemeTheory.DVRStalks.SmoothRegularity
universe u
open _root_.CategoryTheory
open _root_.CategoryTheory.Limits
open _root_.AlgebraicGeometry
theorem _root_.AlgebraicGeometry.Smooth.isRegularLocalRing_stalk_of_isDiscreteValuationRing
    (R : Type u) [CommRing R] [IsDomain R] [IsDiscreteValuationRing R]
    {T : Scheme.{u}} (t : T ⟶ Spec (CommRingCat.of R)) [Smooth t] (x : T) :
    IsRegularLocalRing (T.presheaf.stalk x)