Eine aufbereitete Darstellung der Quelle

 
     
 
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung


Quelle  Order.lean   Sprache: Lean

 

/-
Copyright (c) 2019 Johan Commelin. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Johan Commelin, Kenny Lau
-/

module

public import Mathlib.RingTheory.Multiplicity
public import Mathlib.RingTheory.MvPowerSeries.Order
public import Mathlib.RingTheory.PowerSeries.Basic

/-! # Formal power series (in one variable) - Order

The `PowerSeries.order` of a formal power series `φ` is the multiplicity of the variable `X` in `φ`.

If the coefficients form an integral domain, then `PowerSeries.order` is an
additive valuation (`PowerSeries.order_mul`, `PowerSeries.min_order_le_order_add`).

We prove that if the commutative ring `R` of coefficients is an integral domain,
then the ring `R⟦X⟧` of formal power series in one variable over `R`
is an integral domain.

Given a non-zero power series `f`, `divided_by_X_pow_order f` is the power series obtained by
dividing out the largest power of X that divides `f`, that is its order. This is useful when
proving that `R⟦X⟧` is a normalization monoid, which is done in `PowerSeries.Inverse`.
-/


@[expose] public section
noncomputable section

open Finset (antidiagonal mem_antidiagonal)

namespace PowerSeries

open Finsupp (single)

variable {R : Type*}

section OrderBasic

variable [Semiring R] {φ : R⟦X⟧}

theorem exists_coeff_ne_zero_iff_ne_zero : (∃ n : ℕ, coeff n φ ≠ 0) ↔ φ ≠ 0 := by
  contrapose!
  simp

/-- The order of a formal power series `φ` is the greatest `n : ℕ∞`
such that `X^n` divides `φ`. The order is `⊤` if and only if `φ = 0`. -/

def order (φ : R⟦X⟧) : ℕ∞ :=
  letI := Classical.decEq R
  letI := Classical.decEq R⟦X⟧
  if h : φ = 0 then ⊤ else Nat.find (exists_coeff_ne_zero_iff_ne_zero.mpr h)

/-- The order of the `0` power series is infinite. -/
@[simp]
theorem order_zero : order (0 : R⟦X⟧) = ⊤ :=
  dite_eq_left rfl

theorem order_finite_iff_ne_zero : (order φ < ⊤) ↔ φ ≠ 0 := by
  simp only [order]
  split_ifs with h <;> simpa

/-- The `0` power series is the unique power series with infinite order. -/
@[simp]
theorem order_eq_top {φ : R⟦X⟧} : φ.order = ⊤ ↔ φ = 0 := by
  simpa using order_finite_iff_ne_zero.not_left

theorem coe_toNat_order {φ : R⟦X⟧} (hf : φ ≠ 0) : φ.order.toNat = φ.order := by
  rw [ENat.natCast_toNat_eq_self.mpr (order_eq_top.not.mpr hf)]

/-- If the order of a formal power series is finite,
then the coefficient indexed by the order is nonzero. -/

theorem coeff_order (h : φ ≠ 0) : coeff φ.order.toNat φ ≠ 0 := by
  classical
  simp only [order, h, not_false_iff, dite_eq_right]
  generalize_proofs h
  exact Nat.find_spec h

/-- If the `n`th coefficient of a formal power series is nonzero,
then the order of the power series is less than or equal to `n`. -/

theorem order_le (n : ℕ) (h : coeff n φ ≠ 0) : order φ ≤ n := by
  rw [order, dite_eq_right]
  · simpa using ⟨n, le_rfl, h⟩
  · exact exists_coeff_ne_zero_iff_ne_zero.mp ⟨n, h⟩

/-- The `n`th coefficient of a formal power series is `0` if `n` is strictly
smaller than the order of the power series. -/

theorem coeff_of_lt_order (n : ℕ) (h : ↑n < order φ) : coeff n φ = 0 := by
  contrapose! h
  exact order_le _ h

