Streaming folds over binary indices #
IndexFold.run calls a body at indices 0, …, n - 1, retaining only its binary index and
accumulator. List.range occurs only in the correctness specification. The native certificate
uses the existing binary-counted iterator, not a unary clock or a materialized range.
This is an enumeration building block for the local-assignment and measurement loops of [OAI26c], Lemma 3.2 and Proposition 3.4 (pp. 22–26). It does not yet decode indices into Boolean vectors or mixed-radix tuples. A callback may retain captured inputs in its accumulator; its certificate must cover the full index/accumulator encoding. Arbitrary callbacks need not have small outputs: the reachable-prefix size bound is an explicit hypothesis of the resource bound below. No polynomial-time claim is made for an exponentially long whole loop.
The accumulator agrees with the ordered range fold. The list is specification-only.
The binary index adds only its encoded length to the live accumulator.
A common prefix accumulator bound gives a common full-state bound, without multiplying workspace by the number of visited indices.
The native round is constructed from the existing binary successor and the actual callback certificate. Its input contains both the complete binary index and the complete accumulator.
Instances For
One fixed native machine streams a runtime binary number of indices. Its bound is the
existing iterator's trajectory-max bound; neither a finite state type nor a machine is selected
separately for each runtime n.
Instances For
Independent time/workspace bounds under explicit reachable-prefix callback and accumulator
bounds. The runtime count stays binary. These are charged native O bounds, not exact clocks.
R, Q, and B need not be polynomial; a polynomial live-state invariant can be supplied without
asserting that the entire exponentially long computation is polynomial-time.