Documentation

CslibFrontier.Computability.WordRAM.Footprint

Footprints and replay for flat word-RAM runs #

These results concern the actual deterministic step over any basis, including width-reading operations and faults. Each continuing instruction reads at most one cell and writes at most one cell. Replay changes initial memory outside the cells read by a particular run; it preserves the control path, registers and instruction count. No restriction on arithmetic is needed.

Main results #

The cells read by a memory transcript.

def Cslib.WordRAM.probes {B : Basis} {r : ℕ} (p : Program B r) (s : State r) :

A flat instruction's memory transcript, before testing whether the instruction succeeds.

The registers agree and memory agrees outside the specified finite set.

theorem Cslib.WordRAM.Op.eval_replay {B : Basis} {r w : ℕ} {o : Op B r} {x x' y : Data r} {D : Finset ℕ} (h : eval w o x = some x') (ha : Data.AgreeOutside D x y) (hd : Disjoint (Probe.reads (o.probes x)) D) :
∃ (y' : Data r), eval w o y = some y' ∧ Data.AgreeOutside D x' y'

Replaying one successful data instruction needs equality only at its read address.

theorem Cslib.WordRAM.Next.replay {B : Basis} {r w : ℕ} {p : Program B r} {s t s' : State r} {D : Finset ℕ} (h : Next w p s t) (hpc : s.pc = s'.pc) (ha : Data.AgreeOutside D s.data s'.data) (hd : Disjoint (Probe.reads (probes p s)) D) :
∃ (t' : State r), Next w p s' t' ∧ t.pc = t'.pc ∧ Data.AgreeOutside D t.data t'.data

Replaying a continuing flat step preserves its control and register file.

theorem Cslib.WordRAM.Next.modifies {B : Basis} {r w : ℕ} {p : Program B r} {s t : State r} (h : Next w p s t) :

A continuing step changes memory only at its actual store address.

theorem Cslib.WordRAM.Runs.exists_footprints {B : Basis} {r w n : ℕ} {p : Program B r} {s t : State r} (h : Runs w p s t n) :
∃ (R : Finset ℕ) (W : Finset ℕ), R.card ≤ n ∧ W.card ≤ n ∧ Modifies W s.data.mem t.data.mem ∧ ∀ (D : Finset ℕ) (s' : State r), Disjoint R D → s.pc = s'.pc → Data.AgreeOutside D s.data s'.data → ∃ (t' : State r), Runs w p s' t' n ∧ t.pc = t'.pc ∧ Data.AgreeOutside D t.data t'.data

Actual runs have at most one read and one write per continuing instruction. Any initial memory perturbation outside the read footprint replays with identical control and registers.

theorem Cslib.WordRAM.Executes.exists_readFootprint {B : Basis} {r w n v : ℕ} {p : Program B r} {s : State r} (h : Executes w p s v n) :
∃ (R : Finset ℕ), R.card < n ∧ ∀ (D : Finset ℕ) (s' : State r), Disjoint R D → s.pc = s'.pc → Data.AgreeOutside D s.data s'.data → Executes w p s' v n

Every successful halting execution depends on at most n - 1 read cells. The final halt costs one instruction and reads only a register.