File: Mathlib/RingTheory/DedekindDomain/Factorization.lean

full_name: IsDedekindDomain.HeightOneSpectrum.maxPowDividing
code: /-- Given a maximal ideal `v` and an ideal `I` of `R`, `maxPowDividing` returns the maximal
  power of `v` dividing `I`. -/
def IsDedekindDomain.HeightOneSpectrum.maxPowDividing (I : Ideal R) : Ideal R 
goal: Ideal R

full_name: Ideal.finite_factors
code: /-- Only finitely many maximal ideals of `R` divide a given nonzero ideal. -/
theorem Ideal.finite_factors {I : Ideal R} (hI : I ≠ 0) :
    {v : HeightOneSpectrum R | v.asIdeal ∣ I}.Finite 
goal: {v | v.asIdeal ∣ I}.Finite

full_name: Associates.finite_factors
code: /-- For every nonzero ideal `I` of `v`, there are finitely many maximal ideals `v` such that the
  multiplicity of `v` in the factorization of `I`, denoted `val_v(I)`, is nonzero. -/
theorem Associates.finite_factors {I : Ideal R} (hI : I ≠ 0) :
    ∀ᶠ v : HeightOneSpectrum R in Filter.cofinite,
      ((Associates.mk v.asIdeal).count (Associates.mk I).factors : ℤ) = 0 
goal: ∀ᶠ (v : IsDedekindDomain.HeightOneSpectrum R) in Filter.cofinite,
  ↑((Associates.mk v.asIdeal).count (Associates.mk I).factors) = 0

full_name: Ideal.finite_mulSupport
code: /-- For every nonzero ideal `I` of `v`, there are finitely many maximal ideals `v` such that
  `v^(val_v(I))` is not the unit ideal. -/
theorem finite_mulSupport {I : Ideal R} (hI : I ≠ 0) :
    (mulSupport fun v : HeightOneSpectrum R => v.maxPowDividing I).Finite 
goal: (Function.mulSupport fun v => v.maxPowDividing I).Finite

full_name: Ideal.finite_mulSupport_coe
code: /-- For every nonzero ideal `I` of `v`, there are finitely many maximal ideals `v` such that
`v^(val_v(I))`, regarded as a fractional ideal, is not `(1)`. -/
theorem finite_mulSupport_coe {I : Ideal R} (hI : I ≠ 0) :
    (mulSupport fun v : HeightOneSpectrum R => (v.asIdeal : FractionalIdeal R⁰ K) ^
      ((Associates.mk v.asIdeal).count (Associates.mk I).factors : ℤ)).Finite 
goal: (Function.mulSupport fun v => ↑v.asIdeal ^ ↑((Associates.mk v.asIdeal).count (Associates.mk I).factors)).Finite

full_name: Ideal.finite_mulSupport_inv
code: /-- For every nonzero ideal `I` of `v`, there are finitely many maximal ideals `v` such that
`v^-(val_v(I))` is not the unit ideal. -/
theorem finite_mulSupport_inv {I : Ideal R} (hI : I ≠ 0) :
    (mulSupport fun v : HeightOneSpectrum R => (v.asIdeal : FractionalIdeal R⁰ K) ^
      (-((Associates.mk v.asIdeal).count (Associates.mk I).factors : ℤ))).Finite 
goal: (Function.mulSupport fun v => ↑v.asIdeal ^ (-↑((Associates.mk v.asIdeal).count (Associates.mk I).factors))).Finite

full_name: Ideal.finprod_not_dvd
code: /-- For every nonzero ideal `I` of `v`, `v^(val_v(I) + 1)` does not divide `∏_v v^(val_v(I))`. -/
theorem finprod_not_dvd (I : Ideal R) (hI : I ≠ 0) :
    ¬v.asIdeal ^ ((Associates.mk v.asIdeal).count (Associates.mk I).factors + 1) ∣
        ∏ᶠ v : HeightOneSpectrum R, v.maxPowDividing I 
goal: ¬v.asIdeal ^ ((Associates.mk v.asIdeal).count (Associates.mk I).factors + 1) ∣
    ∏ᶠ (v : IsDedekindDomain.HeightOneSpectrum R), v.maxPowDividing I

full_name: Associates.finprod_ne_zero
code: theorem Associates.finprod_ne_zero (I : Ideal R) :
    Associates.mk (∏ᶠ v : HeightOneSpectrum R, v.maxPowDividing I) ≠ 0 
goal: Associates.mk (∏ᶠ (v : IsDedekindDomain.HeightOneSpectrum R), v.maxPowDividing I) ≠ 0

