Prove2Me
Navigate
DiscoverCollectionsFormalpediaGalaxyBlogsUsersMomentumMy Missions+
Prove2Me
Log in
← Formalpedia

Moduli of a number field and multiplicative congruence

Definition
TauCeti_NumberTheory_NumberField_Global_RayClass_Modulus

by riccardo.brasca · Sep 29, 2026 · Mathlib 0df444a (Lean v4.33.1)

number-theorytauceti-chebotarev

A modulus of a number field KKK is a pair m=(m0,m∞)\mathfrak m=(\mathfrak m_0,\mathfrak m_\infty)m=(m0​,m∞​), with m0\mathfrak m_0m0​ a nonzero integral ideal and m∞\mathfrak m_\inftym∞​ a set of real places. Congruence to one means

x≡1(modPvP(m0)) (P∣m0),τ(x)>0 (τ∈m∞),x\equiv1\pmod{P^{v_P(\mathfrak m_0)}}\ (P\mid\mathfrak m_0),\qquad \tau(x)>0\ (\tau\in\mathfrak m_\infty),x≡1(modPvP​(m0​)) (P∣m0​),τ(x)>0 (τ∈m∞​),

for x∈K×x\in K^\timesx∈K×, with the finite congruences interpreted locally. The bundle supplies support, exponents, divisibility, and the associated groups of congruence elements and coprime ideals.

Formalization Note. These foundational declarations are transplanted from the Tau Ceti contributors' original source (Apache-2.0, commit 948fe4751b1fe528b6d580c522ca5d743d47f185), with compatibility adaptations for Lean 4.33.1. Mathematical proofs requiring separate theorem nodes are published separately.

Definition code
/- Transplanted from https://github.com/TauCetiProject/TauCeti at 948fe4751b1fe528b6d580c522ca5d743d47f185.
Original source copyright/license notices are retained below.
Generated exclusively from compiler declaration, command, and reference facts. -/
import Definitions.Def_TauCeti_NumberTheory_NumberField_Ideal_Away
import Definitions.Def_TauCeti_RingTheory_DedekindDomain_Factorization
import Definitions.Def_TauCeti_RingTheory_DedekindDomain_Ideal
import Mathlib.Algebra.Group.Subgroup.Ker
import Mathlib.Algebra.Order.Ring.Units
import Mathlib.Algebra.Ring.Int.Units
import Mathlib.Data.Nat.Prime.Basic
import Mathlib.Data.Nat.Prime.Defs
import Mathlib.GroupTheory.Index
import Mathlib.GroupTheory.IndexNormal
import Mathlib.GroupTheory.Solvable
import Mathlib.GroupTheory.Subgroup.Center
import Mathlib.NumberTheory.NumberField.Basic
import Mathlib.NumberTheory.NumberField.InfinitePlace.Basic
import Mathlib.NumberTheory.NumberField.InfinitePlace.TotallyRealComplex
import Mathlib.RingTheory.ClassGroup.Basic
import Mathlib.RingTheory.DedekindDomain.AdicValuation
import Mathlib.RingTheory.DedekindDomain.Factorization
import Mathlib.RingTheory.DedekindDomain.Ideal.Lemmas
import Mathlib.RingTheory.Valuation.Discrete.IsDiscreteValuationRing
import Mathlib.Tactic.Group

section
set_option autoImplicit true
/-
Copyright (c) 2026 The Tau Ceti contributors. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: The Tau Ceti contributors
-/
/-!
# Moduli of a number field and multiplicative congruence

A **modulus** of a number field `K` is a pair consisting of a nonzero integral ideal of `𝓞 K` (the
finite part) and a finite set of real infinite places (the infinite part).  Moduli are the data
against which the congruence conditions defining ray classes are imposed: an element `x` of `Kˣ` is
*congruent to one modulo `𝔪`* when the finite part divides `x - 1` locally at each of its prime
divisors, and `x` is positive at each real place selected by the infinite part.

This file builds that vocabulary:

* the carrier `Modulus K`, its divisibility relation, its finite support and exponent function, the
  trivial modulus and the modulus with unit finite part and every real place;
