M6: calling a compiled core procedure from wrapper code #
wp_coreCall: if machine state m holds core s in slot p, a call of the compiled body of a
core procedure ends as evalF says: the slot holds the resulting core, the results are copied
back, the cost is the source's plus the call's overhead, and every array outside slot p is
unchanged.
theorem
OrderMaintenance.Impl.wp_coreCall
{p : ℕ}
{κ : Caps}
{s : Model.Core}
{m : Machine.State}
(h : Enc p κ s m)
{nm : String}
{ps rs ds : List Machine.Reg}
{body : Stm}
{args : List Machine.Expr}
{vs : List ℕ}
(hargs : Machine.evalList m args = some vs)
{s' : Model.Core}
{L' : Loc}
{n : ℕ}
(he : evalF κ body s (Machine.State.setLocs (fun (x : Machine.Reg) => 0) ps vs) = Res.ok s' L' n)
{Q : Machine.State → ℕ → Prop}
(hQ :
∀ (m' : Machine.State),
Enc p κ s' m' →
(∀ (b : ℕ), ¬InSlot p b → Machine.Same b m m') →
m'.loc = Machine.State.setLocs m.loc ds (List.map L' rs) → Q m' (1 + Machine.costList args + ds.length + n))
:
Machine.wp (Machine.Stmt.call nm ps (Stm.compile p κ body) rs args ds) Q m
A call of a compiled core procedure.