Documentation

LeanPool.OrderMaintenance.Impl.Job

M6: the top structure's job at Level M (jobStep) #

The running job lives in the optional record resJob; the program reads its fields into locals (jx jy jz and the program counter jt ja jb jc jd, pcEnc) and writes the new counter with pcSet (or clears the job). Each case is matched against the Level F run lemma the cost proof uses.

A copy step #

Copy a reservation path level to both replacement chunks and repair range endpoints.

Equations
  • One or more equations did not get rendered due to their size.
Instances For
    theorem OrderMaintenance.Impl.getX_default_of_le {α : Type} [Inhabited α] {a : Array α} {i : ℕ} (h : a.size ≤ i) :
    theorem OrderMaintenance.Impl.jcopyS_ok {κ : Caps} {s : Model.Core} {L : Loc} {j : Model.Job} {l : ℕ} (hjob : s.resJob = some j) (hx : L "jx" = j.x) (hy : L "jy" = j.y) (hz : L "jz" = j.z) (hl : L "ja" = l) (hx0 : j.x ≠ Model.NIL) (hnx : notPrep s j.x) (hny : notPrep s j.y) (hnz : notPrep s j.z) (hxC : j.x < κ.tbl Tbl.C) (hyC : j.y < κ.tbl Tbl.C) (hzC : j.z < κ.tbl Tbl.C) (hlw : l < κ.pw) (hvN : (s.path.getX j.x).getX l < κ.tbl Tbl.N) :
    ∃ (L' : Loc) (c : ℕ), evalF κ jcopyS s L = Res.ok (have __src := Proof.Top.copyC s j l; { P := __src.P, E := __src.E, Gs := __src.Gs, C := __src.C, freeG := __src.freeG, count := __src.count, head := __src.head, tail := __src.tail, firstGroup := __src.firstGroup, firstChunk := __src.firstChunk, ready := __src.ready, prep := __src.prep, resJob := some (Proof.Top.copyNext s.P j l), fallbacks := __src.fallbacks, pqHead := __src.pqHead, pqNext := __src.pqNext, pqPrev := __src.pqPrev, pqWhere := __src.pqWhere, nbNext := __src.nbNext, nbPrev := __src.nbPrev, pqHi := __src.pqHi, pqLo := __src.pqLo, nodes := __src.nodes, path := __src.path, cin := __src.cin, lpar := __src.lpar }) L' c ∧ c ≤ 100 ∧ ∀ (r : String), r ≠ "v" → L' r = L r

    A sweep step that moves a chunk (drainStep, drainStep_move) #

    theorem OrderMaintenance.Impl.lor_shift (a c b h : ℕ) (hc : c < 2 ^ b) (hh : 1 ≤ h) :
    a <<< (h * b) ||| c <<< ((h - 1) * b) = a * 2 ^ (h * b) + c * 2 ^ ((h - 1) * b)

    r := belowOf h c (local h).

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      theorem OrderMaintenance.Impl.belowS_ok {κ : Caps} {s : Model.Core} {L : Loc} {c r : Machine.Reg} {h y : ℕ} (hh : L "h" = h) (hc : L c = y) (h1 : 1 ≤ h) (hnp : notPrep s y) (hyC : y < κ.tbl Tbl.C) (hw : h - 1 < κ.pw) :
      evalF κ (belowS c r) s L = Res.ok s (Machine.State.upd L r (if (h == 1) = true then y else (s.path.getX y).getX (h - 1))) (if h = 1 then 6 else 16)

      Select the left drain target and initialize the moved range's boundary locals.

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

        Select the right drain target after checking its recorded side assignment.

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

          The chunk moved (y), its target (t), the direction (lf) and the entry below (bl).

          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            theorem OrderMaintenance.Impl.dsPickS_ok {κ : Caps} {s : Model.Core} {L : Loc} {v : ℕ} (hv : L "v" = v) (hh : L "h" = (s.nodes.getX v).height) (h1 : 1 ≤ (s.nodes.getX v).height) (hside : Proof.Top.goesLeft s v ∨ Model.lookup (s.nodes.getX v).side (Proof.Top.belowY s v (s.nodes.getX v).first) = some Model.Side.right ∧ Model.lookup (s.nodes.getX v).side (Proof.Top.belowY s v (s.nodes.getX v).last) = some Model.Side.right) (hvN : v < κ.tbl Tbl.N) (hvs : v < κ.lrec LK.side) (hnf : notPrep s (s.nodes.getX v).first) (hnl : notPrep s (s.nodes.getX v).last) (hfC : (s.nodes.getX v).first < κ.tbl Tbl.C) (hlC : (s.nodes.getX v).last < κ.tbl Tbl.C) (hw : (s.nodes.getX v).height - 1 < κ.pw) :
            ∃ (L' : Loc) (c : ℕ), evalF κ dsPickS s L = Res.ok s L' c ∧ L' "y" = Proof.Top.dsY s v ∧ L' "t" = Proof.Top.dsT s v ∧ L' "lf" = b2n (decide (Proof.Top.goesLeft s v)) ∧ L' "bl" = Proof.Top.belowY s v (Proof.Top.dsY s v) ∧ c ≤ 300 + 80 * (s.nodes.getX v).side.length ∧ ∀ (r : String), r ≠ "y0" → r ≠ "b0" → r ≠ "f" → r ≠ "sd" → r ≠ "t" → r ≠ "lf" → r ≠ "y" → r ≠ "bl" → L' r = L r

            A table lookup that must succeed: r := lab? of entry e in table t.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              theorem OrderMaintenance.Impl.labS_ok {κ : Caps} {s : Model.Core} {L : Loc} {t e r : Machine.Reg} {tv ev l : ℕ} (hr : r ≠ "f") (ht : L t = tv) (he : L e = ev) (htr : tv < κ.lrec LK.table) (hl : (s.nodes.getX tv).lab? ev = some l) :
              ∃ (c : ℕ), evalF κ (labS t e r) s L = Res.ok s (Machine.State.setLocs L ["f", r] [1, l]) c ∧ c ≤ 70 + 20 * (s.nodes.getX tv).table.length

              The labels around the move and the tag fields they make (locals v h y t bl).

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                theorem OrderMaintenance.Impl.dsLabS_ok {κ : Caps} {s : Model.Core} {L : Loc} {v h y t bl pt tb pv vb : ℕ} (hv : L "v" = v) (hh : L "h" = h) (hy : L "y" = y) (ht : L "t" = t) (hbl : L "bl" = bl) (hhH : h < s.P.H) (h1 : 1 ≤ h) (hnp : notPrep s y) (hyC : y < κ.tbl Tbl.C) (hw : h + 1 < κ.pw) (hpt : (s.nodes.getX ((s.path.getX y).getX (h + 1))).lab? t = some pt) (htb : (s.nodes.getX t).lab? bl = some tb) (hpv : (s.nodes.getX ((s.path.getX y).getX (h + 1))).lab? v = some pv) (hvb : (s.nodes.getX v).lab? bl = some vb) (htbB : tb < 2 ^ s.P.beta) (hvbB : vb < 2 ^ s.P.beta) (hprr : (s.path.getX y).getX (h + 1) < κ.lrec LK.table) (htr : t < κ.lrec LK.table) (hvr : v < κ.lrec LK.table) :
                ∃ (L' : Loc) (c : ℕ), evalF κ dsLabS s L = Res.ok s L' c ∧ L' "old" = pv <<< (h * s.P.beta) ||| vb <<< ((h - 1) * s.P.beta) ∧ L' "new" = pt <<< (h * s.P.beta) ||| tb <<< ((h - 1) * s.P.beta) ∧ c ≤ 400 + 40 * (s.nodes.getX ((s.path.getX y).getX (h + 1))).table.length + 20 * (s.nodes.getX t).table.length + 20 * (s.nodes.getX v).table.length ∧ ∀ (r : String), r = "v" ∨ r = "y" ∨ r = "t" ∨ r = "lf" ∨ r = "h" → L' r = L r
                theorem OrderMaintenance.Impl.evalF_wrN2 {κ : Caps} {s : Model.Core} {L : Loc} {k1 k2 : NF} {i e1 e2 : Exp} {j w1 w2 : ℕ} (hi : ∀ (S : Model.Core), Exp.ev κ S L i = some j) (he1 : ∀ (S : Model.Core), Exp.ev κ S L e1 = some w1) (he2 : ∀ (S : Model.Core), Exp.ev κ S L e2 = some w2) (hj : j < s.nodes.size) (hk1 : NF.ok w1 k1 = true) (hk2 : NF.ok w2 k2 = true) :
                evalF κ (Stm.wr (Fld.n k1) i e1;; Stm.wr (Fld.n k2) i e2) s L = Res.ok { P := s.P, E := s.E, Gs := s.Gs, C := s.C, freeG := s.freeG, count := s.count, head := s.head, tail := s.tail, firstGroup := s.firstGroup, firstChunk := s.firstChunk, ready := s.ready, prep := s.prep, resJob := s.resJob, fallbacks := s.fallbacks, pqHead := s.pqHead, pqNext := s.pqNext, pqPrev := s.pqPrev, pqWhere := s.pqWhere, nbNext := s.nbNext, nbPrev := s.nbPrev, pqHi := s.pqHi, pqLo := s.pqLo, nodes := s.nodes.modify j fun (n : Model.Node) => NF.set (NF.set n w1 k1) w2 k2, path := s.path, cin := s.cin, lpar := s.lpar } L (1 + i.cost + e1.cost + (1 + i.cost + e2.cost))

                Two writes to the same node.

                Check the moved chunk tag against its neighbours and store it.

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

                  Remove the moved chunk from the source node's range endpoints.

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

                    Extend the selected drain target's range to include the moved chunk.

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

                      The writes of a sweep step that moves chunk y to target t (locals v h y t lf old new).

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        theorem OrderMaintenance.Impl.dsMutS_ok {κ : Caps} {s : Model.Core} {L : Loc} {v old new : ℕ} (hv : L "v" = v) (hh : L "h" = (s.nodes.getX v).height) (hy : L "y" = Proof.Top.dsY s v) (ht : L "t" = Proof.Top.dsT s v) (hlf : L "lf" = b2n (decide (Proof.Top.goesLeft s v))) (hold : L "old" = old) (hnew : L "new" = new) (hle : old ≤ (s.C.getX (Proof.Top.dsY s v)).tag) (hok : Proof.TagOK s (Proof.Top.dsY s v) ((s.C.getX (Proof.Top.dsY s v)).tag - old + new)) (hys : Proof.Top.dsY s v < s.C.size) (hyC : Proof.Top.dsY s v < κ.tbl Tbl.C) (hyP : (s.C.getX (Proof.Top.dsY s v)).prev < κ.tbl Tbl.C) (hyN : (s.C.getX (Proof.Top.dsY s v)).next < κ.tbl Tbl.C) (hnp : notPrep s (Proof.Top.dsY s v)) (hw : (s.nodes.getX v).height < κ.pw) (hvs : v < s.nodes.size) (hts : Proof.Top.dsT s v < s.nodes.size) (hvN : v < κ.tbl Tbl.N) (htN : Proof.Top.dsT s v < κ.tbl Tbl.N) (htv : Proof.Top.dsT s v ≠ v) :
                        ∃ (L' : Loc) (c : ℕ), evalF κ dsMutS s L = Res.ok (Proof.Top.dsS s v ((s.C.getX (Proof.Top.dsY s v)).tag - old + new)) L' c ∧ c ≤ 150 ∧ ∀ (r : String), r ≠ "ty" → r ≠ "tg" → L' r = L r
                        theorem OrderMaintenance.Impl.dsMoveS_ok {κ : Caps} {s : Model.Core} {L : Loc} {v pt tb pv vb : ℕ} (hv : L "v" = v) (hh : L "h" = (s.nodes.getX v).height) (hside : Proof.Top.goesLeft s v ∨ Model.lookup (s.nodes.getX v).side (Proof.Top.belowY s v (s.nodes.getX v).first) = some Model.Side.right ∧ Model.lookup (s.nodes.getX v).side (Proof.Top.belowY s v (s.nodes.getX v).last) = some Model.Side.right) (hsz : (s.nodes.getX v).height + 1 < (s.path.getX (Proof.Top.dsY s v)).size) (hpt : (s.nodes.getX ((s.path.getX (Proof.Top.dsY s v)).getX ((s.nodes.getX v).height + 1))).lab? (Proof.Top.dsT s v) = some pt) (htb : (s.nodes.getX (Proof.Top.dsT s v)).lab? (Proof.Top.belowY s v (Proof.Top.dsY s v)) = some tb) (hpv : (s.nodes.getX ((s.path.getX (Proof.Top.dsY s v)).getX ((s.nodes.getX v).height + 1))).lab? v = some pv) (hvb : (s.nodes.getX v).lab? (Proof.Top.belowY s v (Proof.Top.dsY s v)) = some vb) (hold : pv <<< ((s.nodes.getX v).height * s.P.beta) ||| vb <<< (((s.nodes.getX v).height - 1) * s.P.beta) ≤ (s.C.getX (Proof.Top.dsY s v)).tag) (hok : Proof.TagOK s (Proof.Top.dsY s v) (Proof.Top.dsTag s v pt tb pv vb)) (h1 : 1 ≤ (s.nodes.getX v).height) (hpsz : (s.path.getX (Proof.Top.dsY s v)).size = s.P.H + 1) (htbB : tb < 2 ^ s.P.beta) (hvbB : vb < 2 ^ s.P.beta) (htv : Proof.Top.dsT s v ≠ v) (hvs : v < s.nodes.size) (hts : Proof.Top.dsT s v < s.nodes.size) (hys : Proof.Top.dsY s v < s.C.size) (hnf : notPrep s (s.nodes.getX v).first) (hnl : notPrep s (s.nodes.getX v).last) (hvN : v < κ.tbl Tbl.N) (htN : Proof.Top.dsT s v < κ.tbl Tbl.N) (hvsd : v < κ.lrec LK.side) (hvr : v < κ.lrec LK.table) (htr : Proof.Top.dsT s v < κ.lrec LK.table) (hprr : (s.path.getX (Proof.Top.dsY s v)).getX ((s.nodes.getX v).height + 1) < κ.lrec LK.table) (hfC : (s.nodes.getX v).first < κ.tbl Tbl.C) (hlC : (s.nodes.getX v).last < κ.tbl Tbl.C) (hyP : (s.C.getX (Proof.Top.dsY s v)).prev < κ.tbl Tbl.C) (hyN : (s.C.getX (Proof.Top.dsY s v)).next < κ.tbl Tbl.C) (hw : (s.nodes.getX v).height + 1 < κ.pw) :
                        ∃ (L' : Loc) (c : ℕ), evalF κ dsMoveS s L = Res.ok (Proof.Top.dsS s v (Proof.Top.dsTag s v pt tb pv vb)) L' c ∧ c ≤ 1000 + 80 * (s.nodes.getX v).side.length + 40 * (s.nodes.getX ((s.path.getX (Proof.Top.dsY s v)).getX ((s.nodes.getX v).height + 1))).table.length + 20 * (s.nodes.getX (Proof.Top.dsT s v)).table.length + 20 * (s.nodes.getX v).table.length ∧ L' "v" = v ∧ L' "h" = (s.nodes.getX v).height

                        drainStep #

                        ok := drainStep v.

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          theorem OrderMaintenance.Impl.dsP_dead {κ : Caps} {s : Model.Core} {L : Loc} {v : ℕ} (hv : L "v" = v) (hvN : v < κ.tbl Tbl.N) (hal : (s.nodes.getX v).alive = false) :
                          ∃ (L' : Loc) (c : ℕ), evalF κ dsP.body s L = Res.ok s L' c ∧ L' "ok" = 0 ∧ c ≤ 10
                          theorem OrderMaintenance.Impl.dsP_pre {κ : Caps} {s : Model.Core} {L : Loc} {v : ℕ} (hv : L "v" = v) (hvN : v < κ.tbl Tbl.N) (hal : (s.nodes.getX v).alive = true) {s' : Model.Core} {L' : Loc} {c : ℕ} (h : evalF κ (Stm.ite (Exp.bin Machine.BinOp.eq (Exp.rd (Fld.n NF.first) (Exp.var "v")) 0) (finishDrainS;; "ok" ::= 0) (dsMoveS;; "ok" ::= 1)) s (Machine.State.upd L "h" (s.nodes.getX v).height) = Res.ok s' L' c) :
                          evalF κ dsP.body s L = Res.ok s' L' (c + 6)
                          theorem OrderMaintenance.Impl.dsP_move {κ : Caps} {s : Model.Core} {L : Loc} {v pt tb pv vb : ℕ} (hv : L "v" = v) (hal : (s.nodes.getX v).alive = true) (hf : (s.nodes.getX v).first ≠ Model.NIL) (hside : Proof.Top.goesLeft s v ∨ Model.lookup (s.nodes.getX v).side (Proof.Top.belowY s v (s.nodes.getX v).first) = some Model.Side.right ∧ Model.lookup (s.nodes.getX v).side (Proof.Top.belowY s v (s.nodes.getX v).last) = some Model.Side.right) (hsz : (s.nodes.getX v).height + 1 < (s.path.getX (Proof.Top.dsY s v)).size) (hpt : (s.nodes.getX ((s.path.getX (Proof.Top.dsY s v)).getX ((s.nodes.getX v).height + 1))).lab? (Proof.Top.dsT s v) = some pt) (htb : (s.nodes.getX (Proof.Top.dsT s v)).lab? (Proof.Top.belowY s v (Proof.Top.dsY s v)) = some tb) (hpv : (s.nodes.getX ((s.path.getX (Proof.Top.dsY s v)).getX ((s.nodes.getX v).height + 1))).lab? v = some pv) (hvb : (s.nodes.getX v).lab? (Proof.Top.belowY s v (Proof.Top.dsY s v)) = some vb) (hold : pv <<< ((s.nodes.getX v).height * s.P.beta) ||| vb <<< (((s.nodes.getX v).height - 1) * s.P.beta) ≤ (s.C.getX (Proof.Top.dsY s v)).tag) (hok : Proof.TagOK s (Proof.Top.dsY s v) (Proof.Top.dsTag s v pt tb pv vb)) (h1 : 1 ≤ (s.nodes.getX v).height) (hpsz : (s.path.getX (Proof.Top.dsY s v)).size = s.P.H + 1) (htbB : tb < 2 ^ s.P.beta) (hvbB : vb < 2 ^ s.P.beta) (htv : Proof.Top.dsT s v ≠ v) (hvs : v < s.nodes.size) (hts : Proof.Top.dsT s v < s.nodes.size) (hys : Proof.Top.dsY s v < s.C.size) (hnf : notPrep s (s.nodes.getX v).first) (hnl : notPrep s (s.nodes.getX v).last) (hvN : v < κ.tbl Tbl.N) (htN : Proof.Top.dsT s v < κ.tbl Tbl.N) (hvsd : v < κ.lrec LK.side) (hvr : v < κ.lrec LK.table) (htr : Proof.Top.dsT s v < κ.lrec LK.table) (hprr : (s.path.getX (Proof.Top.dsY s v)).getX ((s.nodes.getX v).height + 1) < κ.lrec LK.table) (hfC : (s.nodes.getX v).first < κ.tbl Tbl.C) (hlC : (s.nodes.getX v).last < κ.tbl Tbl.C) (hyP : (s.C.getX (Proof.Top.dsY s v)).prev < κ.tbl Tbl.C) (hyN : (s.C.getX (Proof.Top.dsY s v)).next < κ.tbl Tbl.C) (hw : (s.nodes.getX v).height + 1 < κ.pw) :
                          ∃ (L' : Loc) (c : ℕ), evalF κ dsP.body s L = Res.ok (Proof.Top.dsS s v (Proof.Top.dsTag s v pt tb pv vb)) L' c ∧ L' "ok" = 1 ∧ c ≤ 1100 + 80 * (s.nodes.getX v).side.length + 40 * (s.nodes.getX ((s.path.getX (Proof.Top.dsY s v)).getX ((s.nodes.getX v).height + 1))).table.length + 20 * (s.nodes.getX (Proof.Top.dsT s v)).table.length + 20 * (s.nodes.getX v).table.length
                          theorem OrderMaintenance.Impl.dsP_finish {κ : Caps} {s : Model.Core} {L : Loc} {v B : ℕ} (hv : L "v" = v) (hal : (s.nodes.getX v).alive = true) (hf : (s.nodes.getX v).first = Model.NIL) (hnd : (s.nodes.getX v).inTables.Nodup) (hT : ∀ T ∈ (s.nodes.getX v).inTables, v ∈ (s.nodes.getX T).order) (hv0 : v ≠ 0) (hvs : v < s.nodes.size) (hvo : (s.nodes.getX v).height - 1 ≠ 0 → v ∉ (s.nodes.getX v).order) (hvN : v < κ.tbl Tbl.N) (hvr : v < κ.lrec LK.table) (hvi : v < κ.lrec LK.inTab) (ht1 : (s.nodes.getX v).t1 < κ.tbl Tbl.N) (ht2 : (s.nodes.getX v).t2 < κ.tbl Tbl.N) (hcE : ∀ e ∈ (s.nodes.getX v).order, ((s.nodes.getX v).height - 1 = 0 → e < κ.lrec LK.cin ∧ (s.cin.getX e).length ≤ κ.lcap LK.cin ∧ (s.cin.getX e).length ≤ B) ∧ ((s.nodes.getX v).height - 1 ≠ 0 → e < κ.lrec LK.inTab ∧ (s.nodes.getX e).inTables.length ≤ κ.lcap LK.inTab ∧ (s.nodes.getX e).inTables.length ≤ B)) (hcT : ∀ T ∈ (s.nodes.getX v).inTables, T < κ.lrec LK.table ∧ T < κ.lrec LK.side ∧ (s.nodes.getX T).table.length ≤ κ.lcap LK.table ∧ (s.nodes.getX T).side.length ≤ κ.lcap LK.side ∧ (s.nodes.getX T).table.length ≤ B ∧ (s.nodes.getX T).side.length ≤ B) :
                          ∃ (L' : Loc) (c : ℕ), evalF κ dsP.body s L = Res.ok (Proof.Top.fdS v s) L' c ∧ L' "ok" = 0 ∧ c ≤ 300 + (s.nodes.getX v).table.length * (171 + 100 * B) + (s.nodes.getX v).inTables.length * (301 + 200 * B)

                          The funding loop, the step after a drain start, the walk #

                          The program agrees with Level F's drainStep src from S (within D steps).

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

                            fundLoop (locals ja jb jc jd = v up src k); the job's counter is updated.

                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              theorem OrderMaintenance.Impl.fundS_agree {κ : Caps} {S : Model.Core} {L : Loc} {j : Model.Job} {v up src k D : ℕ} (hjob : S.resJob = some j) (ha : L "ja" = v) (hb : L "jb" = up) (hc : L "jc" = src) (hd : L "jd" = k) (hds : DSAgree κ S src D) {r : Option Model.Job} {S' : Model.Core} (h : EStateM.run (Model.fundLoop j v up src k) S = EStateM.Result.ok r S') :
                              ∃ (L' : Loc) (c : ℕ), evalF κ fundS S L = Res.ok { P := S'.P, E := S'.E, Gs := S'.Gs, C := S'.C, freeG := S'.freeG, count := S'.count, head := S'.head, tail := S'.tail, firstGroup := S'.firstGroup, firstChunk := S'.firstChunk, ready := S'.ready, prep := S'.prep, resJob := r, fallbacks := S'.fallbacks, pqHead := S'.pqHead, pqNext := S'.pqNext, pqPrev := S'.pqPrev, pqWhere := S'.pqWhere, nbNext := S'.nbNext, nbPrev := S'.nbPrev, pqHi := S'.pqHi, pqLo := S'.pqLo, nodes := S'.nodes, path := S'.path, cin := S'.cin, lpar := S'.lpar } L' c ∧ c ≤ D + 80

                              Resume a reservation at the parent or at the source of an overflow target.

                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                theorem OrderMaintenance.Impl.afterDS_agree {κ : Caps} {S : Model.Core} {L : Loc} {j : Model.Job} {v up D : ℕ} (hjob : S.resJob = some j) (hv : L "av" = v) (hu : L "au" = up) (hvN : v < κ.tbl Tbl.N) (hds : (S.nodes.getX v).overflowOf ≠ Model.NIL → DSAgree κ S (S.nodes.getX v).overflowOf D) {r : Option Model.Job} {S' : Model.Core} (h : EStateM.run (Model.afterDrain j v up) S = EStateM.Result.ok r S') :
                                ∃ (L' : Loc) (c : ℕ), evalF κ afterDS S L = Res.ok { P := S'.P, E := S'.E, Gs := S'.Gs, C := S'.C, freeG := S'.freeG, count := S'.count, head := S'.head, tail := S'.tail, firstGroup := S'.firstGroup, firstChunk := S'.firstChunk, ready := S'.ready, prep := S'.prep, resJob := r, fallbacks := S'.fallbacks, pqHead := S'.pqHead, pqNext := S'.pqNext, pqPrev := S'.pqPrev, pqWhere := S'.pqWhere, nbNext := S'.nbNext, nbPrev := S'.nbPrev, pqHi := S'.pqHi, pqLo := S'.pqLo, nodes := S'.nodes, path := S'.path, cin := S'.cin, lpar := S'.lpar } L' c ∧ c ≤ D + 120

                                startDrain v.

                                Equations
                                Instances For

                                  The program agrees with Level F's startDrain v from S (within D steps).

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

                                    pw := a ^ ht, in one step: a is a power of two, so a ^ ht = 1 <<< (log₂ a · ht).

                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For
                                      theorem OrderMaintenance.Impl.powS_ok {κ : Caps} {S : Model.Core} {L : Loc} {h : ℕ} (hh : L "ht" = h) (ha : S.P.a = 2 ^ S.P.a.log2) :
                                      ∃ (L' : Loc) (c : ℕ), evalF κ powS S L = Res.ok S L' c ∧ L' "pw" = S.P.a ^ h ∧ c ≤ 10 ∧ ∀ (r : String), r ≠ "pw" → r ≠ "i" → L' r = L r

                                      Detect a nondraining, nonoverflow node above its weight threshold with a live parent.

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

                                        Read the current reservation-walk node and its continuation.

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

                                          walkBody at node wv.

                                          Equations
                                          • One or more equations did not get rendered due to their size.
                                          Instances For
                                            theorem OrderMaintenance.Impl.walkS_agree {κ : Caps} {S : Model.Core} {L : Loc} {j : Model.Job} {v D1 D2 : ℕ} (hjob : S.resJob = some j) (hv : L "wv" = v) (hvs : v ≠ 0 → v < S.nodes.size) (hvN : v ≠ 0 → v < κ.tbl Tbl.N) (hsd : v ≠ Model.NIL → ((S.nodes.getX v).livePar != Model.NIL && !(S.nodes.getX v).draining && (S.nodes.getX v).overflowOf == Model.NIL && decide ((S.nodes.getX v).weight + 2 > 2 * S.P.a ^ (S.nodes.getX v).height)) = true → SDAgree κ (Proof.Top.wiC S v) v D1) (hds : v ≠ Model.NIL → (S.nodes.getX v).overflowOf ≠ Model.NIL → DSAgree κ (Proof.Top.wiC S v) (S.nodes.getX v).overflowOf D2) (ha : S.P.a = 2 ^ S.P.a.log2) {r : Option Model.Job} {S' : Model.Core} (h : EStateM.run (Model.walkBody j v) S = EStateM.Result.ok r S') :
                                            ∃ (L' : Loc) (c : ℕ), evalF κ walkS S L = Res.ok { P := S'.P, E := S'.E, Gs := S'.Gs, C := S'.C, freeG := S'.freeG, count := S'.count, head := S'.head, tail := S'.tail, firstGroup := S'.firstGroup, firstChunk := S'.firstChunk, ready := S'.ready, prep := S'.prep, resJob := r, fallbacks := S'.fallbacks, pqHead := S'.pqHead, pqNext := S'.pqNext, pqPrev := S'.pqPrev, pqWhere := S'.pqWhere, nbNext := S'.nbNext, nbPrev := S'.nbPrev, pqHi := S'.pqHi, pqLo := S'.pqLo, nodes := S'.nodes, path := S'.path, cin := S'.cin, lpar := S'.lpar } L' c ∧ c ≤ D1 + D2 + 250

                                            The job step #

                                            Load the suspended reservation job into the procedure's working locals.

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

                                              One resumption of the running job; the job's record is updated (or cleared).

                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              Instances For
                                                theorem OrderMaintenance.Impl.jobRdS_ok {κ : Caps} {s : Model.Core} {L : Loc} {j : Model.Job} (hjob : s.resJob = some j) :
                                                ∃ (L' : Loc), evalF κ jobRdS s L = Res.ok s L' 24 ∧ L' "jx" = j.x ∧ L' "jy" = j.y ∧ L' "jz" = j.z ∧ L' "jt" = (pcEnc j.pc).1 ∧ L' "ja" = (pcEnc j.pc).2.1 ∧ L' "jb" = (pcEnc j.pc).2.2.1 ∧ L' "jc" = (pcEnc j.pc).2.2.2.1 ∧ L' "jd" = (pcEnc j.pc).2.2.2.2
                                                theorem OrderMaintenance.Impl.jobStep_fund {s : Model.Core} {j : Model.Job} {v up src k : ℕ} (hpc : j.pc = Model.JobPc.fund v up src k) :
                                                theorem OrderMaintenance.Impl.jobStepS_copy {κ : Caps} {s : Model.Core} {L : Loc} {j : Model.Job} {l : ℕ} (hjob : s.resJob = some j) (hpc : j.pc = Model.JobPc.copy l) (hx0 : j.x ≠ Model.NIL) (hnx : notPrep s j.x) (hny : notPrep s j.y) (hnz : notPrep s j.z) (hxC : j.x < κ.tbl Tbl.C) (hyC : j.y < κ.tbl Tbl.C) (hzC : j.z < κ.tbl Tbl.C) (hlw : l < κ.pw) (hvN : (s.path.getX j.x).getX l < κ.tbl Tbl.N) :
                                                ∃ (L' : Loc) (c : ℕ), evalF κ jobStepS s L = Res.ok (have __src := Proof.Top.copyC s j l; { P := __src.P, E := __src.E, Gs := __src.Gs, C := __src.C, freeG := __src.freeG, count := __src.count, head := __src.head, tail := __src.tail, firstGroup := __src.firstGroup, firstChunk := __src.firstChunk, ready := __src.ready, prep := __src.prep, resJob := some (Proof.Top.copyNext s.P j l), fallbacks := __src.fallbacks, pqHead := __src.pqHead, pqNext := __src.pqNext, pqPrev := __src.pqPrev, pqWhere := __src.pqWhere, nbNext := __src.nbNext, nbPrev := __src.nbPrev, pqHi := __src.pqHi, pqLo := __src.pqLo, nodes := __src.nodes, path := __src.path, cin := __src.cin, lpar := __src.lpar }) L' c ∧ c ≤ 140
                                                theorem OrderMaintenance.Impl.jobStepS_walkNone {κ : Caps} {s : Model.Core} {L : Loc} {j : Model.Job} {D1 D2 : ℕ} (hjob : s.resJob = some j) (hpc : j.pc = Model.JobPc.walk none) (hya : j.y < κ.arr AF.lpar) (hvs : s.lpar.getX j.y ≠ 0 → s.lpar.getX j.y < s.nodes.size) (hvN : s.lpar.getX j.y ≠ 0 → s.lpar.getX j.y < κ.tbl Tbl.N) (hsd : s.lpar.getX j.y ≠ Model.NIL → ((s.nodes.getX (s.lpar.getX j.y)).livePar != Model.NIL && !(s.nodes.getX (s.lpar.getX j.y)).draining && (s.nodes.getX (s.lpar.getX j.y)).overflowOf == Model.NIL && decide ((s.nodes.getX (s.lpar.getX j.y)).weight + 2 > 2 * s.P.a ^ (s.nodes.getX (s.lpar.getX j.y)).height)) = true → SDAgree κ (Proof.Top.wiC s (s.lpar.getX j.y)) (s.lpar.getX j.y) D1) (hds : s.lpar.getX j.y ≠ Model.NIL → (s.nodes.getX (s.lpar.getX j.y)).overflowOf ≠ Model.NIL → DSAgree κ (Proof.Top.wiC s (s.lpar.getX j.y)) (s.nodes.getX (s.lpar.getX j.y)).overflowOf D2) (hpow : s.P.a = 2 ^ s.P.a.log2) {r : Option Model.Job} {s' : Model.Core} (h : EStateM.run (Model.jobStep j) s = EStateM.Result.ok r s') :
                                                ∃ (L' : Loc) (c : ℕ), evalF κ jobStepS s L = Res.ok { P := s'.P, E := s'.E, Gs := s'.Gs, C := s'.C, freeG := s'.freeG, count := s'.count, head := s'.head, tail := s'.tail, firstGroup := s'.firstGroup, firstChunk := s'.firstChunk, ready := s'.ready, prep := s'.prep, resJob := r, fallbacks := s'.fallbacks, pqHead := s'.pqHead, pqNext := s'.pqNext, pqPrev := s'.pqPrev, pqWhere := s'.pqWhere, nbNext := s'.nbNext, nbPrev := s'.nbPrev, pqHi := s'.pqHi, pqLo := s'.pqLo, nodes := s'.nodes, path := s'.path, cin := s'.cin, lpar := s'.lpar } L' c ∧ c ≤ D1 + D2 + 300
                                                theorem OrderMaintenance.Impl.jobStepS_walkSome {κ : Caps} {s : Model.Core} {L : Loc} {j : Model.Job} {v D1 D2 : ℕ} (hjob : s.resJob = some j) (hpc : j.pc = Model.JobPc.walk (some v)) (hvs : v ≠ 0 → v < s.nodes.size) (hvN : v ≠ 0 → v < κ.tbl Tbl.N) (hsd : v ≠ Model.NIL → ((s.nodes.getX v).livePar != Model.NIL && !(s.nodes.getX v).draining && (s.nodes.getX v).overflowOf == Model.NIL && decide ((s.nodes.getX v).weight + 2 > 2 * s.P.a ^ (s.nodes.getX v).height)) = true → SDAgree κ (Proof.Top.wiC s v) v D1) (hds : v ≠ Model.NIL → (s.nodes.getX v).overflowOf ≠ Model.NIL → DSAgree κ (Proof.Top.wiC s v) (s.nodes.getX v).overflowOf D2) (hpow : s.P.a = 2 ^ s.P.a.log2) {r : Option Model.Job} {s' : Model.Core} (h : EStateM.run (Model.jobStep j) s = EStateM.Result.ok r s') :
                                                ∃ (L' : Loc) (c : ℕ), evalF κ jobStepS s L = Res.ok { P := s'.P, E := s'.E, Gs := s'.Gs, C := s'.C, freeG := s'.freeG, count := s'.count, head := s'.head, tail := s'.tail, firstGroup := s'.firstGroup, firstChunk := s'.firstChunk, ready := s'.ready, prep := s'.prep, resJob := r, fallbacks := s'.fallbacks, pqHead := s'.pqHead, pqNext := s'.pqNext, pqPrev := s'.pqPrev, pqWhere := s'.pqWhere, nbNext := s'.nbNext, nbPrev := s'.nbPrev, pqHi := s'.pqHi, pqLo := s'.pqLo, nodes := s'.nodes, path := s'.path, cin := s'.cin, lpar := s'.lpar } L' c ∧ c ≤ D1 + D2 + 300
                                                theorem OrderMaintenance.Impl.jobStepS_after {κ : Caps} {s : Model.Core} {L : Loc} {j : Model.Job} {v up D : ℕ} (hjob : s.resJob = some j) (hpc : j.pc = Model.JobPc.afterDrain v up) (hvN : v < κ.tbl Tbl.N) (hds : (s.nodes.getX v).overflowOf ≠ Model.NIL → DSAgree κ s (s.nodes.getX v).overflowOf D) {r : Option Model.Job} {s' : Model.Core} (h : EStateM.run (Model.jobStep j) s = EStateM.Result.ok r s') :
                                                ∃ (L' : Loc) (c : ℕ), evalF κ jobStepS s L = Res.ok { P := s'.P, E := s'.E, Gs := s'.Gs, C := s'.C, freeG := s'.freeG, count := s'.count, head := s'.head, tail := s'.tail, firstGroup := s'.firstGroup, firstChunk := s'.firstChunk, ready := s'.ready, prep := s'.prep, resJob := r, fallbacks := s'.fallbacks, pqHead := s'.pqHead, pqNext := s'.pqNext, pqPrev := s'.pqPrev, pqWhere := s'.pqWhere, nbNext := s'.nbNext, nbPrev := s'.nbPrev, pqHi := s'.pqHi, pqLo := s'.pqLo, nodes := s'.nodes, path := s'.path, cin := s'.cin, lpar := s'.lpar } L' c ∧ c ≤ D + 200
                                                theorem OrderMaintenance.Impl.jobStepS_fund {κ : Caps} {s : Model.Core} {L : Loc} {j : Model.Job} {v up src k D : ℕ} (hjob : s.resJob = some j) (hpc : j.pc = Model.JobPc.fund v up src k) (hds : DSAgree κ s src D) {r : Option Model.Job} {s' : Model.Core} (h : EStateM.run (Model.jobStep j) s = EStateM.Result.ok r s') :
                                                ∃ (L' : Loc) (c : ℕ), evalF κ jobStepS s L = Res.ok { P := s'.P, E := s'.E, Gs := s'.Gs, C := s'.C, freeG := s'.freeG, count := s'.count, head := s'.head, tail := s'.tail, firstGroup := s'.firstGroup, firstChunk := s'.firstChunk, ready := s'.ready, prep := s'.prep, resJob := r, fallbacks := s'.fallbacks, pqHead := s'.pqHead, pqNext := s'.pqNext, pqPrev := s'.pqPrev, pqWhere := s'.pqWhere, nbNext := s'.nbNext, nbPrev := s'.nbPrev, pqHi := s'.pqHi, pqLo := s'.pqLo, nodes := s'.nodes, path := s'.path, cin := s'.cin, lpar := s'.lpar } L' c ∧ c ≤ D + 150

                                                The agreements, from the cases #

                                                theorem OrderMaintenance.Impl.dsAgree_dead {κ : Caps} {S : Model.Core} {v : ℕ} (hvN : v < κ.tbl Tbl.N) (hal : (S.nodes.getX v).alive = false) :
                                                DSAgree κ S v 10
                                                theorem OrderMaintenance.Impl.dsAgree_move {κ : Caps} {s : Model.Core} {v pt tb pv vb : ℕ} (hal : (s.nodes.getX v).alive = true) (hf : (s.nodes.getX v).first ≠ Model.NIL) (hside : Proof.Top.goesLeft s v ∨ Model.lookup (s.nodes.getX v).side (Proof.Top.belowY s v (s.nodes.getX v).first) = some Model.Side.right ∧ Model.lookup (s.nodes.getX v).side (Proof.Top.belowY s v (s.nodes.getX v).last) = some Model.Side.right) (hsz : (s.nodes.getX v).height + 1 < (s.path.getX (Proof.Top.dsY s v)).size) (hpt : (s.nodes.getX ((s.path.getX (Proof.Top.dsY s v)).getX ((s.nodes.getX v).height + 1))).lab? (Proof.Top.dsT s v) = some pt) (htb : (s.nodes.getX (Proof.Top.dsT s v)).lab? (Proof.Top.belowY s v (Proof.Top.dsY s v)) = some tb) (hpv : (s.nodes.getX ((s.path.getX (Proof.Top.dsY s v)).getX ((s.nodes.getX v).height + 1))).lab? v = some pv) (hvb : (s.nodes.getX v).lab? (Proof.Top.belowY s v (Proof.Top.dsY s v)) = some vb) (hold : pv <<< ((s.nodes.getX v).height * s.P.beta) ||| vb <<< (((s.nodes.getX v).height - 1) * s.P.beta) ≤ (s.C.getX (Proof.Top.dsY s v)).tag) (hok : Proof.TagOK s (Proof.Top.dsY s v) (Proof.Top.dsTag s v pt tb pv vb)) (h1 : 1 ≤ (s.nodes.getX v).height) (hpsz : (s.path.getX (Proof.Top.dsY s v)).size = s.P.H + 1) (htbB : tb < 2 ^ s.P.beta) (hvbB : vb < 2 ^ s.P.beta) (htv : Proof.Top.dsT s v ≠ v) (hvs : v < s.nodes.size) (hts : Proof.Top.dsT s v < s.nodes.size) (hys : Proof.Top.dsY s v < s.C.size) (hnf : notPrep s (s.nodes.getX v).first) (hnl : notPrep s (s.nodes.getX v).last) (hvN : v < κ.tbl Tbl.N) (htN : Proof.Top.dsT s v < κ.tbl Tbl.N) (hvsd : v < κ.lrec LK.side) (hvr : v < κ.lrec LK.table) (htr : Proof.Top.dsT s v < κ.lrec LK.table) (hprr : (s.path.getX (Proof.Top.dsY s v)).getX ((s.nodes.getX v).height + 1) < κ.lrec LK.table) (hfC : (s.nodes.getX v).first < κ.tbl Tbl.C) (hlC : (s.nodes.getX v).last < κ.tbl Tbl.C) (hyP : (s.C.getX (Proof.Top.dsY s v)).prev < κ.tbl Tbl.C) (hyN : (s.C.getX (Proof.Top.dsY s v)).next < κ.tbl Tbl.C) (hw : (s.nodes.getX v).height + 1 < κ.pw) :
                                                DSAgree κ s v (1100 + 80 * (s.nodes.getX v).side.length + 40 * (s.nodes.getX ((s.path.getX (Proof.Top.dsY s v)).getX ((s.nodes.getX v).height + 1))).table.length + 20 * (s.nodes.getX (Proof.Top.dsT s v)).table.length + 20 * (s.nodes.getX v).table.length)
                                                theorem OrderMaintenance.Impl.dsAgree_finish {κ : Caps} {s : Model.Core} {v B : ℕ} (hal : (s.nodes.getX v).alive = true) (hf : (s.nodes.getX v).first = Model.NIL) (hnd : (s.nodes.getX v).inTables.Nodup) (hT : ∀ T ∈ (s.nodes.getX v).inTables, v ∈ (s.nodes.getX T).order) (hv0 : v ≠ 0) (hvs : v < s.nodes.size) (hvo : (s.nodes.getX v).height - 1 ≠ 0 → v ∉ (s.nodes.getX v).order) (hvN : v < κ.tbl Tbl.N) (hvr : v < κ.lrec LK.table) (hvi : v < κ.lrec LK.inTab) (ht1 : (s.nodes.getX v).t1 < κ.tbl Tbl.N) (ht2 : (s.nodes.getX v).t2 < κ.tbl Tbl.N) (hcE : ∀ e ∈ (s.nodes.getX v).order, ((s.nodes.getX v).height - 1 = 0 → e < κ.lrec LK.cin ∧ (s.cin.getX e).length ≤ κ.lcap LK.cin ∧ (s.cin.getX e).length ≤ B) ∧ ((s.nodes.getX v).height - 1 ≠ 0 → e < κ.lrec LK.inTab ∧ (s.nodes.getX e).inTables.length ≤ κ.lcap LK.inTab ∧ (s.nodes.getX e).inTables.length ≤ B)) (hcT : ∀ T ∈ (s.nodes.getX v).inTables, T < κ.lrec LK.table ∧ T < κ.lrec LK.side ∧ (s.nodes.getX T).table.length ≤ κ.lcap LK.table ∧ (s.nodes.getX T).side.length ≤ κ.lcap LK.side ∧ (s.nodes.getX T).table.length ≤ B ∧ (s.nodes.getX T).side.length ≤ B) :
                                                DSAgree κ s v (300 + (s.nodes.getX v).table.length * (171 + 100 * B) + (s.nodes.getX v).inTables.length * (301 + 200 * B))
                                                theorem OrderMaintenance.Impl.sdAgree_noop {κ : Caps} {t : Model.Core} {v : ℕ} (hno : (Proof.Top.sKids t v).length < 2 ∨ Proof.Top.sH t v > 1 ∧ Proof.Top.sK t v = 0) (hv : v < t.nodes.size) (hcN : t.nodes.size ≤ κ.tbl Tbl.N) (hcrc : t.nodes.size ≤ κ.lrec LK.children) (hks : Proof.Top.sH t v ≠ 1 → ∀ e ∈ (t.nodes.getX v).children, e < κ.tbl Tbl.N) :
                                                SDAgree κ t v (230 + 300 * (t.nodes.getX v).children.length)
                                                theorem OrderMaintenance.Impl.sdAgree_ok {κ : Caps} {t : Model.Core} {v B : ℕ} {side : List (ℕ × Model.Side)} (hk2 : 2 ≤ (Proof.Top.sKids t v).length) (hk0 : ¬(Proof.Top.sH t v > 1 ∧ Proof.Top.sK t v = 0)) (hside : Proof.Top.sSideO t v = some side) (hroom : ∀ T ∈ (t.nodes.getX v).inTables, Proof.Top.RoomOK t v T) (hnd : (t.nodes.getX v).inTables.Nodup) (hall : ∀ e ∈ Proof.Top.sKids t v, (Model.lookup side e).isSome = true) (hpar : v ∈ (t.nodes.getX (t.nodes.getX v).livePar).children) (hv : v < t.nodes.size) (hvT : v ∉ (t.nodes.getX v).inTables) (hvk : Proof.Top.sH t v ≠ 1 → v ∉ (t.nodes.getX v).children) (hK : Proof.Top.sH t v - 1 ≠ 0 → ∀ e ∈ List.map (fun (x : ℕ × ℕ) => x.1) (t.nodes.getX v).table, e < t.nodes.size) (hKN : ∀ e ∈ List.map (fun (x : ℕ × ℕ) => x.1) (t.nodes.getX v).table, e < κ.tbl Tbl.N ∧ (Proof.Top.sH t v - 1 = 0 → e < κ.lrec LK.cin)) (hks : Proof.Top.sH t v ≠ 1 → ∀ e ∈ (t.nodes.getX v).children, e < t.nodes.size) (hksl : Proof.Top.sH t v = 1 → ∀ e ∈ (t.nodes.getX v).children, e < κ.arr AF.lpar) (hp : (t.nodes.getX v).livePar < t.nodes.size) (hpv : (t.nodes.getX v).livePar ≠ v) (hB : ∀ T ∈ (t.nodes.getX v).inTables, (t.nodes.getX T).table.length ≤ B ∧ (t.nodes.getX T).side.length ≤ B) (hcN : t.nodes.size + 2 ≤ κ.tbl Tbl.N) (hcrc : t.nodes.size + 2 ≤ κ.lrec LK.children) (hcrs : t.nodes.size + 2 ≤ κ.lrec LK.side) (hcrt : t.nodes.size + 2 ≤ κ.lrec LK.table) (hcri : t.nodes.size + 2 ≤ κ.lrec LK.inTab) (hcT : ∀ T ∈ (t.nodes.getX v).inTables, (t.nodes.getX T).table.length + 2 ≤ κ.lcap LK.table ∧ (t.nodes.getX T).side.length + 2 ≤ κ.lcap LK.side) (hcS : 2 * (t.nodes.getX v).table.length + 1 ≤ κ.lcap LK.side) (hcTv : (t.nodes.getX v).table.length ≤ κ.lcap LK.table) (hcI : (t.nodes.getX v).inTables.length ≤ κ.lcap LK.inTab) (hc4 : ∀ e ∈ List.map (fun (x : ℕ × ℕ) => x.1) (t.nodes.getX v).table, tabsLen t (Proof.Top.sH t v - 1) e + 2 * (t.nodes.getX v).table.length ≤ if Proof.Top.sH t v ≤ 1 then κ.lcap LK.cin else κ.lcap LK.inTab) (hcC : (t.nodes.getX v).children.length ≤ κ.lcap LK.children) (hcP : (t.nodes.getX (t.nodes.getX v).livePar).children.length + 1 ≤ κ.lcap LK.children) :