* the predicate `IsCongrOne` and the subgroup `congruenceSubgroup` of `Kˣ` it cuts out, together
  with the larger subgroup `primeToSubgroup` of elements that are units at the primes dividing the
  finite part, and the subgroup `unitsCongruenceSubgroup` of `(𝓞 K)ˣ` obtained by restriction;
* the group `idealsPrimeTo 𝔪` of invertible fractional ideals and the monoid
  `integralIdealsPrimeTo 𝔪` of nonzero integral ideals that are prime to the finite part.

The last two are *abbreviations* for `TauCeti.NumberFieldArithmetic.idealsAway 𝔪.support` and
`TauCeti.NumberFieldArithmetic.integralIdealsAway 𝔪.support`: there is exactly one group of
prime-to fractional ideals and one monoid of prime-to integral ideals, and both are the ones built
away from a finite set of primes.

## Main definitions

* `TauCeti.GlobalNumberFields.Modulus`: the carrier, with `Modulus.support`, `Modulus.exponent`,
  `Modulus.one` and `TauCeti.GlobalNumberFields.narrowModulus`.
* `TauCeti.GlobalNumberFields.IsCongrOne`: multiplicative congruence to one modulo a modulus.
* `TauCeti.GlobalNumberFields.congruenceSubgroup`, `TauCeti.GlobalNumberFields.primeToSubgroup`,
  `TauCeti.GlobalNumberFields.unitsCongruenceSubgroup`: the subgroups of `Kˣ` and `(𝓞 K)ˣ` these
  conditions define.
* `TauCeti.GlobalNumberFields.unitsToPrimeToSubgroup`: the inclusion of `(𝓞 K)ˣ` into
  `primeToSubgroup 𝔪`.
* `TauCeti.GlobalNumberFields.idealsPrimeTo`,
  `TauCeti.GlobalNumberFields.integralIdealsPrimeTo`: ideals prime to the finite part, with the
  inclusion `TauCeti.GlobalNumberFields.integralIdealsPrimeToInclusion` along divisibility.

## Main results

* `TauCeti.GlobalNumberFields.Modulus.mem_support_iff`: membership in the support is divisibility
  of the finite part.  `Modulus.support_one` and `Modulus.support_mono` are consequences.
* `TauCeti.GlobalNumberFields.Modulus.pow_exponent_dvd_finitePart` and
  `TauCeti.GlobalNumberFields.Modulus.mem_finitePart_of_forall_mem_pow_exponent`: the prime power
  prescribed by the exponent divides the finite part, and membership in the finite part is
  detected by those prime powers.
* `TauCeti.GlobalNumberFields.Modulus.valued_eq_one_of_valued_sub_one_le`: an element of the
  `v`-adic completion congruent to one at a divisor of the finite part is a unit there.
* `TauCeti.GlobalNumberFields.congruenceSubgroup_le_primeToSubgroup`: an element congruent to one
  is a unit at every prime dividing the finite part.  This is what makes the ray a subgroup of the
  prime-to ideals.
* `TauCeti.GlobalNumberFields.IsCongrOne.mono` and
  `TauCeti.GlobalNumberFields.congruenceSubgroup_antitone`: congruence to one is antitone in the
  modulus, which is what makes the transition maps between ray class groups run from a larger
  modulus to a smaller one.
* `TauCeti.GlobalNumberFields.isCongrOne_narrowModulus_iff`: congruence to one modulo the modulus
  with unit finite part and every real place is total positivity.
* `TauCeti.GlobalNumberFields.unitsCongruenceSubgroup_narrowModulus`: the units congruent to one
  modulo the narrow modulus are the totally positive integer units.
* `TauCeti.GlobalNumberFields.Modulus.isCoprimeTo_of_dvd_span_singleton`: a divisor of a principal
  ideal whose generator is a unit at the finite part is prime to the modulus.
* `TauCeti.GlobalNumberFields.Modulus.isCoprimeTo_iff_sup_eq_top`: being prime to the support is
  comaximality with the finite part.

## References

* J. Neukirch, *Algebraic Number Theory*, Chapter VI, §1.
* S. Lang, *Algebraic Number Theory*, Chapter VI, §1.
-/

 section

open IsDedekindDomain IsDedekindDomain.HeightOneSpectrum NumberField
open scoped nonZeroDivisors NumberField

namespace TauCeti.GlobalNumberFields