full_name: Ideal.finprod_count
code: /-- The multiplicity of `v` in `∏_v v^(val_v(I))` equals `val_v(I)`. -/
theorem finprod_count (I : Ideal R) (hI : I ≠ 0) : (Associates.mk v.asIdeal).count
    (Associates.mk (∏ᶠ v : HeightOneSpectrum R, v.maxPowDividing I)).factors =
    (Associates.mk v.asIdeal).count (Associates.mk I).factors 
goal: (Associates.mk v.asIdeal).count
    (Associates.mk (∏ᶠ (v : IsDedekindDomain.HeightOneSpectrum R), v.maxPowDividing I)).factors =
  (Associates.mk v.asIdeal).count (Associates.mk I).factors

full_name: Ideal.finprod_heightOneSpectrum_factorization
code: /-- The ideal `I` equals the finprod `∏_v v^(val_v(I))`. -/
theorem finprod_heightOneSpectrum_factorization {I : Ideal R} (hI : I ≠ 0) :
    ∏ᶠ v : HeightOneSpectrum R, v.maxPowDividing I = I 
goal: ∏ᶠ (v : IsDedekindDomain.HeightOneSpectrum R), v.maxPowDividing I = I

full_name: Ideal.finprod_heightOneSpectrum_factorization_coe
code: /-- The ideal `I` equals the finprod `∏_v v^(val_v(I))`, when both sides are regarded as fractional
ideals of `R`. -/
theorem finprod_heightOneSpectrum_factorization_coe {I : Ideal R} (hI : I ≠ 0) :
    (∏ᶠ v : HeightOneSpectrum R, (v.asIdeal : FractionalIdeal R⁰ K) ^
      ((Associates.mk v.asIdeal).count (Associates.mk I).factors : ℤ)) = I 
goal: ∏ᶠ (v : IsDedekindDomain.HeightOneSpectrum R),
    ↑v.asIdeal ^ ↑((Associates.mk v.asIdeal).count (Associates.mk I).factors) =
  ↑I

full_name: FractionalIdeal.finprod_heightOneSpectrum_factorization
code: /-- If `I` is a nonzero fractional ideal, `a ∈ R`, and `J` is an ideal of `R` such that
`I = a⁻¹J`, then `I` is equal to the product `∏_v v^(val_v(J) - val_v(a))`. -/
theorem finprod_heightOneSpectrum_factorization {I : FractionalIdeal R⁰ K} (hI : I ≠ 0) {a : R}
    {J : Ideal R} (haJ : I = spanSingleton R⁰ ((algebraMap R K) a)⁻¹ * ↑J) :
    ∏ᶠ v : HeightOneSpectrum R, (v.asIdeal : FractionalIdeal R⁰ K) ^
      ((Associates.mk v.asIdeal).count (Associates.mk J).factors -
        (Associates.mk v.asIdeal).count (Associates.mk (Ideal.span {a})).factors : ℤ) = I 
goal: ∏ᶠ (v : IsDedekindDomain.HeightOneSpectrum R),
    ↑v.asIdeal ^
      (↑((Associates.mk v.asIdeal).count (Associates.mk J).factors) -
        ↑((Associates.mk v.asIdeal).count (Associates.mk (Ideal.span {a})).factors)) =
  I

