Skip to content

Commit f618ef9

Browse files
committed
feat(Algebra/Polynomial/PartialFractions): generalize to powers (#35000)
Generalize polynomial partial fractions to work with the denominator being a product of powers of coprime monic polynomials.
1 parent 3f1f9b7 commit f618ef9

File tree

1 file changed

+238
-86
lines changed

1 file changed

+238
-86
lines changed
Lines changed: 238 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,70 @@
11
/-
22
Copyright (c) 2023 Sidharth Hariharan. All rights reserved.
33
Released under Apache 2.0 license as described in the file LICENSE.
4-
Authors: Kevin Buzzard, Sidharth Hariharan
4+
Authors: Kevin Buzzard, Sidharth Hariharan, Aaron Liu
55
-/
66
module
77

8+
public import Mathlib.Algebra.Algebra.Basic
89
public import Mathlib.Algebra.Polynomial.Div
9-
public import Mathlib.Logic.Function.Basic
1010
public import Mathlib.RingTheory.Coprime.Lemmas
11-
public import Mathlib.RingTheory.Localization.FractionRing
12-
public import Mathlib.Tactic.FieldSimp
13-
public import Mathlib.Tactic.LinearCombination
1411

1512
/-!
1613
1714
# Partial fractions
1815
16+
For `f, g : R[X]`, if `g` is expressed as a product `g₁ ^ n₁ * g₂ ^ n₂ * ... * gₙ ^ nₙ`,
17+
where the `gᵢ` are monic and pairwise coprime, then there is a quotient `q` and
18+
for each `i` from 1 to n and for each `0 ≤ j < nᵢ` there is a remainder `rᵢⱼ`
19+
with degree less than the degree of `gᵢ`, such that the fraction `f / g`
20+
decomposes as `q + ∑ i j, rᵢⱼ / gᵢ ^ (j + 1)`.
21+
22+
Since polynomials do not have a division, the main theorem
23+
`mul_prod_pow_inverse_eq_quo_add_sum_rem_mul_pow_inverse` is stated in an `R[X]`-algebra `K`
24+
containing inverses `giᵢ` for each polynomial `gᵢ` occuring in the denominator.
25+
26+
1927
These results were formalised by the Xena Project, at the suggestion
2028
of Patrick Massot.
2129
2230
23-
## The main theorem
31+
## Main results
2432
25-
* `div_eq_quo_add_sum_rem_div`: General partial fraction decomposition theorem for polynomials over
26-
an integral domain R :
27-
If f, g₁, g₂, ..., gₙ ∈ R[X] and the gᵢs are all monic and pairwise coprime, then ∃ q, r₁, ..., rₙ
28-
∈ R[X] such that f / g₁g₂...gₙ = q + r₁/g₁ + ... + rₙ/gₙ and for all i, deg(rᵢ) < deg(gᵢ).
33+
* `mul_prod_pow_inverse_eq_quo_add_sum_rem_mul_pow_inverse`: Partial fraction decomposition for
34+
polynomials over a commutative ring `R`, the denomiator is a product of powers of
35+
monic pairwise coprime polynomials. Division is done in an `R[X]`-algebra `K`
36+
containing inverses `gi i` for each `g i` occuring in the denomiator.
37+
* `eq_quo_mul_prod_pow_add_sum_rem_mul_prod_pow`: Partial fraction decomposition for
38+
polynomials over a commutative ring `R`, the denomiator is a product of powers of
39+
monic pairwise coprime polynomials. The denominators are multiplied out on both sides
40+
and formally cancelled.
41+
* `eq_quo_mul_prod_add_sum_rem_mul_prod`: Partial fraction decomposition for
42+
polynomials over a commutative ring `R`, the denomiator is a product of monic
43+
pairwise coprime polynomials. The denominators are multiplied out on both sides
44+
and formally cancelled.
45+
* `div_prod_eq_quo_add_sum_rem_div`: Partial fraction decomposition for polynomials over an
46+
integral domain `R`, the denominator is a product of monic pairwise coprime polynomials.
47+
Division is done in a field `K` containing `R[X]`.
48+
* `div_eq_quo_add_rem_div_add_rem_div`: Partial fraction decomposition for polynomials over an
49+
integral domain `R`, the denominator is a product of two monic coprime polynomials.
50+
Division is done in a field `K` containing `R[X]`.
2951
30-
* The result is formalized here in slightly more generality, using finsets. That is, if ι is an
31-
arbitrary index type, g denotes a map from ι to R[X], and if s is an arbitrary finite subset of ι,
32-
with g i monic for all i ∈ s and for all i,j ∈ s, i ≠ j → g i is coprime to g j, then we have
33-
∃ q ∈ R[X], r : ι → R[X] such that ∀ i ∈ s, deg(r i) < deg(g i) and
34-
f / ∏ g i = q + ∑ (r i) / (g i), where the product and sum are over s.
52+
## Naming
3553
36-
* The proof is done by proving the two-denominator case and then performing finset induction for an
37-
arbitrary (finite) number of denominators.
54+
The lemmas in this file proving existence of partial fraction decomposition all have
55+
conclusions of the form `∃ q r, degree r < degree g ∧ f / g = q + ∑ r / g`.
56+
The names of these lemmas depict only the final equality `f / g = q + ∑ r / g`.
57+
They are named structurally, except the bound variable `q` is called `quo` (for quotient)
58+
and the bound variable `r` is called `rem` (for remainder), since they are the quotient
59+
and remainder of the division `f / g`.
60+
For example, `div_prod_eq_quo_add_sum_rem_div` has the conclusion
61+
```
62+
∃ q r, (∀ i ∈ s, (r i).degree < (g i).degree) ∧
63+
↑f / ∏ i ∈ s, ↑(g i) = ↑q + ∑ i ∈ s, ↑(r i) / ↑(g i)
64+
```
65+
The name of the lemma only shows the final equality, and in order we have
66+
`/` (`div`), `∏` (`prod`), `=` (`eq`), `q` (`quo`),
67+
`+` (`add`), `∑` (`sum`), `r i` (`rem`), `/` (`div`).
3868
3969
## Scope for Expansion
4070
@@ -45,89 +75,211 @@ of Patrick Massot.
4575
public section
4676

4777

48-
variable (R : Type*) [CommRing R] [IsDomain R]
78+
variable {R : Type*} [CommRing R] [Nontrivial R]
4979

50-
open Polynomial
80+
namespace Polynomial
5181

52-
variable (K : Type*) [Field K] [Algebra R[X] K] [IsFractionRing R[X] K]
82+
section Mul
5383

54-
section TwoDenominators
84+
section OneDenominator
5585

56-
open scoped algebraMap
86+
/-- Let `R` be a commutative ring and `f g : R[X]`. Let `n` be a natural number.
87+
Then `f` can be written in the form `g i ^ n * (q + ∑ i : Fin n, r i / g i ^ (i + 1))`, where
88+
`degree (r i) < degree (g i)` and the denominator cancels formally. -/
89+
theorem eq_quo_mul_pow_add_sum_rem_mul_pow (f : R[X]) {g : R[X]} (hg : g.Monic)
90+
(n : ℕ) : ∃ (q : R[X]) (r : Fin n → R[X]), (∀ i, (r i).degree < g.degree) ∧
91+
f = q * g ^ n + ∑ i, r i * g ^ i.1 := by
92+
induction n with
93+
| zero => simp
94+
| succ n ih =>
95+
obtain ⟨q, r, hr, hf⟩ := ih
96+
refine ⟨q /ₘ g, Fin.snoc r (q %ₘ g), fun i => ?_, hf.trans ?_⟩
97+
· cases i using Fin.lastCases with
98+
| cast i => simpa using hr i
99+
| last => simpa using degree_modByMonic_lt q hg
100+
· rw [Fin.sum_univ_castSucc, ← add_rotate', Fin.snoc_last, Fin.val_last,
101+
← add_assoc, pow_succ', ← mul_assoc, ← add_mul, mul_comm (q /ₘ g) g,
102+
modByMonic_add_div q hg]
103+
simp
57104

58-
/-- Let R be an integral domain and f, g₁, g₂ ∈ R[X]. Let g₁ and g₂ be monic and coprime.
59-
Then, ∃ q, r₁, r₂ ∈ R[X] such that f / g₁g₂ = q + r₁/g₁ + r₂/g₂ and deg(r₁) < deg(g₁) and
60-
deg(r₂) < deg(g₂).
61-
-/
62-
theorem div_eq_quo_add_rem_div_add_rem_div (f : R[X]) {g₁ g₂ : R[X]} (hg₁ : g₁.Monic)
63-
(hg₂ : g₂.Monic) (hcoprime : IsCoprime g₁ g₂) :
64-
∃ q r₁ r₂ : R[X],
65-
r₁.degree < g₁.degree ∧
66-
r₂.degree < g₂.degree ∧ (f : K) / (↑g₁ * ↑g₂) = ↑q + ↑r₁ / ↑g₁ + ↑r₂ / ↑g₂ := by
67-
rcases hcoprime with ⟨c, d, hcd⟩
68-
refine
69-
⟨f * d /ₘ g₁ + f * c /ₘ g₂, f * d %ₘ g₁, f * c %ₘ g₂, degree_modByMonic_lt _ hg₁,
70-
degree_modByMonic_lt _ hg₂, ?_⟩
71-
have hg₁' : (↑g₁ : K) ≠ 0 := by
72-
norm_cast
73-
exact hg₁.ne_zero
74-
have hg₂' : (↑g₂ : K) ≠ 0 := by
75-
norm_cast
76-
exact hg₂.ne_zero
77-
have hfc := modByMonic_add_div (f * c) hg₂
78-
have hfd := modByMonic_add_div (f * d) hg₁
79-
field_simp
80-
norm_cast
81-
linear_combination -1 * f * hcd + -1 * g₁ * hfc + -1 * g₂ * hfd
105+
end OneDenominator
82106

83-
end TwoDenominators
107+
section ManyDenominators
108+
109+
/-- Let `R` be a commutative ring and `f : R[X]`. Let `s` be a finite index set.
110+
Let `g i` be a collection of monic and pairwise coprime polynomials indexed by `s`.
111+
Then `f` can be written in the form `(∏ i ∈ s, g i) * (q + ∑ i ∈ s, r i / g i)`, where
112+
`degree (r i) < degree (g i)` and the denominator cancels formally. -/
113+
theorem eq_quo_mul_prod_add_sum_rem_mul_prod {ι : Type*} [DecidableEq ι] {s : Finset ι}
114+
(f : R[X]) {g : ι → R[X]} (hg : ∀ i ∈ s, (g i).Monic)
115+
(hgg : Set.Pairwise s fun i j => IsCoprime (g i) (g j)) :
116+
∃ (q : R[X]) (r : ι → R[X]),
117+
(∀ i ∈ s, (r i).degree < (g i).degree) ∧
118+
f = q * (∏ i ∈ s, g i) + ∑ i ∈ s, r i * ∏ k ∈ s.erase i, g k := by
119+
induction s using Finset.cons_induction with
120+
| empty => simp
121+
| cons i s hi ih =>
122+
rw [Finset.forall_mem_cons] at hg
123+
rw [Finset.coe_cons, Set.pairwise_insert] at hgg
124+
obtain ⟨q, r, -, hf⟩ := ih hg.2 hgg.1
125+
have hjs {j : ι} (hj : j ∈ s) : i ≠ j := fun hij => hi (hij ▸ hj)
126+
have hc (j : ι) : ∃ a b, j ∈ s → a * g i + b * g j = 1 :=
127+
if h : j ∈ s ∧ i ≠ j then
128+
(hgg.2 j h.1 h.2).1.elim fun a h => h.elim fun b h => ⟨a, b, fun _ => h⟩
129+
else
130+
0, 0, fun hj => (h ⟨hj, hjs hj⟩).elim⟩
131+
choose a b hab using hc
132+
refine ⟨(q + ∑ j ∈ s, r j * b j %ₘ g i) /ₘ g i + ∑ j ∈ s, (r j * b j /ₘ g i + r j * a j /ₘ g j),
133+
Function.update (fun j => r j * a j %ₘ g j) i ((q + ∑ j ∈ s, r j * b j %ₘ g i) %ₘ g i),
134+
?_, hf.trans ?_⟩
135+
· rw [Finset.forall_mem_cons, Function.update_self]
136+
refine ⟨degree_modByMonic_lt _ hg.1, fun j hj => ?_⟩
137+
rw [Function.update_of_ne (hjs hj).symm]
138+
exact degree_modByMonic_lt _ (hg.2 j hj)
139+
· rw [Finset.prod_cons, Finset.sum_cons, Function.update_self, Finset.erase_cons, add_mul,
140+
add_add_add_comm, ← mul_assoc, ← add_mul, add_comm (_ * g i), ← mul_comm (g i),
141+
modByMonic_add_div _ hg.1, add_mul, add_assoc, add_right_inj, Finset.sum_mul,
142+
Finset.sum_mul, ← Finset.sum_add_distrib, ← Finset.sum_add_distrib]
143+
refine Finset.sum_congr rfl fun j hj => ?_
144+
rw [Function.update_of_ne (hjs hj).symm, Finset.erase_cons_of_ne _ (hjs hj),
145+
Finset.prod_cons, ← Finset.mul_prod_erase s g hj]
146+
simp_rw [← mul_assoc, ← add_mul]
147+
refine congrArg (· * _) ?_
148+
rw [add_mul, add_mul, ← add_assoc, ← add_assoc, ← add_mul, ← mul_comm (g i),
149+
modByMonic_add_div _ hg.1, add_assoc, mul_right_comm (_ /ₘ g j),
150+
← add_mul, add_comm (_ * g j) (_ %ₘ g j), mul_comm (_ /ₘ g j),
151+
modByMonic_add_div _ (hg.2 j hj), mul_assoc, mul_assoc, ← mul_add,
152+
add_comm, hab j hj, mul_one]
153+
154+
/-- Let `R` be a commutative ring and `f : R[X]`. Let `s` be a finite index set.
155+
Let `g i` be a collection of monic and pairwise coprime polynomials indexed by `s`,
156+
and for each `g i` let `n i` be a natural number. Then `f` can be written in the form
157+
`(∏ i ∈ s, g i ^ n i) * (q + ∑ i ∈ s, ∑ j : Fin (n i), r i j / g i ^ (j + 1))`, where
158+
`degree (r i j) < degree (g i)` and the denominator cancels formally. -/
159+
theorem eq_quo_mul_prod_pow_add_sum_rem_mul_prod_pow {ι : Type*} [DecidableEq ι] {s : Finset ι}
160+
(f : R[X]) {g : ι → R[X]} (hg : ∀ i ∈ s, (g i).Monic)
161+
(hgg : Set.Pairwise s fun i j => IsCoprime (g i) (g j)) (n : ι → ℕ) :
162+
∃ (q : R[X]) (r : (i : ι) → Fin (n i) → R[X]),
163+
(∀ i ∈ s, ∀ j, (r i j).degree < (g i).degree) ∧
164+
f = q * (∏ i ∈ s, g i ^ n i) +
165+
∑ i ∈ s, ∑ j, r i j * g i ^ j.1 * ∏ k ∈ s.erase i, g k ^ n k := by
166+
obtain ⟨q, r, -, hf⟩ := eq_quo_mul_prod_add_sum_rem_mul_prod f
167+
(fun i hi => (hg i hi).pow (n i))
168+
(hgg.mono' fun i j hij => hij.pow)
169+
have hc (i : ι) : ∃ (q' : R[X]) (r' : Fin (n i) → R[X]), i ∈ s →
170+
(∀ j, (r' j).degree < (g i).degree) ∧
171+
r i = q' * g i ^ (n i) + ∑ j, r' j * g i ^ j.1 :=
172+
if hi : i ∈ s then
173+
(eq_quo_mul_pow_add_sum_rem_mul_pow (r i) (hg i hi) (n i)).elim
174+
fun q' h => h.elim fun r' h => ⟨q', r', fun _ => h⟩
175+
else
176+
0, fun _ => 0, hi.elim⟩
177+
choose q' r' hr' hr using hc
178+
refine ⟨q + ∑ i ∈ s, q' i, r', hr', hf.trans ?_⟩
179+
rw [add_mul, add_assoc, add_right_inj, Finset.sum_mul, ← Finset.sum_add_distrib]
180+
refine Finset.sum_congr rfl fun i hi => ?_
181+
rw [← Finset.mul_prod_erase s _ hi, hr i hi, add_mul, Finset.sum_mul, mul_assoc]
182+
183+
end ManyDenominators
184+
185+
end Mul
186+
187+
section Div
188+
variable {K : Type*} [CommRing K] [Algebra R[X] K]
189+
190+
/-- Let `R` be a commutative ring and `f : R[X]`. Let `s` be a finite index set.
191+
Let `g i` be a collection of monic and pairwise coprime polynomials indexed by `s`,
192+
and for each `g i` let `n i` be a natural number.
193+
Let `K` be an algebra over `R[X]` containing inverses `gi i` for each `g i`.
194+
Then a fraction of the form `f * ∏ i ∈ s, gi i ^ n i` can be rewritten as
195+
`q + ∑ i ∈ s, ∑ j : Fin (n i), r i j * gi i ^ (j + 1)`, where
196+
`degree (r i j) < degree (g i)`. -/
197+
theorem mul_prod_pow_inverse_eq_quo_add_sum_rem_mul_pow_inverse {ι : Type*} {s : Finset ι}
198+
(f : R[X]) {g : ι → R[X]} (hg : ∀ i ∈ s, (g i).Monic)
199+
(hgg : Set.Pairwise s fun i j => IsCoprime (g i) (g j))
200+
(n : ι → ℕ) {gi : ι → K} (hgi : ∀ i ∈ s, gi i * algebraMap R[X] K (g i) = 1) :
201+
∃ (q : R[X]) (r : (i : ι) → Fin (n i) → R[X]),
202+
(∀ i ∈ s, ∀ j, (r i j).degree < (g i).degree) ∧
203+
algebraMap R[X] K f * ∏ i ∈ s, gi i ^ n i =
204+
algebraMap R[X] K q + ∑ i ∈ s, ∑ j,
205+
algebraMap R[X] K (r i j) * gi i ^ (j.1 + 1) := by
206+
classical
207+
obtain ⟨q, r, hr, hf⟩ := eq_quo_mul_prod_pow_add_sum_rem_mul_prod_pow f hg hgg n
208+
refine ⟨q, fun i j => r i j.rev, fun i hi j => hr i hi j.rev, ?_⟩
209+
rw [hf, map_add, map_mul, map_prod, add_mul, mul_assoc, ← Finset.prod_mul_distrib]
210+
have hc (x : ι) (hx : x ∈ s) : (algebraMap R[X] K) (g x ^ n x) * gi x ^ n x = 1 := by
211+
rw [map_pow, ← mul_pow, mul_comm, hgi x hx, one_pow]
212+
rw [Finset.prod_congr rfl hc, Finset.prod_const_one,
213+
mul_one, add_right_inj, map_sum, Finset.sum_mul]
214+
refine Finset.sum_congr rfl fun i hi => ?_
215+
rw [map_sum, Finset.sum_mul, ← Equiv.sum_comp Fin.revPerm]
216+
refine Fintype.sum_congr _ _ fun j => ?_
217+
rw [Fin.revPerm_apply, map_mul, map_prod, ← Finset.prod_erase_mul s _ hi,
218+
← mul_rotate', mul_assoc, ← Finset.prod_mul_distrib,
219+
Finset.prod_congr rfl fun x hx => hc x (Finset.mem_of_mem_erase hx),
220+
Finset.prod_const_one, mul_one, map_mul, map_pow, mul_left_comm]
221+
refine congrArg (_ * ·) ?_
222+
rw [← mul_one (gi i ^ (j.1 + 1)), ← @one_pow K _ j.rev, ← hgi i hi,
223+
mul_pow, ← mul_assoc, ← pow_add, Fin.val_rev, Nat.add_sub_cancel' (by lia)]
224+
225+
end Div
226+
227+
section Field
228+
229+
variable (K : Type*) [Field K] [Algebra R[X] K] [FaithfulSMul R[X] K]
84230

85231
section NDenominators
86232

87233
open algebraMap
88234

89-
/-- Let R be an integral domain and f ∈ R[X]. Let s be a finite index set.
90-
Then, a fraction of the form f / ∏ (g i) can be rewritten as q + ∑ (r i) / (g i), where
91-
deg(r i) < deg(g i), provided that the g i are monic and pairwise coprime.
92-
-/
93-
theorem div_eq_quo_add_sum_rem_div (f : R[X]) {ι : Type*} {g : ι → R[X]} {s : Finset ι}
235+
/-- Let `R` be an integral domain and `f : R[X]`. Let `s` be a finite index set.
236+
Then a fraction of the form `f / ∏ i ∈ s, g i` evaluated in a field `K` containing `R[X]`
237+
can be rewritten as `q + ∑ i ∈ s, r i / g i`, where
238+
`degree (r i) < degree (g i)`, provided that the `g i` are monic and pairwise coprime. -/
239+
theorem div_prod_eq_quo_add_sum_rem_div (f : R[X]) {ι : Type*} {g : ι → R[X]} {s : Finset ι}
94240
(hg : ∀ i ∈ s, (g i).Monic) (hcop : Set.Pairwise ↑s fun i j => IsCoprime (g i) (g j)) :
95241
∃ (q : R[X]) (r : ι → R[X]),
96242
(∀ i ∈ s, (r i).degree < (g i).degree) ∧
97243
((↑f : K) / ∏ i ∈ s, ↑(g i)) = ↑q + ∑ i ∈ s, (r i : K) / (g i : K) := by
98-
classical
99-
induction s using Finset.induction_on generalizing f with
100-
| empty =>
101-
refine ⟨f, fun _ : ι => (0 : R[X]), fun i => ?_, by simp⟩
102-
rintro ⟨⟩
103-
| insert a b hab Hind => ?_
104-
obtain ⟨q₀, r₁, r₂, hdeg₁, _, hf : (↑f : K) / _ = _⟩ :=
105-
div_eq_quo_add_rem_div_add_rem_div R K f
106-
(hg a (b.mem_insert_self a) : Monic (g a))
107-
(monic_prod_of_monic _ _ fun i hi => hg i (Finset.mem_insert_of_mem hi) :
108-
Monic (∏ i ∈ b, g i))
109-
(IsCoprime.prod_right fun i hi =>
110-
hcop (Finset.mem_coe.2 (b.mem_insert_self a))
111-
(Finset.mem_coe.2 (Finset.mem_insert_of_mem hi)) (by rintro rfl; exact hab hi))
112-
obtain ⟨q, r, hrdeg, IH⟩ :=
113-
Hind _ (fun i hi => hg i (Finset.mem_insert_of_mem hi))
114-
(Set.Pairwise.mono (Finset.coe_subset.2 fun i hi => Finset.mem_insert_of_mem hi) hcop)
115-
refine ⟨q₀ + q, fun i => if i = a then r₁ else r i, ?_, ?_⟩
116-
· intro i
117-
dsimp only
118-
split_ifs with h1
119-
· cases h1
120-
intro
121-
exact hdeg₁
122-
· intro hi
123-
exact hrdeg i (Finset.mem_of_mem_insert_of_ne hi h1)
124-
norm_cast at hf IH ⊢
125-
rw [Finset.prod_insert hab, hf, IH, Finset.sum_insert hab, if_pos rfl]
126-
trans (↑(q₀ + q : R[X]) : K) + (↑r₁ / ↑(g a) + ∑ i ∈ b, (r i : K) / (g i : K))
127-
· push_cast
128-
ring
129-
congr 2
130-
refine Finset.sum_congr rfl fun x hxb => ?_
131-
grind
244+
have hgi (i : ι) (hi : i ∈ s) : (algebraMap R[X] K (g i))⁻¹ * algebraMap R[X] K (g i) = 1 :=
245+
inv_mul_cancel₀ (by simpa using (hg i hi).ne_zero)
246+
obtain ⟨q, r, hr, hf⟩ := mul_prod_pow_inverse_eq_quo_add_sum_rem_mul_pow_inverse
247+
f hg hcop (fun _ => 1) hgi
248+
refine ⟨q, fun i => r i 0, fun i hi => hr i hi 0, ?_⟩
249+
simp_rw [Fin.sum_univ_one, Fin.val_zero, zero_add, pow_one, Finset.prod_inv_distrib] at hf
250+
simp_rw [Algebra.cast, div_eq_mul_inv]
251+
exact hf
252+
253+
@[deprecated (since := "2026-02-08")]
254+
alias _root_.div_eq_quo_add_sum_rem_div := div_prod_eq_quo_add_sum_rem_div
132255

133256
end NDenominators
257+
258+
section TwoDenominators
259+
260+
open scoped algebraMap
261+
262+
/-- Let `R` be an integral domain and `f, g₁, g₂ : R[X]`. Let `g₁` and `g₂` be monic and coprime.
263+
Then `∃ q, r₁, r₂ : R[X]` such that `f / (g₁ * g₂) = q + r₁ / g₁ + r₂ / g₂` and
264+
`degree rᵢ < degree gᵢ`, where the equality is taken in a field `K` containing `R[X]`. -/
265+
theorem div_eq_quo_add_rem_div_add_rem_div (f : R[X]) {g₁ g₂ : R[X]} (hg₁ : g₁.Monic)
266+
(hg₂ : g₂.Monic) (hcoprime : IsCoprime g₁ g₂) :
267+
∃ q r₁ r₂ : R[X],
268+
r₁.degree < g₁.degree ∧
269+
r₂.degree < g₂.degree ∧ (f : K) / (↑g₁ * ↑g₂) = ↑q + ↑r₁ / ↑g₁ + ↑r₂ / ↑g₂ := by
270+
let g : Bool → R[X] := Bool.rec g₂ g₁
271+
have hg (i : Bool) (_ : i ∈ Finset.univ) : (g i).Monic := Bool.rec hg₂ hg₁ i
272+
have hcoprime : Set.Pairwise (Finset.univ : Finset Bool) fun i j => IsCoprime (g i) (g j) := by
273+
simp [g, Set.pairwise_insert, hcoprime, hcoprime.symm]
274+
obtain ⟨q, r, hr, hf⟩ := div_prod_eq_quo_add_sum_rem_div K f hg hcoprime
275+
refine ⟨q, r true, r false, hr true (Finset.mem_univ true), hr false (Finset.mem_univ false), ?_⟩
276+
simpa [g, add_assoc] using hf
277+
278+
@[deprecated (since := "2026-02-08")]
279+
alias _root_.div_eq_quo_add_rem_div_add_rem_div := div_eq_quo_add_rem_div_add_rem_div
280+
281+
end TwoDenominators
282+
283+
end Field
284+
285+
end Polynomial

0 commit comments

Comments
 (0)