Module

ResidueTranscendence.lean

Nyll.ValuedFieldTheory.Valuation.ResidueTranscendence
23 declarations indexed from sourceView source ↗

Valuation centers and residue transcendence degree

Imports12
Imported by4

Declarations

IsNoetherianRing.exists_unit_mul_zpow_eq_of_span_singleton_isPrime
Source context 3 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_IsNoetherianRing_exists_unit_mul_zpow_eq_of_span_singleton_isPrime.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 AbelianVarieties.NOSProofs.PrimePowerUnits
theorem _root_.IsNoetherianRing.exists_unit_mul_zpow_eq_of_span_singleton_isPrime
    {A : Type*} [CommRing A] [IsDomain A] [IsNoetherianRing A]
    {K : Type*} [Field K] [Algebra A K] [IsFractionRing A K]
    (π : A) (hπ : (Ideal.span {π}).IsPrime) (hπ0 : π ≠ 0)
    (a : K) (hab : ∃ (m : ℕ) (b : A), a * algebraMap A K π ^ m = algebraMap A K b)
    (hac : ∃ (m : ℕ) (c : A), a⁻¹ * algebraMap A K π ^ m = algebraMap A K c) (ha0 : a ≠ 0) :
    ∃ (n : ℤ) (u : Aˣ), a = algebraMap A K (u : A) * algebraMap A K π ^ n
