Computable Bivariate Polynomials #
This file defines CBivariate R, the computable representation of bivariate polynomials with
coefficients in R. The type is CPolynomial (CPolynomial R), i.e. polynomials in Y with
coefficients that are polynomials in X, matching Mathlib's R[X][Y]
(i.e. Polynomial (Polynomial R)).
The design is intended to be compatible with:
- Mathlib's
Polynomial.Bivariate(seeCompPoly/Bivariate/ToPoly.lean) - ArkLib's
Polynomial.Bivariateinterface (see ArkLib/Data/Polynomial/Bivariate.lean and ArkLib/Data/CodingTheory/PolishchukSpielman/Degrees.lean, BCIKS20.lean, etc.)
Computable bivariate polynomials: F[X][Y] as CPolynomial (CPolynomial R).
Each p : CBivariate R is a polynomial in Y whose coefficients are univariate polynomials
in X. The outer structure is indexed by powers of Y, the inner by powers of X.
Instances For
Extensionality: two bivariate polynomials are equal if their underlying values are.
Coerce to the underlying univariate polynomial (in Y) with polynomial coefficients.
The zero bivariate polynomial is canonical.
Additive structure on CBivariate R
Ring structure on CBivariate R (for ring equiv with Mathlib in ToPoly).
Constant as a bivariate polynomial. Mathlib: Polynomial.Bivariate.CC.
Instances For
The variable X (inner variable). As bivariate: polynomial in Y with single coeff X at Y^0.
Instances For
The variable Y (outer variable). Monomial Y^1 with coefficient 1.
Instances For
Monomial c * X^n * Y^m. ArkLib: Polynomial.Bivariate.monomialXY.
Instances For
Coefficient of X^i Y^j in the bivariate polynomial. Here i is the X-exponent (inner)
and j is the Y-exponent (outer). ArkLib: Polynomial.Bivariate.coeff f i j.
Instances For
The Y-support: indices j such that the coefficient of Y^j is nonzero.
Instances For
The X-support: indices i such that the coefficient of X^i is nonzero (i.e. some monomial X^i Y^j has nonzero coefficient).
Instances For
The Y-degree (degree when viewed as a polynomial in Y).
ArkLib: Polynomial.Bivariate.natDegreeY.
Instances For
The X-degree: maximum over all Y-coefficients of their degree in X.
ArkLib: Polynomial.Bivariate.natDegreeX.
Instances For
Total degree: max over monomials of (deg_X + deg_Y).
ArkLib: Polynomial.Bivariate.totalDegree.
Instances For
The (u, v)-weighted degree: max over monomials of u * deg_X + v * deg_Y.
Instances For
Evaluate in the first variable (X) at a, yielding a univariate polynomial in Y.
ArkLib: Polynomial.Bivariate.evalX.
Instances For
Evaluate in the second variable (Y) at a, yielding a univariate polynomial in X.
ArkLib: Polynomial.Bivariate.evalY.
Folds the Y-coefficients of f with a raw Horner pattern (smulRight a then
addRaw), trimming once at the end. This avoids paying one CPolynomial.mul
and one CPolynomial.add trim per Y-coefficient.
Instances For
Evaluate in the second variable (Y) at a using Horner's method,
yielding a univariate polynomial in X.
Instances For
Full evaluation at (x, y): p(x, y). Inner variable X at x, outer variable Y at y.
Equivalently (evalY y f).eval x. Mathlib: Polynomial.evalEval.
See CBivariate.eval_y_horner_eq_eval_y in CompPoly/Bivariate/ToPoly.lean for
agreement between evalY and evalYHorner.
Instances For
Full evaluation at (x, y) using Horner in Y, then Horner in X on the
intermediate univariate polynomial.
Instances For
Full evaluation at (x, y) by evaluating each X-coefficient polynomial at
x, then Horner-evaluating the resulting scalar polynomial in Y.
Instances For
Swap the roles of X and Y.
ArkLib/Mathlib: Polynomial.Bivariate.swap.
TODO a more efficient implementation
Instances For
Leading coefficient when viewed as a polynomial in Y.
ArkLib: Polynomial.Bivariate.leadingCoeffY.
Instances For
Leading coefficient when viewed as a polynomial in X. The coefficient of X^(degreeX f): a polynomial in Y.
Instances For
CBivariate.coeff as two composed CPolynomial.coeff.
Bivariate coefficients are additive.
Bivariate coefficients distribute over finite sums.
Coefficient of a bivariate monomial c * X^a * Y^b.
Coefficient of Y^m * c(X) as a bivariate polynomial.
The total degree is the (1, 1)-weighted degree.
The X-degree is the (1, 0)-weighted degree.
The Y-degree is the (0, 1)-weighted degree.
The weighted degree of a nonzero monomial c * X^n * Y^m
is u * n + v * m where u is the weight of X and v the weight of Y.
The weighted degree of the zero polynomial is zero.
The weighted degree is at most d iff every Y-support index
satisfies the weighted bound.
The weighted degree is at most d iff every monomial index
satisfies the weighted bound.
The natWeightedDegree of a constant bivariate polynomial CBivariate.CC is zero.
The weighted degree of a sum is at most the max of the weighted degrees.