Skip to content

Commit ec24b5f

Browse files
committed
chore: use order of power series to prove NoZeroDivisors (#24152)
This is the approach used in the multivariate case, and the current proof is essentially a hand-made version of the order argument. This means moving all the results depending on this in a new file depending on `PowerSeries.Order`, which I call `PowerSeries.NoZeroDivisors` (analogous to the existing `MvPowerSeries.NoZeroDivisors`). Also do a little bit of cleanup in the proof of `order_mul` using the cleanup from #24072. This is a followup to #23993 and #24072.
1 parent 7c17fa6 commit ec24b5f

File tree

6 files changed

+89
-85
lines changed

6 files changed

+89
-85
lines changed

Mathlib.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5222,6 +5222,7 @@ import Mathlib.RingTheory.PowerSeries.Binomial
52225222
import Mathlib.RingTheory.PowerSeries.Derivative
52235223
import Mathlib.RingTheory.PowerSeries.Evaluation
52245224
import Mathlib.RingTheory.PowerSeries.Inverse
5225+
import Mathlib.RingTheory.PowerSeries.NoZeroDivisors
52255226
import Mathlib.RingTheory.PowerSeries.Order
52265227
import Mathlib.RingTheory.PowerSeries.PiTopology
52275228
import Mathlib.RingTheory.PowerSeries.Trunc

Mathlib/RingTheory/DividedPowers/Basic.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Authors: Antoine Chambert-Loir, María-Inés de Frutos—Fernández
77
import Mathlib.RingTheory.PowerSeries.Basic
88
import Mathlib.Combinatorics.Enumerative.Bell
99
import Mathlib.Data.Nat.Choose.Multinomial
10+
import Mathlib.RingTheory.Ideal.Maps
1011

1112
/-! # Divided powers
1213

Mathlib/RingTheory/PowerSeries/Basic.lean

Lines changed: 1 addition & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ Authors: Johan Commelin, Kenny Lau
66
import Mathlib.Algebra.CharP.Defs
77
import Mathlib.Algebra.Polynomial.AlgebraMap
88
import Mathlib.Algebra.Polynomial.Basic
9-
import Mathlib.RingTheory.Ideal.Maps
109
import Mathlib.RingTheory.MvPowerSeries.Basic
1110
import Mathlib.Tactic.MoveAdd
1211
import Mathlib.Algebra.MvPolynomial.Equiv
12+
import Mathlib.RingTheory.Ideal.Basic
1313

1414
/-!
1515
# Formal power series (in one variable)
@@ -34,10 +34,6 @@ and the fact that power series over a local ring form a local ring;
3434
and application to the fact that power series over an integral domain
3535
form an integral domain.
3636
37-
## Instance
38-
39-
If `R` has `NoZeroDivisors`, then so does `R⟦X⟧`.
40-
4137
## Implementation notes
4238
4339
Because of its definition,
@@ -563,32 +559,6 @@ theorem X_dvd_iff {φ : R⟦X⟧} : (X : R⟦X⟧) ∣ φ ↔ constantCoeff R φ
563559
· intro m hm
564560
rwa [Nat.eq_zero_of_le_zero (Nat.le_of_succ_le_succ hm)]
565561

566-
instance [NoZeroDivisors R] : NoZeroDivisors R⟦X⟧ where
567-
eq_zero_or_eq_zero_of_mul_eq_zero {φ ψ} h := by
568-
classical
569-
rw [or_iff_not_imp_left]
570-
intro H
571-
have ex : ∃ m, coeff R m φ ≠ 0 := by
572-
contrapose! H
573-
exact ext H
574-
let m := Nat.find ex
575-
ext n
576-
rw [(coeff R n).map_zero]
577-
induction' n using Nat.strong_induction_on with n ih
578-
replace h := congr_arg (coeff R (m + n)) h
579-
rw [LinearMap.map_zero, coeff_mul, Finset.sum_eq_single (m, n)] at h
580-
· simp only [mul_eq_zero] at h
581-
exact Or.resolve_left h (Nat.find_spec ex)
582-
· rintro ⟨i, j⟩ hij hne
583-
rw [mem_antidiagonal] at hij
584-
rcases trichotomy_of_add_eq_add hij with h_eq | hi_lt | hj_lt
585-
· apply False.elim (hne ?_)
586-
simpa using h_eq
587-
· suffices coeff R i φ = 0 by rw [this, zero_mul]
588-
by_contra h; exact Nat.find_min ex hi_lt h
589-
· rw [ih j hj_lt, mul_zero]
590-
· simp
591-
592562
end Semiring
593563

594564
section CommSemiring
@@ -764,45 +734,6 @@ theorem evalNegHom_X : evalNegHom (X : A⟦X⟧) = -X :=
764734

765735
end CommRing
766736

767-
section IsDomain
768-
769-
instance [Ring R] [IsDomain R] : IsDomain R⟦X⟧ :=
770-
NoZeroDivisors.to_isDomain _
771-
772-
variable [CommRing R] [IsDomain R]
773-
774-
/-- The ideal spanned by the variable in the power series ring
775-
over an integral domain is a prime ideal. -/
776-
theorem span_X_isPrime : (Ideal.span ({X} : Set R⟦X⟧)).IsPrime := by
777-
suffices Ideal.span ({X} : Set R⟦X⟧) = RingHom.ker (constantCoeff R) by
778-
rw [this]
779-
exact RingHom.ker_isPrime _
780-
apply Ideal.ext
781-
intro φ
782-
rw [RingHom.mem_ker, Ideal.mem_span_singleton, X_dvd_iff]
783-
784-
/-- The variable of the power series ring over an integral domain is prime. -/
785-
theorem X_prime : Prime (X : R⟦X⟧) := by
786-
rw [← Ideal.span_singleton_prime]
787-
· exact span_X_isPrime
788-
· intro h
789-
simpa [map_zero (coeff R 1)] using congr_arg (coeff R 1) h
790-
791-
/-- The variable of the power series ring over an integral domain is irreducible. -/
792-
theorem X_irreducible : Irreducible (X : R⟦X⟧) := X_prime.irreducible
793-
794-
theorem rescale_injective {a : R} (ha : a ≠ 0) : Function.Injective (rescale a) := by
795-
intro p q h
796-
rw [PowerSeries.ext_iff] at *
797-
intro n
798-
specialize h n
799-
rw [coeff_rescale, coeff_rescale, mul_eq_mul_left_iff] at h
800-
apply h.resolve_right
801-
intro h'
802-
exact ha (pow_eq_zero h')
803-
804-
end IsDomain
805-
806737
section Algebra
807738

808739
variable {A B : Type*} [CommSemiring R] [Semiring A] [Algebra R A] [Semiring B] [Algebra R B]

Mathlib/RingTheory/PowerSeries/Inverse.lean

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ Authors: Johan Commelin, Kenny Lau, María Inés de Frutos-Fernández, Filippo A
77
import Mathlib.Algebra.Polynomial.FieldDivision
88
import Mathlib.RingTheory.DiscreteValuationRing.Basic
99
import Mathlib.RingTheory.MvPowerSeries.Inverse
10-
import Mathlib.RingTheory.PowerSeries.Basic
11-
import Mathlib.RingTheory.PowerSeries.Order
10+
import Mathlib.RingTheory.PowerSeries.NoZeroDivisors
1211
import Mathlib.RingTheory.LocalRing.ResidueField.Defs
1312
import Mathlib.RingTheory.UniqueFactorizationDomain.Multiplicity
1413
import Mathlib.Data.ENat.Lattice
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/-
2+
Copyright (c) 2019 Johan Commelin. All rights reserved.
3+
Released under Apache 2.0 license as described in the file LICENSE.
4+
Authors: Johan Commelin, Kenny Lau
5+
-/
6+
import Mathlib.RingTheory.PowerSeries.Order
7+
import Mathlib.RingTheory.Ideal.Maps
8+
9+
/-!
10+
# Power series over rings with no zero divisors
11+
12+
This file proves, using the properties of orders of power series,
13+
that `R⟦X⟧` is an integral domain when `R` is.
14+
15+
We then state various results about `R⟦X⟧` with `R` an integral domain.
16+
17+
## Instance
18+
19+
If `R` has `NoZeroDivisors`, then so does `R⟦X⟧`.
20+
21+
-/
22+
23+
24+
variable {R : Type*}
25+
26+
namespace PowerSeries
27+
28+
section NoZeroDivisors
29+
30+
variable [Semiring R]
31+
32+
instance [NoZeroDivisors R] : NoZeroDivisors R⟦X⟧ where
33+
eq_zero_or_eq_zero_of_mul_eq_zero {φ ψ} h := by
34+
simp_rw [← order_eq_top, order_mul] at h ⊢
35+
exact WithTop.add_eq_top.mp h
36+
37+
end NoZeroDivisors
38+
39+
section IsDomain
40+
41+
instance [Ring R] [IsDomain R] : IsDomain R⟦X⟧ :=
42+
NoZeroDivisors.to_isDomain _
43+
44+
variable [CommRing R] [IsDomain R]
45+
46+
/-- The ideal spanned by the variable in the power series ring
47+
over an integral domain is a prime ideal. -/
48+
theorem span_X_isPrime : (Ideal.span ({X} : Set R⟦X⟧)).IsPrime := by
49+
suffices Ideal.span ({X} : Set R⟦X⟧) = RingHom.ker (constantCoeff R) by
50+
rw [this]
51+
exact RingHom.ker_isPrime _
52+
apply Ideal.ext
53+
intro φ
54+
rw [RingHom.mem_ker, Ideal.mem_span_singleton, X_dvd_iff]
55+
56+
/-- The variable of the power series ring over an integral domain is prime. -/
57+
theorem X_prime : Prime (X : R⟦X⟧) := by
58+
rw [← Ideal.span_singleton_prime]
59+
· exact span_X_isPrime
60+
· intro h
61+
simpa [map_zero (coeff R 1)] using congr_arg (coeff R 1) h
62+
63+
/-- The variable of the power series ring over an integral domain is irreducible. -/
64+
theorem X_irreducible : Irreducible (X : R⟦X⟧) := X_prime.irreducible
65+
66+
theorem rescale_injective {a : R} (ha : a ≠ 0) : Function.Injective (rescale a) := by
67+
intro p q h
68+
rw [PowerSeries.ext_iff] at *
69+
intro n
70+
specialize h n
71+
rw [coeff_rescale, coeff_rescale, mul_eq_mul_left_iff] at h
72+
apply h.resolve_right
73+
intro h'
74+
exact ha (pow_eq_zero h')
75+
76+
end IsDomain
77+
78+
end PowerSeries

Mathlib/RingTheory/PowerSeries/Order.lean

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -354,24 +354,18 @@ variable [Semiring R] [NoZeroDivisors R]
354354
is the sum of their orders. -/
355355
theorem order_mul (φ ψ : R⟦X⟧) : order (φ * ψ) = order φ + order ψ := by
356356
apply le_antisymm _ (le_order_mul _ _)
357-
by_cases h : φ.order = ∨ ψ.order =
357+
by_cases h : φ = 0 ∨ ψ = 0
358358
· rcases h with h | h <;> simp [h]
359-
· simp only [not_or, ENat.ne_top_iff_exists] at h
360-
obtain ⟨m, hm⟩ := h.1
361-
obtain ⟨n, hn⟩ := h.2
362-
rw [← hm, ← hn, ← ENat.coe_add]
363-
rw [eq_comm, order_eq_nat] at hm hn
359+
· push_neg at h
360+
rw [← coe_toNat_order h.1, ← coe_toNat_order h.2, ← ENat.coe_add]
364361
apply order_le
365-
rw [coeff_mul, Finset.sum_eq_single ⟨m, n⟩]
366-
· exact mul_ne_zero_iff.mpr ⟨hm.1, hn.1
362+
rw [coeff_mul, Finset.sum_eq_single_of_mem ⟨φ.order.toNat, ψ.order.toNat⟩ (by simp)]
363+
· exact mul_ne_zero (coeff_order h.1) (coeff_order h.2)
367364
· intro ij hij h
368365
rcases trichotomy_of_add_eq_add (mem_antidiagonal.mp hij) with h' | h' | h'
369366
· exact False.elim (h (by simp [Prod.ext_iff, h'.1, h'.2]))
370-
· rw [hm.2 ij.1 h', zero_mul]
371-
· rw [hn.2 ij.2 h', mul_zero]
372-
· intro h
373-
apply False.elim (h _)
374-
simp [mem_antidiagonal]
367+
· rw [coeff_of_lt_order_toNat ij.1 h', zero_mul]
368+
· rw [coeff_of_lt_order_toNat ij.2 h', mul_zero]
375369

376370
theorem order_pow [Nontrivial R] (φ : R⟦X⟧) (n : ℕ) :
377371
order (φ ^ n) = n • order φ := by

0 commit comments

Comments
 (0)