Writing out an encoded bit list #
DataEncode serializes a list of booleans as a substitution cipher inside one
pair of brackets: false becomes 01 and true becomes 0011. Producing that
is a fold over the list, which recFoldClamp runs in polynomial time.
Since a natural number is encoded as its Nat.bits, this is also the last
step of encoding a number: count the value out in binary, drop the trailing
zeros, and run the cipher.
Main definitions #
Complexity.boolBits— the two-symbol cipher
Main results #
Complexity.bitstringEncode_list— the cipher describes the encodingComplexity.flatBitsFn_mem_FP— running it is polynomial timeComplexity.natEncodeFn_eq— a number's encoding, from its value in unary
The cipher describes the encoding.
Running the cipher #
The fold step on a zero.
Equations
Instances For
The fold step on a one.
Equations
Instances For
The cipher applied to pairSnd z.
Equations
Instances For
The encoding of a bit list, in polynomial time.