Normalizing the total binary natural-number decoder
DefinitionNormalization of a raw binary natural-number payload#✓fully proved
Cslib.Complexity.FramedCNF.normalizeNat
Canonicalize a raw payload without enumerating its decoded value.
def normalizeNat (bits : List Bool) : List Bool :=
if bits.getLast? = some false then bits ++ [true] else bits
Used by 17
Used byList canonicalizer normalizes a sequence of framed payloads · List canonicalizer normalizes one element · List canonicalizer fails on malformed input · List canonicalizer runs in linear time on decodable input · Payload normalization is polynomial-time · Read phase of the payload normalizer consumes each bit once · Linear step bound for the payload normalizer machine · Re-encoded decoded list of naturals is linear in raw input · Re-encoding decoded payloads normalizes each one · Normalizing framed number payloads at most triples the length · Number normalizer restores its work stacks and prepends its answer · Payload normalization adds at most one bit · Payload normalization fixes canonical encodings · Payload normalization agrees with decode-then-encode · Canonical payloads of a decoded pair are bounded by the raw input · Number-pair projector normalizes both fields of a raw pair frame · Number-pair projector yields both canonical payloads on success
TheoremPayload normalization agrees with decode-then-encode#✓fully proved
Cslib.Complexity.FramedCNF.normalizeNat_eq_encode_decode
Normalization agrees with the existing total decoder on every payload, not just canonical encodings.
theorem normalizeNat_eq_encode_decode (bits : List Bool) :
normalizeNat bits = encodeNat (decodeNat bits)
def normalizeNat (bits : List Bool) : List Bool :=
if bits.getLast? = some false then bits ++ [true] else bits
CSLibExt/Computability/Complexity/FramedCNF/Normalize.lean:27
Uses 1 · Used by 4
Statement usesNormalization of a raw binary natural-number payload
TheoremPayload normalization adds at most one bit#✓fully proved
Cslib.Complexity.FramedCNF.length_normalizeNat_le
Normalization adds at most one bit.
theorem length_normalizeNat_le (bits : List Bool) :
(normalizeNat bits).length ≤ bits.length + 1
def normalizeNat (bits : List Bool) : List Bool :=
if bits.getLast? = some false then bits ++ [true] else bits
CSLibExt/Computability/Complexity/FramedCNF/Normalize.lean:27
Uses 1 · Used by 5
Statement usesNormalization of a raw binary natural-number payload
Used byList canonicalizer normalizes one element · Linear step bound for the payload normalizer machine · Normalizing framed number payloads at most triples the length · Number normalizer restores its work stacks and prepends its answer · Canonical payloads of a decoded pair are bounded by the raw input
TheoremPayload normalization fixes canonical encodings#✓fully proved
Cslib.Complexity.FramedCNF.normalizeNat_encodeNat
Canonical encodings are unchanged.
@[simp] theorem normalizeNat_encodeNat (n : ℕ) :
normalizeNat (encodeNat n) = encodeNat n
def normalizeNat (bits : List Bool) : List Bool :=
if bits.getLast? = some false then bits ++ [true] else bits
CSLibExt/Computability/Complexity/FramedCNF/Normalize.lean:27
Uses 2
4 fully proved
Loading dependency explorer…
The dependency explorer needs JavaScript and its graph data.