Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/Lean/Mathlib/Mathlib/RingTheory/Ideal/Norm/     Datei vom 15.10.2026 mit Größe 26 kB image not shown  

Quelle  AbsNorm.lean   Sprache: Lean

 

/-
Copyright (c) 2022 Anne Baanen. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Anne Baanen, Alex J. Best
-/

module

public import Mathlib.Algebra.CharP.Quotient
public import Mathlib.Data.SetLike.Fintype
public import Mathlib.FieldTheory.Finite.Basic
public import Mathlib.LinearAlgebra.FreeModule.Determinant
public import Mathlib.LinearAlgebra.FreeModule.Finite.CardQuotient
public import Mathlib.RingTheory.DedekindDomain.Ideal.Lemmas
public import Mathlib.RingTheory.Ideal.Basis
public import Mathlib.RingTheory.Ideal.Quotient.HasFiniteQuotients.Basic
public import Mathlib.RingTheory.UniqueFactorizationDomain.Multiplicative

import Mathlib.RingTheory.Norm.Basic

/-!
# Ideal norms

This file defines the absolute ideal norm `Ideal.absNorm (I : Ideal R) : ℕ` as the cardinality of
the quotient `R ⧸ I`, with the junk value `0` at `I = ⊥`.

## Main definitions

* `Submodule.cardQuot (S : Submodule R M)`: the cardinality of the quotient `M ⧸ S`, in `ℕ`.
  This maps `⊥` to `0` and `⊤` to `1`.
* `Ideal.absNorm (I : Ideal R)`: the absolute ideal norm, defined as the cardinality of the
  quotient `R ⧸ I` with the junk value `0` at `I = ⊥`, as a bundled monoid-with-zero
  homomorphism.

## Main results

* `map_mul Ideal.absNorm`: multiplicativity of the ideal norm is bundled in
  the definition of `Ideal.absNorm`
* `Ideal.absNorm_of_ne_bot`: away from `⊥`, the absolute norm is the cardinality of the quotient
* `Ideal.absNorm_apply`: over an infinite ring, the absolute norm is the cardinality of the
  quotient for every ideal
* `Ideal.natAbs_det_basis_change`: the ideal norm is given by the determinant
  of the basis change matrix
* `Ideal.absNorm_span_singleton`: the ideal norm of a principal ideal is the
  norm of its generator
* `Ring.HasFiniteQuotients.finite_cardQuot_le`: a ring with finite quotients has only finitely
  many ideals whose quotient has bounded cardinality
-/


@[expose] public section

open Module
open scoped nonZeroDivisors

section abs_norm

namespace Submodule

variable {R M : Type*} [Ring R] [AddCommGroup M] [Module R M]

section

/-- The cardinality of `(M ⧸ S)`, if `(M ⧸ S)` is finite, and `0` otherwise.
This is used to define the absolute ideal norm `Ideal.absNorm`.
-/

noncomputable def cardQuot (S : Submodule R M) : ℕ :=
  AddSubgroup.index S.toAddSubgroup

theorem cardQuot_apply (S : Submodule R M) : cardQuot S = Nat.card (M ⧸ S) := by
  rfl

variable (R M)

@[simp]
theorem cardQuot_bot [Infinite M] : cardQuot (⊥ : Submodule R M) = 0 :=
  AddSubgroup.index_bot.trans Nat.card_eq_zero_of_infinite

@[simp]
theorem cardQuot_top : cardQuot (⊤ : Submodule R M) = 1 :=
  AddSubgroup.index_top

variable {R M}

@[simp]
theorem cardQuot_eq_one_iff {P : Submodule R M} : cardQuot P = 1 ↔ P = ⊤ :=
  AddSubgroup.index_eq_one.trans (by simp [SetLike.ext_iff])

end

end Submodule

section RingOfIntegers

variable {S : Type*} [CommRing S]

open Submodule

/-- Multiplicity of the ideal norm, for coprime ideals.
This is essentially just a repackaging of the Chinese Remainder Theorem.
-/

theorem cardQuot_mul_of_coprime
    {I J : Ideal S} (coprime : IsCoprime I J) : cardQuot (I * J) = cardQuot I * cardQuot J := by
  rw [cardQuot_apply, cardQuot_apply, cardQuot_apply,
    Nat.card_congr (Ideal.quotientMulEquivQuotientProd I J coprime).toEquiv,
    Nat.card_prod]

/-- If the `d` from `Ideal.exists_mul_add_mem_pow_succ` is unique, up to `P`,
then so are the `c`s, up to `P ^ (i + 1)`.
Inspired by [Neukirch], proposition 6.1 -/

