Documentation

Complexitylib.Classes.PCP.Internal.NatEncode

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 #

Main results #

The serialization of a single boolean.

Equations
Instances For

    Running the cipher #

    The encoding of a bit list, in polynomial time.

    Equations
    Instances For

      A number's own encoding #

      noncomputable def Complexity.natEncodeFn (z : List Bool) :

      The encoding of a natural number, from a width and a value both given in unary.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For

        It really is the number's encoding, whenever the width holds the value.