ValuationSubring.exists_algebraicIndependent_residue_of_le_trdeg
Source context 4 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_ValuationSubring_exists_algebraicIndependent_residue_of_le_trdeg.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 AbelianVarieties.NOSProofs.ResidueLifts
universe u v
theorem _root_.ValuationSubring.exists_algebraicIndependent_residue_of_le_trdeg
    {k : Type u} {K : Type v} [Field k] [Field K] (c : k →+* K) (O : ValuationSubring K)
    (hc : ∀ x : k, c x ∈ O) {d : ℕ} :
    let _ : Algebra k (IsLocalRing.ResidueField O) :=
      ((IsLocalRing.residue O).comp (c.codRestrict O.toSubring hc)).toAlgebra
    (d : Cardinal) ≤ Algebra.trdeg k (IsLocalRing.ResidueField O) →
      ∃ (g : Fin d → K) (hg : ∀ i, g i ∈ O),
        AlgebraicIndependent k (fun i => IsLocalRing.residue O ⟨g i, hg i⟩) := by
  classical
  intro instAlg hd
  obtain ⟨ι, x, hx⟩ := exists_isTranscendenceBasis' k (IsLocalRing.ResidueField O)
  have hcard : (d : Cardinal) ≤ Cardinal.mk ι := by rw [hx.cardinalMk_eq_trdeg]; exact hd
  have hemb : Nonempty (Fin d ↪ ι) := by
    rw [← Cardinal.lift_mk_le']
    simpa only [Cardinal.lift_natCast, Cardinal.mk_fin, Cardinal.lift_lift,
      Cardinal.lift_id, Cardinal.lift_uzero] using hcard
  obtain ⟨e⟩ := hemb
  have hind : AlgebraicIndependent k (x ∘ e) := hx.1.comp e e.injective
  have hl : ∀ i, ∃ y : ↥O, IsLocalRing.residue ↥O y = x (e i) := fun i =>
      IsLocalRing.residue_surjective _
  choose gO hgO using hl
  refine ⟨fun i => (gO i : K), fun i => (gO i).2, ?_⟩
  have : (fun i => IsLocalRing.residue ↥O ⟨(gO i : K), (gO i).2⟩) = x ∘ e := funext fun i => hgO i
  rw [this]
  exact hind
ValuationSubring.eq_zero_of_valuation_eval2_lt_one
Source context 4 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_ValuationSubring_eq_zero_of_valuation_eval2_lt_one.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 AbelianVarieties.NOSProofs.ResidueEvaluation
universe u v
theorem _root_.ValuationSubring.eq_zero_of_valuation_eval2_lt_one
    {k : Type u} {K : Type v} [Field k] [Field K] (c : k →+* K) (O : ValuationSubring K)
    (hc : ∀ x : k, c x ∈ O) {d : ℕ} (g : Fin d → K) (hg : ∀ i, g i ∈ O)
    (hind :
      let : Algebra k (IsLocalRing.ResidueField O) :=
        ((IsLocalRing.residue O).comp (c.codRestrict O.toSubring hc)).toAlgebra
      AlgebraicIndependent k (fun i => IsLocalRing.residue O ⟨g i, hg i⟩))
    (Q : MvPolynomial (Fin d) k) (hQ : O.valuation (Q.eval₂ c g) < 1) : Q = 0 := by
  classical
  let instAlg : Algebra k (IsLocalRing.ResidueField O) :=
    ((IsLocalRing.residue O).comp (c.codRestrict O.toSubring hc)).toAlgebra
  let cO : k →+* ↥O := c.codRestrict O.toSubring hc
  let gO : Fin d → ↥O := fun j => ⟨g j, hg j⟩
  have hev : Q.eval₂ c g = algebraMap ↥O K (Q.eval₂ cO gO) := by
    rw [MvPolynomial.eval₂_comp_left]
    rfl
  rw [hev] at hQ
  have hmem : Q.eval₂ cO gO ∈ IsLocalRing.maximalIdeal ↥O := (O.valuation_lt_one_iff _).mpr hQ
  have hres : IsLocalRing.residue ↥O (Q.eval₂ cO gO) = 0 := (IsLocalRing.residue_eq_zero_iff _).mpr
      hmem
  rw [MvPolynomial.eval₂_comp_left] at hres
  rw [algebraicIndependent_iff] at hind
  apply hind Q
  rw [MvPolynomial.aeval_def]
  exact hres
abbrev

B

L229 ↗
AbelianVarieties.NOSProofs.ResidueBound.ValuationSubring.ResidueTrdeg.B

The restricted valuation 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_ValuationSubring_trdeg_residueField_le_trdeg.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 AbelianVarieties.NOSProofs.ResidueBound
open Cardinal
namespace ValuationSubring
open _root_.ValuationSubring
namespace ResidueTrdeg
open _root_.ValuationSubring
variable (K : Type*) {L : Type*} [Field K] [Field L] [Algebra K L] (A : ValuationSubring L)
abbrev B : ValuationSubring K
AbelianVarieties.NOSProofs.ResidueBound.ValuationSubring.ResidueTrdeg.resHom

The inclusion of restricted valuation rings.

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_ValuationSubring_trdeg_residueField_le_trdeg.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 AbelianVarieties.NOSProofs.ResidueBound
open Cardinal
namespace ValuationSubring
open _root_.ValuationSubring
namespace ResidueTrdeg
open _root_.ValuationSubring
variable (K : Type*) {L : Type*} [Field K] [Field L] [Algebra K L] (A : ValuationSubring L)
def resHom : B K A →+* A
AbelianVarieties.NOSProofs.ResidueBound.ValuationSubring.ResidueTrdeg.coe_resHom_apply
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_ValuationSubring_trdeg_residueField_le_trdeg.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 AbelianVarieties.NOSProofs.ResidueBound
open Cardinal
namespace ValuationSubring
open _root_.ValuationSubring
namespace ResidueTrdeg
open _root_.ValuationSubring
variable (K : Type*) {L : Type*} [Field K] [Field L] [Algebra K L] (A : ValuationSubring L)
lemma coe_resHom_apply (b : B K A) : ((resHom K A b : A) : L) = algebraMap K L (b :
    K)
AbelianVarieties.NOSProofs.ResidueBound.ValuationSubring.ResidueTrdeg.algebraMap_comp_resHom
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_ValuationSubring_trdeg_residueField_le_trdeg.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 AbelianVarieties.NOSProofs.ResidueBound
open Cardinal
namespace ValuationSubring
open _root_.ValuationSubring
namespace ResidueTrdeg
open _root_.ValuationSubring
variable (K : Type*) {L : Type*} [Field K] [Field L] [Algebra K L] (A : ValuationSubring L)
lemma algebraMap_comp_resHom :
    (algebraMap A L).comp (resHom K A) = (algebraMap K L).comp (algebraMap (B K A) K)
AbelianVarieties.NOSProofs.ResidueBound.ValuationSubring.ResidueTrdeg.algebraicIndependent_lift
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_ValuationSubring_trdeg_residueField_le_trdeg.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 AbelianVarieties.NOSProofs.ResidueBound
open Cardinal
namespace ValuationSubring
open _root_.ValuationSubring
namespace ResidueTrdeg
open _root_.ValuationSubring
variable (K : Type*) {L : Type*} [Field K] [Field L] [Algebra K L] (A : ValuationSubring L)
theorem algebraicIndependent_lift
    [Algebra (IsLocalRing.ResidueField (B K A)) (IsLocalRing.ResidueField A)]
    (hcompat : ∀ b : B K A,
      algebraMap (IsLocalRing.ResidueField (B K A)) (IsLocalRing.ResidueField A)
        (IsLocalRing.residue _ b) =
          IsLocalRing.residue A ⟨algebraMap K L (b : K), ValuationSubring.mem_comap.mp b.2⟩)
    {ι : Type*} (y : ι → A)
    (hind : AlgebraicIndependent (IsLocalRing.ResidueField (B K A))
      (fun i => IsLocalRing.residue A (y i))) :
    AlgebraicIndependent K (fun i => ((y i : A) : L)) := by
  classical
  rw [algebraicIndependent_iff]
  intro P hP
  by_contra hP0
  have hsupp : P.support.Nonempty := by
    rw [Finset.nonempty_iff_ne_empty, Ne, MvPolynomial.support_eq_empty]
    exact hP0
  obtain ⟨m₀, hm₀, hmax⟩ := Finset.exists_max_image P.support
    (fun m => A.valuation (algebraMap K L (P.coeff m))) hsupp
  set c : K := P.coeff m₀ with hc
  have hc0 : c ≠ 0 := MvPolynomial.mem_support_iff.mp hm₀
  set Q : MvPolynomial ι K := MvPolynomial.C c⁻¹ * P with hQ
  have hQcoeff : ∀ m, Q.coeff m = c⁻¹ * P.coeff m := fun m => by
    rw [hQ, MvPolynomial.coeff_C_mul]
  have hQm₀ : Q.coeff m₀ = 1 := by rw [hQcoeff, ← hc, inv_mul_cancel₀ hc0]
  have hQeval : MvPolynomial.aeval (fun i => ((y i : A) : L)) Q = 0 := by
    rw [hQ, map_mul, hP, mul_zero]
  have hQmem : ∀ m, algebraMap K L (Q.coeff m) ∈ A := by
    intro m
    rw [← A.valuation_le_one_iff, hQcoeff, map_mul, map_mul, map_inv₀, map_inv₀]
    by_cases hm : m ∈ P.support
    · have hle := hmax m hm
      have hcv : A.valuation (algebraMap K L c) ≠ 0 := by
        rw [Ne, Valuation.zero_iff, map_eq_zero]
        exact hc0
      calc (A.valuation (algebraMap K L c))⁻¹ * A.valuation (algebraMap K L (P.coeff m))
          ≤ (A.valuation (algebraMap K L c))⁻¹ * A.valuation (algebraMap K L c) := by
            gcongr
        _ = 1 := inv_mul_cancel₀ hcv
    · rw [MvPolynomial.notMem_support_iff.mp hm, map_zero, map_zero, mul_zero]
      exact zero_le_one
  obtain ⟨QB, hQB⟩ : Q ∈ Set.range (MvPolynomial.map (algebraMap (B K A) K)) := by
    rw [MvPolynomial.mem_range_map_iff_coeffs_subset]
    intro d hd
    obtain ⟨m, -, rfl⟩ := MvPolynomial.mem_coeffs_iff.mp hd
    exact ⟨⟨Q.coeff m, hQmem m⟩, rfl⟩
  have heval : MvPolynomial.eval₂ (resHom K A) y QB = 0 := by
    have h : algebraMap A L (MvPolynomial.eval₂ (resHom K A) y QB) = 0 := by
      rw [MvPolynomial.eval₂_comp_left, algebraMap_comp_resHom, ← MvPolynomial.eval₂_map, hQB]
      exact hQeval
    apply Subtype.val_injective
    change algebraMap A L (MvPolynomial.eval₂ (resHom K A) y QB) = algebraMap A L 0
    rw [h, map_zero]
  have hres : MvPolynomial.aeval (fun i => IsLocalRing.residue A (y i))
      (MvPolynomial.map (IsLocalRing.residue (B K A)) QB) = 0 := by
    have h1 := congrArg (IsLocalRing.residue A) heval
    rw [map_zero, MvPolynomial.eval₂_comp_left] at h1
    have h2 : (IsLocalRing.residue A).comp (resHom K A) =
        (algebraMap (IsLocalRing.ResidueField (B K A)) (IsLocalRing.ResidueField A)).comp
          (IsLocalRing.residue (B K A)) := by
      ext b
      simp only [RingHom.comp_apply]
      rw [hcompat b]
      rfl
    rw [h2, ← MvPolynomial.eval₂_map] at h1
    rw [MvPolynomial.aeval_def]
    exact h1
  have hzero : MvPolynomial.map (IsLocalRing.residue (B K A)) QB = 0 :=
    (algebraicIndependent_iff.mp hind) _ hres
  have h1 : QB.coeff m₀ = 1 := by
    have h : algebraMap (B K A) K (QB.coeff m₀) = algebraMap (B K A) K 1 := by
      rw [← MvPolynomial.coeff_map, hQB, hQm₀, map_one]
    exact Subtype.val_injective h
  have h2 := congrArg (fun P : MvPolynomial ι (IsLocalRing.ResidueField (B K A)) => P.coeff m₀)
    hzero
  rw [MvPolynomial.coeff_map, h1, map_one, AddMonoidAlgebra.coeff_zero] at h2
  exact one_ne_zero h2
AbelianVarieties.NOSProofs.ResidueBound.ValuationSubring.ResidueTrdeg.main
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_ValuationSubring_trdeg_residueField_le_trdeg.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 AbelianVarieties.NOSProofs.ResidueBound
open Cardinal
namespace ValuationSubring
open _root_.ValuationSubring
namespace ResidueTrdeg
open _root_.ValuationSubring
variable (K : Type*) {L : Type*} [Field K] [Field L] [Algebra K L] (A : ValuationSubring L)
theorem main
    [Algebra (IsLocalRing.ResidueField (A.comap (algebraMap K L))) (IsLocalRing.ResidueField A)]
    (hcompat : ∀ b : A.comap (algebraMap K L),
      algebraMap (IsLocalRing.ResidueField (A.comap (algebraMap K L))) (IsLocalRing.ResidueField A)
        (IsLocalRing.residue _ b) =
          IsLocalRing.residue A ⟨algebraMap K L (b : K), ValuationSubring.mem_comap.mp b.2⟩) :
    Algebra.trdeg (IsLocalRing.ResidueField (A.comap (algebraMap K L)))
        (IsLocalRing.ResidueField A) ≤ Algebra.trdeg K L
ValuationSubring.trdeg_residueField_le_trdeg
Source context 4 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_ValuationSubring_trdeg_residueField_le_trdeg.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 AbelianVarieties.NOSProofs.ResidueBound
open Cardinal
theorem _root_.ValuationSubring.trdeg_residueField_le_trdeg
    {K L : Type*} [Field K] [Field L] [Algebra K L] (A : ValuationSubring L)
    [Algebra (IsLocalRing.ResidueField (A.comap (algebraMap K L))) (IsLocalRing.ResidueField A)]
    (hcompat : ∀ b : A.comap (algebraMap K L),
      algebraMap (IsLocalRing.ResidueField (A.comap (algebraMap K L))) (IsLocalRing.ResidueField A)
        (IsLocalRing.residue _ b) =
          IsLocalRing.residue A ⟨algebraMap K L (b : K), ValuationSubring.mem_comap.mp b.2⟩) :
    Algebra.trdeg (IsLocalRing.ResidueField (A.comap (algebraMap K L)))
        (IsLocalRing.ResidueField A) ≤ Algebra.trdeg K L
AbelianVarieties.NOSProofs.ValuationCenters.Ideal.PrimeDivisorCentre.exists_valuationSubring_centre
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_Ideal_exists_valuationSubring_valuation_lt_one_iff_mem_of_finiteType.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 AbelianVarieties.NOSProofs.ValuationCenters
universe u v w
open scoped nonZeroDivisors
namespace Ideal
open _root_.Ideal
namespace PrimeDivisorCentre
open _root_.Ideal
theorem exists_valuationSubring_centre {B : Type*} [CommRing B] [IsDomain B] {K : Type*} [Field K]
    [Algebra B K] [IsFractionRing B K] (Q : Ideal B) [Q.IsPrime] :
    ∃ V : ValuationSubring K, (∀ b : B, algebraMap B K b ∈ V) ∧
      ∀ b : B, V.valuation (algebraMap B K b) < 1 ↔ b ∈ Q
AbelianVarieties.NOSProofs.ValuationCenters.Ideal.PrimeDivisorCentre.eq_of_one_add_eq_natCast_succ
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_Ideal_exists_valuationSubring_valuation_lt_one_iff_mem_of_finiteType.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 AbelianVarieties.NOSProofs.ValuationCenters
universe u v w
open scoped nonZeroDivisors
namespace Ideal
open _root_.Ideal
namespace PrimeDivisorCentre
open _root_.Ideal
theorem eq_of_one_add_eq_natCast_succ {x : WithBot ℕ∞} {d : ℕ}
    (h : (1 : WithBot ℕ∞) + x = ((d + 1 : ℕ) : WithBot ℕ∞)) : x = (d : WithBot ℕ∞)
AbelianVarieties.NOSProofs.ValuationCenters.Ideal.PrimeDivisorCentre.exists_ringKrullDim_eq_natCast
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_Ideal_exists_valuationSubring_valuation_lt_one_iff_mem_of_finiteType.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 AbelianVarieties.NOSProofs.ValuationCenters
universe u v w
open scoped nonZeroDivisors
namespace Ideal
open _root_.Ideal
namespace PrimeDivisorCentre
open _root_.Ideal
theorem exists_ringKrullDim_eq_natCast (k : Type u) [Field k] (A : Type v) [CommRing A]
    [IsDomain A] [Algebra k A] [Algebra.FiniteType k A] :
    ∃ n : ℕ, ringKrullDim A = (n : WithBot ℕ∞)
AbelianVarieties.NOSProofs.ValuationCenters.Ideal.PrimeDivisorCentre.trdeg_eq_natCast_of_ringKrullDim_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_Ideal_exists_valuationSubring_valuation_lt_one_iff_mem_of_finiteType.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 AbelianVarieties.NOSProofs.ValuationCenters
universe u v w
open scoped nonZeroDivisors
namespace Ideal
open _root_.Ideal
namespace PrimeDivisorCentre
open _root_.Ideal
theorem trdeg_eq_natCast_of_ringKrullDim_eq (k : Type u) [Field k] (A : Type v) [CommRing A]
    [IsDomain A] [Algebra k A] [Algebra.FiniteType k A] {n : ℕ}
    (h : ringKrullDim A = (n : WithBot ℕ∞)) : Algebra.trdeg k A = n
AbelianVarieties.NOSProofs.ValuationCenters.Ideal.PrimeDivisorCentre.exists_algebraicIndependent_of_ringKrullDim_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_Ideal_exists_valuationSubring_valuation_lt_one_iff_mem_of_finiteType.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 AbelianVarieties.NOSProofs.ValuationCenters
universe u v w
open scoped nonZeroDivisors
namespace Ideal
open _root_.Ideal
namespace PrimeDivisorCentre
open _root_.Ideal
theorem exists_algebraicIndependent_of_ringKrullDim_eq (k : Type u) [Field k] (C : Type v)
    [CommRing C] [IsDomain C] [Algebra k C] [Algebra.FiniteType k C] {d : ℕ}
    (h : ringKrullDim C = (d : WithBot ℕ∞)) :
    ∃ x : Fin d → C, AlgebraicIndependent k x
AbelianVarieties.NOSProofs.ValuationCenters.Ideal.PrimeDivisorCentre.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_Ideal_exists_valuationSubring_valuation_lt_one_iff_mem_of_finiteType.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 AbelianVarieties.NOSProofs.ValuationCenters
universe u v w
open scoped nonZeroDivisors
namespace Ideal
open _root_.Ideal
namespace PrimeDivisorCentre
open _root_.Ideal
section Main
variable (k : Type u) [Field k] {A : Type v} [CommRing A] [IsDomain A] [Algebra k A]
  [Algebra.FiniteType k A]
  (K : Type w) [Field K] [Algebra A K] [IsFractionRing A K] [Algebra k K] [IsScalarTower k A K]
theorem main (p : Ideal A) [hp : p.IsPrime] (hp0 : p ≠ ⊥) :
    ∃ (O : ValuationSubring K) (d : ℕ) (f : Fin d → K),
      O ≠ ⊤ ∧ (∀ a : A, algebraMap A K a ∈ O) ∧
      (∀ a : A, O.valuation (algebraMap A K a) < 1 ↔ a ∈ p) ∧
      ((d + 1 : ℕ) : WithBot ℕ∞) = ringKrullDim A ∧
      (∀ i, f i ∈ O) ∧
      ∀ Q : MvPolynomial (Fin d) k, O.valuation (MvPolynomial.aeval f Q) < 1 → Q = 0
Ideal.exists_valuationSubring_valuation_lt_one_iff_mem_of_finiteType
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_Ideal_exists_valuationSubring_valuation_lt_one_iff_mem_of_finiteType.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 AbelianVarieties.NOSProofs.ValuationCenters
universe u v w
open scoped nonZeroDivisors
open Ideal.PrimeDivisorCentre in
theorem _root_.Ideal.exists_valuationSubring_valuation_lt_one_iff_mem_of_finiteType
    (k : Type u) [Field k] {A : Type v} [CommRing A] [IsDomain A] [Algebra k A]
    [Algebra.FiniteType k A]
    (K : Type w) [Field K] [Algebra A K] [IsFractionRing A K] [Algebra k K] [IsScalarTower k A K]
    (p : Ideal A) [p.IsPrime] (hp : p ≠ ⊥) :
    ∃ (O : ValuationSubring K) (d : ℕ) (f : Fin d → K),
      O ≠ ⊤ ∧ (∀ a : A, algebraMap A K a ∈ O) ∧
      (∀ a : A, O.valuation (algebraMap A K a) < 1 ↔ a ∈ p) ∧
      ((d + 1 : ℕ) : WithBot ℕ∞) = ringKrullDim A ∧
      (∀ i, f i ∈ O) ∧
      ∀ Q : MvPolynomial (Fin d) k, O.valuation (MvPolynomial.aeval f Q) < 1 → Q = 0
AbelianVarieties.NOSProofs.HeightOne.Ideal.HeightOneOfIndependentResidues.algebraicIndependent_mk
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_Ideal_height_eq_one_of_ne_bot_of_forall_aeval_mem_imp_eq_zero_of_ringKrullDim_eq.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 AbelianVarieties.NOSProofs.HeightOne
universe u v
namespace Ideal
open _root_.Ideal
namespace HeightOneOfIndependentResidues
open _root_.Ideal
theorem algebraicIndependent_mk (k : Type u) [Field k] {A : Type v} [CommRing A] [Algebra k A]
    (p : Ideal A) {d : ℕ} (f : Fin d → A)
    (hind : ∀ Q : MvPolynomial (Fin d) k, MvPolynomial.aeval f Q ∈ p → Q = 0) :
    AlgebraicIndependent k (fun i => Ideal.Quotient.mk p (f i)) := by
  rw [AlgebraicIndependent]
  intro Q₁ Q₂ hQ
  have h1 : ∀ Q : MvPolynomial (Fin d) k,
      MvPolynomial.aeval (fun i => Ideal.Quotient.mk p (f i)) Q =
        Ideal.Quotient.mkₐ k p (MvPolynomial.aeval f Q) := by
    intro Q
    rw [MvPolynomial.comp_aeval_apply]
    rfl
  have h2 : MvPolynomial.aeval f (Q₁ - Q₂) ∈ p := by
    rw [← Ideal.Quotient.eq_zero_iff_mem]
    have := hQ
    rw [h1, h1] at this
    change Ideal.Quotient.mk p (MvPolynomial.aeval f Q₁) = Ideal.Quotient.mk p (MvPolynomial.aeval
        f Q₂)
      at this
    rw [map_sub, map_sub, this, sub_self]
  exact sub_eq_zero.mp (hind _ h2)
AbelianVarieties.NOSProofs.HeightOne.Ideal.HeightOneOfIndependentResidues.natCast_le_ringKrullDim_of_algebraicIndependent
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_Ideal_height_eq_one_of_ne_bot_of_forall_aeval_mem_imp_eq_zero_of_ringKrullDim_eq.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 AbelianVarieties.NOSProofs.HeightOne
universe u v
namespace Ideal
open _root_.Ideal
namespace HeightOneOfIndependentResidues
open _root_.Ideal
theorem natCast_le_ringKrullDim_of_algebraicIndependent (k : Type u) [Field k] {B : Type v}
    [CommRing B]
    [IsDomain B] [Algebra k B] [Algebra.FiniteType k B] {d : ℕ} {x : Fin d → B}
    (hx : AlgebraicIndependent k x) : ((d : ℕ) : WithBot ℕ∞) ≤ ringKrullDim B
AbelianVarieties.NOSProofs.HeightOne.Ideal.HeightOneOfIndependentResidues.enat_eq_one_of_add_eq_of_le
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_Ideal_height_eq_one_of_ne_bot_of_forall_aeval_mem_imp_eq_zero_of_ringKrullDim_eq.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 AbelianVarieties.NOSProofs.HeightOne
universe u v
namespace Ideal
open _root_.Ideal
namespace HeightOneOfIndependentResidues
open _root_.Ideal
theorem enat_eq_one_of_add_eq_of_le {h : ℕ∞} {x : WithBot ℕ∞} {d : ℕ}
    (hsum : (h : WithBot ℕ∞) + x = ((d + 1 : ℕ) : WithBot ℕ∞)) (hle : ((d : ℕ) : WithBot ℕ∞) ≤ x)
    (hne : h ≠ 0) : h = 1
Ideal.height_eq_one_of_ne_bot_of_forall_aeval_mem_imp_eq_zero_of_ringKrullDim_eq
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_Ideal_height_eq_one_of_ne_bot_of_forall_aeval_mem_imp_eq_zero_of_ringKrullDim_eq.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 AbelianVarieties.NOSProofs.HeightOne
universe u v
open Ideal.HeightOneOfIndependentResidues in
theorem _root_.Ideal.height_eq_one_of_ne_bot_of_forall_aeval_mem_imp_eq_zero_of_ringKrullDim_eq
    (k : Type u) [Field k] {A : Type v} [CommRing A] [IsDomain A] [Algebra k A]
    [Algebra.FiniteType k A]
    (p : Ideal A) [p.IsPrime] (hp : p ≠ ⊥)
    (d : ℕ) (hd : ((d + 1 : ℕ) : WithBot ℕ∞) = ringKrullDim A)
    (f : Fin d → A) (hind : ∀ Q : MvPolynomial (Fin d) k, MvPolynomial.aeval f Q ∈ p → Q = 0) :
    p.height = 1
AbelianVarieties.NOSProofs.ResidueTower.TranscendenceInequality.card_book
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_ValuationSubring_le_trdeg_residueField_comap_of_le_trdeg_residueField.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 AbelianVarieties.NOSProofs.ResidueTower
universe u
open Cardinal
namespace TranscendenceInequality
theorem card_book (a b c : Cardinal.{u}) (nK nL : ℕ)
    (h1 : ((nL - 1 : ℕ) : Cardinal) ≤ a + b) (h2 : b ≤ c) (h3 : (nK : Cardinal) + c ≤ nL) :
    ((nK - 1 : ℕ) : Cardinal) ≤ a
ValuationSubring.le_trdeg_residueField_comap_of_le_trdeg_residueField
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_ValuationSubring_le_trdeg_residueField_comap_of_le_trdeg_residueField.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 AbelianVarieties.NOSProofs.ResidueTower
universe u
open Cardinal
open TranscendenceInequality in
theorem _root_.ValuationSubring.le_trdeg_residueField_comap_of_le_trdeg_residueField
    {k K L : Type u} [Field k] [Field K] [Field L] [Algebra k K] [Algebra K L] [Algebra k L]
    [IsScalarTower k K L]
    (A : ValuationSubring L) (hk : ∀ x : k, algebraMap k L x ∈ A)
    (nK nL : ℕ) (hK : Algebra.trdeg k K = nK) (hL : Algebra.trdeg k L = nL)
    (hA : let : Algebra k (IsLocalRing.ResidueField A) :=
        ((IsLocalRing.residue A).comp ((algebraMap k L).codRestrict A.toSubring hk)).toAlgebra
      ((nL - 1 : ℕ) : Cardinal) ≤ Algebra.trdeg k (IsLocalRing.ResidueField A)) :
    let O : ValuationSubring K := A.comap (algebraMap K L)
    let hkO : ∀ x : k, algebraMap k K x ∈ O := fun x => by
      rw [ValuationSubring.mem_comap, ← IsScalarTower.algebraMap_apply]
      exact hk x
    let : Algebra k (IsLocalRing.ResidueField O) :=
      ((IsLocalRing.residue O).comp ((algebraMap k K).codRestrict O.toSubring hkO)).toAlgebra
    ((nK - 1 : ℕ) : Cardinal) ≤ Algebra.trdeg k (IsLocalRing.ResidueField O) := by
  intro O hkO iO
  let f : O →+* A := ((algebraMap K L).comp O.toSubring.subtype).codRestrict A.toSubring
    (fun o => ValuationSubring.mem_comap.mp o.2)
  have hf : ∀ o : O, (f o : L) = algebraMap K L (o : K) := fun o => rfl
  have : IsLocalHom f := by
    constructor
    intro o ho
    obtain ⟨u, hu⟩ := ho
    have hne : (o : K) ≠ 0 := by
      intro h0
      have : (f o : L) = 0 := by rw [hf, h0, map_zero]
      exact (u.ne_zero) (by rw [hu]; exact Subtype.ext this)
    have hinvA : algebraMap K L (o : K)⁻¹ ∈ A := by
      have h1 : ((u : A) : L) * (((u⁻¹ : Aˣ) : A) : L) = 1 := congrArg Subtype.val u.mul_inv
      have h2 : (((u⁻¹ : Aˣ) : A) : L) = ((u : A) : L)⁻¹ := (eq_inv_of_mul_eq_one_right h1)
      rw [map_inv₀, ← hf, ← hu, ← h2]
      exact ((u⁻¹ : Aˣ) : A).2
    have hinvO : (o : K)⁻¹ ∈ O := ValuationSubring.mem_comap.mpr hinvA
    exact isUnit_iff_exists_inv.mpr ⟨⟨(o : K)⁻¹, hinvO⟩, Subtype.ext (mul_inv_cancel₀ hne)⟩
  let : Algebra (IsLocalRing.ResidueField O) (IsLocalRing.ResidueField A) :=
    (IsLocalRing.ResidueField.map f).toAlgebra
  have hcompat : ∀ b : O,
      algebraMap (IsLocalRing.ResidueField O) (IsLocalRing.ResidueField A) (IsLocalRing.residue _
          b) =
        IsLocalRing.residue A ⟨algebraMap K L (b : K), ValuationSubring.mem_comap.mp b.2⟩ := fun b
            =>
    IsLocalRing.ResidueField.map_residue f b
  have h5 := ValuationSubring.trdeg_residueField_le_trdeg A hcompat
  let iA : Algebra k (IsLocalRing.ResidueField A) :=
    ((IsLocalRing.residue A).comp ((algebraMap k L).codRestrict A.toSubring hk)).toAlgebra
  have : IsScalarTower k (IsLocalRing.ResidueField O) (IsLocalRing.ResidueField A) := by
    apply IsScalarTower.of_algebraMap_eq
    intro x
    change IsLocalRing.residue A ⟨algebraMap k L x, hk x⟩ =
      IsLocalRing.ResidueField.map f (IsLocalRing.residue O ⟨algebraMap k K x, hkO x⟩)
    rw [IsLocalRing.ResidueField.map_residue]
    congr 1
    apply Subtype.ext
    change algebraMap k L x = algebraMap K L (algebraMap k K x)
    exact IsScalarTower.algebraMap_apply k K L x
  have : FaithfulSMul k (IsLocalRing.ResidueField O) :=
    (faithfulSMul_iff_algebraMap_injective k _).mpr (algebraMap k (IsLocalRing.ResidueField
        O)).injective
  have : FaithfulSMul (IsLocalRing.ResidueField O) (IsLocalRing.ResidueField A) :=
    (faithfulSMul_iff_algebraMap_injective _ _).mpr
      (algebraMap (IsLocalRing.ResidueField O) (IsLocalRing.ResidueField A)).injective
  have : FaithfulSMul k K := (faithfulSMul_iff_algebraMap_injective k K).mpr (algebraMap k
      K).injective
  have : FaithfulSMul K L := (faithfulSMul_iff_algebraMap_injective K L).mpr (algebraMap K
      L).injective
  have hadd : Algebra.trdeg k (IsLocalRing.ResidueField O) +
      Algebra.trdeg (IsLocalRing.ResidueField O) (IsLocalRing.ResidueField A) =
        Algebra.trdeg k (IsLocalRing.ResidueField A) :=
    trdeg_add_eq k (IsLocalRing.ResidueField O)
  have hKL : Algebra.trdeg k K + Algebra.trdeg K L ≤ Algebra.trdeg k L := trdeg_add_le
  rw [hK, hL] at hKL
  change ((nL - 1 : ℕ) : Cardinal) ≤ Algebra.trdeg k (IsLocalRing.ResidueField A) at hA
  rw [← hadd] at hA
  exact card_book _ _ _ nK nL hA h5 hKL