Canonical binary count-up loops — comparison internals #
This module proves the exact full-width comparison run used by
TM.binaryForTM. The scanner compares two canonical little-endian natural
numbers without changing their contents, then rewinds both cursors. Under
the loop invariant value ≤ limitValue, the run takes exactly
binaryForCompareTime limitValue steps and branches to the composite
iteration precisely below the limit, or to done precisely at equality.
At equality, the full-width comparison preserves every tape exactly and
reaches the loop's done state in the advertised exact time.
Strictly below the limit, the full-width comparison preserves every tape exactly and reaches the composite iteration start in the advertised time.
A complete canonical comparison has one exact, fully framed endpoint.
The endpoint enters the composite iteration exactly below the limit and is
the final done configuration exactly at equality.