Evaluating a descending computation along a pebbling walk #
A descending computation on the indices 0, …, N - 1 has a source at 0 and, at each positive
index i, a gate gates i reading the values at the d strictly smaller indices
child i 0, …, child i (d - 1). Its dependency graph (Cslib.Pebbling.Descending.graph) is a DAG
of in-degree at most d, and the Boolean test Cslib.Pebbling.Descending.ready decides on
indicator words whether all predecessors of an index carry pebbles. So the word moves
Cslib.Pebbling.wordStep (ready child) s are the moves of the black pebble game on the dependency
graph, and Savitch's recursion decides whether an index is pebblable with s pebbles.
Following a walk of indicator words, an evaluator keeps a table of (index, value) pairs
(Cslib.Pebbling.Descending.tableStep). When a step clears a bit, it drops that index; when a step
sets a bit, it computes the value of that index from the values of its children in the table. As
long as consecutive words are equal or one legal move apart, the table holds exactly the values of
the pebbled indices (Cslib.Pebbling.Descending.Holds), so a walk from the zero word to the word
of the single pebble v ends with the value of v in the table. The table never holds more than
s entries, whatever the walk. This is how the simulation of Hopcroft, Paul and Valiant uses a
pebbling: one stored value per pebble.
Main definitions #
Cslib.Pebbling.Descending.graph: the dependency graph of a descending computation.Cslib.Pebbling.Descending.ready: the readiness test on words.Cslib.Pebbling.Descending.diffIndex: the first position where two words differ.Cslib.Pebbling.Descending.entry: the value of an index computed from the table, reading the stored values of its children withList.lookup.Cslib.Pebbling.Descending.tableStep: one update of the table along a word walk.Cslib.Pebbling.Descending.Holds: the table holds the values of the pebbled indices.
Main results #
Cslib.Pebbling.Descending.wellFounded_graph,Cslib.Pebbling.Descending.ncard_graph_adj_le: the dependency graph is a DAG of in-degree at mostd.Cslib.Pebbling.Descending.ready_indicatorList:readydecides readiness on indicator words.Cslib.Pebbling.Descending.reach_wordStep_ready_iff_blackPebblable: Savitch's recursion decides pebblability of the dependency graph.Cslib.Pebbling.Descending.holds_tableStep,Cslib.Pebbling.Descending.holds_tableStep_of_wordStep: one move, or one step of a word walk, preserves the invariant.Cslib.Pebbling.Descending.lookup_eq_of_tableStep: a walk from the zero word to the word of{v}ends with the value ofvin the table.Cslib.Pebbling.Descending.length_tableStep_le: the table never exceedssentries.
References #
- J. Hopcroft, W. Paul, L. Valiant, On time versus space: simulating a computation by a pebbling of its graph, one stored value per pebble (journal text not inspected).
The dependency graph #
Readiness on words #
Savitch's recursion decides pebblability of the dependency graph.
Differences between words #
The first position where u and v differ, or u.length when there is none.
The invariant #
The table #
The value of index i computed from the table: the source at 0, otherwise the gate of i
on the stored values of its children (default for a child that is not stored).
One update of the table along a walk from u to v, with room for s entries: if v clears
the first bit where the words differ, drop that index; if it sets it and the table has fewer than
s entries, store its value computed from the table. Equal words, and a set bit when the table is
full, leave the table unchanged.
One move preserves the invariant. If the table holds the values of C, and D is C or
one legal move with at most s pebbles away, then after one step from the word of C to the word
of D the table holds the values of D.
One step of a word walk preserves the invariant. Between words of length N that are
equal or one word move apart, a step of the table carries the invariant from the support of u to
the support of v.
The evaluator is correct. Along a walk ws of words of length N from the zero word in
which consecutive words are equal or one word move apart, tables built by tableStep from the
empty table hold the values of the pebbled indices. When the walk reaches the word of {v}, the
table returns the value of v.