What the bracket scan computes #
A model of the left-to-right pass over a serialized Data value: a bracket
depth, a count of the top-level children already passed, and the bits collected
while inside the child that was asked for. This file is about the model alone —
that it really does extract the requested child — and says nothing about
computability.
Two facts drive everything. The depth and the count evolve without looking at
the collected bits, and the collected bits only ever grow at the end
(runSpec_append_acc); and a serialized value read at any depth returns to that
depth, having contributed exactly its own serialization when it was the child
being sought (runSpec_toBits).
Main definitions #
Complexity.DataScan.runSpec— the model of the pass
Main results #
Complexity.DataScan.runSpec_toBits— reading one serialized valueComplexity.DataScan.runSpec_flatten— reading a whole run of childrenComplexity.DataScan.runSpec_inner— the pass over a serialized list returns the requested child
One step of the pass: false opens a bracket, true closes one, and the
bit joins the output exactly when the count matches the child sought.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Reading one serialized value. Starting at depth d with c children
already passed, the pass over y.toBits returns to depth d; it counts one
more child exactly when it was at the top level, and it contributes y.toBits
to the output exactly when y is the child sought.
A run of children #
The pass over a serialized list. Reading the bits strictly between the outer brackets returns the requested child's own serialization.