Documentation

CslibFrontier.Computability.PointerMachine.Randomized

Randomized pointer-machine programs #

Scalar instructions can sample from a supplied kernel. Each step uses the program counter in the machine state. Halt and out-of-range labels are absorbing.

Main definitions #

Main results #

def Cslib.PointerMachine.Op.evalRand {M : Model} {L : Layout} (kernel : M.Op → M.Value → M.Value → ProbComp M.Value) (o : Op M L) (x : State M L) :

Interpret scalar operations with a probabilistic kernel and retain all other effects.

def Cslib.PointerMachine.stepRand {M : Model} {L : Layout} (kernel : M.Op → M.Value → M.Value → ProbComp M.Value) (program : List (Instr M L)) (x : State M L) :

Take one randomized step, leaving terminal states unchanged.

def Cslib.PointerMachine.runRand {M : Model} {L : Layout} (kernel : M.Op → M.Value → M.Value → ProbComp M.Value) (program : List (Instr M L)) :
ℕ → State M L → ProbComp (State M L)

Run a flat pointer-machine program for a fixed instruction budget.

theorem Cslib.PointerMachine.runRand_program {M : Model} {L : Layout} (kernel : M.Op → M.Value → M.Value → ProbComp M.Value) {c : Code M L} {x : State M L} {m : ProbComp (State M L × ℕ)} {T : ℕ} (h : Program.ExecRand (Op.evalRand kernel) c x m) (hT : ∀ z ∈ OracleComp.support m, z.2 ≤ T) :
runRand kernel c.program T { pc := 0, ptr := x.ptr, data := x.data, heap := x.heap } = (fun (z : State M L × ℕ) => have __src := z.1; { pc := Program.Code.size c, ptr := __src.ptr, data := __src.data, heap := __src.heap }) <$> m

The assembled randomized program reaches its final halt with the structured output distribution whenever the budget covers each path.