Documentation

Complexitylib.Classes.PCP.Internal.StripTrailing

The canonical bits of a number #

DataEncode writes a natural number as Nat.bits, its little-endian bits with no trailing zero. A fixed-width counter, which is what a polynomial-time machine can produce, carries trailing zeros; dropping them is the missing step between the two.

Dropping trailing zeros is a right fold — what to do with a bit depends on whether everything after it vanished — so recFoldClamp expresses it directly, with no reversal.

Main definitions #

Main results #

Dropping trailing zeros gives the canonical bits.

Polynomial time #

The fold step on a one.

Equations
Instances For

    The fold computes stripTrailing, as long as the clamp allows the answer.