Module

IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.lean

Nyll.AlgebraicCurves.Foundations.CommutativeAlgebra.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
46 declarations indexed from sourceView source ↗

Is Local Ring length quotient map maximal Ideal eq finsum ramification Idx mul inertia Deg

Imports10
  • Mathlib.RingTheory.Valuation.LocalSubring
  • Mathlib.RingTheory.DedekindDomain.AdicValuation
  • Mathlib.RingTheory.RamificationInertia.Ramification
  • Mathlib.RingTheory.Spectrum.Prime.Noetherian
  • Mathlib.RingTheory.DedekindDomain.Ideal.Lemmas
  • Mathlib.RingTheory.TensorProduct.Quotient
  • Mathlib.RingTheory.RamificationInertia.Inertia
  • Mathlib.RingTheory.HopkinsLevitzki
  • Mathlib.Algebra.Module.LinearMap.End
  • Nyll.AlgebraicCurves.Valuations.IsDiscreteValuationRing_exists_finite_locallyPrincipalOverring
Imported by2

Declarations

AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.isUnit_iff_inv_mem
Source context 9 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section Dict
variable {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
variable {D₁ : Type*} [CommRing D₁] [IsDedekindDomain D₁] [Algebra C D₁]
variable {κ : Type*} [Field κ] [Algebra D₁ κ] [IsFractionRing D₁ κ] [Algebra C κ] [IsScalarTower C
  D₁ κ]
theorem isUnit_iff_inv_mem {L : Type*} [Field L] (B : ValuationSubring L) (x : B)
    (hx0 : (x : L) ≠ 0) : IsUnit x ↔ (x : L)⁻¹ ∈ B
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.mem_maximalIdeal_iff_inv_not_mem
Source context 9 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section Dict
variable {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
variable {D₁ : Type*} [CommRing D₁] [IsDedekindDomain D₁] [Algebra C D₁]
variable {κ : Type*} [Field κ] [Algebra D₁ κ] [IsFractionRing D₁ κ] [Algebra C κ] [IsScalarTower C
  D₁ κ]
theorem mem_maximalIdeal_iff_inv_not_mem {L : Type*} [Field L] (B : ValuationSubring L) (x : B)
    (hx0 : (x : L) ≠ 0) : x ∈ maximalIdeal B ↔ (x : L)⁻¹ ∉ B
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.mem_nonunits_iff_eq_zero_or
Source context 9 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section Dict
variable {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
variable {D₁ : Type*} [CommRing D₁] [IsDedekindDomain D₁] [Algebra C D₁]
variable {κ : Type*} [Field κ] [Algebra D₁ κ] [IsFractionRing D₁ κ] [Algebra C κ] [IsScalarTower C
  D₁ κ]
theorem mem_nonunits_iff_eq_zero_or {L : Type*} [Field L] (B : ValuationSubring L) (x : L) :
    x ∈ B.nonunits ↔ x ∈ B ∧ (x = 0 ∨ x⁻¹ ∉ B)
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.inertiaDeg_maximalIdeal_eq_one_of_isLocalization
Source context 9 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section Dict
variable {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
variable {D₁ : Type*} [CommRing D₁] [IsDedekindDomain D₁] [Algebra C D₁]
variable {κ : Type*} [Field κ] [Algebra D₁ κ] [IsFractionRing D₁ κ] [Algebra C κ] [IsScalarTower C
  D₁ κ]
theorem inertiaDeg_maximalIdeal_eq_one_of_isLocalization {R : Type*} [CommRing R]
    (p : Ideal R) [p.IsMaximal] (Rₚ : Type*) [CommRing Rₚ] [Algebra R Rₚ]
    [IsLocalization.AtPrime Rₚ p] [IsLocalRing Rₚ] :
    (maximalIdeal Rₚ).inertiaDeg R = 1
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.Over

The condition that the valuation subring contains the two base rings and lies over the base maximal ideal.

Source context 10 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section Dict
variable {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
variable {D₁ : Type*} [CommRing D₁] [IsDedekindDomain D₁] [Algebra C D₁]
variable {κ : Type*} [Field κ] [Algebra D₁ κ] [IsFractionRing D₁ κ] [Algebra C κ] [IsScalarTower C
  D₁ κ]
variable (C D₁) in
def Over (B : ValuationSubring κ) : Prop
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.overAlgebra

The algebra structure on the valuation subring induced by the base-ring map landing in it.

Source context 10 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section Dict
variable {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
variable {D₁ : Type*} [CommRing D₁] [IsDedekindDomain D₁] [Algebra C D₁]
variable {κ : Type*} [Field κ] [Algebra D₁ κ] [IsFractionRing D₁ κ] [Algebra C κ] [IsScalarTower C
  D₁ κ]
variable (C D₁) in
abbrev overAlgebra (B : ValuationSubring κ) (h : ∀ c : C, algebraMap C κ c ∈ B) : Algebra C B
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.ef

The product of the ramification index and inertia degree of the valuation subring over the base.

Source context 10 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section Dict
variable {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
variable {D₁ : Type*} [CommRing D₁] [IsDedekindDomain D₁] [Algebra C D₁]
variable {κ : Type*} [Field κ] [Algebra D₁ κ] [IsFractionRing D₁ κ] [Algebra C κ] [IsScalarTower C
  D₁ κ]
variable (C D₁) in
def ef (B : ValuationSubring κ) (h : ∀ c : C, algebraMap C κ c ∈ B) : ℕ
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.algebraMap_Cκ_injective
Source context 11 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section Dict
variable {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
variable {D₁ : Type*} [CommRing D₁] [IsDedekindDomain D₁] [Algebra C D₁]
variable {κ : Type*} [Field κ] [Algebra D₁ κ] [IsFractionRing D₁ κ] [Algebra C κ] [IsScalarTower C
  D₁ κ]
variable (C D₁) in
omit [IsDomain C] [IsDiscreteValuationRing C] [IsDedekindDomain D₁] in
theorem algebraMap_Cκ_injective : Function.Injective (algebraMap C κ) ↔
    Function.Injective (algebraMap C D₁)
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.ne_top_of_over
Source context 11 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section Dict
variable {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
variable {D₁ : Type*} [CommRing D₁] [IsDedekindDomain D₁] [Algebra C D₁]
variable {κ : Type*} [Field κ] [Algebra D₁ κ] [IsFractionRing D₁ κ] [Algebra C κ] [IsScalarTower C
  D₁ κ]
variable (C D₁) in
omit [IsDedekindDomain D₁] in
theorem ne_top_of_over (hinj : Function.Injective (algebraMap C D₁))
    (B : ValuationSubring κ) (h : Over C D₁ B) : B ≠ ⊤
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.maximalIdeal_ne_bot
Source context 11 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section Dict
variable {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
variable {D₁ : Type*} [CommRing D₁] [IsDedekindDomain D₁] [Algebra C D₁]
variable {κ : Type*} [Field κ] [Algebra D₁ κ] [IsFractionRing D₁ κ] [Algebra C κ] [IsScalarTower C
  D₁ κ]
variable (C D₁) in
variable (C) in
theorem maximalIdeal_ne_bot : maximalIdeal C ≠ ⊥
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.isTorsionFree
Source context 12 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section Dict
variable {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
variable {D₁ : Type*} [CommRing D₁] [IsDedekindDomain D₁] [Algebra C D₁]
variable {κ : Type*} [Field κ] [Algebra D₁ κ] [IsFractionRing D₁ κ] [Algebra C κ] [IsScalarTower C
  D₁ κ]
variable (C D₁) in
variable (C) in
omit [IsDiscreteValuationRing C] in
theorem isTorsionFree (hinj : Function.Injective (algebraMap C D₁)) : Module.IsTorsionFree C D₁
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.toOver

The ring map to the valuation subring obtained by restricting the codomain of the field inclusion.

Source context 11 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section Dict
variable {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
variable {D₁ : Type*} [CommRing D₁] [IsDedekindDomain D₁] [Algebra C D₁]
variable {κ : Type*} [Field κ] [Algebra D₁ κ] [IsFractionRing D₁ κ] [Algebra C κ] [IsScalarTower C
  D₁ κ]
variable (C D₁) in
variable (C) in
def toOver (B : ValuationSubring κ) (h : ∀ x : D₁, algebraMap D₁ κ x ∈ B) :
    D₁ →+* B
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.coe_toOver
Source context 12 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section Dict
variable {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
variable {D₁ : Type*} [CommRing D₁] [IsDedekindDomain D₁] [Algebra C D₁]
variable {κ : Type*} [Field κ] [Algebra D₁ κ] [IsFractionRing D₁ κ] [Algebra C κ] [IsScalarTower C
  D₁ κ]
variable (C D₁) in
variable (C) in
omit [IsDedekindDomain D₁] [IsFractionRing D₁ κ] in
theorem coe_toOver (B : ValuationSubring κ) (h : ∀ x : D₁, algebraMap D₁ κ x ∈ B)
    (s : D₁) : ((toOver B h s : B) : κ) = algebraMap D₁ κ s
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.center

The center of the valuation subring on the intermediate ring.

Source context 11 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section Dict
variable {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
variable {D₁ : Type*} [CommRing D₁] [IsDedekindDomain D₁] [Algebra C D₁]
variable {κ : Type*} [Field κ] [Algebra D₁ κ] [IsFractionRing D₁ κ] [Algebra C κ] [IsScalarTower C
  D₁ κ]
variable (C D₁) in
variable (C) in
def center (B : ValuationSubring κ) (h : ∀ x : D₁, algebraMap D₁ κ x ∈ B) :
    Ideal D₁
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.mem_center_iff
Source context 12 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section Dict
variable {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
variable {D₁ : Type*} [CommRing D₁] [IsDedekindDomain D₁] [Algebra C D₁]
variable {κ : Type*} [Field κ] [Algebra D₁ κ] [IsFractionRing D₁ κ] [Algebra C κ] [IsScalarTower C
  D₁ κ]
variable (C D₁) in
variable (C) in
omit [IsDedekindDomain D₁] [IsFractionRing D₁ κ] in
theorem mem_center_iff (B : ValuationSubring κ) (h : ∀ x : D₁, algebraMap D₁ κ x ∈ B)
    (s : D₁) : s ∈ center B h ↔ algebraMap D₁ κ s ∈ B.nonunits
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.center_isPrime
Source context 11 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section Dict
variable {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
variable {D₁ : Type*} [CommRing D₁] [IsDedekindDomain D₁] [Algebra C D₁]
variable {κ : Type*} [Field κ] [Algebra D₁ κ] [IsFractionRing D₁ κ] [Algebra C κ] [IsScalarTower C
  D₁ κ]
variable (C D₁) in
variable (C) in
instance center_isPrime (B : ValuationSubring κ) (h : ∀ x : D₁, algebraMap D₁ κ x ∈ B) :
    (center B h).IsPrime
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.comap_center
Source context 12 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section Dict
variable {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
variable {D₁ : Type*} [CommRing D₁] [IsDedekindDomain D₁] [Algebra C D₁]
variable {κ : Type*} [Field κ] [Algebra D₁ κ] [IsFractionRing D₁ κ] [Algebra C κ] [IsScalarTower C
  D₁ κ]
variable (C D₁) in
variable (C) in
omit [IsDedekindDomain D₁] [IsFractionRing D₁ κ] in
theorem comap_center (B : ValuationSubring κ) (h : Over C D₁ B) :
    (center B h.2.1).comap (algebraMap C D₁) = maximalIdeal C
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.center_liesOver
Source context 11 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section Dict
variable {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
variable {D₁ : Type*} [CommRing D₁] [IsDedekindDomain D₁] [Algebra C D₁]
variable {κ : Type*} [Field κ] [Algebra D₁ κ] [IsFractionRing D₁ κ] [Algebra C κ] [IsScalarTower C
  D₁ κ]
variable (C D₁) in
variable (C) in
instance center_liesOver (B : ValuationSubring κ) (h : Over C D₁ B) :
    (center B h.2.1).LiesOver (maximalIdeal C)
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.center_ne_bot
Source context 12 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section Dict
variable {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
variable {D₁ : Type*} [CommRing D₁] [IsDedekindDomain D₁] [Algebra C D₁]
variable {κ : Type*} [Field κ] [Algebra D₁ κ] [IsFractionRing D₁ κ] [Algebra C κ] [IsScalarTower C
  D₁ κ]
variable (C D₁) in
variable (C) in
omit [IsDedekindDomain D₁] [IsFractionRing D₁ κ] in
theorem center_ne_bot (hinj : Function.Injective (algebraMap C D₁)) (B : ValuationSubring κ)
    (h : Over C D₁ B) : center B h.2.1 ≠ ⊥
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.vOf

The height-one prime determined by the center of the valuation subring.

Source context 11 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section Dict
variable {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
variable {D₁ : Type*} [CommRing D₁] [IsDedekindDomain D₁] [Algebra C D₁]
variable {κ : Type*} [Field κ] [Algebra D₁ κ] [IsFractionRing D₁ κ] [Algebra C κ] [IsScalarTower C
  D₁ κ]
variable (C D₁) in
variable (C) in
def vOf (hinj : Function.Injective (algebraMap C D₁)) (B : ValuationSubring κ)
    (h : Over C D₁ B) : HeightOneSpectrum D₁
abbrev

W

L194 ↗
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.W

The valuation subring associated with a height-one prime of the intermediate ring.

Source context 11 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section Dict
variable {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
variable {D₁ : Type*} [CommRing D₁] [IsDedekindDomain D₁] [Algebra C D₁]
variable {κ : Type*} [Field κ] [Algebra D₁ κ] [IsFractionRing D₁ κ] [Algebra C κ] [IsScalarTower C
  D₁ κ]
variable (C D₁) in
variable (C) in
abbrev W (v : HeightOneSpectrum D₁) : ValuationSubring κ
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.isDiscreteValuationRing_W
Source context 11 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section Dict
variable {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
variable {D₁ : Type*} [CommRing D₁] [IsDedekindDomain D₁] [Algebra C D₁]
variable {κ : Type*} [Field κ] [Algebra D₁ κ] [IsFractionRing D₁ κ] [Algebra C κ] [IsScalarTower C
  D₁ κ]
variable (C D₁) in
variable (C) in
theorem isDiscreteValuationRing_W (v : HeightOneSpectrum D₁) : IsDiscreteValuationRing (W (κ := κ)
  v)
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.coe_algebraMap_W
Source context 11 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section Dict
variable {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
variable {D₁ : Type*} [CommRing D₁] [IsDedekindDomain D₁] [Algebra C D₁]
variable {κ : Type*} [Field κ] [Algebra D₁ κ] [IsFractionRing D₁ κ] [Algebra C κ] [IsScalarTower C
  D₁ κ]
variable (C D₁) in
variable (C) in
theorem coe_algebraMap_W (v : HeightOneSpectrum D₁) (s : D₁) :
    ((algebraMap D₁ (W (κ := κ) v) s : W v) : κ) = algebraMap D₁ κ s
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.over_W
Source context 12 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section Dict
variable {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
variable {D₁ : Type*} [CommRing D₁] [IsDedekindDomain D₁] [Algebra C D₁]
variable {κ : Type*} [Field κ] [Algebra D₁ κ] [IsFractionRing D₁ κ] [Algebra C κ] [IsScalarTower C
  D₁ κ]
variable (C D₁) in
variable (C) in
variable (C) in
theorem over_W (v : HeightOneSpectrum D₁) [v.asIdeal.LiesOver (maximalIdeal C)] :
    Over C D₁ (W (κ := κ) v)
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.W_vOf_le
Source context 12 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section Dict
variable {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
variable {D₁ : Type*} [CommRing D₁] [IsDedekindDomain D₁] [Algebra C D₁]
variable {κ : Type*} [Field κ] [Algebra D₁ κ] [IsFractionRing D₁ κ] [Algebra C κ] [IsScalarTower C
  D₁ κ]
variable (C D₁) in
variable (C) in
variable (C) in
theorem W_vOf_le (hinj : Function.Injective (algebraMap C D₁)) (B : ValuationSubring κ)
    (h : Over C D₁ B) : W (vOf hinj B h) ≤ B
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.W_vOf_eq
Source context 12 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section Dict
variable {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
variable {D₁ : Type*} [CommRing D₁] [IsDedekindDomain D₁] [Algebra C D₁]
variable {κ : Type*} [Field κ] [Algebra D₁ κ] [IsFractionRing D₁ κ] [Algebra C κ] [IsScalarTower C
  D₁ κ]
variable (C D₁) in
variable (C) in
variable (C) in
theorem W_vOf_eq (hinj : Function.Injective (algebraMap C D₁)) (B : ValuationSubring κ)
    (h : Over C D₁ B) : W (vOf hinj B h) = B
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.vOf_W
Source context 12 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section Dict
variable {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
variable {D₁ : Type*} [CommRing D₁] [IsDedekindDomain D₁] [Algebra C D₁]
variable {κ : Type*} [Field κ] [Algebra D₁ κ] [IsFractionRing D₁ κ] [Algebra C κ] [IsScalarTower C
  D₁ κ]
variable (C D₁) in
variable (C) in
variable (C) in
theorem vOf_W (hinj : Function.Injective (algebraMap C D₁)) (v : HeightOneSpectrum D₁)
    [v.asIdeal.LiesOver (maximalIdeal C)] : vOf hinj (W (κ := κ) v) (over_W C v) = v
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.ef_W
Source context 12 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section Dict
variable {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
variable {D₁ : Type*} [CommRing D₁] [IsDedekindDomain D₁] [Algebra C D₁]
variable {κ : Type*} [Field κ] [Algebra D₁ κ] [IsFractionRing D₁ κ] [Algebra C κ] [IsScalarTower C
  D₁ κ]
variable (C D₁) in
variable (C) in
variable (C) in
theorem ef_W (hinj : Function.Injective (algebraMap C D₁)) (v : HeightOneSpectrum D₁)
    [v.asIdeal.LiesOver (maximalIdeal C)] :
    ef (W (κ := κ) v) (over_W C v).1 =
    (maximalIdeal C).ramificationIdx' v.asIdeal * v.asIdeal.inertiaDeg C
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.valuationSubring_equiv_primesOver
Source context 5 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
theorem valuationSubring_equiv_primesOver
    {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
    (K : Type*) [Field K] [Algebra C K] [IsFractionRing C K]
    {D₁ : Type*} [CommRing D₁] [IsDedekindDomain D₁] [Algebra C D₁]
    (κ : Type*) [Field κ] [Algebra D₁ κ] [IsFractionRing D₁ κ] [Algebra C κ] [IsScalarTower C D₁ κ]
    [Algebra K κ] [IsScalarTower C K κ]
    (hinj : Function.Injective (algebraMap C D₁)) :
    ∃ ε : {B : ValuationSubring κ // (∀ c : C, algebraMap C κ c ∈ B) ∧ (∀ x : D₁, algebraMap D₁ κ x
      ∈ B) ∧
              ∀ c : C, algebraMap C κ c ∈ B.nonunits ↔ c ∈ maximalIdeal C}
            ≃ ↥(IsDedekindDomain.primesOverFinset (maximalIdeal C) D₁),
      ∀ B : {B : ValuationSubring κ // (∀ c : C, algebraMap C κ c ∈ B) ∧
          (∀ x : D₁, algebraMap D₁ κ x ∈ B) ∧ ∀ c : C, algebraMap C κ c ∈ B.nonunits ↔ c ∈
            maximalIdeal C},
        (letI : Algebra C ↥B.1 := ((algebraMap C κ).codRestrict B.1 B.2.1).toAlgebra
         (maximalIdeal C).ramificationIdx' (maximalIdeal ↥B.1) *
           (maximalIdeal ↥B.1).inertiaDeg C) =
          (maximalIdeal C).ramificationIdx' (ε B).1 * (ε B).1.inertiaDeg C := by
  classical
  have : Module.IsTorsionFree C D₁ := isTorsionFree hinj
  have hmem : ∀ P : Ideal D₁, P ∈ IsDedekindDomain.primesOverFinset (maximalIdeal C) D₁ ↔
      P.IsPrime ∧ P.LiesOver (maximalIdeal C) := fun P =>
    IsDedekindDomain.mem_primesOverFinset_iff (maximalIdeal_ne_bot C) D₁
  let hos : ↥(IsDedekindDomain.primesOverFinset (maximalIdeal C) D₁) → HeightOneSpectrum D₁ := fun
    P =>
    haveI := ((hmem P.1).mp P.2).1
    haveI := ((hmem P.1).mp P.2).2
    ⟨P.1, inferInstance, Ideal.ne_bot_of_liesOver_of_ne_bot (maximalIdeal_ne_bot C) P.1⟩
  have hos_over : ∀ P : ↥(IsDedekindDomain.primesOverFinset (maximalIdeal C) D₁),
      (hos P).asIdeal.LiesOver (maximalIdeal C) := fun P => ((hmem P.1).mp P.2).2
  let ε : {B : ValuationSubring κ // Over C D₁ B} ≃ ↥(IsDedekindDomain.primesOverFinset
    (maximalIdeal C) D₁) :=
    { toFun := fun B => ⟨center B.1 B.2.2.1, (hmem _).mpr ⟨inferInstance, center_liesOver B.1 B.2⟩⟩
      invFun := fun P => haveI := hos_over P; ⟨W (hos P), over_W C (hos P)⟩
      left_inv := fun B => Subtype.ext (W_vOf_eq hinj B.1 B.2)
      right_inv := fun P => by
        have := hos_over P
        exact Subtype.ext (congrArg HeightOneSpectrum.asIdeal (vOf_W (κ := κ) hinj (hos P))) }
  refine ⟨ε, fun B => ?_⟩
  have := hos_over (ε B)
  have key : B = ε.symm (ε B) := (ε.symm_apply_apply B).symm
  have : (letI : Algebra C ↥B.1 := ((algebraMap C κ).codRestrict B.1 B.2.1).toAlgebra
          (maximalIdeal C).ramificationIdx' (maximalIdeal ↥B.1) *
            (maximalIdeal ↥B.1).inertiaDeg C) = ef B.1 B.2.1 := rfl
  rw [this]
  conv_lhs => rw [key]
  exact ef_W hinj (hos (ε B))
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.sum_ramification_inertia_eq_finrank_finite_fiber
Source context 7 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section CRT

/-
The finite-fiber sum argument below is adapted from Mathlib by Thomas Browning:
Copyright (c) 2026 Thomas Browning. All rights reserved.
The primes-over argument is adapted from Mathlib by Kenji Nakagawa,
Anne Baanen, and Filippo A. E. Nuccio:
Copyright (c) 2020 Kenji Nakagawa. All rights reserved.
Both sources are released under Apache 2.0 as described in LICENSE.
Pinned sources:
https://github.com/leanprover-community/mathlib4/blob/065356127b1dc0016f66b7283ce0ce2c4055aa55/Mathlib/RingTheory/RamificationInertia/Basic.lean
https://github.com/leanprover-community/mathlib4/blob/065356127b1dc0016f66b7283ce0ce2c4055aa55/Mathlib/RingTheory/DedekindDomain/Ideal/Lemmas.lean
The quotient/fiber bridge and local adaptation are by Naganori Yamaguchi
(assisted by OpenAI Codex), https://github.com/n-yamaguchi-0729.
-/
open IsLocalRing Module OrderIso PrimeSpectrum
theorem sum_ramification_inertia_eq_finrank_finite_fiber
    {R : Type*} [CommRing R] (p : Ideal R) [p.IsPrime]
    (S : Type*) [CommRing S] [Algebra R S]
    [Module.Finite p.ResidueField (p.Fiber S)] [Fintype (p.primesOver S)] :
    ∑ q : p.primesOver S, q.1.ramificationIdx R * q.1.inertiaDeg R =
      finrank p.ResidueField (p.Fiber S)
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.quotientFiberAlgEquiv

The algebra equivalence between quotient by the extended maximal ideal and the corresponding fiber.

Source context 8 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section CRT

/-
The finite-fiber sum argument below is adapted from Mathlib by Thomas Browning:
Copyright (c) 2026 Thomas Browning. All rights reserved.
The primes-over argument is adapted from Mathlib by Kenji Nakagawa,
Anne Baanen, and Filippo A. E. Nuccio:
Copyright (c) 2020 Kenji Nakagawa. All rights reserved.
Both sources are released under Apache 2.0 as described in LICENSE.
Pinned sources:
https://github.com/leanprover-community/mathlib4/blob/065356127b1dc0016f66b7283ce0ce2c4055aa55/Mathlib/RingTheory/RamificationInertia/Basic.lean
https://github.com/leanprover-community/mathlib4/blob/065356127b1dc0016f66b7283ce0ce2c4055aa55/Mathlib/RingTheory/DedekindDomain/Ideal/Lemmas.lean
The quotient/fiber bridge and local adaptation are by Naganori Yamaguchi
(assisted by OpenAI Codex), https://github.com/n-yamaguchi-0729.
-/
open IsLocalRing Module OrderIso PrimeSpectrum
attribute [local instance] Ideal.Quotient.field
def quotientFiberAlgEquiv
    {R : Type*} [CommRing R] (p : Ideal R) [p.IsMaximal]
    (S : Type*) [CommRing S] [Algebra R S] :
    (S ⧸ p.map (algebraMap R S)) ≃ₐ[R ⧸ p] p.Fiber S
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.finite_fiber_and_finrank_eq_quotient
Source context 8 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section CRT

/-
The finite-fiber sum argument below is adapted from Mathlib by Thomas Browning:
Copyright (c) 2026 Thomas Browning. All rights reserved.
The primes-over argument is adapted from Mathlib by Kenji Nakagawa,
Anne Baanen, and Filippo A. E. Nuccio:
Copyright (c) 2020 Kenji Nakagawa. All rights reserved.
Both sources are released under Apache 2.0 as described in LICENSE.
Pinned sources:
https://github.com/leanprover-community/mathlib4/blob/065356127b1dc0016f66b7283ce0ce2c4055aa55/Mathlib/RingTheory/RamificationInertia/Basic.lean
https://github.com/leanprover-community/mathlib4/blob/065356127b1dc0016f66b7283ce0ce2c4055aa55/Mathlib/RingTheory/DedekindDomain/Ideal/Lemmas.lean
The quotient/fiber bridge and local adaptation are by Naganori Yamaguchi
(assisted by OpenAI Codex), https://github.com/n-yamaguchi-0729.
-/
open IsLocalRing Module OrderIso PrimeSpectrum
attribute [local instance] Ideal.Quotient.field
theorem finite_fiber_and_finrank_eq_quotient
    {R : Type*} [CommRing R] (p : Ideal R) [p.IsMaximal]
    (S : Type*) [CommRing S] [Algebra R S]
    [Module.Finite (R ⧸ p) (S ⧸ p.map (algebraMap R S))] :
    Module.Finite p.ResidueField (p.Fiber S) ∧
      Module.finrank p.ResidueField (p.Fiber S) =
        Module.finrank (R ⧸ p) (S ⧸ p.map (algebraMap R S))
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.mem_primesOver_iff_mem_factors_of_map_ne_bot
Source context 10 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section CRT

/-
The finite-fiber sum argument below is adapted from Mathlib by Thomas Browning:
Copyright (c) 2026 Thomas Browning. All rights reserved.
The primes-over argument is adapted from Mathlib by Kenji Nakagawa,
Anne Baanen, and Filippo A. E. Nuccio:
Copyright (c) 2020 Kenji Nakagawa. All rights reserved.
Both sources are released under Apache 2.0 as described in LICENSE.
Pinned sources:
https://github.com/leanprover-community/mathlib4/blob/065356127b1dc0016f66b7283ce0ce2c4055aa55/Mathlib/RingTheory/RamificationInertia/Basic.lean
https://github.com/leanprover-community/mathlib4/blob/065356127b1dc0016f66b7283ce0ce2c4055aa55/Mathlib/RingTheory/DedekindDomain/Ideal/Lemmas.lean
The quotient/fiber bridge and local adaptation are by Naganori Yamaguchi
(assisted by OpenAI Codex), https://github.com/n-yamaguchi-0729.
-/
open IsLocalRing Module OrderIso PrimeSpectrum
attribute [local instance] Ideal.Quotient.field
open Ideal UniqueFactorizationMonoid
variable {R S : Type*} [CommRing R] [CommRing S] [IsDedekindDomain S] [Algebra R S]
theorem mem_primesOver_iff_mem_factors_of_map_ne_bot (p : Ideal R) [h : p.IsMaximal]
    (hp : p.map (algebraMap R S) ≠ ⊥) {P : Ideal S} :
    P ∈ p.primesOver S ↔ P ∈ normalizedFactors (p.map (algebraMap R S))
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.coe_primesOverFinset_of_map_ne_bot
Source context 10 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section CRT

/-
The finite-fiber sum argument below is adapted from Mathlib by Thomas Browning:
Copyright (c) 2026 Thomas Browning. All rights reserved.
The primes-over argument is adapted from Mathlib by Kenji Nakagawa,
Anne Baanen, and Filippo A. E. Nuccio:
Copyright (c) 2020 Kenji Nakagawa. All rights reserved.
Both sources are released under Apache 2.0 as described in LICENSE.
Pinned sources:
https://github.com/leanprover-community/mathlib4/blob/065356127b1dc0016f66b7283ce0ce2c4055aa55/Mathlib/RingTheory/RamificationInertia/Basic.lean
https://github.com/leanprover-community/mathlib4/blob/065356127b1dc0016f66b7283ce0ce2c4055aa55/Mathlib/RingTheory/DedekindDomain/Ideal/Lemmas.lean
The quotient/fiber bridge and local adaptation are by Naganori Yamaguchi
(assisted by OpenAI Codex), https://github.com/n-yamaguchi-0729.
-/
open IsLocalRing Module OrderIso PrimeSpectrum
attribute [local instance] Ideal.Quotient.field
open Ideal UniqueFactorizationMonoid
variable {R S : Type*} [CommRing R] [CommRing S] [IsDedekindDomain S] [Algebra R S]
theorem coe_primesOverFinset_of_map_ne_bot (p : Ideal R) [p.IsMaximal]
    (hp : p.map (algebraMap R S) ≠ ⊥) :
    (IsDedekindDomain.primesOverFinset p S : Set (Ideal S)) = p.primesOver S
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.finrank_quotient_map_eq_sum
Source context 10 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section CRT

/-
The finite-fiber sum argument below is adapted from Mathlib by Thomas Browning:
Copyright (c) 2026 Thomas Browning. All rights reserved.
The primes-over argument is adapted from Mathlib by Kenji Nakagawa,
Anne Baanen, and Filippo A. E. Nuccio:
Copyright (c) 2020 Kenji Nakagawa. All rights reserved.
Both sources are released under Apache 2.0 as described in LICENSE.
Pinned sources:
https://github.com/leanprover-community/mathlib4/blob/065356127b1dc0016f66b7283ce0ce2c4055aa55/Mathlib/RingTheory/RamificationInertia/Basic.lean
https://github.com/leanprover-community/mathlib4/blob/065356127b1dc0016f66b7283ce0ce2c4055aa55/Mathlib/RingTheory/DedekindDomain/Ideal/Lemmas.lean
The quotient/fiber bridge and local adaptation are by Naganori Yamaguchi
(assisted by OpenAI Codex), https://github.com/n-yamaguchi-0729.
-/
open IsLocalRing Module OrderIso PrimeSpectrum
attribute [local instance] Ideal.Quotient.field
open Ideal UniqueFactorizationMonoid
variable {R S : Type*} [CommRing R] [CommRing S] [IsDedekindDomain S] [Algebra R S]
theorem finrank_quotient_map_eq_sum
    {R S : Type*} [CommRing R] [CommRing S] [IsDedekindDomain S] [Algebra R S]
    (p : Ideal R) [p.IsMaximal] (hp : p.map (algebraMap R S) ≠ ⊥)
    [Module.Finite (R ⧸ p) (S ⧸ p.map (algebraMap R S))] :
    Module.finrank (R ⧸ p) (S ⧸ p.map (algebraMap R S)) =
      ∑ P ∈ IsDedekindDomain.primesOverFinset p S,
        p.ramificationIdx' P * P.inertiaDeg R
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.finrank_quotient_map_maximalIdeal_eq_finsum
Source context 5 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
theorem finrank_quotient_map_maximalIdeal_eq_finsum
    {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
    (K : Type*) [Field K] [Algebra C K] [IsFractionRing C K]
    {D₁ : Type*} [CommRing D₁] [IsDedekindDomain D₁] [Algebra C D₁]
    (κ : Type*) [Field κ] [Algebra D₁ κ] [IsFractionRing D₁ κ] [Algebra C κ] [IsScalarTower C D₁ κ]
    [Algebra K κ] [IsScalarTower C K κ]
    (hinj : Function.Injective (algebraMap C D₁))
    [Module.Finite (C ⧸ maximalIdeal C) (D₁ ⧸ (maximalIdeal C).map (algebraMap C D₁))] :
    Finite {B : ValuationSubring κ // (∀ c : C, algebraMap C κ c ∈ B) ∧ (∀ x : D₁, algebraMap D₁ κ
      x ∈ B) ∧
        ∀ c : C, algebraMap C κ c ∈ B.nonunits ↔ c ∈ maximalIdeal C} ∧
    (Module.finrank (C ⧸ maximalIdeal C) (D₁ ⧸ (maximalIdeal C).map (algebraMap C D₁)) : ℕ∞) =
      ∑ᶠ B : {B : ValuationSubring κ // (∀ c : C, algebraMap C κ c ∈ B) ∧ (∀ x : D₁, algebraMap D₁
        κ x ∈ B) ∧
          ∀ c : C, algebraMap C κ c ∈ B.nonunits ↔ c ∈ maximalIdeal C},
        ((letI : Algebra C ↥B.1 := ((algebraMap C κ).codRestrict B.1 B.2.1).toAlgebra
          (maximalIdeal C).ramificationIdx' (maximalIdeal ↥B.1) * (maximalIdeal ↥B.1).inertiaDeg C
            : ℕ) : ℕ∞) := by
  classical
  obtain ⟨ε, hε⟩ := valuationSubring_equiv_primesOver K κ hinj (D₁ := D₁)
  have : Fintype {B : ValuationSubring κ // (∀ c : C, algebraMap C κ c ∈ B) ∧
      (∀ x : D₁, algebraMap D₁ κ x ∈ B) ∧ ∀ c : C, algebraMap C κ c ∈ B.nonunits ↔ c ∈ maximalIdeal
        C} :=
    Fintype.ofEquiv _ ε.symm
  refine ⟨Finite.of_fintype _, ?_⟩
  have hp : Ideal.map (algebraMap C D₁) (maximalIdeal C) ≠ ⊥ := by
    rw [Ne, Ideal.map_eq_bot_iff_of_injective hinj]; exact maximalIdeal_ne_bot C
  rw [finsum_eq_sum_of_fintype, ← Nat.cast_sum, finrank_quotient_map_eq_sum (maximalIdeal C) hp,
    Fintype.sum_equiv ε _
      (fun P => (maximalIdeal C).ramificationIdx' P.1 * P.1.inertiaDeg C) hε,
    Finset.sum_coe_sort (IsDedekindDomain.primesOverFinset (maximalIdeal C) D₁)
      (fun P => (maximalIdeal C).ramificationIdx' P * P.inertiaDeg C)]
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.isFractionRing_subalgebra
Source context 7 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section Overring
variable {D : Type*} [CommRing D] [IsDomain D] (κ : Type*) [Field κ] [Algebra D κ] [IsFractionRing
  D κ]
theorem isFractionRing_subalgebra (D₁ : Subalgebra D κ) : IsFractionRing ↥D₁ κ
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.isDedekindDomain_of_locallyPrincipal
Source context 8 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section Overring
variable {D : Type*} [CommRing D] [IsDomain D] (κ : Type*) [Field κ] [Algebra D κ] [IsFractionRing
  D κ]
variable {κ}
theorem isDedekindDomain_of_locallyPrincipal [IsNoetherianRing D] [IsLocalRing D] (hDdim :
  Ring.DimensionLEOne D)
    (D₁ : Subalgebra D κ) (hfin : Module.Finite D ↥D₁)
    (hloc : ∀ 𝔫 : Ideal ↥D₁, 𝔫.IsMaximal → ∃ t ∈ 𝔫, ∀ x ∈ 𝔫, ∃ s ∉ 𝔫, ∃ y : ↥D₁, s * x = t * y) :
    IsDedekindDomain ↥D₁
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.isArtinianRing_quotient_of_ne_bot
Source context 8 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section FiniteLength
variable {D : Type*} [CommRing D] [IsDomain D] [IsNoetherianRing D]
omit [IsDomain D] in
theorem isArtinianRing_quotient_of_ne_bot (hDdim : Ring.DimensionLEOne D) (𝔟 : Ideal D) (h𝔟 : 𝔟 ≠
  ⊥) :
    IsArtinianRing (D ⧸ 𝔟)
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.length_ne_top_of_smul_eq_zero
Source context 8 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section FiniteLength
variable {D : Type*} [CommRing D] [IsDomain D] [IsNoetherianRing D]
omit [IsDomain D] in
theorem length_ne_top_of_smul_eq_zero (hDdim : Ring.DimensionLEOne D)
    {M : Type*} [AddCommGroup M] [Module D M] [Module.Finite D M]
    (d : D) (hd : d ≠ 0) (hM : ∀ m : M, d • m = 0) : Module.length D M ≠ ⊤
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.length_quotient_span_singleton_smul_top_eq
Source context 8 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section Lattice
variable {R : Type*} [CommRing R] {M : Type*} [AddCommGroup M] [Module R M]
open Pointwise in
theorem length_quotient_span_singleton_smul_top_eq (x : R) (hx : ∀ m : M, x • m = 0 → m = 0)
    (N : Submodule R M) (hN : Module.length R (M ⧸ N) ≠ ⊤) :
    Module.length R (↥N ⧸ ((Ideal.span {x} : Ideal R) • (⊤ : Submodule R ↥N))) =
      Module.length R (M ⧸ ((Ideal.span {x} : Ideal R) • (⊤ : Submodule R M)))
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.IsSimpleModule.of_surjective_residue_comp_algebraMap
Source context 8 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section LengthTransfer
open IsLocalRing
variable {A R : Type*} [CommRing A] [CommRing R] [IsLocalRing R] [Algebra A R]
theorem IsSimpleModule.of_surjective_residue_comp_algebraMap
    (h : Function.Surjective ((residue R).comp (algebraMap A R)))
    (M : Type*) [AddCommGroup M] [Module R M] [Module A M] [IsScalarTower A R M] [IsSimpleModule R
      M] :
    IsSimpleModule A M
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.Module.length_restrictScalars_eq_of_surjective_residue_aux
Source context 8 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section LengthTransfer
open IsLocalRing
variable {A R : Type*} [CommRing A] [CommRing R] [IsLocalRing R] [Algebra A R]
theorem Module.length_restrictScalars_eq_of_surjective_residue_aux
    (h : Function.Surjective ((residue R).comp (algebraMap A R))) :
    ∀ (M : Type*) [AddCommGroup M] [Module R M], IsFiniteLength R M →
      ∀ [Module A M] [IsScalarTower A R M], Module.length A M = Module.length R M
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.Module.length_restrictScalars_eq_of_surjective_residue
Source context 8 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
section LengthTransfer
open IsLocalRing
variable {A R : Type*} [CommRing A] [CommRing R] [IsLocalRing R] [Algebra A R]
theorem Module.length_restrictScalars_eq_of_surjective_residue
    (h : Function.Surjective ((residue R).comp (algebraMap A R)))
    {M : Type*} [AddCommGroup M] [Module R M] (hM : IsFiniteLength R M)
    [Module A M] [IsScalarTower A R M] :
    Module.length A M = Module.length R M
AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs.IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg.NormLength.core
Source context 5 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
namespace NormLength
theorem core
    {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
    (K : Type*) [Field K] [Algebra C K] [IsFractionRing C K]
    {D : Type*} [CommRing D] [IsDomain D] [IsLocalRing D] [IsNoetherianRing D] [Algebra C D]
    (_hDmax : ∀ c : C, algebraMap C D c ∈ maximalIdeal D ↔ c ∈ maximalIdeal C)
    (hDres : ∀ d : D, ∃ c : C, d - algebraMap C D c ∈ maximalIdeal D)
    (hDdim : Ring.DimensionLEOne D) (_hDnf : maximalIdeal D ≠ ⊥)
    (κ : Type*) [Field κ] [Algebra D κ] [IsFractionRing D κ] [Algebra C κ] [IsScalarTower C D κ]
    [Algebra K κ] [IsScalarTower C K κ] [FiniteDimensional K κ] [Algebra.IsSeparable K κ]
    (D₁ : Type*) [CommRing D₁] [IsDedekindDomain D₁] [Algebra D D₁] [Module.Finite D D₁]
    [Algebra C D₁] [IsScalarTower C D D₁] [Algebra D₁ κ] [IsFractionRing D₁ κ]
    [IsScalarTower D D₁ κ] [IsScalarTower C D₁ κ] :
    {B : ValuationSubring κ | ∀ d : D, algebraMap D κ d ∈ B}.Finite ∧
    Module.length D (D ⧸ (maximalIdeal C).map (algebraMap C D)) =
      ∑ᶠ B : {B : ValuationSubring κ // (∀ c : C, algebraMap C κ c ∈ B) ∧ (∀ d : D, algebraMap D κ
        d ∈ B) ∧
          ∀ c : C, algebraMap C κ c ∈ B.nonunits ↔ c ∈ maximalIdeal C},
        ((letI : Algebra C ↥B.1 := ((algebraMap C κ).codRestrict B.1 B.2.1).toAlgebra
          (maximalIdeal C).ramificationIdx' (maximalIdeal ↥B.1) * (maximalIdeal ↥B.1).inertiaDeg C
            : ℕ) : ℕ∞) := by
  classical
  have := hDdim
  have hCκ : Function.Injective (algebraMap C κ) := by
    rw [IsScalarTower.algebraMap_eq C K κ]
    exact (algebraMap K κ).injective.comp (IsFractionRing.injective C K)
  have hCD : Function.Injective (algebraMap C D) := fun a b h => hCκ (by
    rw [IsScalarTower.algebraMap_apply C D κ, IsScalarTower.algebraMap_apply C D κ b, h])
  obtain ⟨ϖ, hϖ⟩ := IsDiscreteValuationRing.exists_irreducible C
  have hmC : maximalIdeal C = Ideal.span {ϖ} := hϖ.maximalIdeal_eq
  have hϖm : ϖ ∈ maximalIdeal C := hmC ▸ Ideal.mem_span_singleton_self ϖ
  set ϖD : D := algebraMap C D ϖ with hϖD
  have hϖD0 : ϖD ≠ 0 := (map_ne_zero_iff _ hCD).mpr hϖ.ne_zero
  have hmCD : (maximalIdeal C).map (algebraMap C D) = Ideal.span {ϖD} := by
    rw [hmC, Ideal.map_span, Set.image_singleton]
  have hsurj : Function.Surjective ((residue D).comp (algebraMap C D)) := by
    intro x
    obtain ⟨d, rfl⟩ := IsLocalRing.residue_surjective x
    obtain ⟨c, hc⟩ := hDres d
    refine ⟨c, ?_⟩
    rw [RingHom.comp_apply]
    exact ((Ideal.Quotient.eq (I := maximalIdeal D)).mpr hc).symm
  have : Algebra.IsIntegral D D₁ := Algebra.IsIntegral.of_finite D D₁
  have hDD₁ : Function.Injective (algebraMap D D₁) := fun a b h => by
    have := congrArg (algebraMap D₁ κ) h
    rw [← IsScalarTower.algebraMap_apply, ← IsScalarTower.algebraMap_apply] at this
    exact IsFractionRing.injective D κ this
  have hCD₁ : Function.Injective (algebraMap C D₁) := by
    rw [IsScalarTower.algebraMap_eq C D D₁]; exact hDD₁.comp hCD
  have hmCD₁ : (maximalIdeal C).map (algebraMap C D₁) = (Ideal.span {ϖD}).map (algebraMap D D₁) :=
    by
    rw [IsScalarTower.algebraMap_eq C D D₁, ← Ideal.map_map, hmCD]
  set N : Submodule D D₁ := LinearMap.range (Algebra.linearMap D D₁) with hN
  have hNfin : Module.length D (D₁ ⧸ N) ≠ ⊤ := by
    obtain ⟨s, hs⟩ := Module.Finite.fg_top (R := D) (M := D₁)
    obtain ⟨b, hb⟩ := IsLocalization.exist_integer_multiples_of_finset (nonZeroDivisors D)
      (s.image (fun x : D₁ => algebraMap D₁ κ x))
    have hbN : ∀ x : D₁, (b : D) • x ∈ N := by
      intro x
      have hx : x ∈ Submodule.span D (s : Set D₁) := by rw [hs]; exact Submodule.mem_top
      refine Submodule.span_induction ?_ ?_ ?_ ?_ hx
      · intro y hy
        obtain ⟨a, ha⟩ := hb (algebraMap D₁ κ y) (Finset.mem_image_of_mem _ hy)
        refine ⟨a, ?_⟩
        apply IsFractionRing.injective D₁ κ
        change algebraMap D₁ κ (algebraMap D D₁ a) = algebraMap D₁ κ ((b : D) • y)
        rw [← IsScalarTower.algebraMap_apply, ha, Algebra.smul_def, Algebra.smul_def, map_mul,
          ← IsScalarTower.algebraMap_apply]
      · rw [smul_zero]; exact N.zero_mem
      · intro y z _ _ hy hz; rw [smul_add]; exact N.add_mem hy hz
      · intro a y _ hy; rw [smul_comm]; exact N.smul_mem a hy
    refine length_ne_top_of_smul_eq_zero hDdim (b : D) (nonZeroDivisors.ne_zero b.2) fun q => ?_
    obtain ⟨x, rfl⟩ := Submodule.mkQ_surjective N q
    rw [← map_smul, Submodule.mkQ_apply, Submodule.Quotient.mk_eq_zero]
    exact hbN x
  have hreg : ∀ m : D₁, ϖD • m = 0 → m = 0 := fun m hm => by
    rw [Algebra.smul_def, mul_eq_zero] at hm
    exact hm.resolve_left ((map_ne_zero_iff _ hDD₁).mpr hϖD0)
  have hlat := length_quotient_span_singleton_smul_top_eq ϖD hreg N hNfin
  have eN : ↥N ≃ₗ[D] D := (LinearEquiv.ofInjective (Algebra.linearMap D D₁) hDD₁).symm
  have hleft : Module.length D (↥N ⧸ ((Ideal.span {ϖD} : Ideal D) • (⊤ : Submodule D ↥N))) =
      Module.length D (D ⧸ (maximalIdeal C).map (algebraMap C D)) := by
    refine (Submodule.Quotient.equiv ((Ideal.span {ϖD} : Ideal D) • (⊤ : Submodule D ↥N))
      ((Ideal.span {ϖD} : Ideal D) • (⊤ : Submodule D D)) eN (by
        rw [Submodule.map_smul'', Submodule.map_top, LinearEquiv.range])).length_eq.trans ?_
    · rw [hmCD, Submodule.ideal_span_singleton_smul]
      refine (Submodule.quotEquivOfEq _ _ ?_).length_eq
      ext d
      rw [Submodule.mem_smul_pointwise_iff_exists, Ideal.mem_span_singleton']
      exact ⟨fun ⟨e, _, h⟩ => ⟨e,
        by rw [← h, smul_eq_mul, mul_comm]⟩, fun ⟨e, h⟩ => ⟨e, Submodule.mem_top, by
        rw [← h, smul_eq_mul, mul_comm]⟩⟩
  have hright : Module.length D (D₁ ⧸ ((Ideal.span {ϖD} : Ideal D) • (⊤ : Submodule D D₁))) =
      Module.length D (D₁ ⧸ (maximalIdeal C).map (algebraMap C D₁)) := by
    rw [Ideal.smul_top_eq_map, ← hmCD₁]
    exact (Submodule.Quotient.restrictScalarsEquiv D ((maximalIdeal C).map (algebraMap C
      D₁))).length_eq
  have hM0 : ∀ q : D₁ ⧸ (maximalIdeal C).map (algebraMap C D₁), ϖD • q = 0 := by
    intro q
    obtain ⟨x, rfl⟩ := Ideal.Quotient.mk_surjective q
    change ϖD • Submodule.Quotient.mk x = 0
    rw [← Submodule.Quotient.mk_smul, Submodule.Quotient.mk_eq_zero, Algebra.smul_def]
    refine Ideal.mul_mem_right _ _ ?_
    rw [hϖD, ← IsScalarTower.algebraMap_apply C D D₁]
    exact Ideal.mem_map_of_mem _ hϖm
  have hMfin : Module.Finite D (D₁ ⧸ (maximalIdeal C).map (algebraMap C D₁)) :=
    Module.Finite.of_surjective (Ideal.Quotient.mkₐ D ((maximalIdeal C).map (algebraMap C
      D₁))).toLinearMap
      Ideal.Quotient.mk_surjective
  have hlenM : Module.length D (D₁ ⧸ (maximalIdeal C).map (algebraMap C D₁)) ≠ ⊤ :=
    length_ne_top_of_smul_eq_zero hDdim ϖD hϖD0 hM0
  have h1 : Module.length C (D₁ ⧸ (maximalIdeal C).map (algebraMap C D₁)) =
      Module.length D (D₁ ⧸ (maximalIdeal C).map (algebraMap C D₁)) :=
    Module.length_restrictScalars_eq_of_surjective_residue hsurj (Module.length_ne_top_iff.mp hlenM)
  have h2 : Module.length C (D₁ ⧸ (maximalIdeal C).map (algebraMap C D₁)) =
      Module.length (C ⧸ maximalIdeal C) (D₁ ⧸ (maximalIdeal C).map (algebraMap C D₁)) :=
    Module.length_eq_of_surjective (R := C ⧸ maximalIdeal C) (S := C) Ideal.Quotient.mk_surjective
  have := IsLocalRing.maximalIdeal.isMaximal C
  let : Field (C ⧸ maximalIdeal C) := Ideal.Quotient.field _
  have hflk : IsFiniteLength (C ⧸ maximalIdeal C) (D₁ ⧸ (maximalIdeal C).map (algebraMap C D₁)) :=
    by
    rw [← Module.length_ne_top_iff, ← h2, h1]; exact hlenM
  have : IsNoetherian (C ⧸ maximalIdeal C) (D₁ ⧸ (maximalIdeal C).map (algebraMap C D₁)) :=
    (isFiniteLength_iff_isNoetherian_isArtinian.mp hflk).1
  have : Module.Finite (C ⧸ maximalIdeal C) (D₁ ⧸ (maximalIdeal C).map (algebraMap C D₁)) :=
    inferInstance
  have h3 : Module.length (C ⧸ maximalIdeal C) (D₁ ⧸ (maximalIdeal C).map (algebraMap C D₁)) =
      Module.finrank (C ⧸ maximalIdeal C) (D₁ ⧸ (maximalIdeal C).map (algebraMap C D₁)) :=
    Module.length_eq_finrank _ _
  obtain ⟨hIfin, hsum⟩ := finrank_quotient_map_maximalIdeal_eq_finsum (C := C) K (D₁ := D₁) κ hCD₁
  have hDκ : ∀ d : D, algebraMap D κ d = algebraMap D₁ κ (algebraMap D D₁ d) := fun d =>
    IsScalarTower.algebraMap_apply D D₁ κ d
  have hD₁B : ∀ B : ValuationSubring κ, (∀ d : D, algebraMap D κ d ∈ B) → ∀ x : D₁, algebraMap D₁ κ
    x ∈ B := by
    intro B hB x
    let : Algebra D ↥B := ((algebraMap D κ).codRestrict B hB).toAlgebra
    have : IsScalarTower D ↥B κ := IsScalarTower.of_algebraMap_eq (fun _ => rfl)
    have hx : IsIntegral D (algebraMap D₁ κ x) :=
      (Algebra.IsIntegral.isIntegral (R := D) x).map (IsScalarTower.toAlgHom D D₁ κ)
    have hx' : IsIntegral ↥B (algebraMap D₁ κ x) := hx.tower_top
    obtain ⟨z, hz⟩ := (isIntegrallyClosed_iff κ).mp inferInstance hx'
    rw [← hz]; exact z.2
  let e : {B : ValuationSubring κ // (∀ c : C, algebraMap C κ c ∈ B) ∧ (∀ x : D₁, algebraMap D₁ κ x
    ∈ B) ∧
        ∀ c : C, algebraMap C κ c ∈ B.nonunits ↔ c ∈ maximalIdeal C} ≃
      {B : ValuationSubring κ // (∀ c : C, algebraMap C κ c ∈ B) ∧ (∀ d : D, algebraMap D κ d ∈ B) ∧
        ∀ c : C, algebraMap C κ c ∈ B.nonunits ↔ c ∈ maximalIdeal C} :=
    { toFun := fun B => ⟨B.1, B.2.1, fun d => by rw [hDκ]; exact B.2.2.1 _, B.2.2.2⟩
      invFun := fun B => ⟨B.1, B.2.1, hD₁B B.1 B.2.2.1, B.2.2.2⟩
      left_inv := fun B => rfl
      right_inv := fun B => rfl }
  have := hIfin
  have : Finite {B : ValuationSubring κ // (∀ c : C, algebraMap C κ c ∈ B) ∧ (∀ d : D, algebraMap D
    κ d ∈ B) ∧
      ∀ c : C, algebraMap C κ c ∈ B.nonunits ↔ c ∈ maximalIdeal C} := Finite.of_equiv _ e
  have : Algebra.IsIntegral K κ := Algebra.IsIntegral.of_finite K κ
  have hcentred : ∀ B : ValuationSubring κ, (∀ d : D, algebraMap D κ d ∈ B) → B ≠ ⊤ →
      ∀ c : C, algebraMap C κ c ∈ B.nonunits ↔ c ∈ maximalIdeal C := by
    intro B hB hBtop
    have hCB : ∀ c : C, algebraMap C κ c ∈ B := fun c => by
      rw [IsScalarTower.algebraMap_apply C D κ]; exact hB _
    have hϖκ0 : algebraMap C κ ϖ ≠ 0 := (map_ne_zero_iff _ hCκ).mpr hϖ.ne_zero
    have hϖB : algebraMap C κ ϖ ∈ B.nonunits := by
      rw [ValuationSubring.mem_nonunits_iff_or]
      refine Or.inr fun hinv => hBtop ?_
      have hKB : ∀ k : K, algebraMap K κ k ∈ B := by
        intro k
        obtain ⟨a, b, hb, rfl⟩ := IsFractionRing.div_surjective (A := C) k
        have hb0 : b ≠ 0 := nonZeroDivisors.ne_zero hb
        obtain ⟨n, hn⟩ := IsDiscreteValuationRing.associated_pow_irreducible hb0 hϖ
        obtain ⟨u, hu⟩ := hn
        have hbinv : (algebraMap C κ b)⁻¹ = algebraMap C κ u * ((algebraMap C κ ϖ)⁻¹) ^ n := by
          refine inv_eq_of_mul_eq_one_right ?_
          rw [← mul_assoc, ← map_mul, hu, map_pow, inv_pow, mul_inv_cancel₀ (pow_ne_zero n hϖκ0)]
        rw [map_div₀, ← IsScalarTower.algebraMap_apply, ← IsScalarTower.algebraMap_apply,
          div_eq_mul_inv, hbinv]
        exact B.mul_mem _ _ (hCB a) (B.mul_mem _ _ (hCB u) (pow_mem hinv n))
      let : Algebra K ↥B := ((algebraMap K κ).codRestrict B hKB).toAlgebra
      have : IsScalarTower K ↥B κ := IsScalarTower.of_algebraMap_eq (fun _ => rfl)
      refine eq_top_iff.mpr fun x _ => ?_
      have hx' : IsIntegral ↥B x := (Algebra.IsIntegral.isIntegral (R := K) x).tower_top
      obtain ⟨z, hz⟩ := (isIntegrallyClosed_iff κ).mp inferInstance hx'
      rw [← hz]; exact z.2
    intro c
    constructor
    · intro hc
      by_contra hcm
      have hu : IsUnit c := by
        by_contra h; exact hcm ((IsLocalRing.mem_maximalIdeal c).mpr h)
      obtain ⟨u, rfl⟩ := hu
      rw [ValuationSubring.mem_nonunits_iff_or] at hc
      rcases hc with h | h
      · exact ((map_ne_zero_iff _ hCκ).mpr u.ne_zero) h
      · apply h
        have hui : (algebraMap C κ ↑u)⁻¹ = algebraMap C κ ↑u⁻¹ :=
          inv_eq_of_mul_eq_one_right (by rw [← map_mul, Units.mul_inv, map_one])
        rw [hui]
        exact hCB _
    · intro hc
      rw [hmC, Ideal.mem_span_singleton'] at hc
      obtain ⟨c', rfl⟩ := hc
      rw [map_mul, ValuationSubring.mem_nonunits_iff_exists_mem_maximalIdeal]
      refine ⟨B.mul_mem _ _ (hCB c') (hCB ϖ), ?_⟩
      have : (⟨algebraMap C κ c' * algebraMap C κ ϖ, B.mul_mem _ _ (hCB c') (hCB ϖ)⟩ : ↥B) =
          ⟨algebraMap C κ c', hCB c'⟩ * ⟨algebraMap C κ ϖ, hCB ϖ⟩ := rfl
      rw [this]
      exact Ideal.mul_mem_left _ _ (ValuationSubring.coe_mem_nonunits_iff.mp hϖB)
  have hfinite : {B : ValuationSubring κ | ∀ d : D, algebraMap D κ d ∈ B}.Finite := by
    refine ((Set.finite_range (fun B : {B : ValuationSubring κ // (∀ c : C, algebraMap C κ c ∈ B) ∧
      (∀ d : D, algebraMap D κ d ∈ B) ∧ ∀ c : C, algebraMap C κ c ∈ B.nonunits ↔ c ∈ maximalIdeal
        C} => B.1)).insert
        ⊤).subset ?_
    intro B hB
    by_cases hBtop : B = ⊤
    · exact Or.inl hBtop
    · refine Or.inr ⟨⟨B, fun c => ?_, hB, hcentred B hB hBtop⟩, rfl⟩
      rw [IsScalarTower.algebraMap_apply C D κ]; exact hB _
  refine ⟨hfinite, ?_⟩
  rw [← hleft, hlat, hright, ← h1, h2, h3, hsum]
  exact finsum_eq_of_bijective e e.bijective (fun B => rfl)
IsLocalRing.length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
Source context 4 commands

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

section ProofImplementation
namespace AlgebraicCurves.Foundations.CommutativeAlgebra.Proofs
namespace IsLocalRing_length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
open IsLocalRing IsDedekindDomain
theorem _root_.IsLocalRing.length_quotient_map_maximalIdeal_eq_finsum_ramificationIdx_mul_inertiaDeg
    {C : Type*} [CommRing C] [IsDomain C] [IsDiscreteValuationRing C]
    (K : Type*) [Field K] [Algebra C K] [IsFractionRing C K]
    {D : Type*} [CommRing D] [IsDomain D] [IsLocalRing D] [IsNoetherianRing D] [Algebra C D]
    (hDmax : ∀ c : C, algebraMap C D c ∈ maximalIdeal D ↔ c ∈ maximalIdeal C)
    (hDres : ∀ d : D, ∃ c : C, d - algebraMap C D c ∈ maximalIdeal D)
    (hDdim : Ring.DimensionLEOne D) (hDnf : maximalIdeal D ≠ ⊥)
    (κ : Type*) [Field κ] [Algebra D κ] [IsFractionRing D κ] [Algebra C κ] [IsScalarTower C D κ]
    [Algebra K κ] [IsScalarTower C K κ] [FiniteDimensional K κ] [Algebra.IsSeparable K κ] :
    {B : ValuationSubring κ | ∀ d : D, algebraMap D κ d ∈ B}.Finite ∧
    Module.length D (D ⧸ (maximalIdeal C).map (algebraMap C D)) =
      ∑ᶠ B : {B : ValuationSubring κ // (∀ c : C, algebraMap C κ c ∈ B) ∧ (∀ d : D, algebraMap D κ
        d ∈ B) ∧
          ∀ c : C, algebraMap C κ c ∈ B.nonunits ↔ c ∈ maximalIdeal C},
        ((letI : Algebra C ↥B.1 := ((algebraMap C κ).codRestrict B.1 B.2.1).toAlgebra
          (maximalIdeal C).ramificationIdx' (maximalIdeal ↥B.1) * (maximalIdeal ↥B.1).inertiaDeg C
            : ℕ) : ℕ∞) := by
  obtain ⟨D₁, hfin, -, hloc⟩ :=
    IsDiscreteValuationRing.exists_finite_locallyPrincipalOverring (C := C) K (κ := κ) (A := D)
  have := hfin
  have : IsDedekindDomain ↥D₁ := NormLength.isDedekindDomain_of_locallyPrincipal hDdim D₁ hfin hloc
  have : IsFractionRing ↥D₁ κ := NormLength.isFractionRing_subalgebra κ D₁
  exact NormLength.core K hDmax hDres hDdim hDnf κ ↥D₁