Polynomial lengths inside the algebra #
A computation in Cobham's algebra measures sizes by string lengths, so a
polynomial time or space bound has to be available as a string of that
length. smash multiplies lengths and concatenation adds them, so Horner's
scheme builds, for any polynomial with natural coefficients, a member of the
algebra whose output has exactly the polynomial's value as its length.
Main definitions #
Cobham.hornerEval— Horner evaluation of a coefficient listCobham.lenOfCoeffs— the string realizing that value as its lengthCobham.polyLen— the same for aPolynomial ℕ
Main results #
Cobham.lenOfCoeffs_mem,Cobham.polyLen_mem— both are in the algebraCobham.polyLen_length—polyLen q shas length exactlyq.eval |s|
Horner evaluation of a coefficient list, lowest coefficient first.
Equations
- Complexity.Cobham.hornerEval [] x✝ = 0
- Complexity.Cobham.hornerEval (a :: as) x✝ = a + x✝ * Complexity.Cobham.hornerEval as x✝
Instances For
The string whose length is the Horner value of the coefficient list at
|s|: constants contribute blocks of that many bits, and each multiplication
by |s| is one smash.
Equations
- Complexity.Cobham.lenOfCoeffs [] x✝ = []
- Complexity.Cobham.lenOfCoeffs (a :: as) x✝ = List.replicate a false ++ Complexity.smash x✝ (Complexity.Cobham.lenOfCoeffs as x✝)
Instances For
Horner evaluation of a truncated coefficient sequence is the truncated power sum.
The string realizing a polynomial's value as its length.
Equations
- Complexity.Cobham.polyLen q s = Complexity.Cobham.lenOfCoeffs (List.map q.coeff (List.range (q.natDegree + 1))) s
Instances For
The polynomial's value is the string's length.