Memory-access traces of word-RAM executions #
The decorated execution relation retains the exact instruction count of Exec while exposing
successful reads and writes, including their addresses and word values. Branches and loop control
keep their ordinary instruction charges and produce no memory probes. A trace is an observation
of a RAM execution, not the full cell-probe model with arbitrary free computation.
Main definitions #
Probe: a read or write event with address and value.TraceExec: structured execution with its memory-access transcript.Probe.readCount,Probe.writeCount: additive resource interpretations.
Main results #
TraceExec.exec: forgetting the transcript recovers exactExec.Exec.exists_trace: every execution has a transcript.Probe.readCount_append,Probe.writeCount_append: compositional probe accounting.
References #
The machine and its exact compilation costs are those of WordRAM.Structured.
Instances For
An exact structured execution decorated with its successful memory probes.
- op {B : Basis} {r w : ℕ} {o : Op B r} {x y : Data r} : Op.eval w o x = some y → TraceExec w (Code.op o) x y 1 (o.probes x)
A successful data instruction.
- seq {B : Basis} {r w : ℕ} {c₁ c₂ : Code B r} {x y z : Data r} {m n : ℕ} {ts us : List Probe} : TraceExec w c₁ x y m ts → TraceExec w c₂ y z n us → TraceExec w (c₁.seq c₂) x z (m + n) (ts ++ us)
Sequential traces concatenate.
- branch_pos {B : Basis} {r w : ℕ} {c : Cond r} {pos neg : Code B r} {x y : Data r} {n : ℕ} {ts : List Probe} : c.Holds x → TraceExec w pos x y n ts → TraceExec w (Code.branch c pos neg) x y (n + 1) ts
The positive branch pays one control instruction.
- branch_neg {B : Basis} {r w : ℕ} {c : Cond r} {pos neg : Code B r} {x y : Data r} {n : ℕ} {ts : List Probe} : ¬c.Holds x → TraceExec w neg x y n ts → TraceExec w (Code.branch c pos neg) x y (n + 2) ts
The negative branch pays two control instructions.
- loop_exit {B : Basis} {r w : ℕ} {c : Cond r} {body : Code B r} {x : Data r} : ¬c.Holds x → TraceExec w (Code.loop c body) x x 2 []
Loop termination pays two control instructions and has no probes.
- loop_iter {B : Basis} {r w : ℕ} {c : Cond r} {body : Code B r} {x y z : Data r} {m n : ℕ} {ts us : List Probe} : c.Holds x →
TraceExec w body x y m ts →
TraceExec w (Code.loop c body) y z n us → TraceExec w (Code.loop c body) x z (m + n + 2) (ts ++ us)
A loop iteration concatenates its body's trace and the remaining trace.
Instances For
Number of reads in a transcript.
Instances For
Number of writes in a transcript.
Instances For
Write counts add across consecutive executions.
Every probe is exactly one read or one write.
A concrete execution preserves any assertion disjoint from its write transcript.