Documentation

LeanPool.OrderMaintenance.Impl.ListErase

M6: removing from lists #

def OrderMaintenance.Impl.mvS (k : LK) (dst src : Exp) :

Element src of list k of record i is copied to position dst.

Equations
  • One or more equations did not get rendered due to their size.
Instances For
    theorem OrderMaintenance.Impl.LK.view_put_self {s : Model.Core} {i : ℕ} {l : List (ℕ × ℕ)} {k : LK} (hr : recOk s i k = true) (hv : valid l k = true) :
    view (put s i l k) i k = l
    theorem OrderMaintenance.Impl.valid_getD {k : LK} {B : List (ℕ × ℕ)} (hv : LK.valid B k = true) {m : ℕ} (hm : m < B.length) :
    theorem OrderMaintenance.Impl.valid_snd {k : LK} {a : ℕ × ℕ} (h : LK.valid [a] k = true) (u : ℕ) :
    theorem OrderMaintenance.Impl.mvS_ok {κ : Caps} {k : LK} {s : Model.Core} {L : Loc} {i q q' : ℕ} {B : List (ℕ × ℕ)} {dst src : Exp} (hLi : L "i" = i) (hd : ∀ (S : Model.Core), Exp.ev κ S L dst = some q) (hs : ∀ (S : Model.Core), Exp.ev κ S L src = some q') (hq : q < B.length) (hq' : q' < B.length) (hr : LK.recOk s i k = true) (hir : i < κ.lrec k) (hv : LK.valid B k = true) (hlen : B.length ≤ κ.lcap k) :
    ∃ (c : ℕ), evalF κ (mvS k dst src) (LK.put s i B k) L = Res.ok (LK.put s i (B.set q (B.getD q' (0, 0))) k) L c ∧ c ≤ 2 * (10 + dst.cost + src.cost)

    Removing an element #

    The list after t steps of shifting the tail of l left over position p.

    Equations
    Instances For
      theorem OrderMaintenance.Impl.shiftL_getElem (l : List (ℕ × ℕ)) (p t m : ℕ) (hm : m < (shiftL l p t).length) :
      (shiftL l p t)[m] = if p ≤ m ∧ m < p + t then l.getD (m + 1) (0, 0) else l.getD m (0, 0)
      theorem OrderMaintenance.Impl.shiftL_succ {l : List (ℕ × ℕ)} {p t : ℕ} (h : p + t + 1 < l.length) :
      (shiftL l p t).set (p + t) ((shiftL l p t).getD (p + t + 1) (0, 0)) = shiftL l p (t + 1)
      theorem OrderMaintenance.Impl.shiftL_end {l : List (ℕ × ℕ)} {p : ℕ} (h : p < l.length) :
      (shiftL l p (l.length - 1 - p)).dropLast = l.eraseIdx p
      theorem OrderMaintenance.Impl.valid_shiftL {k : LK} {l : List (ℕ × ℕ)} (hv : LK.valid l k = true) (p t : ℕ) :
      LK.valid (shiftL l p t) k = true

      Procedure removing the list entry at a specified index.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        theorem OrderMaintenance.Impl.eraseIdxP_agree (κ : Caps) (k : LK) (s : Model.Core) (L : Loc) {i p : ℕ} (hi : L "i" = i) (hp : L "p" = p) (hpl : p < (LK.view s i k).length) (hid : LK.idOk s i k) (hr : LK.recOk s i k = true) (hir : i < κ.lrec k) (hcap : (LK.view s i k).length ≤ κ.lcap k) :
        ∃ (L' : Loc) (c : ℕ), evalF κ (eraseIdxP k).body s L = Res.ok (LK.put s i ((LK.view s i k).eraseIdx p) k) L' c ∧ c ≤ 100 + 70 * (LK.view s i k).length

        eraseIdxP computes eraseIdx.

        Filtering by key #

        @[reducible, inline]

        The kept prefix after j elements.

        Equations
        Instances For
          theorem OrderMaintenance.Impl.keepF_succ {l : List (ℕ × ℕ)} {x j : ℕ} (hj : j < l.length) :
          keepF l x (j + 1) = keepF l x j ++ if (l[j].1 != x) = true then [l[j] ] else []
          theorem OrderMaintenance.Impl.getElem_append_drop {A l : List (ℕ × ℕ)} {j : ℕ} (hA : A.length ≤ j) (hj : j < l.length) (h : j < (A ++ List.drop A.length l).length) :
          (A ++ List.drop A.length l)[j] = l[j]
          theorem OrderMaintenance.Impl.getD_append_drop {A l : List (ℕ × ℕ)} {j : ℕ} (hA : A.length ≤ j) (hj : j < l.length) :
          (A ++ List.drop A.length l).getD j (0, 0) = l[j]
          theorem OrderMaintenance.Impl.valid_append_drop {k : LK} {l A : List (ℕ × ℕ)} (hv : LK.valid l k = true) (hA : LK.valid A k = true) (w : ℕ) :
          theorem OrderMaintenance.Impl.valid_keepF {k : LK} {l : List (ℕ × ℕ)} (hv : LK.valid l k = true) (x j : ℕ) :
          LK.valid (keepF l x j) k = true

          Retain one list entry when its key differs from the key being filtered out.

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

            Procedure filtering every occurrence of a key from a stored list.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              theorem OrderMaintenance.Impl.filterP_agree (κ : Caps) (k : LK) (s : Model.Core) (L : Loc) {i x : ℕ} (hi : L "i" = i) (hx : L "x" = x) (hid : LK.idOk s i k) (hr : LK.recOk s i k = true) (hir : i < κ.lrec k) (hcap : (LK.view s i k).length ≤ κ.lcap k) :
              ∃ (L' : Loc) (c : ℕ), evalF κ (filterP k).body s L = Res.ok (LK.put s i (List.filter (fun (x_1 : ℕ × ℕ) => x_1.1 != x) (LK.view s i k)) k) L' c ∧ c ≤ 50 + 90 * (LK.view s i k).length

              filterP keeps the elements whose key is not x.