Writing encodings in polynomial time #
A polynomial-time construction that hands its result to a DataEncode consumer,
such as a verifier reading a list of query positions, has to write the
DataEncode.bitstringEncode of that result. This module shows that writing the
encoding of a bit list, and of a number, is polynomial-time.
A bit list is encoded as the encodings of its bits between two brackets, and
writing that is a fold over the list (encodeList_mem_FP). A number is encoded
as its minimal binary expansion Nat.bits, so writing a polynomial-time
number's encoding is writing its expansion (bits_mem_FP) and then encoding
that list (natEncode_mem_FP). No width has to be supplied.
Main results #
encodeList_mem_FP— writing the encoding of a bit list is polynomial-timenatEncode_mem_FP— writing the encoding of a polynomial-time number is polynomial-time
Writing the encoding of a polynomial-time number is polynomial-time. If
n is a polynomial-time number, then z ↦ DataEncode.bitstringEncode (n z) is
in FP: a number is encoded as its minimal binary expansion.