Induction on polynomials #
This file contains lemmas dealing with different flavours of induction on polynomials.
div_X p
returns a polynomial q
such that q * X + C (p.coeff 0) = p
.
It can be used in a semiring where the usual division algorithm is not possible
Equations
- p.div_X = ∑ (n : ℕ) in finset.Ico 0 p.nat_degree, ⇑(polynomial.monomial n) (p.coeff (n + 1))
theorem
polynomial.div_X_mul_X_add
{R : Type u}
[semiring R]
(p : R[X]) :
(p.div_X) * polynomial.X + ⇑polynomial.C (p.coeff 0) = p
@[simp]
noncomputable
def
polynomial.rec_on_horner
{R : Type u}
[semiring R]
{M : R[X] → Sort u_1}
(p : R[X]) :
An induction principle for polynomials, valued in Sort* instead of Prop.
Equations
- p.rec_on_horner = λ (M0 : M 0) (MC : Π (p : R[X]) (a : R), p.coeff 0 = 0 → a ≠ 0 → M p → M (p + ⇑polynomial.C a)) (MX : Π (p : R[X]), p ≠ 0 → M p → M (p * polynomial.X)), dite (p = 0) (λ (hp : p = 0), _.rec_on M0) (λ (hp : ¬p = 0), _.mpr (dite (p.coeff 0 = 0) (λ (hcp0 : p.coeff 0 = 0), _.mpr (_.mpr (_.mpr (MX p.div_X _ (p.div_X.rec_on_horner M0 MC MX))))) (λ (hcp0 : ¬p.coeff 0 = 0), MC ((p.div_X) * polynomial.X) (p.coeff 0) _ hcp0 (dite (p.div_X = 0) (λ (hpX0 : p.div_X = 0), show M ((p.div_X) * polynomial.X), from _.mpr (polynomial.rec_on_horner._main._pack._proof_9.mpr M0)) (λ (hpX0 : ¬p.div_X = 0), MX p.div_X hpX0 (p.div_X.rec_on_horner M0 MC MX))))))
theorem
polynomial.degree_pos_induction_on
{R : Type u}
[semiring R]
{P : R[X] → Prop}
(p : R[X])
(h0 : 0 < p.degree)
(hC : ∀ {a : R}, a ≠ 0 → P ((⇑polynomial.C a) * polynomial.X))
(hX : ∀ {p : R[X]}, 0 < p.degree → P p → P (p * polynomial.X))
(hadd : ∀ {p : R[X]} {a : R}, 0 < p.degree → P p → P (p + ⇑polynomial.C a)) :
P p
A property holds for all polynomials of positive degree
with coefficients in a semiring R
if it holds for
a * X
, witha ∈ R
,p * X
, withp ∈ R[X]
,p + a
, witha ∈ R
,p ∈ R[X]
, with appropriate restrictions on each term.
See nat_degree_ne_zero_induction_on
for a similar statement involving no explicit multiplication.
theorem
polynomial.nat_degree_ne_zero_induction_on
{R : Type u}
[semiring R]
{M : R[X] → Prop}
{f : R[X]}
(f0 : f.nat_degree ≠ 0)
(h_C_add : ∀ {a : R} {p : R[X]}, M p → M (⇑polynomial.C a + p))
(h_add : ∀ {p q : R[X]}, M p → M q → M (p + q))
(h_monomial : ∀ {n : ℕ} {a : R}, a ≠ 0 → n ≠ 0 → M (⇑(polynomial.monomial n) a)) :
M f
A property holds for all polynomials of non-zero nat_degree
with coefficients in a
semiring R
if it holds for
p + a
, witha ∈ R
,p ∈ R[X]
,p + q
, withp, q ∈ R[X]
,- monomials with nonzero coefficient and non-zero exponent,
with appropriate restrictions on each term.
Note that multiplication is "hidden" in the assumption on monomials, so there is no explicit
multiplication in the statement.
See
degree_pos_induction_on
for a similar statement involving more explicit multiplications.