Canonical binary count-up loops #
This module exposes an output-safe bounded loop whose counter and preserved
limit use canonical little-endian binary work tapes. Under the certified
invariant counter ≤ limit, every test scans the full limit width, so a
comparison has the value-independent exact time 2 * limit.size + 2. A
nonterminal test runs the supplied body, increments the counter, and returns
to a fresh test; equality halts with both binary tapes rewound.
The generic certificates keep body-specific facts explicit. In particular,
the loop driver does not assume that an arbitrary body preserves its counter,
limit, or tape frames. Clients record those endpoint facts in
BinaryForLoopSpec and the corresponding prefix-space facts in
BinaryForLoopSpaceSpec.
Main results #
binaryForTM_compare_reachesIn_framegives the exact framed comparison.BinaryForLoopSpec.reachesIncomposes a certified loop exactly.BinaryForLoopSpaceSpec.prefix_withinAuxSpacecovers every run prefix.IsTransducer.binaryForTMpreserves one-way output safety.
At equality, one full-width comparison preserves every tape and reaches the final driver configuration in exact time.
Strictly below the limit, one full-width comparison preserves every tape and reaches the composite iteration start in exact time.
A bounded canonical comparison has one exact, fully framed endpoint. It enters the composite iteration exactly below the limit and halts exactly at equality.
A certified count-up loop has its advertised exact remaining run.
Every canonical scanner configuration in a certified range satisfies the declared auxiliary-space budget.
The final configuration of a space-certified loop satisfies its declared auxiliary-space budget.
Every prefix of a certified binary count-up loop respects its declared auxiliary-space budget.
A binary count-up loop preserves the body's one-way-output discipline.