theorem coeff_of_lt_order_toNat (n : ℕ) (h : n < φ.order.toNat) : coeff n φ = 0 := by
  by_cases h' : φ = 0
  · simp [h']
  · refine coeff_of_lt_order _ ?_
    rwa [← coe_toNat_order h', ENat.natCast_lt_natCast]

/-- The order of a formal power series is at least `n` if
the `i`th coefficient is `0` for all `i < n`. -/

theorem nat_le_order (φ : R⟦X⟧) (n : ℕ) (h : ∀ i < n, coeff i φ = 0) : ↑n ≤ order φ := by
  simp only [order]
  split_ifs
  · simp
  · simpa [Nat.le_find_iff]

/-- The order of a formal power series is at least `n` if and only if its coefficients below `n`
vanish. -/

theorem nat_le_order_iff {φ : R⟦X⟧} {n : ℕ} :
    ↑n ≤ order φ ↔ ∀ i < n, coeff i φ = 0 :=
  ⟨fun h i hi ↦ coeff_of_lt_order i <| lt_of_lt_of_le (mod_cast hi) h, nat_le_order φ n⟩

/-- The order of a formal power series is at least `n` if
the `i`th coefficient is `0` for all `i < n`. -/

theorem le_order (φ : R⟦X⟧) (n : ℕ∞) (h : ∀ i : ℕ, ↑i < n → coeff i φ = 0) :
    n ≤ order φ := by
  cases n with
  | top => simpa using ext (by simpa using h)
  | coe n =>
    convert nat_le_order φ n _
    simpa using h

/-- The order of a formal power series is at least `n` if and only if its coefficients below `n`
vanish. -/

theorem le_order_iff {φ : R⟦X⟧} {n : ℕ∞} :
    n ≤ order φ ↔ ∀ i : ℕ, i < n → coeff i φ = 0 := by
  cases n with
  | top => simp
  | coe n => simpa using nat_le_order_iff

/-- The order of a formal power series is exactly `n` if the `n`th coefficient is nonzero,
and the `i`th coefficient is `0` for all `i < n`. -/

theorem order_eq_nat {φ : R⟦X⟧} {n : ℕ} :
    order φ = n ↔ coeff n φ ≠ 0 ∧ ∀ i, i < n → coeff i φ = 0 := by
  rcases eq_or_ne φ 0 with (rfl | hφ)
  · simp
  simp [order, dite_eq_right hφ, Nat.find_eq_iff]

/-- The order of a formal power series is exactly `n` if the `n`th coefficient is nonzero,
and the `i`th coefficient is `0` for all `i < n`. -/

theorem order_eq {φ : R⟦X⟧} {n : ℕ∞} :
    order φ = n ↔ (∀ i : ℕ, ↑i = n → coeff i φ ≠ 0) ∧ ∀ i : ℕ, ↑i < n → coeff i φ = 0 := by
  cases n with
  | top => simp
  | coe n => simp [order_eq_nat]

theorem order_eq_order {φ : R⟦X⟧} : φ.order = MvPowerSeries.order φ := by
  refine eq_of_le_of_ge ?_ ?_
  · refine MvPowerSeries.le_order fun d hd => by
      have : coeff ↑(Finsupp.degree d) φ = 0 := coeff_of_lt_order _ hd
      have eq_aux : d.degree = d () := Finset.sum_eq_single _ (by simp) (by simp)
      exact (PowerSeries.coeff_def rfl (R := R)) ▸ (eq_aux ▸ this)
  · refine le_order φ (MvPowerSeries.order φ) fun i hi => by
      rw [← Finsupp.degree_single () i] at hi
      exact MvPowerSeries.coeff_of_lt_order hi

/-- The order of the sum of two formal power series
is at least the minimum of their orders. -/

theorem min_order_le_order_add (φ ψ : R⟦X⟧) : min (order φ) (order ψ) ≤ order (φ + ψ) := by
  refine le_order _ _ ?_
  simp +contextual [coeff_of_lt_order]

private theorem order_add_of_order_ne.aux (φ ψ : R⟦X⟧)
    (H : order φ < order ψ) : order (φ + ψ) ≤ order φ ⊓ order ψ := by
  suffices order (φ + ψ) = order φ by grind
  rw [order_eq]
  grind [LinearMap.map_add, coeff_of_lt_order, order_eq_nat]

/-- The order of the sum of two formal power series
is the minimum of their orders if their orders differ. -/

theorem order_add_of_order_ne (φ ψ : R⟦X⟧) (h : order φ ≠ order ψ) :
    order (φ + ψ) = order φ ⊓ order ψ := by
  refine le_antisymm ?_ (min_order_le_order_add _ _)
  rcases h.lt_or_gt with (φ_lt_ψ | ψ_lt_φ)
  · apply order_add_of_order_ne.aux _ _ φ_lt_ψ
  · simpa only [add_comm, inf_comm] using order_add_of_order_ne.aux _ _ ψ_lt_φ

theorem le_order_map {S : Type*} [Semiring S] (f : R →+* S) :
    φ.order ≤ (φ.map f).order :=
  le_order _ _ fun i hi => by simp [coeff_of_lt_order i hi]

theorem le_order_smul {a : R} :
    φ.order ≤ (a • φ).order :=
  le_order _ φ.order fun i hi => by simp [coeff_of_lt_order i hi]

/-- The order of the product of two formal power series
is at least the sum of their orders. -/

theorem le_order_mul (φ ψ : R⟦X⟧) : order φ + order ψ ≤ order (φ * ψ) := by
  apply le_order
  intro n hn; rw [coeff_mul, Finset.sum_eq_zero]
  rintro ⟨i, j⟩ hij
  by_cases! hi : ↑i < order φ
  · rw [coeff_of_lt_order i hi, zero_mul]
  by_cases! hj : ↑j < order ψ
  · rw [coeff_of_lt_order j hj, mul_zero]
  rw [mem_antidiagonal] at hij
  exfalso
  apply ne_of_lt (lt_of_lt_of_le hn <| add_le_add hi hj)
  rw [← Nat.cast_add, hij]

theorem le_order_pow (φ : R⟦X⟧) (n : ℕ) : n • order φ ≤ order (φ ^ n) := by
  induction n with
  | zero => simp
  | succ n ih => grw [add_smul, one_smul, pow_succ, ih, le_order_mul]

theorem le_order_prod {R : Type*} [CommSemiring R] {ι : Type*} (φ : ι → R⟦X⟧) (s : Finset ι) :
    ∑ i ∈ s, (φ i).order ≤ (∏ i ∈ s, φ i).order := by
  induction s using Finset.cons_induction with
  | empty => simp
  | cons a s ha ih => grw [Finset.sum_cons ha, Finset.prod_cons ha, ih, le_order_mul]

alias order_mul_ge := le_order_mul

theorem one_le_order_iff_constCoeff_eq_zero :
    1 ≤ φ.order ↔ φ.constantCoeff = 0 := by
  simp [le_order_iff]

theorem order_ne_zero_iff_constCoeff_eq_zero {φ : R⟦X⟧} :
    φ.order ≠ 0 ↔ φ.constantCoeff = 0 := by
  rw [← Order.one_le_iff_ne_zero, one_le_order_iff_constCoeff_eq_zero]

theorem le_order_pow_of_constantCoeff_eq_zero (n : ℕ) (hf : φ.constantCoeff = 0) :
    n ≤ (φ ^ n).order := by
  refine .trans ?_ (le_order_pow _ n)
  simpa using le_mul_of_one_le_right' (one_le_order_iff_constCoeff_eq_zero.mpr hf)

/-- The order of the monomial `a*X^n` is infinite if `a = 0` and `n` otherwise. -/
theorem order_monomial (n : ℕ) (a : R) [Decidable (a = 0)] :
    order (monomial n a) = if a = 0 then (⊤ : ℕ∞) else n := by
  split_ifs with h
  · rw [h, order_eq_top, map_zero]
  · simp only [order_eq, Nat.cast_inj, coeff_monomial]
    grind

/-- The order of the monomial `a*X^n` is `n` if `a ≠ 0`. -/
theorem order_monomial_of_ne_zero (n : ℕ) (a : R) (h : a ≠ 0) : order (monomial n a) = n := by
  classical
  rw [order_monomial, ite_eq_right h]

/-- If `n` is strictly smaller than the order of `ψ`, then the `n`th coefficient of its product
with any other power series is `0`. -/

theorem coeff_mul_of_lt_order {φ ψ : R⟦X⟧} {n : ℕ} (h : ↑n < ψ.order) :
    coeff n (φ * ψ) = 0 := by
  suffices coeff n (φ * ψ) = ∑ p ∈ antidiagonal n, 0 by rw [this, Finset.sum_const_zero]
  rw [coeff_mul]
  apply Finset.sum_congr rfl
  intro x hx
  refine mul_eq_zero_of_right (coeff x.fst φ) (coeff_of_lt_order x.snd (lt_of_le_of_lt ?_ h))
  rw [mem_antidiagonal] at hx
  norm_cast
  lia

theorem coeff_mul_one_sub_of_lt_order {R : Type*} [Ring R] {φ ψ : R⟦X⟧} (n : ℕ)
    (h : ↑n < ψ.order) : coeff n (φ * (1 - ψ)) = coeff n φ := by
  simp [coeff_mul_of_lt_order h, mul_sub]

theorem coeff_mul_prod_one_sub_of_lt_order {R ι : Type*} [CommRing R] (k : ℕ) (s : Finset ι)
    (φ : R⟦X⟧) (f : ι → R⟦X⟧) :
    (∀ i ∈ s, ↑k < (f i).order) → coeff k (φ * ∏ i ∈ s, (1 - f i)) = coeff k φ := by
  classical
  induction s using Finset.induction_on with
  | empty => simp
  | insert a s ha ih =>
    intro t
    simp only [Finset.mem_insert, forall_eq_or_imp] at t
    rw [Finset.prod_insert ha, ← mul_assoc, mul_right_comm, coeff_mul_one_sub_of_lt_order _ t.1]
    exact ih t.2

@[simp]
theorem order_neg {R : Type*} [Ring R] (φ : PowerSeries R) : (-φ).order = φ.order := by
  by_contra! h
  have : φ = 0 := by simpa using (order_add_of_order_ne _ _ h).symm
  simp [this] at h

/-- Given a non-zero power series `f`, `divXPowOrder f` is the power series obtained by
dividing out the largest power of X that divides `f`, that is its order -/

def divXPowOrder (f : R⟦X⟧) : R⟦X⟧ :=
  .mk fun n ↦ coeff (n + f.order.toNat) f

@[simp]
lemma coeff_divXPowOrder {f : R⟦X⟧} {n : ℕ} :
    coeff n (divXPowOrder f) = coeff (n + f.order.toNat) f :=
  coeff_mk _ _

@[simp]
lemma divXPowOrder_zero :
    divXPowOrder (0 : R⟦X⟧) = 0 := by
  ext
  simp

lemma constantCoeff_divXPowOrder {f : R⟦X⟧} :
    constantCoeff (divXPowOrder f) = coeff f.order.toNat f := by
  simp [← coeff_zero_eq_constantCoeff]

lemma constantCoeff_divXPowOrder_eq_zero_iff {f : R⟦X⟧} :
    constantCoeff (divXPowOrder f) = 0 ↔ f = 0 := by
  by_cases h : f = 0
  · simp [h]
  · simp [constantCoeff_divXPowOrder, coeff_order h, h]

theorem X_pow_order_mul_divXPowOrder {f : R⟦X⟧} :
    X ^ f.order.toNat * divXPowOrder f = f := by
  ext n
  rw [coeff_X_pow_mul']
  split_ifs with h
  · simp [h]
  · push Not at h
    rw [coeff_of_lt_order_toNat _ h]

theorem X_pow_order_dvd : X ^ φ.order.toNat ∣ φ := by
  simpa only [X_pow_dvd_iff] using coeff_of_lt_order_toNat

theorem order_eq_emultiplicity_X {R : Type*} [Semiring R] (φ : R⟦X⟧) :
    order φ = emultiplicity X φ := by
  classical
  rcases eq_or_ne φ 0 with (rfl | hφ)
  · simp
  cases ho : order φ with
  | top => simp [hφ] at ho
  | coe n =>
    have hn : φ.order.toNat = n := by simp [ho]
    rw [← hn, eq_comm]
    apply le_antisymm _
    · apply le_emultiplicity_of_pow_dvd
      apply X_pow_order_dvd
    · apply Order.le_of_lt_add_one
      rw [← not_le, ← Nat.cast_one, ← Nat.cast_add, ← pow_dvd_iff_le_emultiplicity]
      rintro ⟨ψ, H⟩
      have := congr(coeff n $H)
      rw [X_pow_mul, coeff_mul_of_lt_order, ← hn] at this
      · exact coeff_order hφ this
      · rw [X_pow_eq, order_monomial]
        split_ifs
        · simp
        · rw [← hn, ENat.natCast_lt_natCast]
          simp

end OrderBasic

section OrderZeroNeOne

variable [Semiring R] [Nontrivial R]

/-- The order of the formal power series `1` is `0`. -/
@[simp]
theorem order_one : order (1 : R⟦X⟧) = 0 := by
  simpa using order_monomial_of_ne_zero 0 (1 : R) one_ne_zero

/-- The order of an invertible power series is `0`. -/
theorem order_zero_of_isUnit {f : R⟦X⟧} : IsUnit f → f.order = 0 := by
  rintro ⟨⟨u, v, hu, hv⟩, hf⟩
  apply And.left
  rw [← add_eq_zero, ← hf, ← nonpos_iff_eq_zero, ← @order_one R _ _, ← hu]
  exact order_mul_ge _ _

@[deprecated (since := "2026-08-18")]
alias order_zero_of_unit := order_zero_of_isUnit

/-- The order of the formal power series `X` is `1`. -/
@[simp]
theorem order_X : order (X : R⟦X⟧) = 1 := by
  simpa only [Nat.cast_one] using! order_monomial_of_ne_zero 1 (1 : R) one_ne_zero

/-- The order of the formal power series `X^n` is `n`. -/
@[simp]
theorem order_X_pow (n : ℕ) : order ((X : R⟦X⟧) ^ n) = n := by
  rw [X_pow_eq, order_monomial_of_ne_zero]
  exact one_ne_zero

/-- Dividing `X` by the maximal power of `X` dividing it leaves `1`. -/
@[simp]
theorem divXPowOrder_X :
    divXPowOrder X = (1 : R⟦X⟧) := by
  ext n
  simp [coeff_X]

theorem divXPowOrder_one : divXPowOrder 1 = (1 : R⟦X⟧) := by
  ext k
  simp

end OrderZeroNeOne

section NoZeroDivisors

variable [Semiring R] [NoZeroDivisors R]

/-- The order of the product of two formal power series over an integral domain
is the sum of their orders. -/

theorem order_mul (φ ψ : R⟦X⟧) : order (φ * ψ) = order φ + order ψ := by
  apply le_antisymm _ (le_order_mul _ _)
  by_cases! h : φ = 0 ∨ ψ = 0
  · rcases h with h | h <;> simp [h]
  · rw [← coe_toNat_order h.1, ← coe_toNat_order h.2, ← ENat.natCast_add]
    apply order_le
    rw [coeff_mul, Finset.sum_eq_single_of_mem ⟨φ.order.toNat, ψ.order.toNat⟩ (by simp)]
    · exact mul_ne_zero (coeff_order h.1) (coeff_order h.2)
    · intro ij hij h
      rcases trichotomy_of_add_eq_add (mem_antidiagonal.mp hij) with h' | h' | h'
      · exact False.elim (h (by simp [Prod.ext_iff, h'.1, h'.2]))
      · rw [coeff_of_lt_order_toNat ij.1 h', zero_mul]
      · rw [coeff_of_lt_order_toNat ij.2 h', mul_zero]

/-- The operation of dividing a power series by the largest possible power of `X`
preserves multiplication. -/

theorem divXPowOrder_mul {f g : R⟦X⟧} :
    divXPowOrder (f * g) = divXPowOrder f * divXPowOrder g := by
  by_cases! h : f = 0 ∨ g = 0
  · rcases h with (h | h) <;> simp [h]
  apply X_pow_mul_cancel (k := f.order.toNat + g.order.toNat)
  calc
    _ = X ^ ((f * g).order.toNat) * (f * g).divXPowOrder := by
        rw [order_mul, ENat.toNat_add (order_eq_top.not.mpr h.1) (order_eq_top.not.mpr h.2)]
    _ = f * g := by
        simp [X_pow_order_mul_divXPowOrder]
    _ = (X ^ f.order.toNat * f.divXPowOrder) * (X ^ g.order.toNat * g.divXPowOrder) := by
        simp [X_pow_order_mul_divXPowOrder]
    _ = f.divXPowOrder * g.divXPowOrder * X ^ (g.order.toNat + f.order.toNat) := by
        rw [mul_assoc, X_pow_mul, X_pow_mul, ← mul_assoc, mul_assoc, ← pow_add]
    _ = X ^ (f.order.toNat + g.order.toNat) * (f.divXPowOrder * g.divXPowOrder) := by
        rw [X_pow_mul, add_comm]

variable [Nontrivial R]

/-- `PowerSeries.order` as a `MonoidHom`. -/
def orderHom : R⟦X⟧ →* Multiplicative ℕ∞ where
  toFun g := .ofAdd g.order
  map_one' := order_one
  map_mul' := order_mul

@[simp, norm_cast]
lemma coe_orderHom : (orderHom : R⟦X⟧ → ℕ∞) = order := rfl

theorem order_pow (φ : R⟦X⟧) (n : ℕ) : order (φ ^ n) = n • order φ :=
  map_pow orderHom φ n

theorem order_prod {R : Type*} [CommSemiring R] [NoZeroDivisors R] [Nontrivial R] {ι : Type*}
    (φ : ι → R⟦X⟧) (s : Finset ι) : (∏ i ∈ s, φ i).order = ∑ i ∈ s, (φ i).order :=
  map_prod orderHom φ s

/-- `PowerSeries.divXPowOrder` as a `MonoidHom`. -/
def divXPowOrderHom : R⟦X⟧ →* R⟦X⟧ where
  toFun g := g.divXPowOrder
  map_one' := divXPowOrder_one
  map_mul' f g := divXPowOrder_mul (f := f) (g := g)

@[simp, norm_cast]
lemma coe_divXPowOrderHom : (divXPowOrderHom : R⟦X⟧ → R⟦X⟧) = divXPowOrder := rfl

theorem divXPowOrder_pow (φ : R⟦X⟧) (n : ℕ) : divXPowOrder (φ ^ n) = (divXPowOrder φ) ^ n :=
  map_pow divXPowOrderHom φ n

theorem divXPowOrder_prod {R : Type*} [CommSemiring R] [NoZeroDivisors R] [Nontrivial R] {ι : Type*}
    (φ : ι → R⟦X⟧) (s : Finset ι) : (∏ i ∈ s, φ i).divXPowOrder = ∏ i ∈ s, (φ i).divXPowOrder :=
  map_prod divXPowOrderHom φ s

end NoZeroDivisors

section Ring

variable [Ring R] (p : PowerSeries R) (T : Subring R) (hp : ∀ n, p.coeff n ∈ T)

@[simp]
theorem order_toSubring : (p.toSubring T hp).order = p.order := by
  apply ENat.eq_of_forall_natCast_le_iff
  simp only [nat_le_order_iff, ← coeff_toSubring p T hp, ZeroMemClass.coe_eq_zero, implies_true]

end Ring

end PowerSeries

end

Messung
CHZG
9210010097

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

*© Formatika GbR, Deutschland







                                                                                                                                                                                                                                                                                                                                                                                                     

 

Neuigkeiten

Aktuelles
Motto des Tages

Open Source Software


Gedichte
Musik
Bilder

Jenseits des Üblichen

Besucherstatistik

Besucherstatistik

Statistik
#Sources=1,188,113
#Domains=863,466