Theorem W, option (A), stage A1: calling a core procedure with a peak budget #
wpB_coreCall is wp_coreCall (WCall.lean) with a peak budget: the call of a compiled core
procedure computes nothing above B when its arguments' peak and the body's Level F peak
(pkF, sim_peak) are at most B. This is where the bounds of stage A2 (on pkF of each core
procedure) enter the machine-only proofs of stage A3.
theorem
OrderMaintenance.Impl.wpB_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)
{B : ℕ}
(hBa : Machine.maxvList m args ≤ B)
(hBb : pkF κ body s (Machine.State.setLocs (fun (x : Machine.Reg) => 0) ps vs) ≤ B)
{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.wpB B (Machine.Stmt.call nm ps (Stm.compile p κ body) rs args ds) Q m
A call of a compiled core procedure, with a peak budget.