Documentation

CslibFrontier.Computability.Machines.Turing.MultiTape.Complexity.PolyTime.Nat.ListProd

Products of lists of binary naturals #

The product of a framed list of binary naturals is computable in binary in polynomial time, by a left fold of binary multiplications from 1. Multiplying by an element adds at most its binary length to the running product (Nat.size_mul_le), and no element is longer than the encoded list, so each partial product has binary length at most one more than the number of elements times the length of the encoded list. The fold rule Turing.MultiTapeTM.ComputableInPolyTime.foldlWith_of_bounded_growth takes exactly this additive growth bound. This is the product counterpart of Turing.MultiTapeTM.ComputableInPolyTime.binary_sum and the natural-number counterpart of Turing.MultiTapeTM.ComputableInPolyTime.intBin_prod. For a product (l.map H).prod of the binary values of a polynomial-time H, compose with Turing.MultiTapeTM.ComputableInPolyTime.map, as in binary_prod.comp (.map hH); fun_prop finds this composition too.

Main results #

The product of a list of binary naturals, by a left fold of binary multiplications.