Raw Computable Univariate Polynomials #
Core definitions for array-backed computable univariate polynomials.
A type analogous to Polynomial that supports computable operations. This is defined to be a
wrapper around Array.
For example, the Array #[1,2,3] represents the polynomial 1 + 2x + 3x^2.
Two arrays may represent the same polynomial via zero-padding,
for example #[1,2,3] = #[1,2,3,0,0,0,...].
Instances For
Extract the underlying array of coefficients.
Instances For
The constant polynomial C r.
Instances For
Construct a monomial c * X^n as a CPolynomial.Raw R.
The result is an array with n zeros followed by c.
For example, monomial 2 3 = #[0, 0, 3] represents 3 * X^2.
Note: If c = 0, this returns #[] (the zero polynomial).
Instances For
Return the index of the last non-zero coefficient of a CPolynomial.Raw
Instances For
Remove trailing zeroes from a CPolynomial.Raw.
Requires BEq to check if the coefficients are zero.
Instances For
Return the degree of a CPolynomial.Raw.
Instances For
Natural number degree of a CPolynomial.Raw.
Returns the degree as a natural number. For the zero polynomial, returns 0.
This matches Mathlib's Polynomial.natDegree API.
Instances For
Return the leading coefficient of a CPolynomial.Raw as the last coefficient
of the trimmed array, or 0 if the trimmed array is empty.
Instances For
If all coefficients are zero, lastNonzero is none.
If there is a non-zero coefficient, lastNonzero is some.
lastNonzero returns the largest index with a non-zero coefficient.
The property that an index is the last non-zero coefficient.
Instances For
The last non-zero index is unique.
Characterization of lastNonzero via lastNonzeroProp.
eliminator for p.lastNonzero, e.g. use with the induction tactic as follows:
induction p using lastNonzero_induct with
| case1 p h_none h_all_zero => ...
| case2 p k h_some h_nonzero h_max => ...
eliminator for p.trim; use with the induction tactic as follows:
induction p using induct with
| case1 p h_empty h_all_zero => ...
| case2 p k h_extract h_nonzero h_max => ...
Non-dependent canonicality criterion using getLastD.