Space bounds at every clock of calls and call loops #
A space bound for a query machine must hold at every physical clock, including the clocks spent
inside a callee, not only at call boundaries. This file proves such bounds once for the two
shapes that machines built from Turing.QueryMachine.withCalls repeat: one state-returning call,
and a counter loop of bounded runs that may stop early. The lemmas are distilled from Christian
Reitwiessner's per-machine proofs of these bounds for block-computation searches, gate vectors,
the packed interpolation loop and the packed tree-evaluation controller.
Main results #
Turing.QueryMachine.withCalls_runFrom_call_encoding_le: every clock of one call is encoded in2 * C + D + 2bits when both boundary callers fitCbits and every callee state fitsDbits.Turing.QueryMachine.exists_runFrom_search_encoding_le: a counter loop of bounded runs, each either advancing the counter or stopping, is one run with the same bound at every clock.Turing.QueryMachine.exists_runFrom_chain_encoding_le: the same for a loop that never stops early.
One state-returning call is encoded in 2 * C + D + 2 bits at every clock from its request
through its return, when the requesting and resumed callers fit C bits and every callee state
up to the callee's first halt fits D bits.
Concatenate two encoded-state bounds at their actual shared run boundary.
A counter loop from lo towards hi is one run whose every clock is encoded in B bits.
Each step from c j is a run encoded in B bits that either advances to c (j + 1), when
hit j = none, or stops at found j a, when hit j = some a. The loop reaches c hi with no
hit in between, or stops at the first hit.
A loop of runs from c j to c (j + 1) for j < n, each encoded in B bits at every
clock, is one run from c 0 to c n encoded in B bits at every clock.