Documentation

Complexity.Computability.WordRAM.Trace

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 #

Main results #

References #

The machine and its exact compilation costs are those of WordRAM.Structured.

An observed memory access, with the value read or written.

  • read (address value : ℕ) : Probe

    Read a word from an address.

  • write (address value : ℕ) : Probe

    Write a word at an address.

Instances For
    def Cslib.WordRAM.instDecidableEqProbe.decEq (x✝ x✝¹ : Probe) :
    Decidable (x✝ = x✝¹)
    Instances For
      @[instance_reducible]
      def Cslib.WordRAM.Op.probes {B : Basis} {r : ℕ} (o : Op B r) (x : Data r) :

      The memory accesses made by a data instruction in its initial state.

      Instances For
        inductive Cslib.WordRAM.TraceExec {B : Basis} {r : ℕ} (w : ℕ) :
        Code B r → Data r → Data r → ℕ → List Probe → Prop

        An exact structured execution decorated with its successful memory probes.

        Instances For
          theorem Cslib.WordRAM.TraceExec.exec {B : Basis} {r w n : ℕ} {c : Code B r} {x y : Data r} {ts : List Probe} (h : TraceExec w c x y n ts) :
          Exec w c x y n

          Erasing probes leaves the original exact instruction-count theorem.

          theorem Cslib.WordRAM.Exec.exists_trace {B : Basis} {r w n : ℕ} {c : Code B r} {x y : Data r} (h : Exec w c x y n) :
          ∃ (ts : List Probe), TraceExec w c x y n ts

          Every successful structured execution admits its exact memory transcript.

          Number of reads in a transcript.

          Instances For

            Number of writes in a transcript.

            Instances For

              Read counts add across consecutive executions.

              Write counts add across consecutive executions.

              Every probe is exactly one read or one write.

              The finite set of cells actually written by a transcript.

              Instances For

                Sequential write footprints combine by union, allowing repeated writes.

                theorem Cslib.WordRAM.Op.eval_modifies {B : Basis} {r w : ℕ} {o : Op B r} {x y : Data r} (h : eval w o x = some y) :

                A successful primitive instruction preserves every cell absent from its write transcript.

                theorem Cslib.WordRAM.TraceExec.modifies {B : Basis} {r w n : ℕ} {c : Code B r} {x y : Data r} {ts : List Probe} (h : TraceExec w c x y n ts) :

                An execution changes memory only at addresses appearing as writes in its transcript.

                theorem Cslib.WordRAM.TraceExec.frame {B : Basis} {r w n : ℕ} {c : Code B r} {x y : Data r} {ts : List Probe} (h : TraceExec w c x y n ts) {P : HeapAssertion} (hP : P.holds x.mem) (hdisj : Disjoint P.footprint (Probe.writes ts)) :

                A concrete execution preserves any assertion disjoint from its write transcript.

                theorem Cslib.WordRAM.TraceExec.length_le {B : Basis} {r w n : ℕ} {c : Code B r} {x y : Data r} {ts : List Probe} (h : TraceExec w c x y n ts) :
                ts.length ≤ n

                No instruction makes more than one memory access.