Little-endian binary predecessor #
This module exposes the canonical semantics and compositional contracts for
TM.binaryPredTM. Natural numbers use little-endian Nat.bits. On positive
input value + 1, borrow propagates through initial zero bits, canonicalizes
the high bit when decrementing a power of two, and rewinds the target tape.
The machine is total on canonical zero and leaves its empty representation
unchanged, but the decrement theorems deliberately require the target to
represent value + 1; they make no underflow claim.
Main results #
BinaryPred.ripple_succ_natBits— pure borrow computes predecessor.TM.binaryPredTM_reachesIn_frame— exact execution with a full tape frame.TM.binaryPredTM_hoareTimeSpace_frame— terminating and all-reachable width-based space contract.TM.binaryPredTM_isTransducer— the output head never moves left.
Exact predecessor time is bounded linearly in the binary width of the
positive input value + 1.
Starting on canonical positive value + 1, binaryPredTM halts after
exactly binaryPredTime value transitions with canonical value. Input,
output, and every unrelated work tape are preserved exactly. The positive
precondition is the explicit no-underflow boundary of this contract.
Time-bounded compositional form of binaryPredTM_reachesIn_frame.
Time-and-space contract for positive canonical predecessor. Every
reachable configuration stays inside the explicit width-based budget
binaryPredSpace initialSpace value; this is independent of the represented
numeric magnitude except through its binary width.
binaryPredTM never moves the output head left, so it is safe in
one-way-output, space-bounded compositions.