full_name: FractionalIdeal.finprod_heightOneSpectrum_factorization_principal_fraction
code: /-- For a nonzero `k = r/s ∈ K`, the fractional ideal `(k)` is equal to the product
`∏_v v^(val_v(r) - val_v(s))`. -/
theorem finprod_heightOneSpectrum_factorization_principal_fraction {n : R} (hn : n ≠ 0) (d : ↥R⁰) :
    ∏ᶠ v : HeightOneSpectrum R, (v.asIdeal : FractionalIdeal R⁰ K) ^
      ((Associates.mk v.asIdeal).count (Associates.mk (Ideal.span {n} : Ideal R)).factors -
        (Associates.mk v.asIdeal).count (Associates.mk ((Ideal.span {(↑d : R)}) :
        Ideal R)).factors : ℤ) = spanSingleton R⁰ (mk' K n d) 
goal: ∏ᶠ (v : IsDedekindDomain.HeightOneSpectrum R),
    ↑v.asIdeal ^
      (↑((Associates.mk v.asIdeal).count (Associates.mk (Ideal.span {n})).factors) -
        ↑((Associates.mk v.asIdeal).count (Associates.mk (Ideal.span {↑d})).factors)) =
  FractionalIdeal.spanSingleton R⁰ (IsLocalization.mk' K n d)

full_name: FractionalIdeal.finprod_heightOneSpectrum_factorization_principal
code: /-- For a nonzero `k = r/s ∈ K`, the fractional ideal `(k)` is equal to the product
`∏_v v^(val_v(r) - val_v(s))`. -/
theorem finprod_heightOneSpectrum_factorization_principal {I : FractionalIdeal R⁰ K} (hI : I ≠ 0)
    (k : K) (hk : I = spanSingleton R⁰ k) :
    ∏ᶠ v : HeightOneSpectrum R, (v.asIdeal : FractionalIdeal R⁰ K) ^
      ((Associates.mk v.asIdeal).count (Associates.mk (Ideal.span {choose
          (mk'_surjective R⁰ k)} : Ideal R)).factors -
        (Associates.mk v.asIdeal).count (Associates.mk ((Ideal.span {(↑(choose
          (choose_spec (mk'_surjective R⁰ k)) : ↥R⁰) : R)}) : Ideal R)).factors : ℤ) = I 
goal: ∏ᶠ (v : IsDedekindDomain.HeightOneSpectrum R),
    ↑v.asIdeal ^
      (↑((Associates.mk v.asIdeal).count (Associates.mk (Ideal.span {Classical.choose ⋯})).factors) -
        ↑((Associates.mk v.asIdeal).count (Associates.mk (Ideal.span {↑(Classical.choose ⋯)})).factors)) =
  I

full_name: FractionalIdeal.count
code: /-- If `I` is a nonzero fractional ideal, `a ∈ R`, and `J` is an ideal of `R` such that `I = a⁻¹J`,
then we define `val_v(I)` as `(val_v(J) - val_v(a))`. If `I = 0`, we set `val_v(I) = 0`. -/
def count (I : FractionalIdeal R⁰ K) : ℤ 
goal: ℤ

full_name: FractionalIdeal.count_zero
code: /-- val_v(0) = 0. -/
lemma count_zero : count K v (0 : FractionalIdeal R⁰ K) = 0 
goal: FractionalIdeal.count K v 0 = 0

full_name: FractionalIdeal.count_ne_zero
code: lemma count_ne_zero {I : FractionalIdeal R⁰ K} (hI : I ≠ 0) :
    count K v I = ((Associates.mk v.asIdeal).count (Associates.mk
      (choose (choose_spec (exists_eq_spanSingleton_mul I)))).factors -
      (Associates.mk v.asIdeal).count
        (Associates.mk (Ideal.span {choose (exists_eq_spanSingleton_mul I)})).factors : ℤ) 
goal: FractionalIdeal.count K v I =
  ↑((Associates.mk v.asIdeal).count (Associates.mk (Classical.choose ⋯)).factors) -
    ↑((Associates.mk v.asIdeal).count (Associates.mk (Ideal.span {Classical.choose ⋯})).factors)

full_name: FractionalIdeal.count_well_defined
code: /-- `val_v(I)` does not depend on the choice of `a` and `J` used to represent `I`. -/
theorem count_well_defined {I : FractionalIdeal R⁰ K} (hI : I ≠ 0) {a : R}
    {J : Ideal R} (h_aJ : I = spanSingleton R⁰ ((algebraMap R K) a)⁻¹ * ↑J) :
    count K v I = ((Associates.mk v.asIdeal).count (Associates.mk J).factors -
      (Associates.mk v.asIdeal).count (Associates.mk (Ideal.span {a})).factors : ℤ) 
goal: FractionalIdeal.count K v I =
  ↑((Associates.mk v.asIdeal).count (Associates.mk J).factors) -
    ↑((Associates.mk v.asIdeal).count (Associates.mk (Ideal.span {a})).factors)

full_name: FractionalIdeal.count_mul
code: /-- For nonzero `I, I'`, `val_v(I*I') = val_v(I) + val_v(I')`. -/
theorem count_mul {I I' : FractionalIdeal R⁰ K} (hI : I ≠ 0) (hI' : I' ≠ 0) :
    count K v (I * I') = count K v I + count K v I' 
goal: FractionalIdeal.count K v (I * I') = FractionalIdeal.count K v I + FractionalIdeal.count K v I'

full_name: FractionalIdeal.count_mul'
code: /-- For nonzero `I, I'`, `val_v(I*I') = val_v(I) + val_v(I')`. If `I` or `I'` is zero, then
`val_v(I*I') = 0`. -/
theorem count_mul' (I I' : FractionalIdeal R⁰ K) :
    count K v (I * I') = if I ≠ 0 ∧ I' ≠ 0 then count K v I + count K v I' else 0 
goal: FractionalIdeal.count K v (I * I') =
  if I ≠ 0 ∧ I' ≠ 0 then FractionalIdeal.count K v I + FractionalIdeal.count K v I' else 0

full_name: FractionalIdeal.count_one
code: /-- val_v(1) = 0. -/
theorem count_one : count K v (1 : FractionalIdeal R⁰ K) = 0 
goal: FractionalIdeal.count K v 1 = 0

full_name: FractionalIdeal.count_prod
code: theorem count_prod {ι} (s : Finset ι) (I : ι → FractionalIdeal R⁰ K) (hS : ∀ i ∈ s, I i ≠ 0) :
    count K v (∏ i ∈ s, I i) = ∑ i ∈ s, count K v (I i) 
goal: FractionalIdeal.count K v (∏ i ∈ s, I i) = ∑ i ∈ s, FractionalIdeal.count K v (I i)

full_name: FractionalIdeal.count_pow
code: /-- For every `n ∈ ℕ` and every ideal `I`, `val_v(I^n) = n*val_v(I)`. -/
theorem count_pow (n : ℕ) (I : FractionalIdeal R⁰ K) :
    count K v (I ^ n) = n * count K v I 
goal: FractionalIdeal.count K v (I ^ n) = ↑n * FractionalIdeal.count K v I

full_name: FractionalIdeal.count_self
code: /-- `val_v(v) = 1`, when `v` is regarded as a fractional ideal. -/
theorem count_self : count K v (v.asIdeal : FractionalIdeal R⁰ K) = 1 
goal: FractionalIdeal.count K v ↑v.asIdeal = 1

full_name: FractionalIdeal.count_pow_self
code: /-- `val_v(v^n) = n` for every `n ∈ ℕ`. -/
theorem count_pow_self (n : ℕ) :
    count K v ((v.asIdeal : FractionalIdeal R⁰ K) ^ n) = n 
goal: FractionalIdeal.count K v (↑v.asIdeal ^ n) = ↑n

full_name: FractionalIdeal.count_neg_zpow
code: /-- `val_v(I⁻ⁿ) = -val_v(Iⁿ)` for every `n ∈ ℤ`. -/
theorem count_neg_zpow (n : ℤ) (I : FractionalIdeal R⁰ K) :
    count K v (I ^ (-n)) = - count K v (I ^ n) 
goal: FractionalIdeal.count K v (I ^ (-n)) = -FractionalIdeal.count K v (I ^ n)

full_name: FractionalIdeal.count_inv
code: theorem count_inv  (I : FractionalIdeal R⁰ K) :
    count K v (I⁻¹) = - count K v I 
goal: FractionalIdeal.count K v I⁻¹ = -FractionalIdeal.count K v I

full_name: FractionalIdeal.count_zpow
code: /-- `val_v(Iⁿ) = n*val_v(I)` for every `n ∈ ℤ`. -/
theorem count_zpow (n : ℤ) (I : FractionalIdeal R⁰ K) :
    count K v (I ^ n) = n * count K v I 
goal: FractionalIdeal.count K v (I ^ n) = n * FractionalIdeal.count K v I

full_name: FractionalIdeal.count_zpow_self
code: /-- `val_v(v^n) = n` for every `n ∈ ℤ`. -/
theorem count_zpow_self (n : ℤ) :
    count K v ((v.asIdeal : FractionalIdeal R⁰ K) ^ n) = n 
goal: FractionalIdeal.count K v (↑v.asIdeal ^ n) = n

full_name: FractionalIdeal.count_maximal_coprime
code: /-- If `v ≠ w` are two maximal ideals of `R`, then `val_v(w) = 0`. -/
theorem count_maximal_coprime {w : HeightOneSpectrum R} (hw : w ≠ v) :
    count K v (w.asIdeal : FractionalIdeal R⁰ K) = 0 
goal: FractionalIdeal.count K v ↑w.asIdeal = 0

full_name: FractionalIdeal.count_maximal
code: theorem count_maximal (w : HeightOneSpectrum R) :
    count K v (w.asIdeal : FractionalIdeal R⁰ K) = if w = v then 1 else 0 
goal: FractionalIdeal.count K v ↑w.asIdeal = if w = v then 1 else 0

full_name: FractionalIdeal.count_finprod_coprime
code: /-- `val_v(∏_{w ≠ v} w^{exps w}) = 0`. -/
theorem count_finprod_coprime (exps : HeightOneSpectrum R → ℤ) :
    count K v (∏ᶠ (w : HeightOneSpectrum R) (_ : w ≠ v),
      (w.asIdeal : (FractionalIdeal R⁰ K)) ^ exps w) = 0 
goal: FractionalIdeal.count K v (∏ᶠ (w : IsDedekindDomain.HeightOneSpectrum R) (_ : w ≠ v), ↑w.asIdeal ^ exps w) = 0

full_name: FractionalIdeal.count_finsupp_prod
code: theorem count_finsupp_prod (exps : HeightOneSpectrum R →₀ ℤ) :
    count K v (exps.prod (HeightOneSpectrum.asIdeal · ^ ·)) = exps v 
goal: FractionalIdeal.count K v (exps.prod fun x x_1 => ↑x.asIdeal ^ x_1) = exps v

full_name: FractionalIdeal.count_finprod
code: /-- If `exps` is finitely supported, then `val_v(∏_w w^{exps w}) = exps v`. -/
theorem count_finprod (exps : HeightOneSpectrum R → ℤ)
    (h_exps : ∀ᶠ v : HeightOneSpectrum R in Filter.cofinite, exps v = 0) :
    count K v (∏ᶠ v : HeightOneSpectrum R,
      (v.asIdeal : FractionalIdeal R⁰ K) ^ exps v) = exps v 
goal: FractionalIdeal.count K v (∏ᶠ (v : IsDedekindDomain.HeightOneSpectrum R), ↑v.asIdeal ^ exps v) = exps v

full_name: FractionalIdeal.count_coe
code: theorem count_coe {J : Ideal R} (hJ : J ≠ 0) :
    count K v J = (Associates.mk v.asIdeal).count (Associates.mk J).factors 
goal: FractionalIdeal.count K v ↑J = ↑((Associates.mk v.asIdeal).count (Associates.mk J).factors)

full_name: FractionalIdeal.count_coe_nonneg
code: theorem count_coe_nonneg (J : Ideal R) : 0 ≤ count K v J 
goal: 0 ≤ FractionalIdeal.count K v ↑J

full_name: FractionalIdeal.count_mono
code: theorem count_mono {I J} (hI : I ≠ 0) (h : I ≤ J) : count K v J ≤ count K v I 
goal: FractionalIdeal.count K v J ≤ FractionalIdeal.count K v I

full_name: FractionalIdeal.finprod_heightOneSpectrum_factorization'
code: /-- If `I` is a nonzero fractional ideal, then `I` is equal to the product `∏_v v^(count K v I)`. -/
theorem finprod_heightOneSpectrum_factorization' {I : FractionalIdeal R⁰ K} (hI : I ≠ 0) :
    ∏ᶠ v : HeightOneSpectrum R, (v.asIdeal : FractionalIdeal R⁰ K) ^ (count K v I) = I 
goal: ∏ᶠ (v : IsDedekindDomain.HeightOneSpectrum R), ↑v.asIdeal ^ FractionalIdeal.count K v I = I

full_name: FractionalIdeal.finite_factors'
code: /-- If `I ≠ 0`, then `val_v(I) = 0` for all but finitely many maximal ideals of `R`. -/
theorem finite_factors' {I : FractionalIdeal R⁰ K} (hI : I ≠ 0) {a : R}
    {J : Ideal R} (haJ : I = spanSingleton R⁰ ((algebraMap R K) a)⁻¹ * ↑J) :
    ∀ᶠ v : HeightOneSpectrum R in Filter.cofinite,
      ((Associates.mk v.asIdeal).count (Associates.mk J).factors : ℤ) -
        (Associates.mk v.asIdeal).count (Associates.mk (Ideal.span {a})).factors = 0 
goal: ∀ᶠ (v : IsDedekindDomain.HeightOneSpectrum R) in Filter.cofinite,
  ↑((Associates.mk v.asIdeal).count (Associates.mk J).factors) -
      ↑((Associates.mk v.asIdeal).count (Associates.mk (Ideal.span {a})).factors) =
    0

full_name: FractionalIdeal.finite_factors
code: /-- `val_v(I) = 0` for all but finitely many maximal ideals of `R`. -/
theorem finite_factors (I : FractionalIdeal R⁰ K) :
    ∀ᶠ v : HeightOneSpectrum R in Filter.cofinite, count K v I = 0 
goal: ∀ᶠ (v : IsDedekindDomain.HeightOneSpectrum R) in Filter.cofinite, FractionalIdeal.count K v I = 0