The red-blue pebble game: calculations as sequences indexed by ℕ #
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.
HasCompleteCalculation indexes configurations by Fin (t + 1) and charges by Fin t, which
is the right shape for reading and the wrong one for proving. This file supplies:
step_iff, the five moves as a disjunction, and the facts about a single move that the proofs use: a move adds at most one red pebble and at most one blue pebble, never one of each, and the first pebble a non-input receives comes from a computation;Trace, a calculation with configurations and charges indexed byℕ, and the passage to it fromHasCompleteCalculation;Run, a calculation assembled move by move, which is how calculations are built, and the passage from it back toHasCompleteCalculation;- the count behind the trivial I/O bound: every input loaded and every output stored at least
once costs at least
|I| + |O|.
A single move #
The five moves of Step, as a disjunction over the configuration's components.
Whether a move is legal can be decided on a finite graph, which lets concrete calculations be
checked by decide.
Equations
- One or more equations did not get rendered due to their size.
A red pebble that appears in a move comes from a load, charged 1, or from a computation, charged 0; either way the move adds exactly that red pebble.
A move adds at most one red pebble.
A move adds at most one blue pebble.
No move adds both a red pebble and a blue one.
The first pebble a vertex receives, red or blue, comes from computing it.
Calculations indexed by ℕ #
A calculation within a red-pebble budget S, with configurations σ j (j ≤ t) and
charges c i (i < t) indexed by ℕ. Charges past the end are 0, so that partial sums of
charges stop growing at t.
- t : ℕ
The number of moves.
Instances For
Every complete calculation, read as a Trace.
If a vertex holds a red pebble at time j but not at time 0, some move before j gave
it one.
If a vertex holds a blue pebble at time j but not at time 0, some move before j gave
it one.
A non-input that holds a pebble at time j ≤ t, in a calculation that starts from the
inputs alone, was computed by some move before j: at that move all its predecessors were red
and it was not.
The trivial I/O bound. If every input is red at some point and every output ends blue,
the inputs and outputs being disjoint, the calculation is charged at least |I| + |O|: each input
is loaded, each output stored, and no move does two of these.
Calculations built move by move #
Run E I S s q s': a sequence of moves from s to s', charged q in total, in which every
configuration after the first has at most S red pebbles.
- refl {V : Type u_1} [DecidableEq V] {E : V → V → Prop} {I : Finset V} {S : ℕ} (s : Finset V × Finset V) : Run E I S s 0 s
- cons {V : Type u_1} [DecidableEq V] {E : V → V → Prop} {I : Finset V} {S : ℕ} {s s' s'' : Finset V × Finset V} {c q : ℕ} : Step E I s c s' → s'.1.card ≤ S → Run E I S s' q s'' → Run E I S s (c + q) s''
Instances For
A run from the inputs alone to the outputs alone is a complete calculation.