Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit bfa7055

Browse files
jcommelinsgouezelmergify[bot]
authored
feat(ring_theory/power_series): several simp lemmas (#1945)
* Small start on generating functions * Playing with Bernoulli * Finished sum_bernoulli * Some updates after PRs * Analogue for mv_power_series * Cleanup after merged PRs * feat(ring_theory/power_series): several simp lemmas * Remove file that shouldn't be there yet * Update src/ring_theory/power_series.lean Co-Authored-By: sgouezel <sebastien.gouezel@univ-rennes1.fr> * Generalise lemma to canonically_ordered_monoid * Update name * Fix build Co-authored-by: sgouezel <sebastien.gouezel@univ-rennes1.fr> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 6264667 commit bfa7055

File tree

4 files changed

+69
-2
lines changed

4 files changed

+69
-2
lines changed

src/data/finsupp.lean

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,7 @@ instance nat_sub : has_sub (α →₀ ℕ) := ⟨zip_with (λ m n, m - n) (nat.s
384384

385385
@[simp] lemma nat_sub_apply {g₁ g₂ : α →₀ ℕ} {a : α} :
386386
(g₁ - g₂) a = g₁ a - g₂ a := rfl
387+
387388
end nat_sub
388389

389390
section add_monoid
@@ -1488,6 +1489,21 @@ lemma le_iff [canonically_ordered_monoid α] (f g : σ →₀ α) :
14881489
⟨λ h s hs, h s,
14891490
λ h s, if H : s ∈ f.support then h s H else (not_mem_support_iff.1 H).symm ▸ zero_le (g s)⟩
14901491

1492+
@[simp] lemma add_eq_zero_iff [canonically_ordered_monoid α] (f g : σ →₀ α) :
1493+
f + g = 0 ↔ f = 0 ∧ g = 0 :=
1494+
begin
1495+
split,
1496+
{ assume h,
1497+
split,
1498+
all_goals
1499+
{ ext s,
1500+
suffices H : f s + g s = 0,
1501+
{ rw add_eq_zero_iff at H, cases H, assumption },
1502+
show (f + g) s = 0,
1503+
rw h, refl } },
1504+
{ rintro ⟨rfl, rfl⟩, simp }
1505+
end
1506+
14911507
attribute [simp] to_multiset_zero to_multiset_add
14921508

14931509
@[simp] lemma to_multiset_to_finsupp (f : σ →₀ ℕ) :

src/data/mv_polynomial.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ begin
346346
delta X monomial at hi', rw mem_support_single at hi', cases hi', subst i',
347347
erw finset.mem_singleton at H, subst m,
348348
rw [mem_support_iff, add_apply, single_apply, if_pos rfl],
349-
intro H, rw [add_eq_zero_iff] at H, exact one_ne_zero H.2 }
349+
intro H, rw [_root_.add_eq_zero_iff] at H, exact one_ne_zero H.2 }
350350
end
351351

352352
end coeff

src/data/polynomial.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2006,7 +2006,7 @@ have hq0 : q ≠ 0, from λ hp0, by simpa [hp0] using hq,
20062006
have nat_degree (1 : polynomial α) = nat_degree (p * q),
20072007
from congr_arg _ hq,
20082008
by rw [nat_degree_one, nat_degree_mul_eq hp0 hq0, eq_comm,
2009-
add_eq_zero_iff, ← with_bot.coe_eq_coe,
2009+
_root_.add_eq_zero_iff, ← with_bot.coe_eq_coe,
20102010
← degree_eq_nat_degree hp0] at this;
20112011
exact this.1
20122012

src/ring_theory/power_series.lean

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,32 @@ lemma coeff_X_pow (m : σ →₀ ℕ) (s : σ) (n : ℕ) :
316316
coeff α m ((X s : mv_power_series σ α)^n) = if m = single s n then 1 else 0 :=
317317
by rw [X_pow_eq s n, coeff_monomial]
318318

319+
@[simp] lemma coeff_mul_C (n : σ →₀ ℕ) (φ : mv_power_series σ α) (a : α) :
320+
coeff α n (φ * (C σ α a)) = (coeff α n φ) * a :=
321+
begin
322+
rw [coeff_mul n φ], rw [finset.sum_eq_single (n,(0 : σ →₀ ℕ))],
323+
{ rw [coeff_C, if_pos rfl] },
324+
{ rintro ⟨i,j⟩ hij hne,
325+
rw finsupp.mem_antidiagonal_support at hij,
326+
by_cases hj : j = 0,
327+
{ subst hj, simp at *, contradiction },
328+
{ rw [coeff_C, if_neg hj, mul_zero] } },
329+
{ intro h, exfalso, apply h,
330+
rw finsupp.mem_antidiagonal_support,
331+
apply add_zero }
332+
end
333+
334+
@[simp] lemma coeff_zero_mul_X (φ : mv_power_series σ α) (s : σ) :
335+
coeff α (0 : σ →₀ ℕ) (φ * X s) = 0 :=
336+
begin
337+
rw [coeff_mul _ φ, finset.sum_eq_zero],
338+
rintro ⟨i,j⟩ hij,
339+
obtain ⟨rfl, rfl⟩ : i = 0 ∧ j = 0,
340+
{ rw finsupp.mem_antidiagonal_support at hij,
341+
simpa using hij },
342+
simp,
343+
end
344+
319345
variables (σ) (α)
320346

321347
/-- The constant coefficient of a formal power series.-/
@@ -896,6 +922,31 @@ begin
896922
exact ⟨finsupp.unique_single f, finsupp.unique_single g⟩ } }
897923
end
898924

925+
@[simp] lemma coeff_mul_C (n : ℕ) (φ : power_series α) (a : α) :
926+
coeff α n (φ * (C α a)) = (coeff α n φ) * a :=
927+
mv_power_series.coeff_mul_C _ φ a
928+
929+
@[simp] lemma coeff_succ_mul_X (n : ℕ) (φ : power_series α) :
930+
coeff α (n+1) (φ * X) = coeff α n φ :=
931+
begin
932+
rw [coeff_mul _ φ, finset.sum_eq_single (n,1)],
933+
{ rw [coeff_X, if_pos rfl, mul_one] },
934+
{ rintro ⟨i,j⟩ hij hne,
935+
by_cases hj : j = 1,
936+
{ subst hj, simp at *, contradiction },
937+
{ simp [coeff_X, hj] } },
938+
{ intro h, exfalso, apply h, simp },
939+
end
940+
941+
@[simp] lemma coeff_zero_mul_X (φ : power_series α) :
942+
coeff α 0 (φ * X) = 0 :=
943+
begin
944+
rw [coeff_mul _ φ, finset.sum_eq_zero],
945+
rintro ⟨i,j⟩ hij,
946+
obtain ⟨rfl, rfl⟩ : i = 0 ∧ j = 0, { simpa using hij },
947+
simp,
948+
end
949+
899950
@[simp] lemma constant_coeff_C (a : α) : constant_coeff α (C α a) = a := rfl
900951
@[simp] lemma constant_coeff_comp_C :
901952
(constant_coeff α).comp (C α) = ring_hom.id α := rfl

0 commit comments

Comments
 (0)