Native executions and semantic implementations #
A backend chooses concrete states and native execution evidence. Implementations assert existence of executions and angelic step correctness of every supplied terminating execution, independently of cost:
total: every represented state and admissible operation admits a native execution;correct: every native execution from a represented state on an admissible operation realizes some permitted abstract post-states'withD.step s o s' a ∧ rep s' c'.
For deterministic specifications ([D.HasStepFn f]), StateTransitionImpl.ofFn constructs a
StateTransitionImpl from a functional step-correctness proof
(a = (D.stepFn s o).2 ∧ rep (D.stepFn s o).1 c'), and StateTransitionImpl.exists_executes and
StateTransitionImpl.correct_client recover the functional runClient characterizations directly.
Main definitions #
Execution: one native operation with typed answer and execution evidence.Executes: sequential adaptive execution, retaining native evidence in order.StateTransitionImpl: angelic representation simulation and existence without resource assumptions.StateTransitionImpl.ofFn: constructor for deterministic specifications ([D.HasStepFn f]).
Main results #
StateTransitionImpl.correct_demonic,StateTransitionImpl.exists_demonic: soundness and existence of native client executions underD.DemonicValid.StateTransitionImpl.exists_executes,StateTransitionImpl.correct_client: deterministic specializations for[D.HasStepFn f].executes_bind_iff: sequential execution splits exactly at the intermediate state.
References #
A backend chooses its own execution evidence, independently of a resource measure.
Instances For
Clients collect native execution evidence in call order; no costs occur in this semantics.
- pure {S : PFunctor.{v, w}} {C τ : Type x} {α : Type y} {exec : Execution S C τ} (a : α) (c : C) : Executes exec (PFunctor.FreeM.pure a) c a c []
- call {S : PFunctor.{v, w}} {C τ : Type x} {α : Type y} {exec : Execution S C τ} {o : S.A} {k : S.B o → S.FreeM α} {c : C} {a : S.B o} {c' : C} {trace : τ} {b : α} {c'' : C} {traces : List τ} : exec c o a c' trace → Executes exec (k a) c' b c'' traces → Executes exec (PFunctor.FreeM.liftBind o k) c b c'' (trace :: traces)
Instances For
Angelic semantic implementation of a relational specification D : StateTransitionSpec:
total: every represented state and admissible operation admits a native execution;correct: every native execution from a represented state on an admissible operation realizes some permitted abstract post-states'withD.step s o s' a ∧ rep s' c'.
The relation between mathematical states and concrete backend states.
- total {s : D.State} {c : C} (o : D.Op) : self.rep s c → D.valid s o → ∃ (a : D.signature.B o) (c' : C) (trace : τ), exec c o a c' trace
Existence of a native execution for every represented state and admissible operation.
- correct {s : D.State} {c : C} {o : D.Op} {a : D.signature.B o} {c' : C} {trace : τ} : self.rep s c → D.valid s o → exec c o a c' trace → ∃ (s' : D.State), D.step s o s' a ∧ self.rep s' c'
Angelic step correctness: every native execution realizes some permitted abstract step.
Instances For
Construct a StateTransitionImpl for a deterministic specification ([D.HasStepFn f]) from a
functional step-correctness proof.
Instances For
From related states, every native execution of a demonically admissible client realizes a
valid ClientRun ending in a related state.
From related states, every demonically admissible client admits a native execution realizing a
valid ClientRun ending in a related state.
On a deterministic specification ([D.HasStepFn f]), every native step returns
(D.stepFn s o).2 and reaches (D.stepFn s o).1.
From related states, a client whose history is admissible has a native execution that returns the specified result and ends in a state related to the specified final state.
From related states, every native execution of a client whose history is admissible returns the specified result and ends in a state related to the specified final state.
Execution of a sequential composition splits its native trace at the call boundary.