compute_degree_le a tactic for computing degrees of polynomials #
This file defines the tactic compute_degree_le.
Using compute_degree_le when the goal is of the form f.nat_degree ≤ d, tries to solve the goal.
It may leave side-goals, in case it is not entirely successful.
See the doc-string for more details.
Future work #
- Deal with goals of the form
f.(nat_)degree = d(PR #14040 does exactly this). - Add better functionality to deal with exponents that are not necessarily closed natural numbers.
- Add support for proving goals of the from
f.(nat_)degree ≠ 0. - Make sure that
degreeandnat_degreeare equally supported.
Implementation details #
We start with a goal of the form f.(nat_)degree ≤ d. Recurse into f breaking apart sums,
products and powers. Take care of numerals, C a, X (^ n), monomial a n separately.
compute_degree_le tries to solve a goal of the form f.nat_degree ≤ d or f.degree ≤ d,
where f : R[X] and d : ℕ or d : with_bot ℕ.
If the given degree d is smaller than the one that the tactic computes,
then the tactic suggests the degree that it computed.
Examples:
open polynomial
open_locale polynomial
variables {R : Type*} [semiring R] {a b c d e : R}
example {F} [ring F] {a : F} {n : ℕ} (h : n ≤ 10) :
nat_degree (X ^ n + C a * X ^ 10 : F[X]) ≤ 10 :=
by compute_degree_le
example : nat_degree (7 * X : R[X]) ≤ 1 :=
by compute_degree_le
example {p : R[X]} {n : ℕ} {p0 : p.nat_degree = 0} :
(p ^ n).nat_degree ≤ 0 :=
by compute_degree_le
```