Documentation

LeanPool.OrderMaintenance.Impl.PeakSim

Theorem W, option (A), stage A1: the peak of the compiled code #

sim_peak: if machine state m holds core s with the same locals, and evalF κ c s L ends normally or with a failed guard, then the compiled run of c ends with peak = max m.peak (pkF κ c s L). Together with sim (same outcome, same encoding, same cost), this is the one-time extension of the simulation theorem that approach (i′) of docs/WORD.md needs: every later peak bound for a core procedure is a bound on pkF, a Level F quantity.

Nothing here is used by Theorems A and B; sim is unchanged.

The compiled run ends with peak q, when the source run ends ok or fail.

Equations
Instances For
    theorem OrderMaintenance.Impl.PAgree.addCost {r : Res} {o : Machine.Out} {q : ℕ} (h : PAgree r o q) (c : ℕ) :
    PAgree (Res.addCost c r) { st := o.st, cost := c + o.cost, status := o.status } q
    theorem OrderMaintenance.Impl.PAgree.congr {r : Res} {o : Machine.Out} {q q' : ℕ} (h : PAgree r o q) (e : q = q') :
    PAgree r o q'
    @[simp]

    Loops #

    theorem OrderMaintenance.Impl.sim_peak_runFor {p : ℕ} {κ : Caps} {b : Stm} {x : Machine.Reg} (ih : ∀ (s : Model.Core) (L : Machine.Reg → ℕ) (m : Machine.State), Enc p κ s m → m.loc = L → PAgree (evalF κ b s L) (Machine.exec (Stm.compile p κ b) m) (max m.peak (pkF κ b s L))) (n k : ℕ) (s : Model.Core) (L : Machine.Reg → ℕ) (m : Machine.State) :
    Enc p κ s m → m.loc = L → PAgree (runForF (evalF κ b) x k n s L) (Machine.runFor (Machine.exec (Stm.compile p κ b)) x k n m) (max m.peak (pkFor (evalF κ b) (pkF κ b) x k n s L))
    theorem OrderMaintenance.Impl.Exp.le_pkList {κ : Caps} {s : Model.Core} {L : Loc} {e : Exp} {v : ℕ} {es : List Exp} :
    e ∈ es → ev κ s L e = some v → v ≤ pkList κ s L es

    The statements with their own compiled form #

    theorem OrderMaintenance.Impl.peak_lwr {p : ℕ} {κ : Caps} {s : Model.Core} {L : Loc} {m : Machine.State} (h : Enc p κ s m) (hL : m.loc = L) (k : LK) (b : Bool) (i j e : Exp) :
    PAgree (evalF κ (Stm.lwr k b i j e) s L) (Machine.exec (Stm.compile p κ (Stm.lwr k b i j e)) m) (max m.peak (pkF κ (Stm.lwr k b i j e) s L))
    theorem OrderMaintenance.Impl.peak_lgrow {p : ℕ} {κ : Caps} {s : Model.Core} {L : Loc} {m : Machine.State} (h : Enc p κ s m) (hL : m.loc = L) (k : LK) (i a b : Exp) :
    PAgree (evalF κ (Stm.lgrow k i a b) s L) (Machine.exec (Stm.compile p κ (Stm.lgrow k i a b)) m) (max m.peak (pkF κ (Stm.lgrow k i a b) s L))
    theorem OrderMaintenance.Impl.peak_lshrink {p : ℕ} {κ : Caps} {s : Model.Core} {L : Loc} {m : Machine.State} (h : Enc p κ s m) (hL : m.loc = L) (k : LK) (i : Exp) :
    PAgree (evalF κ (Stm.lshrink k i) s L) (Machine.exec (Stm.compile p κ (Stm.lshrink k i)) m) (max m.peak (pkF κ (Stm.lshrink k i) s L))
    theorem OrderMaintenance.Impl.peak_lclear {p : ℕ} {κ : Caps} {s : Model.Core} {L : Loc} {m : Machine.State} (h : Enc p κ s m) (hL : m.loc = L) (k : LK) (i : Exp) :
    PAgree (evalF κ (Stm.lclear k i) s L) (Machine.exec (Stm.compile p κ (Stm.lclear k i)) m) (max m.peak (pkF κ (Stm.lclear k i) s L))
    theorem OrderMaintenance.Impl.peak_pwr {p : ℕ} {κ : Caps} {s : Model.Core} {L : Loc} {m : Machine.State} (h : Enc p κ s m) (hL : m.loc = L) (c j e : Exp) :
    PAgree (evalF κ (Stm.pwr c j e) s L) (Machine.exec (Stm.compile p κ (Stm.pwr c j e)) m) (max m.peak (pkF κ (Stm.pwr c j e) s L))
    theorem OrderMaintenance.Impl.peak_rowReset {p : ℕ} {κ : Caps} {s : Model.Core} {L : Loc} {m : Machine.State} (_h : Enc p κ s m) (_hL : m.loc = L) (c : Exp) :
    PAgree (evalF κ (Stm.rowReset c) s L) (Machine.exec (Stm.compile p κ (Stm.rowReset c)) m) (max m.peak (pkF κ (Stm.rowReset c) s L))
    theorem OrderMaintenance.Impl.peak_prepInit {p : ℕ} {κ : Caps} {s : Model.Core} {L : Loc} {m : Machine.State} (h : Enc p κ s m) (hL : m.loc = L) (c b : Exp) :
    PAgree (evalF κ (Stm.prepInit c b) s L) (Machine.exec (Stm.compile p κ (Stm.prepInit c b)) m) (max m.peak (pkF κ (Stm.prepInit c b) s L))
    theorem OrderMaintenance.Impl.peak_prepSet {p : ℕ} {κ : Caps} {s : Model.Core} {L : Loc} {m : Machine.State} (h : Enc p κ s m) (hL : m.loc = L) (hh b t : Exp) :
    PAgree (evalF κ (Stm.prepSet hh b t) s L) (Machine.exec (Stm.compile p κ (Stm.prepSet hh b t)) m) (max m.peak (pkF κ (Stm.prepSet hh b t) s L))
    theorem OrderMaintenance.Impl.peak_prepPath {p : ℕ} {κ : Caps} {s : Model.Core} {L : Loc} {m : Machine.State} (h : Enc p κ s m) (hL : m.loc = L) (j e : Exp) :
    PAgree (evalF κ (Stm.prepPath j e) s L) (Machine.exec (Stm.compile p κ (Stm.prepPath j e)) m) (max m.peak (pkF κ (Stm.prepPath j e) s L))
    theorem OrderMaintenance.Impl.peak_prepCommit {p : ℕ} {κ : Caps} {s : Model.Core} {L : Loc} {m : Machine.State} (h : Enc p κ s m) (_hL : m.loc = L) :
    theorem OrderMaintenance.Impl.peak_jobSet {p : ℕ} {κ : Caps} {s : Model.Core} {L : Loc} {m : Machine.State} (h : Enc p κ s m) (hL : m.loc = L) (x y z t a b c d : Exp) :
    PAgree (evalF κ (Stm.jobSet x y z t a b c d) s L) (Machine.exec (Stm.compile p κ (Stm.jobSet x y z t a b c d)) m) (max m.peak (pkF κ (Stm.jobSet x y z t a b c d) s L))
    theorem OrderMaintenance.Impl.peak_jobClear {p : ℕ} {κ : Caps} {s : Model.Core} {L : Loc} {m : Machine.State} (h : Enc p κ s m) (_hL : m.loc = L) :
    theorem OrderMaintenance.Impl.peak_pcSet {p : ℕ} {κ : Caps} {s : Model.Core} {L : Loc} {m : Machine.State} (h : Enc p κ s m) (hL : m.loc = L) (t a b c d : Exp) :
    PAgree (evalF κ (Stm.pcSet t a b c d) s L) (Machine.exec (Stm.compile p κ (Stm.pcSet t a b c d)) m) (max m.peak (pkF κ (Stm.pcSet t a b c d) s L))

    The simulation of the peak #

    theorem OrderMaintenance.Impl.sim_peak {p : ℕ} {κ : Caps} (c : Stm) {s : Model.Core} {L : Loc} {m : Machine.State} :
    Enc p κ s m → m.loc = L → PAgree (evalF κ c s L) (Machine.exec (Stm.compile p κ c) m) (max m.peak (pkF κ c s L))

    The compiled code's peak is pkF: when the source run ends normally or with a failed guard, the compiled run ends with peak = max m.peak (pkF κ c s L).