The red-blue pebble game: the partition a calculation defines #
Support module of MiscMath.Computability.RedBluePebbleGame, where the results are stated and
where the reader should start. Nothing here is a result on its own.
This is the construction behind Hong and Kung's Theorem 3.1, corrected. A calculation charged q
with at most S red pebbles is cut into q / S + 1 windows, move i lying in window
charges i / S, so that each window makes at most S loads and stores. Window m contributes
the part part m: the vertices given a red pebble in the window and not already in an earlier
part, from which a path through such vertices leads to one that is red when the window ends or is
stored during it. These parts form a 2S-partition (exists_isPartition).
The argument follows the source's, with two repairs:
- The case split in the cover argument is on red, not on any pebble. A predecessor of a vertex
computed in window
mis either red when the window starts, and so already in a part, or is given a red pebble during the window. An input holding its initial blue pebble need not be in any earlier part, and the source's case split puts it on the wrong side. - The terminal condition asks for a store during the window, not for a blue pebble still there when it ends. Either works; this one is simpler to use.
It also records the facts about the graph that the argument needs: under IsComputationDAG every
vertex reaches an output (IsComputationDAG.exists_output), and a calculation with no red pebbles
exists only on the empty graph (IsComputationDAG.isEmpty_of_hasCompleteCalculation_zero).
Domination, set by set #
The graphs of the key lemma #
In a finite graph with no cycle, every vertex reaches a vertex with no successor.
Every vertex of a computation DAG reaches an output.
A vertex with a predecessor is not an input.
Calculations, move by move #
The last time before τ a vertex red at τ was given its red pebble: it has stayed red
since.
The last time before τ a vertex blue at τ was given its blue pebble: it has stayed blue
since.
A vertex with no pebble at time a and a pebble at time b was computed in between: at some
move i ∈ [a, b) it was not red and all its predecessors were.
The vertices given a blue pebble by moves j, …, e - 1: those it stores.
Instances For
Windows #
The time at which window m starts: the first time that is the end of the calculation or
lies in window m or a later one.
Instances For
A move before the end lies before the start of window m exactly when its window is earlier.
The parts #
The vertices a window m must account for when it ends: those red then, and those it
stored.
Instances For
The candidates of window m, given the vertices U already placed in earlier parts: those
given a red pebble in the window and not in U.
Instances For
The part of window m, given the vertices U already placed: the candidates from which a path
through candidates leads to a terminal vertex.
Equations
Instances For
The vertices placed in the parts of windows 0, …, m - 1.
Instances For
A candidate with a successor in the part is in the part.
The key claims #
A vertex red when a window ends is in its part or an earlier one.
A vertex stored in a window is in its part or an earlier one.
A non-input in a part has no pebble when its window starts.
A predecessor of a non-input in a part is in that part or an earlier one.
Every vertex is in one of the first charges t / S + 1 parts.
The dominator of a part: the red pebbles when its window starts, and the vertices it loads.
The parts form a 2S-partition.
So on the empty type no move can be made, and a complete calculation costs nothing.
With no red pebbles nothing can be loaded, computed or stored, so a complete calculation exists only on the empty graph.
Hong and Kung's Theorem 3.1, corrected. A complete calculation of a computation DAG with at
most S red pebbles, charged q, comes with a 2S-partition into h parts, q ≤ S h ≤ q + S.