Documentation

LeanPool.OrderMaintenance.Machine.Alloc

Allocating a list of arrays #

allocAll l allocates the arrays of l in turn, each with the capacity its expression gives. When the expressions read only locals (Expr.noLoad), they evaluate the same throughout, and the result is exact (exec_allocAll): each listed array has its capacity and reads 0, every other array is unchanged, and so are the locals.

theorem OrderMaintenance.Machine.Expr.eval_noLoad {s s' : State} (hl : s'.loc = s.loc) (e : Expr) :
e.noLoad = true → eval s' e = eval s e

Allocate the listed arrays in order, followed by a skip instruction.

Equations
  • One or more equations did not get rendered due to their size.
Instances For

    The static instruction cost of allocating the listed arrays.

    Equations
    Instances For
      theorem OrderMaintenance.Machine.exec_allocAll (l : List (Arr × Expr)) (s : State) :
      (∀ (ae : Arr × Expr), ae ∈ l → ae.snd.noLoad = true ∧ (Expr.eval s ae.snd).isSome = true) → (List.map Prod.fst l).Nodup → (exec (allocAll l) s).status = Status.ok ∧ (exec (allocAll l) s).cost = allocCost l ∧ (exec (allocAll l) s).st.loc = s.loc ∧ (∀ (ae : Arr × Expr), ae ∈ l → (exec (allocAll l) s).st.cap ae.fst = (Expr.eval s ae.snd).getD 0 ∧ ∀ (i : Nat), (exec (allocAll l) s).st.mem ae.fst i = 0) ∧ ∀ (b : Arr), ¬b ∈ List.map Prod.fst l → Same b s (exec (allocAll l) s).st

      Allocating a list of arrays.

      The cost of straight-line code #

      The cost of straight-line code, read off its syntax (none for branches, loops, calls).

      Equations
      Instances For
        theorem OrderMaintenance.Machine.cost_of_ok (c : Stmt) (s : State) (k : Nat) :
        c.slCost = some k → (exec c s).status = Status.ok → (exec c s).cost = k

        Straight-line code that ends normally costs its syntactic cost.

        Storing a list of values into one array #

        Store each (i, e) of l into array a, in turn.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For

          The contents after the stores.

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            theorem OrderMaintenance.Machine.exec_storeAll (a : Arr) (l : List (Nat × Expr)) (s : State) :
            (∀ (ie : Nat × Expr), ie ∈ l → ie.snd.noLoad = true ∧ (Expr.eval s ie.snd).isSome = true ∧ ie.fst < s.cap a) → (exec (storeAll a l) s).status = Status.ok ∧ (exec (storeAll a l) s).st.loc = s.loc ∧ (exec (storeAll a l) s).st.cap = s.cap ∧ (exec (storeAll a l) s).st.mem a = storeFold s (s.mem a) l ∧ ∀ (b : Arr), b ≠ a → (exec (storeAll a l) s).st.mem b = s.mem b

            Storing a list of values into one array.