Sign-pattern counts from integer product queries #
A quadratic polynomial on {-1, 0, 1} gives twice the indicator of a requested sign.
Multiplying these indicators expresses 2 ^ k times a sign-pattern count as an integer
combination of 3 ^ k product-sign queries. No division or selection of matrix rows is needed.
For a polynomial's roots, the queries and counts use roots.toFinset, so each distinct real
root contributes once, independently of its multiplicity. Mathlib assigns the zero polynomial
an empty root multiset. The equivalence with existence of a real root therefore requires a
nonzero polynomial.
This is a counting identity. It does not supply an algorithm for evaluating a sign query or a time or space bound for sign determination.
Main definitions #
Cslib.SignQueries.signCount: the number of points realizing a sign pattern.Cslib.SignQueries.weight: the coefficients of the quadratics giving twice the indicator of a sign.Cslib.SignQueries.patternWeight: the coefficient of an exponent vector in the expanded indicator product.Cslib.SignQueries.queryPolynomial: a product with exponents in{0, 1, 2}.Cslib.SignQueries.signSum: the sum of the signs of a polynomial on a finite set of points.Cslib.SignQueries.tarskiQuery: the sum of signs at distinct real roots.Cslib.SignQueries.scaledRootCount: the integer combination of root sign queries.
Main results #
Cslib.SignQueries.weighted_queries_eq_count: the finite sign-pattern counting identity.Cslib.SignQueries.scaledRootCount_eq: its specialization to distinct real roots.Cslib.SignQueries.scaledRootCount_pos_iff: for a nonzero polynomial, a positive scaled count is equivalent to existence of a root realizing the requested sign pattern.
References #
Adapted from LeanCanny/Algebra/ScaledSignQueries.lean in [lea26].
The coefficient of X ^ e in the quadratic that gives twice the indicator of sign s.
The three quadratics are 2 - 2 * X ^ 2, X ^ 2 - X, and X ^ 2 + X.
Instances For
There are 3 ^ k exponent choices for a family of k polynomials.
The sum of the signs of q on a finite set of real points.
Instances For
The number of points in Z at which every polynomial has its requested sign.
Instances For
The product query polynomial, with each input polynomial raised to 0, 1, or 2.
Instances For
The weighted product-sign queries equal 2 ^ k times the number of matching points.
The Tarski query of q at the distinct real roots of p.
For p = 0, this is zero by Mathlib's root-multiset convention.
Instances For
The weighted sum of product-sign queries for roots realizing a sign pattern.
Instances For
The scaled count is 2 ^ k times the number of distinct matching real roots.
The zero polynomial's scaled count is zero, since its root multiset is empty.
For a nonzero polynomial, a positive count means a real root realizes the sign pattern.
For a nonzero polynomial, the integer combination of sign queries is positive exactly when a real root realizes the requested sign pattern.