theorem Ideal.mul_add_mem_pow_succ_inj (P : Ideal S) {i : ℕ} (a d d' e e' : S) (a_mem : a ∈ P ^ i)
    (e_mem : e ∈ P ^ (i + 1)) (e'_mem : e' ∈ P ^ (i + 1)) (h : d - d' ∈ P) :
    a * d + e - (a * d' + e') ∈ P ^ (i + 1) := by
  have : a * d - a * d' ∈ P ^ (i + 1) := by
    simp only [← mul_sub]
    exact Ideal.mul_mem_mul a_mem h
  convert Ideal.add_mem _ this (Ideal.sub_mem _ e_mem e'_mem) using 1
  ring

section PPrime

variable {P : Ideal S} [P_prime : P.IsPrime]

/-- If `a ∈ P^i \ P^(i+1)` and `c ∈ P^i`, then `a * d + e = c` for `e ∈ P^(i+1)`.
`Ideal.mul_add_mem_pow_succ_unique` shows the choice of `d` is unique, up to `P`.
Inspired by [Neukirch], proposition 6.1 -/

theorem Ideal.exists_mul_add_mem_pow_succ [IsDedekindDomain S] (hP : P ≠ ⊥)
    {i : ℕ} (a c : S) (a_mem : a ∈ P ^ i)
    (a_notMem : a ∉ P ^ (i + 1)) (c_mem : c ∈ P ^ i) :
    ∃ d : S, ∃ e ∈ P ^ (i + 1), a * d + e = c := by
  suffices eq_b : P ^ i = Ideal.span {a} ⊔ P ^ (i + 1) by
    rw [eq_b] at c_mem
    simp only [mul_comm a]
    exact Ideal.mem_span_singleton_sup.mp c_mem
  refine (Ideal.eq_prime_pow_of_succ_lt_of_le hP (lt_of_le_of_ne le_sup_right ?_)
    (sup_le (Ideal.span_le.mpr (Set.singleton_subset_iff.mpr a_mem))
      (Ideal.pow_succ_lt_pow hP i).le)).symm
  contrapose a_notMem with this
  rw [this]
  exact mem_sup.mpr ⟨a, mem_span_singleton_self a, 0, by simp, by simp⟩

theorem Ideal.mem_prime_of_mul_mem_pow [IsDedekindDomain S] {P : Ideal S} [P_prime : P.IsPrime]
    (hP : P ≠ ⊥) {i : ℕ} {a b : S} (a_notMem : a ∉ P ^ (i + 1)) (ab_mem : a * b ∈ P ^ (i + 1)) :
    b ∈ P := by
  simp only [← Ideal.span_singleton_le_iff_mem, ← Ideal.dvd_iff_le, pow_succ, ←
    Ideal.span_singleton_mul_span_singleton] at a_notMem ab_mem ⊢
  exact (prime_pow_succ_dvd_mul (Ideal.prime_of_isPrime hP P_prime) ab_mem).resolve_left a_notMem

/-- The choice of `d` in `Ideal.exists_mul_add_mem_pow_succ` is unique, up to `P`.
Inspired by [Neukirch], proposition 6.1 -/

theorem Ideal.mul_add_mem_pow_succ_unique [IsDedekindDomain S] (hP : P ≠ ⊥)
    {i : ℕ} (a d d' e e' : S)
    (a_notMem : a ∉ P ^ (i + 1)) (e_mem : e ∈ P ^ (i + 1)) (e'_mem : e' ∈ P ^ (i + 1))
    (h : a * d + e - (a * d' + e') ∈ P ^ (i + 1)) : d - d' ∈ P := by
  have h' : a * (d - d') ∈ P ^ (i + 1) := by
    convert Ideal.add_mem _ h (Ideal.sub_mem _ e'_mem e_mem) using 1
    ring
  exact Ideal.mem_prime_of_mul_mem_pow hP a_notMem h'

/-- Multiplicity of the ideal norm, for powers of prime ideals. -/
theorem cardQuot_pow_of_prime [IsDedekindDomain S] (hP : P ≠ ⊥) {i : ℕ} :
    cardQuot (P ^ i) = cardQuot P ^ i := by
  induction i with
  | zero => simp
  | succ i ih => ?_
  have : P ^ (i + 1) < P ^ i := Ideal.pow_succ_lt_pow hP i
  suffices hquot : map (P ^ i.succ).mkQ (P ^ i) ≃ S ⧸ P by
    rw [pow_succ' (cardQuot P), ← ih, cardQuot_apply (P ^ i.succ), ←
      card_quotient_mul_card_quotient (P ^ i) (P ^ i.succ) this.le, cardQuot_apply (P ^ i),
      cardQuot_apply P, Nat.card_congr hquot]
  choose a a_mem a_notMem using IsConcreteLE.exists_of_lt this
  choose f g hg hf using fun c (hc : c ∈ P ^ i) =>
    Ideal.exists_mul_add_mem_pow_succ hP a c a_mem a_notMem hc
  choose k hk_mem hk_eq using fun c' (hc' : c' ∈ map (mkQ (P ^ i.succ)) (P ^ i)) =>
    Submodule.mem_map.mp hc'
  refine Equiv.ofBijective (fun c' => Quotient.mk'' (f (k c' c'.prop) (hk_mem c' c'.prop))) ⟨?_, ?_⟩
  · rintro ⟨c₁', hc₁'⟩ ⟨c₂', hc₂'⟩ h
    rw [Subtype.mk_eq_mk, ← hk_eq _ hc₁', ← hk_eq _ hc₂', mkQ_apply, mkQ_apply,
      Submodule.Quotient.eq, ← hf _ (hk_mem _ hc₁'), ← hf _ (hk_mem _ hc₂')]
    refine Ideal.mul_add_mem_pow_succ_inj _ _ _ _ _ _ a_mem (hg _ _) (hg _ _) ?_
    simpa only [Submodule.Quotient.mk''_eq_mk, Submodule.Quotient.mk''_eq_mk,
      Submodule.Quotient.eq] using h
  · intro d'
    induction d' using Quotient.inductionOn with | _ d
    have hd' := (mem_map (f := mkQ (P ^ i.succ))).mpr ⟨a * d, Ideal.mul_mem_right d _ a_mem, rfl⟩
    refine ⟨⟨_, hd'⟩, ?_⟩
    simp only [Submodule.Quotient.mk''_eq_mk, Ideal.Quotient.mk_eq_mk, Ideal.Quotient.eq]
    refine
      Ideal.mul_add_mem_pow_succ_unique hP a _ _ _ _ a_notMem (hg _ (hk_mem _ hd')) (zero_mem _) ?_
    rw [hf, add_zero]
    exact (Submodule.Quotient.eq _).mp (hk_eq _ hd')

end PPrime

/-- Multiplicativity of the ideal norm in number rings. -/
theorem cardQuot_mul [IsDedekindDomain S] [Infinite S] (I J : Ideal S) :
    cardQuot (I * J) = cardQuot I * cardQuot J :=
  UniqueFactorizationMonoid.multiplicative_of_coprime cardQuot I J (cardQuot_bot _ _)
      (fun {I J} hI => by simp [Ideal.isUnit_iff.mp hI, Ideal.mul_top])
      (fun {I} i hI =>
        have : Ideal.IsPrime I := Ideal.isPrime_of_prime hI
        cardQuot_pow_of_prime hI.ne_zero)
      fun {I J} hIJ => cardQuot_mul_of_coprime <| Ideal.isCoprime_iff_sup_eq.mpr
        (Ideal.isUnit_iff.mp
          (hIJ (Ideal.dvd_iff_le.mpr le_sup_left) (Ideal.dvd_iff_le.mpr le_sup_right)))

namespace Ring.HasFiniteQuotients

variable [Ring.HasFiniteQuotients S]

theorem cardQuot_pos (I : Ideal S) (hI : I ≠ ⊥) : 0 < I.cardQuot := by
  have := finiteQuotient hI
  rw [Submodule.cardQuot_apply]
  exact Nat.card_pos

theorem finite_setOfPred_mem (x : S) (hx : x ≠ 0) : {I : Ideal S | x ∈ I}.Finite := by
  have := finiteQuotient (mt Ideal.span_singleton_eq_bot.mp hx)
  have : {I | Ideal.comap (Ideal.Quotient.mk (Ideal.span {x})) ⊥ ≤ I}.Finite :=
    .of_equiv _ (Ideal.relIsoOfSurjective _ Ideal.Quotient.mk_surjective).toEquiv
  simpa [← RingHom.ker_eq_comap_bot] using this

@[deprecated (since := "2026-07-09")] alias finite_setOf_mem := finite_setOfPred_mem

open scoped Pointwise in
/-- For every bound `B`, a ring with finite quotients has only finitely many ideals of norm bounded
by `B`. -/

theorem finite_cardQuot_le (B : ℕ) : {I : Ideal S | I.cardQuot ≤ B}.Finite := by
  classical
  rcases finite_or_infinite S
  · apply Set.toFinite
  -- if `S` is infinite, then we can pick a finite set `s` of cardinality `B + 1`
  obtain ⟨s, hs⟩ := Infinite.exists_subset_card_eq S (B + 1)
  -- and consider the finite set `t` of nonzero differences
  let t := (s - s) \ {0}
  refine Set.Finite.of_sdiff ?_ (Set.finite_singleton ⊥)
  -- in a ring with finite quotients, each nonzero element is contained in only finitely many ideals
  -- so it is enough to show that each ideal `I` of norm at most `B` contains some element of `t`
  suffices {I | Submodule.cardQuot I ≤ B} \ {⊥} ⊆ ⋃ x ∈ t, {I | x ∈ I} from
    (t.finite_toSet.biUnion fun x hx ↦ finite_setOfPred_mem x (by grind)).subset this
  intro I hI
  rw [Set.mem_sdiff, Set.mem_ofPred, Submodule.cardQuot_apply] at hI
  simp_rw [Set.mem_iUnion, exists_prop, Set.mem_ofPred_eq]
  -- `s` has cardinality `B + 1`, but the quotient `S ⧸ I` has cardinality at most `B`
  replace hs : (s.image (Ideal.Quotient.mk I)).card < s.card := by
    have := finiteQuotient hI.2
    have := Fintype.ofFinite (S ⧸ I)
    grw [Finset.card_le_univ, Fintype.card_eq_nat_card, hI.1, hs, Nat.lt_add_one_iff]
  -- so we can find distinct `x, y ∈ s` with the desired collision `x - y ∈ I`
  obtain ⟨x, hx, y, hy, hxy, h⟩ := Finset.exists_ne_map_eq_of_card_image_lt hs
  refine ⟨x - y, ?_, (Submodule.Quotient.eq I).mp h⟩
  refine Finset.mem_sdiff.mpr ⟨Finset.mem_sub.mpr ⟨x, hx, y, hy, rfl⟩, ?_⟩
  rwa [Finset.notMem_singleton, sub_ne_zero]

/-- A ring with finite quotients has only finitely many nonzero prime ideals of bounded norm. -/
theorem finite_cardQuot_heightOneSpectrum_le (B : ℕ) :
    {p : IsDedekindDomain.HeightOneSpectrum S | p.asIdeal.cardQuot ≤ B}.Finite :=
  (finite_cardQuot_le B).preimage IsDedekindDomain.HeightOneSpectrum.asIdeal_injective.injOn

end Ring.HasFiniteQuotients

/-- The absolute norm of the ideal `I : Ideal S` is the cardinality of the quotient `S ⧸ I`,
with the junk value `0` at `I = ⊥`. -/

noncomputable def Ideal.absNorm [IsDedekindDomain S] :
    Ideal S →*₀ ℕ where
  toFun I := if I = ⊥ then 0 else Submodule.cardQuot I
  map_mul' I J := by
    by_cases hI : I = ⊥
    · simp [hI]
    cases finite_or_infinite S
    · let := (Finite.isField_of_domain S).toField
      simp [I.eq_bot_or_top.resolve_left hI]
    · simp [hI, cardQuot_mul]
  map_one' := by simp
  map_zero' := by simp

@[simp]
theorem Ideal.absNorm_bot [IsDedekindDomain S] : absNorm (⊥ : Ideal S) = 0 := by
  rw [← Ideal.zero_eq_bot, map_zero]

@[simp]
theorem Ideal.absNorm_top [IsDedekindDomain S] : absNorm (⊤ : Ideal S) = 1 := by
  rw [← Ideal.one_eq_top, map_one]

/-- Away from `⊥`, the absolute norm is the cardinality of the quotient. -/
theorem Ideal.absNorm_of_ne_bot [IsDedekindDomain S] {I : Ideal S} (hI : I ≠ ⊥) :
    absNorm I = Submodule.cardQuot I :=
  ite_eq_right hI

/-- Over an infinite ring, the absolute norm is the cardinality of the quotient for every ideal. -/
theorem Ideal.absNorm_apply [IsDedekindDomain S] [Infinite S] (I : Ideal S) :
    absNorm I = Submodule.cardQuot I := by
  obtain rfl | hI := eq_or_ne I ⊥
  · rw [absNorm_bot, Submodule.cardQuot_bot]
  · exact absNorm_of_ne_bot hI

/-- Over an infinite ring, the absolute norm of `I` is the cardinality of the quotient `S ⧸ I`. -/
theorem Ideal.absNorm_eq_natCard [IsDedekindDomain S] [Infinite S] (I : Ideal S) :
    absNorm I = Nat.card (S ⧸ I) := by
  rw [absNorm_apply, ← cardQuot_apply]

namespace Ring.HasFiniteQuotients

variable [Ring.HasFiniteQuotients S]

/-- A ring with finite quotients has only finitely many ideals of bounded norm. -/
theorem finite_absNorm_le [IsDedekindDomain S] (B : ℕ) :
    {I : Ideal S | I.absNorm ≤ B}.Finite := by
  obtain _ | _ := finite_or_infinite S
  · exact Set.toFinite _
  · simpa [Ideal.absNorm_apply] using finite_cardQuot_le B

/-- A ring with finite quotients has only finitely many ideals of given norm. -/
theorem finite_absNorm_eq [IsDedekindDomain S] (B : ℕ) :
    {I : Ideal S | I.absNorm = B}.Finite :=
  (finite_absNorm_le B).subset fun _ h ↦ h.le

/-- A ring with finite quotients has only finitely many nonzero ideals of bounded norm. -/
theorem finite_absNorm_le₀ [IsDedekindDomain S] (B : ℕ) :
    {I : (Ideal S)⁰ | Ideal.absNorm (I : Ideal S) ≤ B}.Finite :=
  (finite_absNorm_le B).preimage Subtype.val_injective.injOn

/-- A ring with finite quotients has only finitely many nonzero prime ideals of bounded norm. -/
theorem finite_absNorm_heightOneSpectrum_le [IsDedekindDomain S] (B : ℕ) :
    {p : IsDedekindDomain.HeightOneSpectrum S | p.asIdeal.absNorm ≤ B}.Finite :=
  (finite_absNorm_le B).preimage IsDedekindDomain.HeightOneSpectrum.asIdeal_injective.injOn

end Ring.HasFiniteQuotients

namespace Ideal

variable [IsDedekindDomain S]

@[simp]
theorem absNorm_eq_one_iff {I : Ideal S} : absNorm I = 1 ↔ I = ⊤ := by
  obtain rfl | hI := eq_or_ne I ⊥
  · simp
  · rw [absNorm_of_ne_bot hI, cardQuot_eq_one_iff]

theorem absNorm_dvd_absNorm_of_le {I J : Ideal S} (h : J ≤ I) : Ideal.absNorm I ∣ Ideal.absNorm J :=
  map_dvd absNorm (dvd_iff_le.mpr h)

theorem irreducible_of_irreducible_absNorm {I : Ideal S} (hI : Irreducible (Ideal.absNorm I)) :
    Irreducible I :=
  irreducible_iff.mpr
    ⟨fun h =>
      hI.not_isUnit (by simpa only [Ideal.isUnit_iff, Nat.isUnit_iff, absNorm_eq_one_iff] using h),
      by
      rintro a b rfl
      simpa only [Ideal.isUnit_iff, Nat.isUnit_iff, absNorm_eq_one_iff] using
        hI.isUnit_or_isUnit (map_mul absNorm a b)⟩

theorem isPrime_of_irreducible_absNorm {I : Ideal S} (hI : Irreducible (Ideal.absNorm I)) :
    I.IsPrime :=
  isPrime_of_prime
    (UniqueFactorizationMonoid.irreducible_iff_prime.mp (irreducible_of_irreducible_absNorm hI))

theorem prime_of_irreducible_absNorm_span {a : S}
    (hI : Irreducible (Ideal.absNorm (Ideal.span ({a} : Set S)))) : Prime a := by
  rcases eq_or_ne a 0 with rfl | ha
  · simp at hI
  exact (Ideal.span_singleton_prime ha).mp (isPrime_of_irreducible_absNorm hI)

theorem absNorm_mem (I : Ideal S) : ↑(Ideal.absNorm I) ∈ I := by
  obtain rfl | hI := eq_or_ne I ⊥
  · simp
  · rw [absNorm_of_ne_bot hI, cardQuot, ← Ideal.Quotient.eq_zero_iff_mem, map_natCast,
      Quotient.index_eq_zero]

theorem span_singleton_absNorm_le (I : Ideal S) : Ideal.span {(Ideal.absNorm I : S)} ≤ I := by
  simp only [Ideal.span_le, Set.singleton_subset_iff, SetLike.mem_coe, Ideal.absNorm_mem I]

theorem span_singleton_absNorm {I : Ideal S} (hI : (Ideal.absNorm I).Prime) :
    Ideal.span (singleton (Ideal.absNorm I : ℤ)) = I.comap (algebraMap ℤ S) := by
  have : Ideal.IsPrime (Ideal.span (singleton (Ideal.absNorm I : ℤ))) := by
    rwa [Ideal.span_singleton_prime (Int.ofNat_ne_zero.mpr hI.ne_zero), ← Nat.prime_iff_prime_int]
  apply (this.isMaximal _).eq_of_le
  · exact ((isPrime_of_irreducible_absNorm
      ((Nat.irreducible_iff_nat_prime _).mpr hI)).comap (algebraMap ℤ S)).ne_top
  · rw [span_singleton_le_iff_mem, mem_comap, algebraMap_int_eq, map_natCast]
    exact absNorm_mem I
  · rw [Ne, span_singleton_eq_bot]
    exact Int.ofNat_ne_zero.mpr hI.ne_zero

section Infinite

variable [Infinite S]

lemma absNorm_eq_index (I : Ideal S) : absNorm I = I.toAddSubgroup.index := absNorm_apply I

theorem absNorm_ne_zero_iff (I : Ideal S) : Ideal.absNorm I ≠ 0 ↔ Finite (S ⧸ I) := by
  rw [absNorm_eq_natCard]
  exact ⟨Nat.finite_of_card_ne_zero, fun h ↦ Nat.card_ne_zero.mpr ⟨⟨0⟩, h⟩⟩

end Infinite

section HasFiniteQuotients

variable [Ring.HasFiniteQuotients S]

@[simp]
theorem absNorm_eq_zero_iff {I : Ideal S} : Ideal.absNorm I = 0 ↔ I = ⊥ := by
  obtain rfl | hI := eq_or_ne I ⊥
  · simp
  · have := Ring.HasFiniteQuotients.finiteQuotient hI
    simpa [hI, absNorm_of_ne_bot hI, Submodule.cardQuot_apply] using Nat.card_pos.ne'

@[deprecated (since := "2026-10-23")] alias absNorm_eq_zero_iff' := absNorm_eq_zero_iff

theorem absNorm_ne_zero_iff_mem_nonZeroDivisors {I : Ideal S} :
    absNorm I ≠ 0 ↔ I ∈ (Ideal S)⁰ := by
  simp_rw [ne_eq, absNorm_eq_zero_iff, mem_nonZeroDivisors_iff_ne_zero, Submodule.zero_eq_bot]

@[deprecated (since := "2026-10-23")]
alias absNorm_ne_zero_iff_mem_nonZeroDivisors' := absNorm_ne_zero_iff_mem_nonZeroDivisors

theorem absNorm_pos_iff_mem_nonZeroDivisors {I : Ideal S} :
    0 < absNorm I ↔ I ∈ (Ideal S)⁰ := by
  rw [← absNorm_ne_zero_iff_mem_nonZeroDivisors, Nat.pos_iff_ne_zero]

@[deprecated (since := "2026-10-23")]
alias absNorm_pos_iff_mem_nonZeroDivisors' := absNorm_pos_iff_mem_nonZeroDivisors

theorem absNorm_ne_zero_of_nonZeroDivisors (I : (Ideal S)⁰) : absNorm (I : Ideal S) ≠ 0 :=
  absNorm_ne_zero_iff_mem_nonZeroDivisors.mpr (SetLike.coe_mem I)

@[deprecated (since := "2026-10-23")]
alias absNorm_ne_zero_of_nonZeroDivisors' := absNorm_ne_zero_of_nonZeroDivisors

theorem absNorm_pos_of_nonZeroDivisors (I : (Ideal S)⁰) : 0 < absNorm (I : Ideal S) :=
  absNorm_pos_iff_mem_nonZeroDivisors.mpr (SetLike.coe_mem I)

@[deprecated (since := "2026-10-23")]
alias absNorm_pos_of_nonZeroDivisors' := absNorm_pos_of_nonZeroDivisors

theorem card_norm_le_eq_card_norm_le_add_one (n : ℕ) :
    Nat.card {I : Ideal S // absNorm I ≤ n} =
      Nat.card {I : (Ideal S)⁰ // absNorm (I : Ideal S) ≤ n} + 1 := by
  rw [← Set.coe_ofPred, ← Set.coe_ofPred, Nat.card_coe_set_eq, Nat.card_coe_set_eq,
    ← Set.ncard_sdiff_singleton_add_one (a := ⊥) (by simp)
    (Ring.HasFiniteQuotients.finite_absNorm_le n), Nat.add_left_inj,
    ← Set.ncard_image_of_injective _ Subtype.val_injective]
  congr
  ext
  simp

@[deprecated (since := "2026-10-23")]
alias card_norm_le_eq_card_norm_le_add_one' := card_norm_le_eq_card_norm_le_add_one

end HasFiniteQuotients

section Finite

variable [Module.Finite ℤ S]

@[deprecated (since := "2026-10-26")]
alias finite_setOfPred_absNorm_le := Ring.HasFiniteQuotients.finite_absNorm_le

@[deprecated (since := "2026-07-09")]
alias finite_setOf_absNorm_le := Ring.HasFiniteQuotients.finite_absNorm_le

@[deprecated (since := "2026-10-26")]
alias finite_setOfPred_absNorm_eq := Ring.HasFiniteQuotients.finite_absNorm_eq

@[deprecated (since := "2026-07-09")]
alias finite_setOf_absNorm_eq := Ring.HasFiniteQuotients.finite_absNorm_eq

@[deprecated (since := "2026-10-26")]
alias finite_setOfPred_absNorm_le₀ := Ring.HasFiniteQuotients.finite_absNorm_le₀

@[deprecated (since := "2026-07-09")]
alias finite_setOf_absNorm_le₀ := Ring.HasFiniteQuotients.finite_absNorm_le₀

section Free

variable [Module.Free ℤ S]

-- A nontrivial free `ℤ`-module is infinite; local to this section to supply `Infinite S`.
local instance : Infinite S := Module.Free.infinite ℤ S

/-- Let `e : S ≃ I` be an additive isomorphism (therefore a `ℤ`-linear equiv).
Then an alternative way to compute the norm of `I` is given by taking the determinant of `e`.
See `natAbs_det_basis_change` for a more familiar formulation of this result. -/

theorem natAbs_det_equiv (I : Ideal S) {E : Type*} [EquivLike E S I] [AddEquivClass E S I] (e : E) :
    Int.natAbs
        (LinearMap.det
          ((Submodule.subtype I).restrictScalars ℤ ∘ₗ AddMonoidHom.toIntLinearMap (e : S →+ I))) =
      Ideal.absNorm I := by
  -- `S ⧸ I` might be infinite if `I = ⊥`, but then `e` can't be an equiv.
  by_cases hI : I = ⊥
  · subst hI
    have : (1 : S) ≠ 0 := one_ne_zero
    have : (1 : S) = 0 := EquivLike.injective e (Subsingleton.elim _ _)
    contradiction
  rw [Ideal.absNorm_apply]
  exact Submodule.natAbs_det_equiv (I.restrictScalars ℤ) e

/-- Let `b` be a basis for `S` over `ℤ` and `bI` a basis for `I` over `ℤ` of the same dimension.
Then an alternative way to compute the norm of `I` is given by taking the determinant of `bI`
over `b`. -/

theorem natAbs_det_basis_change {ι : Type*} [Fintype ι] [DecidableEq ι] (b : Basis ι ℤ S)
    (I : Ideal S) (bI : Basis ι ℤ I) : (b.det ((↑) ∘ bI)).natAbs = Ideal.absNorm I := by
  rw [Ideal.absNorm_apply]
  exact Submodule.natAbs_det_basis_change b (I.restrictScalars ℤ) bI

@[simp]
theorem absNorm_span_singleton (r : S) :
    absNorm (span ({r} : Set S)) = (Algebra.norm ℤ r).natAbs := by
  rw [Algebra.norm_apply]
  by_cases hr : r = 0
  · simp only [hr, Ideal.span_zero, Ideal.absNorm_bot,
      LinearMap.det_zero'', Set.singleton_zero, map_zero, Int.natAbs_zero]
  let b := Module.Free.chooseBasis ℤ S
  rw [← natAbs_det_equiv _ (b.equiv (basisSpanSingleton b hr) (Equiv.refl _))]
  congr
  refine b.ext fun i => ?_
  simp

lemma absNorm_span_natCast (n : ℕ) : (span {(n : S)}).absNorm = n ^ Module.finrank ℤ S := by
  simp [absNorm_span_singleton, Algebra.norm_natCast]

theorem absNorm_dvd_norm_of_mem {I : Ideal S} {x : S} (h : x ∈ I) :
    ↑(Ideal.absNorm I) ∣ Algebra.norm ℤ x := by
  rw [← Int.dvd_natAbs, ← absNorm_span_singleton x, Int.natCast_dvd_natCast]
  exact absNorm_dvd_absNorm_of_le ((span_singleton_le_iff_mem _).mpr h)

@[simp]
theorem absNorm_span_insert (r : S) (s : Set S) :
    absNorm (span (insert r s)) ∣ gcd (absNorm (span s)) (Algebra.norm ℤ r).natAbs :=
  (dvd_gcd_iff _ _ _).mpr
    ⟨absNorm_dvd_absNorm_of_le (span_mono (Set.subset_insert _ _)),
      _root_.trans
        (absNorm_dvd_absNorm_of_le (span_mono (Set.singleton_subset_iff.mpr (Set.mem_insert _ _))))
        (by rw [absNorm_span_singleton])⟩

/-- The norm of a maximal ideal is a prime power.
The prime is `(P.under ℤ).absNorm` and the exponent is `(P.under ℤ).inertialDeg P`.
See `Ideal.absNorm_pow_inertiaDeg`. -/

lemma exists_prime_and_absNorm_eq_pow (P : Ideal S) [P.IsMaximal] :
    ∃ p n, 0 < n ∧ ↑p ∈ P ∧ p.Prime ∧ P.absNorm = p ^ n := by
  have : HasUniqueDiv S := .of_isTorsionFree ℤ _
  have := CharZero.of_hasUniqueDiv S S
  have : Finite (S ⧸ P) := Submodule.finiteQuotientOfFreeOfRankEq (P.restrictScalars ℤ)
    (Ideal.finrank_eq_finrank (Module.Free.chooseBasis _ _) _
      (Ideal.IsMaximal.ne_bot_of_isIntegral_int P))
  cases nonempty_fintype (S ⧸ P)
  let := Ideal.Quotient.field P
  obtain ⟨p, hpR⟩ := CharP.exists (S ⧸ P)
  obtain ⟨n, hp, e⟩ := FiniteField.card (S ⧸ P) p
  have hP : P.absNorm = p ^ (n : ℕ) := by
    rw [Ideal.absNorm_eq_natCard]
    exact Nat.card_eq_fintype_card.trans e
  refine ⟨p, n, n.2, ?_, hp, hP⟩
  rw [← Ideal.IsPrime.pow_mem_iff_mem (I := P) inferInstance _ n.pos, ← Nat.cast_pow, ← hP]
  exact P.absNorm_mem

lemma exists_isMaximal_dvd_of_dvd_absNorm
    {p : ℤ} (hp : Prime p) (I : Ideal S) (hI : p ∣ I.absNorm) :
    ∃ P : Ideal S, P.IsMaximal ∧ P.under ℤ = .span {p} ∧ P ∣ I := by
  have : HasUniqueDiv S := .of_isTorsionFree ℤ _
  have := CharZero.of_hasUniqueDiv S S
  have hpMax : (Ideal.span {p}).IsMaximal :=
    ((Ideal.span_singleton_prime hp.ne_zero).mpr hp).isMaximal (by simpa using hp.ne_zero)
  induction I using UniqueFactorizationMonoid.induction_on_prime with
  | h₁ =>
    obtain ⟨Q, hQ, e⟩ := Ideal.exists_ideal_over_maximal_of_isIntegral (S := S) (Ideal.span {p})
      (fun x ↦ by simp +contextual)
    exact ⟨Q, hQ, e, dvd_zero _⟩
  | h₂ I hI' =>
    obtain rfl : I = ⊤ := by simpa using hI'
    cases hp.not_dvd_one (by simpa using hI)
  | h₃ I P hI' hP IH =>
    simp only [_root_.map_mul, Nat.cast_mul, hp.dvd_mul] at hI
    cases hI with
    | inr h =>
      obtain ⟨Q, h₁, h₂, h₃⟩ := IH h
      exact ⟨Q, h₁, h₂, dvd_mul_of_dvd_right h₃ _⟩
    | inl hI =>
      have := (Ideal.isPrime_of_prime hP).isMaximal hP.ne_zero
      refine ⟨P, this, (hpMax.eq_of_le (by simpa using this.ne_top) ?_).symm, dvd_mul_right _ _⟩
      obtain ⟨q, n, hn, hqP, hq, H⟩ := Ideal.exists_prime_and_absNorm_eq_pow P
      rw [H, Nat.cast_pow, dvd_prime_pow (Nat.prime_iff_prime_int.mp hq)] at hI
      obtain ⟨m, hmn, hp⟩ := hI
      rw [Ideal.span_singleton_le_iff_mem]
      have : m ≠ 0 := fun h ↦ hpMax.ne_top (Ideal.span_singleton_eq_top.mpr (by simpa [h] using hp))
      exact Ideal.mem_of_dvd _ hp.symm.dvd (Ideal.pow_mem_of_mem _ (by simpa) _ this.bot_lt)

/-- A version that takes a natural number and `Nat.Prime`. -/
lemma exists_isMaximal_dvd_of_dvd_absNorm'
    {p : ℕ} (hp : p.Prime) (I : Ideal S) (hI : p ∣ I.absNorm) :
    ∃ P : Ideal S, P.IsMaximal ∧ P.under ℤ = .span {(p : ℤ)} ∧ P ∣ I :=
  exists_isMaximal_dvd_of_dvd_absNorm (Int.prime_iff_natAbs_prime.mpr (by simpa)) _
    (mod_cast hI)

theorem norm_dvd_iff {x : S} (hx : Prime (Algebra.norm ℤ x)) {y : ℤ} :
    Algebra.norm ℤ x ∣ y ↔ x ∣ y := by
  rw [← Ideal.mem_span_singleton (y := x), ← eq_intCast (algebraMap ℤ S), ← Ideal.mem_comap,
    ← Ideal.span_singleton_absNorm, Ideal.mem_span_singleton, Ideal.absNorm_span_singleton,
    Int.natAbs_dvd]
  rwa [Ideal.absNorm_span_singleton, ← Int.prime_iff_natAbs_prime]

end Free

end Finite

end Ideal

end RingOfIntegers

section Int

open Ideal

@[simp]
theorem Int.ideal_span_absNorm_eq_self (J : Ideal ℤ) :
    span {(absNorm J : ℤ)} = J := by
  obtain ⟨g, rfl⟩ := IsPrincipalIdealRing.principal J
  simp

@[simp]
theorem Int.prime_absNorm (J : Ideal ℤ) :
    (absNorm J).Prime ↔ Prime J := by
  obtain ⟨g, rfl⟩ := IsPrincipalIdealRing.principal J
  simp [prime_span_singleton_iff, prime_iff_natAbs_prime]

end Int

end abs_norm

Messung
CHZG
8910010096

¤ Dauer der Verarbeitung: 0.5 Sekunden  (vorverarbeitet am  2026-11-24) ¤

*© Formatika GbR, Deutschland