Theorem W, stage B2: a step of the running job keeps the stored-value bound #
The cases of top_step (Top/Step.lean), each with its final state as the cost proof computes
it: a copy step (copyC), a walk step (wiC, then a drain start sdS, or the funding loop), the
step after a drain start, and a step of the funding loop (a sweep dsS, the end of a drain fdS).
The values that need a reachable state:
- the weight
weight + 2of the walk (Sz): the stored weight plus the pending 2 is the true weight (Timing.wts), at most the chunk count; - the weights of a drain start's new nodes (Sz): sums of their children's stored weights, at most
the true weights (
Timing.wts), which add up to the drained node's (Shape.tw_kids); - the two fresh nodes (F): the hypothesis
nodes.size + 2 ≤ 2^K; - the new tag of a sweep (Tag): the tag of a chunk in the state after the step, which the top
invariant of that state bounds (
tag_lt_of_topInv), as a hypothesis on the final state.
The walk #
The walk's weight update (Sz): the stored weight plus the pending 2 is the true weight.
A drain start's new weights (Sz): the children's stored weights are at most their true weights, which add up to the drained node's.
The funding loop #
A step of the funding loop: a sweep (dsS, its tag bounded by the final state's
hypothesis), the end of a drain (fdS), or the end of the loop.
A walk step #
A walk step: the weight update (wiC, Sz), then a drain start (sdS: F, Lab, Sz), or the
funding loop, or the walk moves up.
A step of the running job #
A step of the running job keeps the stored-value bound, given the top invariant before
the step (for the run) and after it (for the new tag of a sweep), room for two fresh nodes, and
the chunk count below 2^K (for the weights).