Truncating to the length of a leading block — proof internals #
takeLen (pair c y) = y.take |c|: the leading self-delimiting block acts as a
ruler and the verbatim suffix is truncated to its length. Carrying a width
bound as a string rather than as a number is what keeps an iterated FP step
function polynomial-time — each iteration truncates its state to the ruler, so no
intermediate value can grow beyond it.
The transducer takeLenTM has one work tape: scan parses the leading block two
symbols at a time, writing one unary mark per payload bit; rewind returns the
work head to cell one; copy emits one input symbol per remaining mark.
Malformed input halts with empty output, matching unpair? = none.
Main results #
Complexity.takeLen_pair— the defining equation on genuine pairsComplexity.takeLen_mem_FP— the truncation is inFP
The function computed by the scanner #
The remaining output of the truncation scanner when k payload bits of the
leading block have already been counted and w is the unread part of the input:
the suffix truncated to the total ruler length, and nothing at all when the block
framing is broken.
Equations
Instances For
Truncate the verbatim suffix of a pair to the length of its leading block.
Equations
Instances For
A doubled payload bit lengthens the ruler by one.
Control states of takeLenTM.
- skip : TakePhase
Move every head off the left-end marker.
- scanA : TakePhase
Read the first symbol of a doubled payload bit.
- scanB0 : TakePhase
The first symbol of the pair was
0. - scanB1 : TakePhase
The first symbol of the pair was
1. - rew : TakePhase
Rewind the work head to cell one.
- copy : TakePhase
Emit one input symbol per remaining mark.
- done : TakePhase
Halt.
Instances For
Equations
- One or more equations did not get rendered due to their size.
The truncation scanner. Parses the leading self-delimiting block into
|c| unary marks on its work tape, then copies that many input symbols to the
output. Computes takeLen.
Equations
- One or more equations did not get rendered due to their size.