/-- A **modulus** of a number field `K`: a nonzero integral ideal of `𝓞 K` together with a finite
set of real infinite places.  Complex places never divide a modulus, which is why the infinite part
is a `Finset` of the subtype `{w : InfinitePlace K // w.IsReal}` rather than of all infinite
places. -/
structure Modulus (K : Type*) [Field K] [NumberField K] where
  /-- The finite part of the modulus: a nonzero integral ideal of `𝓞 K`. -/
  finitePart : Ideal (𝓞 K)
  /-- The finite part of a modulus is nonzero. -/
  finitePart_ne_bot : finitePart ≠ ⊥
  /-- The infinite part of the modulus: a finite set of real places of `K`. -/
  infinitePart : Finset {w : InfinitePlace K // w.IsReal}

variable {K : Type*} [Field K] [NumberField K]

namespace Modulus



theorem finitePart_ne_zero (𝔪 : Modulus K) : 𝔪.finitePart ≠ 0 := fun h ↦
  𝔪.finitePart_ne_bot (by rwa [Ideal.zero_eq_bot] at h)

/-- **Divisibility of moduli**: `𝔪 ∣ 𝔫` when the finite part of `𝔪` divides that of `𝔫` and the
infinite part of `𝔪` is contained in that of `𝔫`, so that the congruence conditions imposed by
`𝔫` are the stronger ones. -/
instance : Dvd (Modulus K) :=
  ⟨fun 𝔪 𝔫 ↦ 𝔪.finitePart ∣ 𝔫.finitePart ∧ 𝔪.infinitePart ⊆ 𝔫.infinitePart⟩

/-- **Divisibility of moduli is componentwise.**  This is the introduction and elimination rule for
`𝔪 ∣ 𝔫`, so no proof of a divisibility statement, here or downstream, needs the
`Dvd (Modulus K)` instance body. -/
@[simp] theorem dvd_iff {𝔪 𝔫 : Modulus K} :
    𝔪 ∣ 𝔫 ↔ 𝔪.finitePart ∣ 𝔫.finitePart ∧ 𝔪.infinitePart ⊆ 𝔫.infinitePart :=
  Iff.rfl







/-- The **support** of a modulus: the finite set of height-one primes dividing its finite part. -/
noncomputable def support (𝔪 : Modulus K) : Finset (HeightOneSpectrum (𝓞 K)) :=
  (Ideal.finite_factors 𝔪.finitePart_ne_zero).toFinset

/-- **Membership in the support is divisibility of the finite part.**  This is the characterizing
theorem of `Modulus.support`; `Modulus.support_one` and `Modulus.support_mono` are derived from
it. -/
@[simp]
theorem mem_support_iff (𝔪 : Modulus K) (v : HeightOneSpectrum (𝓞 K)) :
    v ∈ 𝔪.support ↔ v.asIdeal ∣ 𝔪.finitePart :=
  Set.Finite.mem_toFinset _

/-- The support grows with the modulus. -/
theorem support_mono {𝔪 𝔫 : Modulus K} (h : 𝔪 ∣ 𝔫) : 𝔪.support ⊆ 𝔫.support := fun v hv ↦
  (mem_support_iff 𝔫 v).mpr (((mem_support_iff 𝔪 v).mp hv).trans (dvd_iff.mp h).1)

/-- The **exponent** of a finite place in a modulus: the multiplicity of `v` in the factorization
of the finite part. -/
noncomputable def exponent (𝔪 : Modulus K) (v : HeightOneSpectrum (𝓞 K)) : ℕ :=
  (Associates.mk v.asIdeal).count (Associates.mk 𝔪.finitePart).factors



/-- A prime lies in the support of a modulus exactly when it occurs in the finite part with a
positive exponent. -/
theorem mem_support_iff_exponent_ne_zero (𝔪 : Modulus K) (v : HeightOneSpectrum (𝓞 K)) :
    v ∈ 𝔪.support ↔ 𝔪.exponent v ≠ 0 := by
  rw [mem_support_iff, exponent,
    Associates.count_ne_zero_iff_dvd 𝔪.finitePart_ne_zero v.irreducible]

theorem exponent_pos_of_mem_support {𝔪 : Modulus K} {v : HeightOneSpectrum (𝓞 K)}
    (hv : v ∈ 𝔪.support) : 0 < 𝔪.exponent v :=
  Nat.pos_of_ne_zero ((mem_support_iff_exponent_ne_zero 𝔪 v).mp hv)

/-- **The exponent is the exact multiplicity of the prime in the finite part**: `v ^ n` divides the
finite part exactly when `n` is at most the exponent of `v`. -/
theorem pow_dvd_finitePart_iff_le_exponent (𝔪 : Modulus K) (v : HeightOneSpectrum (𝓞 K))
    {n : ℕ} : v.asIdeal ^ n ∣ 𝔪.finitePart ↔ n ≤ 𝔪.exponent v := by
  rw [exponent, le_count_associates_iff_le_pow v 𝔪.finitePart_ne_bot, Ideal.dvd_iff_le]

/-- **The prescribed prime power divides the finite part.**  This is what turns membership in the
finite part into the valuation bound recorded by `IsCongrOne`. -/
theorem pow_exponent_dvd_finitePart (𝔪 : Modulus K) (v : HeightOneSpectrum (𝓞 K)) :
    v.asIdeal ^ 𝔪.exponent v ∣ 𝔪.finitePart :=
  (pow_dvd_finitePart_iff_le_exponent 𝔪 v).mpr le_rfl

/-- **Membership in the finite part is a local condition.**  An algebraic integer lying in the
prime power prescribed by the exponent at every prime dividing the finite part lies in the finite
part itself.  This is the converse direction to `Modulus.pow_exponent_dvd_finitePart`. -/
theorem mem_finitePart_of_forall_mem_pow_exponent (𝔪 : Modulus K) {y : 𝓞 K}
    (h : ∀ v : HeightOneSpectrum (𝓞 K), v.asIdeal ∣ 𝔪.finitePart →
      y ∈ v.asIdeal ^ 𝔪.exponent v) :
    y ∈ 𝔪.finitePart := by
  rw [← Ideal.iInf_maxPowDividing_eq 𝔪.finitePart_ne_zero, Submodule.mem_iInf]
  intro v
  -- `maxPowDividing` is, by definition, the prime power recorded by `exponent`.
  have hmax : v.maxPowDividing 𝔪.finitePart = v.asIdeal ^ 𝔪.exponent v := rfl
  rw [hmax]
  by_cases hv : v.asIdeal ∣ 𝔪.finitePart
  · exact h v hv
  · have hzero : 𝔪.exponent v = 0 := by
      by_contra hne
      exact hv ((mem_support_iff 𝔪 v).mp ((mem_support_iff_exponent_ne_zero 𝔪 v).mpr hne))
    rw [hzero, pow_zero, Ideal.one_eq_top]
    exact Submodule.mem_top

/-- Exponents grow with the modulus. -/
theorem exponent_mono {𝔪 𝔫 : Modulus K} (h : 𝔪 ∣ 𝔫) (v : HeightOneSpectrum (𝓞 K)) :
    𝔪.exponent v ≤ 𝔫.exponent v :=
  Associates.count_le_count_of_le (Associates.mk_ne_zero.mpr 𝔫.finitePart_ne_zero)
    (Associates.irreducible_mk.mpr v.irreducible) (Associates.mk_le_mk_of_dvd (dvd_iff.mp h).1)



/-- The **trivial modulus**: unit finite part and no real places.  It imposes no condition, so its
ray class group is the ordinary class group. -/
def one (K : Type*) [Field K] [NumberField K] : Modulus K where
  finitePart := ⊤
  finitePart_ne_bot := top_ne_bot
  infinitePart := ∅

@[simp] theorem one_finitePart : (one K).finitePart = ⊤ := (rfl)

@[simp] theorem one_infinitePart : (one K).infinitePart = ∅ := (rfl)

/-- The trivial modulus has empty support: no height-one prime divides the unit ideal. -/
@[simp] theorem support_one : (one K).support = ∅ := by
  ext v
  rw [mem_support_iff, one_finitePart]
  simpa only [Finset.notMem_empty, iff_false, ← Ideal.one_eq_top] using v.prime.not_dvd_one

theorem one_dvd (𝔪 : Modulus K) : one K ∣ 𝔪 :=
  dvd_iff.mpr ⟨by rw [one_finitePart, ← Ideal.one_eq_top]; exact _root_.one_dvd _, by simp⟩



end Modulus

/-- The modulus with unit finite part and **every** real place.  Its ray class group is the narrow
class group. -/
noncomputable def narrowModulus (K : Type*) [Field K] [NumberField K] : Modulus K :=
  { Modulus.one K with
    infinitePart := (Set.finite_univ (α := {w : InfinitePlace K // w.IsReal})).toFinset }



@[simp] theorem mem_narrowModulus_infinitePart (w : {w : InfinitePlace K // w.IsReal}) :
    w ∈ (narrowModulus K).infinitePart :=
  (Set.Finite.mem_toFinset _).mpr (Set.mem_univ w)



/-! ### Multiplicative congruence -/

/-- **Multiplicative congruence to one modulo a modulus.**  An element `x` of `Kˣ` satisfies
`IsCongrOne 𝔪 x` when, at every prime `v` dividing the finite part of `𝔪`, the element `x - 1` is
divisible by `v ^ (𝔪.exponent v)` locally — equivalently `v.valuation K (x - 1)` is at most
`exp (-𝔪.exponent v)` — and `x` is positive at every real place selected by the infinite part.

This is a condition on `Kˣ`, not on `K`.  Zero is excluded because it generates no invertible
principal fractional ideal, so it has no ray class to contribute, while it would satisfy the empty
conditions imposed by the trivial modulus.  The condition is also not unqualified membership in
`1 + 𝔪.finitePart`, since `x` need not be an algebraic integer. -/
def IsCongrOne (𝔪 : Modulus K) (x : Kˣ) : Prop :=
  (∀ v : HeightOneSpectrum (𝓞 K), v.asIdeal ∣ 𝔪.finitePart →
      v.valuation K ((x : K) - 1) ≤ WithZero.exp (-(𝔪.exponent v : ℤ))) ∧
    ∀ w ∈ 𝔪.infinitePart, 0 < InfinitePlace.embedding_of_isReal w.2 (x : K)

theorem isCongrOne_iff {𝔪 : Modulus K} {x : Kˣ} :
    IsCongrOne 𝔪 x ↔
      (∀ v : HeightOneSpectrum (𝓞 K), v.asIdeal ∣ 𝔪.finitePart →
          v.valuation K ((x : K) - 1) ≤ WithZero.exp (-(𝔪.exponent v : ℤ))) ∧
        ∀ w ∈ 𝔪.infinitePart, 0 < InfinitePlace.embedding_of_isReal w.2 (x : K) :=
  Iff.rfl

namespace IsCongrOne

variable {𝔪 : Modulus K} {x : Kˣ}

theorem valuation_sub_one_le (hx : IsCongrOne 𝔪 x) {v : HeightOneSpectrum (𝓞 K)}
    (hv : v.asIdeal ∣ 𝔪.finitePart) :
    v.valuation K ((x : K) - 1) ≤ WithZero.exp (-(𝔪.exponent v : ℤ)) := hx.1 v hv

theorem pos (hx : IsCongrOne 𝔪 x) {w : {w : InfinitePlace K // w.IsReal}}
    (hw : w ∈ 𝔪.infinitePart) : 0 < InfinitePlace.embedding_of_isReal w.2 (x : K) := hx.2 w hw

/-- An element congruent to one modulo `𝔪` has `v`-adic valuation strictly less than one at
`x - 1`, for every prime `v` dividing the finite part: the exponent there is positive. -/
theorem valuation_sub_one_lt_one (hx : IsCongrOne 𝔪 x) {v : HeightOneSpectrum (𝓞 K)}
    (hv : v.asIdeal ∣ 𝔪.finitePart) : v.valuation K ((x : K) - 1) < 1 := by
  refine lt_of_le_of_lt (hx.valuation_sub_one_le hv) ?_
  have hpos : 0 < 𝔪.exponent v :=
    Modulus.exponent_pos_of_mem_support ((Modulus.mem_support_iff 𝔪 v).mpr hv)
  rw [← WithZero.exp_zero, WithZero.exp_lt_exp]
  exact neg_neg_iff_pos.mpr (Int.natCast_pos.mpr hpos)

/-- **An element congruent to one is a unit at the primes dividing the finite part.** -/
theorem valuation_eq_one (hx : IsCongrOne 𝔪 x) {v : HeightOneSpectrum (𝓞 K)}
    (hv : v.asIdeal ∣ 𝔪.finitePart) : v.valuation K (x : K) = 1 := by
  have h := Valuation.map_one_add_of_lt (v.valuation K) (hx.valuation_sub_one_lt_one hv)
  rwa [add_sub_cancel] at h

/-- **Congruence is antitone in the modulus.**  An element congruent to one modulo the larger
modulus `𝔫` is congruent to one modulo every divisor `𝔪` of `𝔫`: the exponents can only have
shrunk and fewer real places are constrained. -/
theorem mono {𝔫 : Modulus K} (h : 𝔪 ∣ 𝔫) (hx : IsCongrOne 𝔫 x) : IsCongrOne 𝔪 x := by
  refine ⟨fun v hv ↦ ?_, fun w hw ↦ hx.pos ((Modulus.dvd_iff.mp h).2 hw)⟩
  refine (hx.valuation_sub_one_le (hv.trans (Modulus.dvd_iff.mp h).1)).trans
    (WithZero.exp_le_exp.mpr ?_)
  exact neg_le_neg (Int.ofNat_le.mpr (Modulus.exponent_mono h v))

end IsCongrOne

/-- The subgroup of `Kˣ` of elements congruent to one modulo `𝔪`.  The ray of principal ideals is
generated by its image in the fractional ideals. -/
def congruenceSubgroup (𝔪 : Modulus K) : Subgroup Kˣ where
  carrier := {x | IsCongrOne 𝔪 x}
  one_mem' := by
    refine ⟨fun v _ ↦ ?_, fun w _ ↦ ?_⟩
    · simp
    · simp
  mul_mem' := by
    rintro x y hx hy
    refine ⟨fun v hv ↦ ?_, fun w hw ↦ ?_⟩
    · -- `xy - 1 = x (y - 1) + (x - 1)`, and `x` is a unit at `v`.
      have hxy : ((x * y : Kˣ) : K) - 1 = (x : K) * ((y : K) - 1) + ((x : K) - 1) := by
        push_cast; ring
      refine le_trans (hxy ▸ Valuation.map_add (v.valuation K) _ _) (max_le ?_ ?_)
      · rw [map_mul, hx.valuation_eq_one hv, one_mul]
        exact hy.valuation_sub_one_le hv
      · exact hx.valuation_sub_one_le hv
    · have := mul_pos (hx.pos hw) (hy.pos hw)
      rwa [← map_mul, ← Units.val_mul] at this
  inv_mem' := by
    rintro x hx
    refine ⟨fun v hv ↦ ?_, fun w hw ↦ ?_⟩
    · have hne : (x : K) ≠ 0 := x.ne_zero
      have hxy : ((x⁻¹ : Kˣ) : K) - 1 = -(((x : K) - 1) * (x : K)⁻¹) := by
        rw [Units.val_inv_eq_inv_val]
        field_simp
        ring
      rw [hxy, Valuation.map_neg, map_mul, map_inv₀, hx.valuation_eq_one hv, inv_one, mul_one]
      exact hx.valuation_sub_one_le hv
    · have := inv_pos.mpr (hx.pos hw)
      rwa [← map_inv₀, ← Units.val_inv_eq_inv_val] at this

@[simp] theorem mem_congruenceSubgroup {𝔪 : Modulus K} {x : Kˣ} :
    x ∈ congruenceSubgroup 𝔪 ↔ IsCongrOne 𝔪 x := Iff.rfl



/-- The subgroup of `Kˣ` of elements that are units at every prime dividing the finite part of the
modulus.  This is the domain of reduction to the residue units. -/
def primeToSubgroup (𝔪 : Modulus K) : Subgroup Kˣ where
  carrier := {x | ∀ v : HeightOneSpectrum (𝓞 K), v.asIdeal ∣ 𝔪.finitePart →
    v.valuation K (x : K) = 1}
  one_mem' := by simp
  mul_mem' := fun hx hy v hv ↦ by
    rw [Units.val_mul, map_mul, hx v hv, hy v hv, one_mul]
  inv_mem' := fun hx v hv ↦ by
    rw [Units.val_inv_eq_inv_val, map_inv₀, hx v hv, inv_one]

@[simp] theorem mem_primeToSubgroup {𝔪 : Modulus K} {x : Kˣ} :
    x ∈ primeToSubgroup 𝔪 ↔
      ∀ v : HeightOneSpectrum (𝓞 K), v.asIdeal ∣ 𝔪.finitePart → v.valuation K (x : K) = 1 :=
  Iff.rfl



/-- **Congruence to one implies being a unit at the finite part.**  This inclusion is what makes
the principal ideal of an element congruent to one prime to the modulus. -/
theorem congruenceSubgroup_le_primeToSubgroup (𝔪 : Modulus K) :
    congruenceSubgroup 𝔪 ≤ primeToSubgroup 𝔪 :=
  fun _ hx v hv ↦ hx.valuation_eq_one (v := v) hv

/-- The units of `𝓞 K` congruent to one modulo `𝔪`.  Its index in `(𝓞 K)ˣ` is the unit correction
in the ray class number formula. -/
def unitsCongruenceSubgroup (𝔪 : Modulus K) : Subgroup (𝓞 K)ˣ :=
  (congruenceSubgroup 𝔪).comap (Units.map (algebraMap (𝓞 K) K).toMonoidHom)

@[simp] theorem mem_unitsCongruenceSubgroup {𝔪 : Modulus K} {u : (𝓞 K)ˣ} :
    u ∈ unitsCongruenceSubgroup 𝔪 ↔
      IsCongrOne 𝔪 (Units.map (algebraMap (𝓞 K) K).toMonoidHom u) := Iff.rfl

/-- The image of an integer unit is a unit at every finite place, hence lies in
`primeToSubgroup 𝔪`. -/
theorem unitsMap_mem_primeToSubgroup (𝔪 : Modulus K) (u : (𝓞 K)ˣ) :
    Units.map (algebraMap (𝓞 K) K).toMonoidHom u ∈ primeToSubgroup 𝔪 := by
  refine mem_primeToSubgroup.mpr fun v _ ↦ ?_
  rw [Units.coe_map, RingHom.toMonoidHom_eq_coe, MonoidHom.coe_coe, valuation_of_algebraMap]
  refine intValuation_eq_one_iff.mpr fun hu ↦ v.isPrime.ne_top ?_
  exact Ideal.eq_top_of_isUnit_mem _ hu u.isUnit

/-- The inclusion of the integer units into the elements that are units at the finite part.  Its
composition with the residue-and-sign presentation is the unit obstruction in the ray class exact
sequence. -/
noncomputable def unitsToPrimeToSubgroup (𝔪 : Modulus K) :
    (𝓞 K)ˣ →* primeToSubgroup 𝔪 :=
  MonoidHom.codRestrict (Units.map (algebraMap (𝓞 K) K).toMonoidHom) _
    (unitsMap_mem_primeToSubgroup 𝔪)

@[simp] theorem coe_unitsToPrimeToSubgroup (𝔪 : Modulus K) (u : (𝓞 K)ˣ) :
    ((unitsToPrimeToSubgroup 𝔪 u : primeToSubgroup 𝔪) : Kˣ) =
      Units.map (algebraMap (𝓞 K) K).toMonoidHom u := by
  rw [unitsToPrimeToSubgroup, MonoidHom.codRestrict_apply]

/-- **The trivial modulus imposes no condition.**  Its finite part is the unit ideal, which no
prime divides, and its infinite part is empty. -/
@[simp] theorem isCongrOne_one (x : Kˣ) : IsCongrOne (Modulus.one K) x :=
  ⟨fun v hv ↦ False.elim <| v.prime.not_dvd_one (by
      simpa only [Modulus.one_finitePart, ← Ideal.one_eq_top] using hv),
    fun w hw ↦ absurd hw (by simp)⟩









/-! ### Ideals prime to a modulus -/

/-- **The group of fractional ideals prime to a modulus**: the invertible fractional ideals whose
multiplicity vanishes at every prime dividing the finite part.  There is one such group, the one
built away from a finite set of primes. -/
noncomputable abbrev idealsPrimeTo (𝔪 : Modulus K) :
    Subgroup (FractionalIdeal (𝓞 K)⁰ K)ˣ :=
  NumberFieldArithmetic.idealsAway (K := K) 𝔪.support

/-- Coprimality of a nonzero integral ideal to a modulus: it is prime to the support, that is, to
the finite part.  This is the membership predicate of `integralIdealsPrimeTo`. -/
def Modulus.IsCoprimeTo (𝔪 : Modulus K) (I : Ideal (𝓞 K)) : Prop :=
  Ideal.IsPrimeTo I (𝔪.support : Set (HeightOneSpectrum (𝓞 K)))

theorem Modulus.isCoprimeTo_iff {𝔪 : Modulus K} {I : Ideal (𝓞 K)} :
    𝔪.IsCoprimeTo I ↔ I ≠ ⊥ ∧ ∀ v ∈ 𝔪.support, ¬ v.asIdeal ∣ I := Ideal.isPrimeTo_iff



/-- **Being prime to the modulus is comaximality with its finite part.**  A prime dividing both `I`
and the finite part is exactly a prime of the support dividing `I`, and such a prime exists as soon
as `I` and the finite part fail to generate the unit ideal. -/
theorem Modulus.isCoprimeTo_iff_sup_eq_top {𝔪 : Modulus K} {I : Ideal (𝓞 K)} :
    𝔪.IsCoprimeTo I ↔ I ≠ ⊥ ∧ I ⊔ 𝔪.finitePart = ⊤ := by
  rw [isCoprimeTo_iff]
  refine and_congr_right fun hI ↦ ⟨fun h ↦ ?_, fun h v hv hdvd ↦ ?_⟩
  · refine Ideal.isCoprime_iff_sup_eq.mp (Ideal.coprime_of_no_prime_ge fun 𝔭 h𝔭I h𝔭m h𝔭 ↦ ?_)
    have h𝔭bot : 𝔭 ≠ ⊥ := fun hbot ↦ 𝔪.finitePart_ne_bot (le_bot_iff.mp (hbot ▸ h𝔭m))
    exact h ⟨𝔭, h𝔭, h𝔭bot⟩ ((mem_support_iff _ _).mpr (Ideal.dvd_iff_le.mpr h𝔭m))
      (Ideal.dvd_iff_le.mpr h𝔭I)
  · refine v.isPrime.ne_top (top_le_iff.mp ?_)
    rw [← h]
    exact sup_le (Ideal.le_of_dvd hdvd) (Ideal.le_of_dvd ((mem_support_iff _ _).mp hv))

/-- **The monoid of nonzero integral ideals prime to a modulus.**  There is one such monoid, the
one built away from a finite set of primes; its membership predicate is `Modulus.IsCoprimeTo`. -/
noncomputable abbrev integralIdealsPrimeTo (𝔪 : Modulus K) : Submonoid (Ideal (𝓞 K)) :=
  NumberFieldArithmetic.integralIdealsAway (K := K) 𝔪.support

theorem Modulus.mem_integralIdealsPrimeTo {𝔪 : Modulus K} {I : Ideal (𝓞 K)} :
    I ∈ integralIdealsPrimeTo 𝔪 ↔ 𝔪.IsCoprimeTo I :=
  NumberFieldArithmetic.mem_integralIdealsAway_iff.trans Modulus.isCoprimeTo_iff.symm







end TauCeti.GlobalNumberFields

end
end
Source
https://github.com/TauCetiProject/TauCeti/blob/948fe4751b1fe528b6d580c522ca5d743d47f185/TauCeti/NumberTheory/NumberField/Global/RayClass/Modulus.lean

View graph

Get started

Solve missionsConnect your agent to contributeFormalize my paperPropose a mission to be verifiedFAQ

About Prove2Me

Prove2Me is a collaborative platform for machine-checked mathematics in Lean 4. Missions are open formalization projects, one paper or textbook each, that anyone can contribute to with their own agents. Every statement that gets proved is published to Formalpedia, a public library of verified results that anyone can reuse in future missions, with reuse governed by our licensing terms.

How Prove2Me worksResearch paperProve2Me Team
SKILL.mdTourFAQContactTerms
© 2026 Prove2Me