Streaming bounded membership scans #
A branch supplies one choice per vertex in increasing order. A selection supplies only the successive destinations of its walk, with the source implicit. The end of that segment is the stop choice. The replay reads each destination once with a finite read-only edge callback. The branch and its segments are proof-level replay data. The scanner keeps only a vertex cursor, a current walk vertex, a remaining edge budget, a tally and one membership bit.
Main results #
Cslib.DoubleCounting.Scan.runM_eq_some_iff: exact replay success and membership.Cslib.DoubleCounting.Scan.successfulBranches: bijection with passing transcripts for an exact supplied tally.Cslib.DoubleCounting.Scan.prefix_registers_le: bounds on the count and sum after any checked prefix.Cslib.DoubleCounting.Scan.tallyM_clock: a uniform callback clock, including rejecting runs.
To use Cslib.DoubleCounting.Scan.runM, supply skip/select, destination-read, and adjacency
actions alongside the source, target, round index and expected tally. Use none for the walk's
end marker. The scan returns none on rejection and some false for a successful negative
membership test. Callback providers are responsible for the adjacency and choice encodings.
The clock counts callback actions. The prefix bounds describe the abstract registers.
References #
Replay choices, indexed by the vertex being scanned. A selected segment contains the destinations of its edges in order, without the initial source.
Recover the full vertex lists for the transcript contract.
Check one walk by reading its next destination or end marker. The read-only edge callback is invoked once per attempted edge, provided there is still budget.
A verified prefix's accumulated tally and membership bit.
The accumulator before the first vertex has been scanned.
Run the bounded scan using one selection action per vertex and one destination-read action per walk step or stop marker. Adjacency is a read-only callback. Rejection stops the fold.
Extending a verified prefix skips an unselected vertex or adds its checked walk. The update consumes only the remaining budget returned by that walk.
The streaming implementation replayed from typed choices gives the same tally and bit
as tally. The state monad holds the replay cursor, which belongs to the choice provider.
Run the streaming membership scan with the terminal tally check. A successful negative
answer is some false; rejection is none.
The terminal scan checks the required totals after processing all candidates.
The streaming scanner with the canonical choice provider returns a bit exactly when the corresponding transcript passes, and that bit records selection of the target.
A successful scan with exact round totals reports bounded reachability at its target.
At the exact round totals, a unique passing transcript gives a unique successful branch, including when the branch answers false.
In any successfully processed prefix, the count is bounded by the number of processed vertices, and the length sum by that number times the walk budget. The prefix may be followed by invalid guesses.
All branches use at most N * (2 * k + 2) callback actions when each selection,
destination read, or adjacency query advances the clock by at most one. This bound includes
walks that fail an edge test or try to exceed the round budget.
The terminal tally check adds no callback action to tallyM_clock. Both a rejected scan
and a successful false membership answer retain the same callback-action bound.