Documentation

Complexity.Computability.Ram.Source.Effects

Source executions with preserved shared state or streams #

Stmt.NoSharedWrites excludes stores and stream operations. Expressions may still read memory, so this condition does not assert that returned values are independent of the heap. Calls are admitted provided every function body in the program satisfies the same condition.

Stmt.NoIOWrites instead permits memory stores and preserves only the two streams. A function can therefore return an updated heap without changing its input or output stream.

Induction on the actual finite execution covers recursive and mutually recursive calls without assuming their termination. The resulting local frame combines shared-state preservation with the existing static register-frame theorem. At a function boundary, restoring caller locals then recovers the whole entry state. No instruction count or proposed time budget occurs in these results.

A syntactic sufficient condition for preserving shared memory and both streams. Calls require the separately stated condition on program bodies; read-only expression evaluation is allowed.

Equations
Instances For

    A sufficient condition for retaining both streams while permitting actual heap stores. Calls also require the condition on their program's bodies.

    Equations
    Instances For
      theorem Ram.Source.Exec.streams_eq_of_noIOWrites {w : ℕ} {program : Program} {stmt : Stmt} {s t : State w} (execution : Exec program stmt s t) (programCondition : ∀ (f : Func), f ∈ program → f.body.NoIOWrites) (statementCondition : stmt.NoIOWrites) :

      Actual finite execution of a stream-free statement preserves its input and output, independently of changes to shared memory or local registers.

      theorem Ram.Source.FunctionExec.streams_eq_of_noIOWrites {w : ℕ} {program : Program} {f : Func} {heapLimit depth : ℕ} {args values : List (Word w)} {entry finish : State w} (execution : FunctionExec program heapLimit depth f args entry values finish) (programCondition : ∀ (function : Func), function ∈ program → function.body.NoIOWrites) (bodyCondition : f.body.NoIOWrites) :
      finish.input = entry.input ∧ finish.outputRev = entry.outputRev

      Function return keeps the callee's actual heap while retaining both streams when all executed bodies contain no stream operations.

      theorem Ram.Source.Exec.localFrame_of_noSharedWrites {w : ℕ} {program : Program} {stmt : Stmt} {s t : State w} (execution : Exec program stmt s t) (programCondition : ∀ (f : Func), f ∈ program → f.body.NoSharedWrites) (statementCondition : stmt.NoSharedWrites) :

      A completed statement without shared writes changes only its possible local destinations. Program-wide body conditions include recursive callees.

      theorem Ram.Source.SafeExec.localFrame_of_noSharedWrites {w : ℕ} {program : Program} {stmt : Stmt} {heapLimit depth : ℕ} {s t : State w} (execution : SafeExec program heapLimit depth stmt s t) (programCondition : ∀ (f : Func), f ∈ program → f.body.NoSharedWrites) (statementCondition : stmt.NoSharedWrites) :

      Heap-safe execution inherits the same local frame by erasing its safety premises, without another induction or a callee termination assumption.

      theorem Ram.Source.FunctionExec.finish_eq_of_noSharedWrites {w : ℕ} {program : Program} {f : Func} {heapLimit depth : ℕ} {args values : List (Word w)} {entry finish : State w} (execution : FunctionExec program heapLimit depth f args entry values finish) (programCondition : ∀ (function : Func), function ∈ program → function.body.NoSharedWrites) (bodyCondition : f.body.NoSharedWrites) :
      finish = entry

      The same function invocation restores its entire entry state when its body and every callable body have no shared writes. Result fields remain separately returned by the original execution; the top-level function need not be a table member.