Documentation

LeanPool.OrderMaintenance.Impl.StartDrain

M6: startDrain at Level M #

The program builds the side list of v first (in place), so until its last step its state is Level F's stage with v's side list already set: φ X = X with side v := side. Every stage after the side list touches other nodes or other fields, so it commutes with φ, and the last step sets side v := side anyway.

Level F's state with v's side list already set.

Equations
  • One or more equations did not get rendered due to their size.
Instances For
    theorem OrderMaintenance.Impl.put_side_phi (X : Model.Core) (v : ℕ) (side : List (ℕ × Model.Side)) :
    LK.put X v (encS side) LK.side = phiS v side X
    theorem OrderMaintenance.Impl.Array.modify_push_lt {α : Type} (a : Array α) (x : α) (f : α → α) {i : ℕ} (hi : i < a.size) :
    (a.modify i f).push x = (a.push x).modify i f

    Steps #

    theorem OrderMaintenance.Impl.evalF_pushN_ok {κ : Caps} {s : Model.Core} {L : Loc} {x : Machine.Reg} (h : s.nodes.size < κ.tbl Tbl.N) :
    evalF κ (Stm.push Tbl.N x) 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.push default, path := s.path, cin := s.cin, lpar := s.lpar } (Machine.State.upd L x s.nodes.size) pushCost
    theorem OrderMaintenance.Impl.evalF_wrN_ok {κ : Caps} {s : Model.Core} {L : Loc} {k : NF} {i e : Exp} {j w : ℕ} (hi : Exp.ev κ s L i = some j) (he : Exp.ev κ s L e = some w) (hj : j < s.nodes.size) (hk : NF.ok w k = true) :
    evalF κ (Stm.wr (Fld.n k) i e) 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 (x : Model.Node) => NF.set x w k, path := s.path, cin := s.cin, lpar := s.lpar } L (1 + i.cost + e.cost)

    Stage 1: the two new nodes #

    Allocate the two drain targets at the source node's height.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      theorem OrderMaintenance.Impl.newNodesS_ok {κ : Caps} {t : Model.Core} {L : Loc} {v : ℕ} {side : List (ℕ × Model.Side)} (hh : L "h" = Proof.Top.sH t v) (hv : v < t.nodes.size) (hcap : t.nodes.size + 2 ≤ κ.tbl Tbl.N) :
      ∃ (L' : Loc), evalF κ newNodesS (phiS v side t) L = Res.ok (phiS v side (Proof.Top.sd1 t v)) L' (2 * pushCost + 6) ∧ L' "v1" = t.nodes.size ∧ L' "v2" = t.nodes.size + 1 ∧ ∀ (r : String), r ≠ "v1" → r ≠ "v2" → L' r = L r

      Stage 2: v1, v2 around v in every table holding v #

      theorem OrderMaintenance.Impl.Array.modify_comm {α : Type} (a : Array α) {i j : ℕ} (h : i ≠ j) (f g : α → α) :
      (a.modify i f).modify j g = (a.modify j g).modify i f
      theorem OrderMaintenance.Impl.fold_modify_getX_notin {f : Array Model.Node → ℕ → Array Model.Node} (hf : ∀ (ns : Array Model.Node) (T u : ℕ), u ≠ T → (f ns T).getX u = ns.getX u) {u : ℕ} (l : List ℕ) (a : Array Model.Node) :
      u ∉ l → (List.foldl f a l).getX u = a.getX u
      theorem OrderMaintenance.Impl.fold_modify_size {f : Array Model.Node → ℕ → Array Model.Node} (hf : ∀ (ns : Array Model.Node) (T : ℕ), (f ns T).size = ns.size) (l : List ℕ) (a : Array Model.Node) :
      (List.foldl f a l).size = a.size

      Level F after the insertions into the first j tables.

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

        The drain-start state after updating the first j enclosing tables.

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

          Insert both drain targets around the source in one enclosing table.

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

            Insert both drain targets into every table containing the source.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              theorem OrderMaintenance.Impl.nodup_getElem_notin_take {l : List ℕ} (hnd : l.Nodup) {j : ℕ} (hj : j < l.length) :
              l[j] ∉ List.take j l
              theorem OrderMaintenance.Impl.aroundStep_getX (t : Model.Core) (v : ℕ) (ns : Array Model.Node) (T u : ℕ) (h : u ≠ T) :
              (aroundStep t v ns T).getX u = ns.getX u
              theorem OrderMaintenance.Impl.sdJ_getX_notin {t : Model.Core} {v j u : ℕ} (hu : u ∉ List.take j (t.nodes.getX v).inTables) (hlt : u < t.nodes.size) :
              (sdJ t v j).nodes.getX u = t.nodes.getX u
              theorem OrderMaintenance.Impl.sdJ_succ (t : Model.Core) (v j : ℕ) (hj : j < (t.nodes.getX v).inTables.length) :
              (sdJ t v (j + 1)).nodes = aroundStep t v (sdJ t v j).nodes (t.nodes.getX v).inTables[j]
              theorem OrderMaintenance.Impl.phiS_getX_ne {v u : ℕ} {side : List (ℕ × Model.Side)} {X : Model.Core} (h : u ≠ v) :
              (phiS v side X).nodes.getX u = X.nodes.getX u
              theorem OrderMaintenance.Impl.phiS_getX_self {v : ℕ} {side : List (ℕ × Model.Side)} {X : Model.Core} (h : v < X.nodes.size) :
              (phiS v side X).nodes.getX v = have __src := X.nodes.getX v; { height := __src.height, livePar := __src.livePar, children := __src.children, weight := __src.weight, table := __src.table, inTables := __src.inTables, first := __src.first, last := __src.last, draining := __src.draining, t1 := __src.t1, t2 := __src.t2, side := side, overflowOf := __src.overflowOf, alive := __src.alive }
              theorem OrderMaintenance.Impl.insStep_ok {κ : Caps} {t : Model.Core} {L : Loc} {v j B : ℕ} {side : List (ℕ × Model.Side)} (hv : v < t.nodes.size) (hnd : (t.nodes.getX v).inTables.Nodup) (hvT : v ∉ (t.nodes.getX v).inTables) (hroom : ∀ T ∈ (t.nodes.getX v).inTables, Proof.Top.RoomOK t v T) (hj : j < (t.nodes.getX v).inTables.length) (hLv : L "v" = v) (hLv1 : L "v1" = t.nodes.size) (hLv2 : L "v2" = t.nodes.size + 1) (hvi : v < κ.lrec LK.inTab) (hcapT : ∀ T ∈ (t.nodes.getX v).inTables, T < κ.lrec LK.table ∧ T < κ.lrec LK.side ∧ T < κ.tbl Tbl.N ∧ (t.nodes.getX T).table.length + 2 ≤ κ.lcap LK.table ∧ (t.nodes.getX T).side.length + 2 ≤ κ.lcap LK.side) (hB : ∀ T ∈ (t.nodes.getX v).inTables, (t.nodes.getX T).table.length ≤ B ∧ (t.nodes.getX T).side.length ≤ B) :
              ∃ (L' : Loc) (c : ℕ), evalF κ insBody (phiS v side (sdJ t v j)) (Machine.State.upd L "j" j) = Res.ok (phiS v side (sdJ t v (j + 1))) L' c ∧ c ≤ 1000 + 400 * B ∧ ∀ (r : String), r ≠ "j" → r ≠ "T" → r ≠ "a" → r ≠ "b" → L' r = L r
              theorem OrderMaintenance.Impl.insS_ok {κ : Caps} {t : Model.Core} {L : Loc} {v B : ℕ} {side : List (ℕ × Model.Side)} (hv : v < t.nodes.size) (hnd : (t.nodes.getX v).inTables.Nodup) (hvT : v ∉ (t.nodes.getX v).inTables) (hroom : ∀ T ∈ (t.nodes.getX v).inTables, Proof.Top.RoomOK t v T) (hLv : L "v" = v) (hLv1 : L "v1" = t.nodes.size) (hLv2 : L "v2" = t.nodes.size + 1) (hvi : v < κ.lrec LK.inTab) (hcapT : ∀ T ∈ (t.nodes.getX v).inTables, T < κ.lrec LK.table ∧ T < κ.lrec LK.side ∧ T < κ.tbl Tbl.N ∧ (t.nodes.getX T).table.length + 2 ≤ κ.lcap LK.table ∧ (t.nodes.getX T).side.length + 2 ≤ κ.lcap LK.side) (hB : ∀ T ∈ (t.nodes.getX v).inTables, (t.nodes.getX T).table.length ≤ B ∧ (t.nodes.getX T).side.length ≤ B) :
              ∃ (L' : Loc) (c : ℕ), evalF κ insS (phiS v side (Proof.Top.sd1 t v)) L = Res.ok (phiS v side (Proof.Top.sd2 t v)) L' c ∧ c ≤ 5 + (t.nodes.getX v).inTables.length * (1001 + 400 * B) ∧ ∀ (r : String), r ≠ "m" → r ≠ "j" → r ≠ "T" → r ≠ "a" → r ≠ "b" → L' r = L r

              Stage 3: the tables of v1, v2 #

              drainEntries' test for entry e of v's table.

              Equations
              Instances For

                q := entry e is a drain entry on side sd (locals v h e sd).

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

                  Decide whether a table entry belongs to the selected side of the drain.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    structure OrderMaintenance.Impl.ReadOK (St t : Model.Core) (v : ℕ) (side : List (ℕ × Model.Side)) :

                    What selS reads agrees with Level F's state t.

                    Instances For
                      theorem OrderMaintenance.Impl.selS_ok {κ : Caps} {St t : Model.Core} {L : Loc} {v e : ℕ} {side : List (ℕ × Model.Side)} {sd : Model.Side} (hR : ReadOK St t v side) (hLv : L "v" = v) (hLh : L "h" = Proof.Top.sH t v) (hLe : L "e" = e) (hLs : L "sd" = sideN sd) (hvc : v < κ.lrec LK.children) (hvs : v < κ.lrec LK.side) (heN : e < κ.tbl Tbl.N) :
                      ∃ (L' : Loc) (c : ℕ), evalF κ selS St L = Res.ok St L' c ∧ (L' "q" = if entOK t v e = true ∧ Model.lookup side e = some sd then 1 else 0) ∧ c ≤ 120 + 20 * (t.nodes.getX v).children.length + 20 * side.length ∧ ∀ (r : String), r ≠ "r" → r ≠ "m" → r ≠ "f" → r ≠ "x" → r ≠ "q" → L' r = L r
                      def OrderMaintenance.Impl.selP (t : Model.Core) (v : ℕ) (side : List (ℕ × Model.Side)) (sd : Model.Side) (e : ℕ) :

                      The entries of v's table that go to the new node on side sd.

                      Equations
                      Instances For

                        Filter a node's table entries by the requested drain side.

                        Equations
                        Instances For

                          evenTable with the spacing st.

                          Equations
                          Instances For
                            theorem OrderMaintenance.Impl.evT_append (st : ℕ) (l : List ℕ) (e : ℕ) :
                            evT st (l ++ [e]) = evT st l ++ [(e, (l.length + 1) * st)]
                            theorem OrderMaintenance.Impl.foldl_count (p : ℕ → Bool) (l : List ℕ) (n : ℕ) :
                            n ≤ l.length → List.foldl (fun (c j : ℕ) => c + if p (l.getD j 0) = true then 1 else 0) 0 (List.range n) = (List.filter p (List.take n l)).length
                            theorem OrderMaintenance.Impl.ReadOK.put_table {St t : Model.Core} {v w : ℕ} {side : List (ℕ × Model.Side)} (hR : ReadOK St t v side) (hw : w ≠ v) (l : List (ℕ × ℕ)) :
                            ReadOK (LK.put St w l LK.table) t v side

                            Count one table entry when it belongs to the selected drain side.

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

                              Append a selected table entry with its evenly spaced target label.

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

                                The table of a new node w: the drain entries of side sd, evenly labelled.

                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  theorem OrderMaintenance.Impl.count_selected_entries {κ : Caps} {St t : Model.Core} {L : Loc} {v : ℕ} {side : List (ℕ × Model.Side)} {sd : Model.Side} (hR : ReadOK St t v side) (hLv : L "v" = v) (hLh : L "h" = Proof.Top.sH t v) (hLs : L "sd" = sideN sd) (hvc : v < κ.lrec LK.children) (hvs : v < κ.lrec LK.side) (hvt : v < κ.lrec LK.table) (hN : ∀ e ∈ List.map (fun (x : ℕ × ℕ) => x.1) (t.nodes.getX v).table, e < κ.tbl Tbl.N) :
                                  have n := (t.nodes.getX v).table.length; have L2 := Machine.State.upd (Machine.State.upd L "nt" n) "cnt" 0; ∃ (L3 : Loc) (c3 : ℕ), evalF κ (Stm.loop "j" (Exp.var "nt") cntBody) St L2 = Res.ok St L3 c3 ∧ c3 ≤ 1 + (Exp.var "nt").cost + n * (1 + (140 + 20 * (t.nodes.getX v).children.length + 20 * side.length)) ∧ (∀ (r : String), r ≠ "cnt" → r ≠ "j" → r ≠ "e" → r ≠ "r" → r ≠ "m" → r ≠ "f" → r ≠ "x" → r ≠ "q" → L3 r = L2 r) ∧ L3 "cnt" = (part t v side sd).length

                                  Count selected entries, recording the exact counter value and preserved registers.

                                  theorem OrderMaintenance.Impl.tabS_ok {κ : Caps} {St t : Model.Core} {L : Loc} {v w : ℕ} {side : List (ℕ × Model.Side)} {sd : Model.Side} (hR : ReadOK St t v side) (hP : St.P = t.P) (hw0 : (St.nodes.getX w).table = []) (hwv : w ≠ v) (hws : w < St.nodes.size) (hLv : L "v" = v) (hLw : L "w" = w) (hLh : L "h" = Proof.Top.sH t v) (hLs : L "sd" = sideN sd) (hvc : v < κ.lrec LK.children) (hvs : v < κ.lrec LK.side) (hvt : v < κ.lrec LK.table) (hwt : w < κ.lrec LK.table) (hN : ∀ e ∈ List.map (fun (x : ℕ × ℕ) => x.1) (t.nodes.getX v).table, e < κ.tbl Tbl.N) (hcap : (t.nodes.getX v).table.length ≤ κ.lcap LK.table) :
                                  ∃ (L' : Loc) (c : ℕ), evalF κ tabS St L = Res.ok (LK.put St w (Model.evenTable t.P.beta (part t v side sd)) LK.table) L' c ∧ c ≤ 20 + (t.nodes.getX v).table.length * (320 + 40 * (t.nodes.getX v).children.length + 40 * side.length) ∧ ∀ (r : String), r ≠ "nt" → r ≠ "cnt" → r ≠ "j" → r ≠ "e" → r ≠ "r" → r ≠ "m" → r ≠ "f" → r ≠ "x" → r ≠ "q" → r ≠ "st" → r ≠ "idx" → L' r = L r
                                  theorem OrderMaintenance.Impl.sd2_getX_v {t : Model.Core} {v : ℕ} (hv : v < t.nodes.size) (hvT : v ∉ (t.nodes.getX v).inTables) :
                                  theorem OrderMaintenance.Impl.sd2_getX_new {t : Model.Core} {v u : ℕ} (hroom : ∀ T ∈ (t.nodes.getX v).inTables, Proof.Top.RoomOK t v T) (hu : t.nodes.size ≤ u) (hu2 : u < t.nodes.size + 2) :
                                  (Proof.Top.sd2 t v).nodes.getX u = { height := Proof.Top.sH t v }
                                  theorem OrderMaintenance.Impl.ReadOK.of_sd2 {t : Model.Core} {v : ℕ} {side : List (ℕ × Model.Side)} (hv : v < t.nodes.size) (hvT : v ∉ (t.nodes.getX v).inTables) :
                                  ReadOK (phiS v side (Proof.Top.sd2 t v)) t v side
                                  theorem OrderMaintenance.Impl.ReadOK.put_inTab {St t : Model.Core} {v w : ℕ} {side : List (ℕ × Model.Side)} (hR : ReadOK St t v side) (hw : w ≠ v) (l : List (ℕ × ℕ)) :
                                  ReadOK (LK.put St w l LK.inTab) t v side
                                  theorem OrderMaintenance.Impl.newTabS_ok {κ : Caps} {St t : Model.Core} {L : Loc} {v w : ℕ} {side : List (ℕ × Model.Side)} {sd : Model.Side} (hR : ReadOK St t v side) (hP : St.P = t.P) (hw0 : (St.nodes.getX w).table = []) (hw1 : (St.nodes.getX w).inTables = []) (hwv : w ≠ v) (hws : w < St.nodes.size) (hvi : (St.nodes.getX v).inTables = (t.nodes.getX v).inTables) (hLv : L "v" = v) (hLw : L "w" = w) (hLh : L "h" = Proof.Top.sH t v) (hLs : L "sd" = sideN sd) (hvc : v < κ.lrec LK.children) (hvs : v < κ.lrec LK.side) (hvt : v < κ.lrec LK.table) (hwt : w < κ.lrec LK.table) (hvI : v < κ.lrec LK.inTab) (hwI : w < κ.lrec LK.inTab) (hN : ∀ e ∈ List.map (fun (x : ℕ × ℕ) => x.1) (t.nodes.getX v).table, e < κ.tbl Tbl.N) (hcap : (t.nodes.getX v).table.length ≤ κ.lcap LK.table) (hcapI : (t.nodes.getX v).inTables.length ≤ κ.lcap LK.inTab) :
                                  ∃ (L' : Loc) (c : ℕ), evalF κ newTabS St L = Res.ok (LK.put (LK.put St w (List.map (fun (e : ℕ) => (e, 0)) (t.nodes.getX v).inTables) LK.inTab) w (Model.evenTable t.P.beta (part t v side sd)) LK.table) L' c ∧ c ≤ 30 + 40 * (t.nodes.getX v).inTables.length + (t.nodes.getX v).table.length * (320 + 40 * (t.nodes.getX v).children.length + 40 * side.length) ∧ ∀ (r : String), r ≠ "a" → r ≠ "n" → r ≠ "j" → r ≠ "nt" → r ≠ "cnt" → r ≠ "e" → r ≠ "r" → r ≠ "m" → r ≠ "f" → r ≠ "x" → r ≠ "q" → r ≠ "st" → r ≠ "idx" → L' r = L r

                                  Build the left and right target tables from their selected drain entries.

                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For
                                    theorem OrderMaintenance.Impl.put_getX_ne_t {St : Model.Core} {w u : ℕ} {l : List (ℕ × ℕ)} (h : u ≠ w) :
                                    (LK.put St w l LK.table).nodes.getX u = St.nodes.getX u
                                    theorem OrderMaintenance.Impl.put_getX_ne_i {St : Model.Core} {w u : ℕ} {l : List (ℕ × ℕ)} (h : u ≠ w) :
                                    (LK.put St w l LK.inTab).nodes.getX u = St.nodes.getX u
                                    theorem OrderMaintenance.Impl.stage3S_ok {κ : Caps} {t : Model.Core} {L : Loc} {v : ℕ} {side : List (ℕ × Model.Side)} (hv : v < t.nodes.size) (hvT : v ∉ (t.nodes.getX v).inTables) (hroom : ∀ T ∈ (t.nodes.getX v).inTables, Proof.Top.RoomOK t v T) (hLv : L "v" = v) (hLv1 : L "v1" = t.nodes.size) (hLv2 : L "v2" = t.nodes.size + 1) (hLh : L "h" = Proof.Top.sH t v) (hvc : v < κ.lrec LK.children) (hvs : v < κ.lrec LK.side) (hvt : v < κ.lrec LK.table) (hwt : t.nodes.size + 1 < κ.lrec LK.table) (hvI : v < κ.lrec LK.inTab) (hwI : t.nodes.size + 1 < κ.lrec LK.inTab) (hN : ∀ e ∈ List.map (fun (x : ℕ × ℕ) => x.1) (t.nodes.getX v).table, e < κ.tbl Tbl.N) (hcap : (t.nodes.getX v).table.length ≤ κ.lcap LK.table) (hcapI : (t.nodes.getX v).inTables.length ≤ κ.lcap LK.inTab) :
                                    ∃ (L' : Loc) (c : ℕ), evalF κ stage3S (phiS v side (Proof.Top.sd2 t v)) L = Res.ok (phiS v side (Proof.Top.sd4 t v side)) L' c ∧ c ≤ 70 + 80 * (t.nodes.getX v).inTables.length + 2 * ((t.nodes.getX v).table.length * (320 + 40 * (t.nodes.getX v).children.length + 40 * side.length)) ∧ ∀ (r : String), r ≠ "w" → r ≠ "sd" → r ≠ "a" → r ≠ "n" → r ≠ "j" → r ≠ "nt" → r ≠ "cnt" → r ≠ "e" → r ≠ "r" → r ≠ "m" → r ≠ "f" → r ≠ "x" → r ≠ "q" → r ≠ "st" → r ≠ "idx" → L' r = L r

                                    Stage 4: the entries learn their new tables #

                                    Record one newly built table in an entry's containing-table list.

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

                                      Record the new table membership of every entry in one drain target.

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

                                        How long a list of tables can get during the loop.

                                        Equations
                                        Instances For
                                          theorem OrderMaintenance.Impl.atS_ok {κ : Caps} {St : Model.Core} {L : Loc} {w hh : ℕ} {l : List ℕ} (hLw : L "w" = w) (hLh : L "h" = hh) (hwt : w < κ.lrec LK.table) (hkeys : List.map (fun (x : ℕ × ℕ) => x.1) (St.nodes.getX w).table = l) (hE : ∀ e ∈ l, (hh ≤ 1 → e < κ.lrec LK.cin) ∧ (1 < hh → e < κ.lrec LK.inTab ∧ e < St.nodes.size)) (hcap : ∀ e ∈ l, tabsLen St (hh - 1) e + l.length ≤ if hh ≤ 1 then κ.lcap LK.cin else κ.lcap LK.inTab) :
                                          ∃ (L' : Loc) (c : ℕ), evalF κ atS St L = Res.ok (List.foldl (fun (s : Model.Core) (e : ℕ) => Proof.Top.addTableS (hh - 1) w e s) St l) L' c ∧ c ≤ 5 + 40 * l.length ∧ ∀ (r : String), r ≠ "nt" → r ≠ "j" → r ≠ "e" → L' r = L r
                                          theorem OrderMaintenance.Impl.addTableS_phi (hh w e v : ℕ) (side : List (ℕ × Model.Side)) (X : Model.Core) :
                                          Proof.Top.addTableS hh w e (phiS v side X) = phiS v side (Proof.Top.addTableS hh w e X)
                                          theorem OrderMaintenance.Impl.fold_addTableS_phi (hh w v : ℕ) (side : List (ℕ × Model.Side)) (l : List ℕ) (X : Model.Core) :
                                          List.foldl (fun (s : Model.Core) (e : ℕ) => Proof.Top.addTableS hh w e s) (phiS v side X) l = phiS v side (List.foldl (fun (s : Model.Core) (e : ℕ) => Proof.Top.addTableS hh w e s) X l)
                                          theorem OrderMaintenance.Impl.fold_tabsLen (hh w u : ℕ) (l : List ℕ) (s : Model.Core) :
                                          tabsLen (List.foldl (fun (s : Model.Core) (e : ℕ) => Proof.Top.addTableS hh w e s) s l) hh u ≤ tabsLen s hh u + l.length
                                          theorem OrderMaintenance.Impl.fold_addTableS_table (hh w u : ℕ) (l : List ℕ) (s : Model.Core) :
                                          ((List.foldl (fun (s : Model.Core) (e : ℕ) => Proof.Top.addTableS hh w e s) s l).nodes.getX u).table = (s.nodes.getX u).table
                                          theorem OrderMaintenance.Impl.evenTable_keys (β : ℕ) (l : List ℕ) :
                                          List.map (fun (x : ℕ × ℕ) => x.1) (Model.evenTable β l) = l
                                          theorem OrderMaintenance.Impl.sd4_inTables {t : Model.Core} {v e : ℕ} {side : List (ℕ × Model.Side)} (he : e < t.nodes.size) :
                                          ((phiS v side (Proof.Top.sd4 t v side)).nodes.getX e).inTables = (t.nodes.getX e).inTables
                                          theorem OrderMaintenance.Impl.sd4_cin (t : Model.Core) (v : ℕ) (side : List (ℕ × Model.Side)) :
                                          (phiS v side (Proof.Top.sd4 t v side)).cin = t.cin
                                          theorem OrderMaintenance.Impl.stage4S_ok {κ : Caps} {t : Model.Core} {L : Loc} {v : ℕ} {side : List (ℕ × Model.Side)} (hv : v < t.nodes.size) (hK : 1 < Proof.Top.sH t v → ∀ e ∈ List.map (fun (x : ℕ × ℕ) => x.1) (t.nodes.getX v).table, e < t.nodes.size) (hLv1 : L "v1" = t.nodes.size) (hLv2 : L "v2" = t.nodes.size + 1) (hLh : L "h" = Proof.Top.sH t v) (hwt : t.nodes.size + 1 < κ.lrec LK.table) (hE : ∀ e ∈ List.map (fun (x : ℕ × ℕ) => x.1) (t.nodes.getX v).table, (Proof.Top.sH t v ≤ 1 → e < κ.lrec LK.cin) ∧ (1 < Proof.Top.sH t v → e < κ.lrec LK.inTab)) (hcap : ∀ 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) :
                                          ∃ (L' : Loc) (c : ℕ), evalF κ stage4S (phiS v side (Proof.Top.sd4 t v side)) L = Res.ok (phiS v side (Proof.Top.sd6 t v side)) L' c ∧ c ≤ 14 + 80 * (t.nodes.getX v).table.length ∧ ∀ (r : String), r ≠ "w" → r ≠ "nt" → r ≠ "j" → r ≠ "e" → L' r = L r

                                          Stages 5, 6: the children of v1, v2 #

                                          Test whether a live child has the currently selected drain side.

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

                                            Set an entry's live parent, using the chunk-parent array at height one.

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

                                              Transfer one selected child, repair its live parent, and accumulate its weight.

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

                                                The children on side sd, with their parent and weight updated for the new node u.

                                                Equations
                                                • One or more equations did not get rendered due to their size.
                                                Instances For
                                                  def OrderMaintenance.Impl.chRes (h u v lp wsum : ℕ) (ch : List ℕ) (St : Model.Core) :

                                                  What chS produces (Level F's sd8 / sd10 step).

                                                  Equations
                                                  • One or more equations did not get rendered due to their size.
                                                  Instances For
                                                    theorem OrderMaintenance.Impl.fold_setParentS_fields (h u x : ℕ) (l : List ℕ) (s : Model.Core) :
                                                    ((List.foldl (fun (s : Model.Core) (e : ℕ) => Proof.Top.setParentS h u e s) s l).nodes.getX x).children = (s.nodes.getX x).children ∧ ((List.foldl (fun (s : Model.Core) (e : ℕ) => Proof.Top.setParentS h u e s) s l).nodes.getX x).side = (s.nodes.getX x).side ∧ ((List.foldl (fun (s : Model.Core) (e : ℕ) => Proof.Top.setParentS h u e s) s l).nodes.getX x).weight = (s.nodes.getX x).weight
                                                    theorem OrderMaintenance.Impl.fold_setParentS_getX_notin {h u x : ℕ} (l : List ℕ) (s : Model.Core) :
                                                    h = 1 ∨ x ∉ l → (List.foldl (fun (s : Model.Core) (e : ℕ) => Proof.Top.setParentS h u e s) s l).nodes.getX x = s.nodes.getX x

                                                    Setting a parent commutes with replacing the children of another node.

                                                    theorem OrderMaintenance.Impl.put_getX_ne_c {St : Model.Core} {w u : ℕ} {l : List (ℕ × ℕ)} (h : u ≠ w) :
                                                    theorem OrderMaintenance.Impl.child_loop_ok {κ : Caps} {St t : Model.Core} {L : Loc} {v u : ℕ} {side : List (ℕ × Model.Side)} {sd : Model.Side} (huk : Proof.Top.sH t v ≠ 1 → u ∉ (t.nodes.getX v).children) (hus : u < St.nodes.size) (hks : ∀ e ∈ (t.nodes.getX v).children, (Proof.Top.sH t v ≠ 1 → e < St.nodes.size ∧ e < κ.tbl Tbl.N) ∧ (Proof.Top.sH t v = 1 → e < κ.arr AF.lpar)) (hLv : L "v" = v) (hLu : L "u" = u) (hLh : L "h" = Proof.Top.sH t v) (hLs : L "sd" = sideN sd) (hvc : v < κ.lrec LK.children) (hvs : v < κ.lrec LK.side) (huc : u < κ.lrec LK.children) (hcap : (t.nodes.getX v).children.length ≤ κ.lcap LK.children) (hput0 : LK.put St u [] LK.children = St) (hfv : ∀ (pre : List ℕ) (l : List (ℕ × ℕ)), ((LK.put (List.foldl (fun (s : Model.Core) (e : ℕ) => Proof.Top.setParentS (Proof.Top.sH t v) u e s) St pre) u l LK.children).nodes.getX v).children = (t.nodes.getX v).children ∧ ((LK.put (List.foldl (fun (s : Model.Core) (e : ℕ) => Proof.Top.setParentS (Proof.Top.sH t v) u e s) St pre) u l LK.children).nodes.getX v).side = side) (hfw : Proof.Top.sH t v ≠ 1 → ∀ (pre : List ℕ) (l : List (ℕ × ℕ)), ∀ e ∈ (t.nodes.getX v).children, ((LK.put (List.foldl (fun (s : Model.Core) (e : ℕ) => Proof.Top.setParentS (Proof.Top.sH t v) u e s) St pre) u l LK.children).nodes.getX e).weight = (t.nodes.getX e).weight) (hfs : ∀ (pre : List ℕ) (l : List (ℕ × ℕ)), (LK.put (List.foldl (fun (s : Model.Core) (e : ℕ) => Proof.Top.setParentS (Proof.Top.sH t v) u e s) St pre) u l LK.children).nodes.size = St.nodes.size) :
                                                    have kids := (t.nodes.getX v).children; have sel := fun (e : ℕ) => Model.lookup side e == some sd; have F := fun (s : Model.Core) (e : ℕ) => Proof.Top.setParentS (Proof.Top.sH t v) u e s; have L2 := Machine.State.upd (Machine.State.upd L "ws" 0) "nk" kids.length; ∃ (S' : Model.Core) (L' : Loc) (c : ℕ), evalF κ (Stm.loop "j" (Exp.var "nk") chBody) St L2 = Res.ok S' L' c ∧ c ≤ 1 + (Exp.var "nk").cost + kids.length * (1 + (130 + 20 * side.length)) ∧ S' = LK.put (List.foldl F St (List.filter sel kids)) u (List.map (fun (e : ℕ) => (e, 0)) (List.filter sel kids)) LK.children ∧ L' "ws" = (List.map (Proof.Top.sWt t v) (List.filter sel kids)).sum ∧ ∀ (r : String), r ≠ "j" → r ≠ "e" → r ≠ "f" → r ≠ "x" → r ≠ "w" → r ≠ "ws" → L' r = L2 r

                                                    The child-selection loop, preserving its parent-update and register invariants.

                                                    theorem OrderMaintenance.Impl.chS_ok {κ : Caps} {St t : Model.Core} {L : Loc} {v u : ℕ} {side : List (ℕ × Model.Side)} {sd : Model.Side} (hkids : (St.nodes.getX v).children = (t.nodes.getX v).children) (hside : (St.nodes.getX v).side = side) (hwt : Proof.Top.sH t v ≠ 1 → ∀ e ∈ (t.nodes.getX v).children, (St.nodes.getX e).weight = (t.nodes.getX e).weight) (hlp : (St.nodes.getX v).livePar = (t.nodes.getX v).livePar) (hu0 : (St.nodes.getX u).children = []) (huv : u ≠ v) (huk : Proof.Top.sH t v ≠ 1 → u ∉ (t.nodes.getX v).children) (hvk : Proof.Top.sH t v ≠ 1 → v ∉ (t.nodes.getX v).children) (hus : u < St.nodes.size) (hks : ∀ e ∈ (t.nodes.getX v).children, (Proof.Top.sH t v ≠ 1 → e < St.nodes.size ∧ e < κ.tbl Tbl.N) ∧ (Proof.Top.sH t v = 1 → e < κ.arr AF.lpar)) (hLv : L "v" = v) (hLu : L "u" = u) (hLh : L "h" = Proof.Top.sH t v) (hLs : L "sd" = sideN sd) (hvc : v < κ.lrec LK.children) (hvs : v < κ.lrec LK.side) (huc : u < κ.lrec LK.children) (hvN : v < κ.tbl Tbl.N) (hcap : (t.nodes.getX v).children.length ≤ κ.lcap LK.children) :
                                                    ∃ (L' : Loc) (c : ℕ), evalF κ chS St L = Res.ok (chRes (Proof.Top.sH t v) u v (t.nodes.getX v).livePar (List.map (Proof.Top.sWt t v) (List.filter (fun (x : ℕ) => Model.lookup side x == some sd) (t.nodes.getX v).children)).sum (List.filter (fun (x : ℕ) => Model.lookup side x == some sd) (t.nodes.getX v).children) St) L' c ∧ c ≤ 30 + (t.nodes.getX v).children.length * (140 + 20 * side.length) ∧ ∀ (r : String), r ≠ "ws" → r ≠ "nk" → r ≠ "j" → r ≠ "e" → r ≠ "f" → r ≠ "x" → r ≠ "w" → L' r = L r
                                                    theorem OrderMaintenance.Impl.setParentS_phi (h w e v : ℕ) (side : List (ℕ × Model.Side)) (X : Model.Core) :
                                                    Proof.Top.setParentS h w e (phiS v side X) = phiS v side (Proof.Top.setParentS h w e X)
                                                    theorem OrderMaintenance.Impl.fold_setParentS_phi (h w v : ℕ) (side : List (ℕ × Model.Side)) (l : List ℕ) (X : Model.Core) :
                                                    List.foldl (fun (s : Model.Core) (e : ℕ) => Proof.Top.setParentS h w e s) (phiS v side X) l = phiS v side (List.foldl (fun (s : Model.Core) (e : ℕ) => Proof.Top.setParentS h w e s) X l)
                                                    theorem OrderMaintenance.Impl.chRes_phi {h u v' lp ws v : ℕ} {ch : List ℕ} {side : List (ℕ × Model.Side)} {X : Model.Core} (huv : u ≠ v) :
                                                    chRes h u v' lp ws ch (phiS v side X) = phiS v side (chRes h u v' lp ws ch X)

                                                    Children, weight and live parent.

                                                    Equations
                                                    Instances For
                                                      theorem OrderMaintenance.Impl.CWL.trans {a b c : Model.Node} (h1 : CWL a b) (h2 : CWL b c) :
                                                      CWL a c
                                                      theorem OrderMaintenance.Impl.sd1_getX_new' (t : Model.Core) (v : ℕ) {u : ℕ} (hu : t.nodes.size ≤ u) (hu2 : u < t.nodes.size + 2) :
                                                      (Proof.Top.sd1 t v).nodes.getX u = { height := Proof.Top.sH t v }
                                                      theorem OrderMaintenance.Impl.chRes_getX_notin {h u v' lp ws x : ℕ} {ch : List ℕ} {X : Model.Core} (hx : h = 1 ∨ x ∉ ch) (hxu : x ≠ u) :
                                                      (chRes h u v' lp ws ch X).nodes.getX x = X.nodes.getX x
                                                      theorem OrderMaintenance.Impl.chRes_weight {h u v' lp ws x : ℕ} {ch : List ℕ} {X : Model.Core} (hxu : x ≠ u) :
                                                      ((chRes h u v' lp ws ch X).nodes.getX x).weight = (X.nodes.getX x).weight
                                                      theorem OrderMaintenance.Impl.chRes_size {h u v' lp ws : ℕ} {ch : List ℕ} {X : Model.Core} :
                                                      (chRes h u v' lp ws ch X).nodes.size = X.nodes.size

                                                      Transfer and weigh the children assigned to each drain target.

                                                      Equations
                                                      • One or more equations did not get rendered due to their size.
                                                      Instances For
                                                        theorem OrderMaintenance.Impl.stage56S_ok {κ : Caps} {t : Model.Core} {L : Loc} {v : ℕ} {side : List (ℕ × Model.Side)} (hv : v < t.nodes.size) (hvk : Proof.Top.sH t v ≠ 1 → v ∉ (t.nodes.getX v).children) (hks : ∀ e ∈ (t.nodes.getX v).children, (Proof.Top.sH t v ≠ 1 → e < t.nodes.size ∧ e < κ.tbl Tbl.N) ∧ (Proof.Top.sH t v = 1 → e < κ.arr AF.lpar)) (hLv : L "v" = v) (hLv1 : L "v1" = t.nodes.size) (hLv2 : L "v2" = t.nodes.size + 1) (hLh : L "h" = Proof.Top.sH t v) (hvc : v < κ.lrec LK.children) (hvs : v < κ.lrec LK.side) (huc : t.nodes.size + 1 < κ.lrec LK.children) (hvN : v < κ.tbl Tbl.N) (hcap : (t.nodes.getX v).children.length ≤ κ.lcap LK.children) :
                                                        ∃ (L' : Loc) (c : ℕ), evalF κ stage56S (phiS v side (Proof.Top.sd6 t v side)) L = Res.ok (phiS v side (Proof.Top.sd10 t v side)) L' c ∧ c ≤ 70 + 2 * ((t.nodes.getX v).children.length * (140 + 20 * side.length)) ∧ ∀ (r : String), r ≠ "u" → r ≠ "sd" → r ≠ "ws" → r ≠ "nk" → r ≠ "j" → r ≠ "e" → r ≠ "f" → r ≠ "x" → r ≠ "w" → L' r = L r

                                                        Stage 7: the parent of v takes v1, v2 in place of v #

                                                        theorem OrderMaintenance.Impl.replace1_eq (x a b : ℕ) (l : List ℕ) :
                                                        x ∈ l → l.replace1 x [a, b] = (l.set (List.findIdx (fun (x_1 : ℕ) => x_1 == x) l) a).insertIdx (List.findIdx (fun (x_1 : ℕ) => x_1 == x) l + 1) b
                                                        theorem OrderMaintenance.Impl.findIdx_pair0' (l : List ℕ) (x : ℕ) :
                                                        List.findIdx (fun (x_1 : ℕ × ℕ) => x_1.1 == x) (List.map (fun (e : ℕ) => (e, 0)) l) = List.findIdx (fun (x_1 : ℕ) => x_1 == x) l

                                                        Replace the source node by its two targets in the live parent's child list.

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

                                                          Level F after the parent's children (s11 of sdS).

                                                          Equations
                                                          • One or more equations did not get rendered due to their size.
                                                          Instances For
                                                            theorem OrderMaintenance.Impl.chRes_children (h u v' lp ws x : ℕ) (ch : List ℕ) (X : Model.Core) (hxu : x ≠ u) :
                                                            ((chRes h u v' lp ws ch X).nodes.getX x).children = (X.nodes.getX x).children
                                                            theorem OrderMaintenance.Impl.chRes_livePar_notin {h u v' lp ws x : ℕ} {ch : List ℕ} {X : Model.Core} (hx : h = 1 ∨ x ∉ ch) (hxu : x ≠ u) :
                                                            ((chRes h u v' lp ws ch X).nodes.getX x).livePar = (X.nodes.getX x).livePar
                                                            theorem OrderMaintenance.Impl.stage7S_ok {κ : Caps} {t : Model.Core} {L : Loc} {v : ℕ} {side : List (ℕ × Model.Side)} (hv : v < t.nodes.size) (hvk : Proof.Top.sH t v ≠ 1 → v ∉ (t.nodes.getX v).children) (hp : (t.nodes.getX v).livePar < t.nodes.size) (hpv : (t.nodes.getX v).livePar ≠ v) (hpar : v ∈ (t.nodes.getX (t.nodes.getX v).livePar).children) (hLv : L "v" = v) (hLv1 : L "v1" = t.nodes.size) (hLv2 : L "v2" = t.nodes.size + 1) (hpc : (t.nodes.getX v).livePar < κ.lrec LK.children) (hvN : v < κ.tbl Tbl.N) (hcap : (t.nodes.getX (t.nodes.getX v).livePar).children.length + 1 ≤ κ.lcap LK.children) :
                                                            ∃ (L' : Loc) (c : ℕ), evalF κ stage7S (phiS v side (Proof.Top.sd10 t v side)) L = Res.ok (phiS v side (sd11 t v side)) L' c ∧ c ≤ 100 + 111 * (t.nodes.getX (t.nodes.getX v).livePar).children.length ∧ ∀ (r : String), r ≠ "p" → r ≠ "r" → L' r = L r

                                                            Stage 8: v becomes a ghost #

                                                            Turn the source into a draining ghost and clear its live child list.

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

                                                              What v becomes.

                                                              Equations
                                                              • One or more equations did not get rendered due to their size.
                                                              Instances For
                                                                theorem OrderMaintenance.Impl.sdS_eq (t : Model.Core) (v : ℕ) (side : List (ℕ × Model.Side)) :
                                                                Proof.Top.sdS t v side = have __src := sd11 t v side; { 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 := __src.resJob, 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 := (sd11 t v side).nodes.modify v (ghostF t.nodes.size side), path := __src.path, cin := __src.cin, lpar := __src.lpar }
                                                                theorem OrderMaintenance.Impl.stage8S_ok {κ : Caps} {t : Model.Core} {L : Loc} {v : ℕ} {side : List (ℕ × Model.Side)} (hvs : v < (sd11 t v side).nodes.size) (hLv : L "v" = v) (hLv1 : L "v1" = t.nodes.size) (hLv2 : L "v2" = t.nodes.size + 1) (hvc : v < κ.lrec LK.children) :
                                                                ∃ (c : ℕ), evalF κ stage8S (phiS v side (sd11 t v side)) L = Res.ok (Proof.Top.sdS t v side) L c ∧ c ≤ 20

                                                                startDrain #

                                                                Detect a nonleaf cut that leaves no child on its left side.

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

                                                                  Construct a drain's side assignment, targets, tables, links and ghost source.

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

                                                                    startDrain v at Level M (local v).

                                                                    Equations
                                                                    • One or more equations did not get rendered due to their size.
                                                                    Instances For
                                                                      def OrderMaintenance.Impl.sdCost (K T I S B P : ℕ) :

                                                                      The cost bound of startDrain, in the lengths of the lists it walks.

                                                                      Equations
                                                                      • One or more equations did not get rendered due to their size.
                                                                      Instances For
                                                                        theorem OrderMaintenance.Impl.startDrainS_ok {κ : Caps} {t : Model.Core} {L : Loc} {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) (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) (hLv : L "v" = v) (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) :
                                                                        theorem OrderMaintenance.Impl.startDrainS_noop {κ : Caps} {t : Model.Core} {L : Loc} {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) (hLv : L "v" = v) (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) :
                                                                        ∃ (L' : Loc) (c : ℕ), evalF κ startDrainS t L = Res.ok t L' c ∧ c ≤ 230 + 300 * (t.nodes.getX v).children.length

                                                                        startDrain v with too few children or an empty cut above height one changes nothing.