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

Commit 9051aa7

Browse files
jjaassoonnjcommelin
andcommitted
feat(polynomial): prepare for transcendence of e by adding small lemmas (#4175)
This will be a series of pull request to prepare for the proof of transcendence of e by adding lots of small lemmas. Co-authored-by: Johan Commelin <johan@commelin.net>
1 parent ae72826 commit 9051aa7

File tree

4 files changed

+43
-1
lines changed

4 files changed

+43
-1
lines changed

src/data/polynomial/basic.lean

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,14 @@ by rw [←one_smul R p, ←h, zero_smul]
117117

118118
end semiring
119119

120+
section comm_semiring
121+
variables [comm_semiring R]
122+
123+
instance : comm_semiring (polynomial R) := add_monoid_algebra.comm_semiring
124+
instance : comm_monoid (polynomial R) := comm_semiring.to_comm_monoid (polynomial R)
125+
126+
end comm_semiring
127+
120128
section ring
121129
variables [ring R]
122130

@@ -129,7 +137,6 @@ lemma coeff_sub (p q : polynomial R) (n : ℕ) : coeff (p - q) n = coeff p n - c
129137

130138
end ring
131139

132-
instance [comm_semiring R] : comm_semiring (polynomial R) := add_monoid_algebra.comm_semiring
133140
instance [comm_ring R] : comm_ring (polynomial R) := add_monoid_algebra.comm_ring
134141

135142
section nonzero_semiring

src/data/polynomial/coeff.lean

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ coeff (r • p) n = r * coeff p n := finsupp.smul_apply
4242
lemma mem_support_iff_coeff_ne_zero : n ∈ p.support ↔ p.coeff n ≠ 0 :=
4343
by { rw mem_support_to_fun, refl }
4444

45+
lemma not_mem_support_iff_coeff_zero : n ∉ p.support ↔ p.coeff n = 0 :=
46+
by { rw [mem_support_to_fun, not_not], refl, }
47+
4548
variable (R)
4649
/-- The nth coefficient, as a linear map. -/
4750
def lcoeff (n : ℕ) : polynomial R →ₗ[R] R :=

src/data/polynomial/degree.lean

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,18 @@ else with_bot.coe_le_coe.1 $
4848
(le_nat_degree_of_ne_zero (finsupp.mem_support_iff.1 hn))
4949
(nat.zero_le _))
5050

51+
lemma eq_C_of_nat_degree_eq_zero (hp : p.nat_degree = 0) : p = C (p.coeff 0) :=
52+
begin
53+
ext, induction n with n hn,
54+
{ simp only [polynomial.coeff_C_zero], },
55+
{ have ineq : p.nat_degree < n.succ := hp.symm ▸ n.succ_pos,
56+
have zero1 : p.coeff n.succ = 0 := coeff_eq_zero_of_nat_degree_lt ineq,
57+
have zero2 : (C (p.coeff 0)).nat_degree = 0 := nat_degree_C (p.coeff 0),
58+
have zero3 : (C (p.coeff 0)).coeff n.succ = 0 :=
59+
coeff_eq_zero_of_nat_degree_lt (zero2.symm ▸ n.succ_pos),
60+
rw [zero1, zero3], }
61+
end
62+
5163
lemma degree_map_le [semiring S] (f : R →+* S) :
5264
degree (p.map f) ≤ degree p :=
5365
if h : p.map f = 0 then by simp [h]

src/data/polynomial/derivative.lean

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,26 @@ le_antisymm
212212
exact hp
213213
end
214214

215+
theorem nat_degree_eq_zero_of_derivative_eq_zero [char_zero R] {f : polynomial R} (h : f.derivative = 0) :
216+
f.nat_degree = 0 :=
217+
begin
218+
by_cases hf : f = 0,
219+
{ exact (congr_arg polynomial.nat_degree hf).trans rfl },
220+
{ rw nat_degree_eq_zero_iff_degree_le_zero,
221+
by_contra absurd,
222+
have f_nat_degree_pos : 0 < f.nat_degree,
223+
{ rwa [not_le, ←nat_degree_pos_iff_degree_pos] at absurd },
224+
let m := f.nat_degree - 1,
225+
have hm : m + 1 = f.nat_degree := nat.sub_add_cancel f_nat_degree_pos,
226+
have h2 := coeff_derivative f m,
227+
rw polynomial.ext_iff at h,
228+
rw [h m, coeff_zero, zero_eq_mul] at h2,
229+
cases h2,
230+
{ rw [hm, ←leading_coeff, leading_coeff_eq_zero] at h2,
231+
exact hf h2, },
232+
{ norm_cast at h2 } }
233+
end
234+
215235
end domain
216236

217237
end derivative

0 commit comments

Comments
 (0)