M5: labels in tables #
A new entry next to entry e gets the midpoint of the gap on that side (roomNextTo), and is
inserted there (tableInsert). With the table split as A ++ (e, l) :: B: the run lemmas
roomNextTo_run, tableInsert_run, and the gap arithmetic gapsGe_insert_before/after: if all
gaps are at least B ≥ 2, the insertion succeeds and all gaps stay at least B / 2.
Chains with gaps #
Room next to an entry #
The upper label boundary before or after an entry, with the full-width sentinel at the end.
Equations
Instances For
theorem
OrderMaintenance.Proof.Top.roomNextTo_run
{s : Model.Core}
{t e : ℕ}
{A Bs : List (ℕ × ℕ)}
{le : ℕ}
(htab : (s.nodes.getX t).table = A ++ (e, le) :: Bs)
(hA : e ∉ List.map (fun (x : ℕ × ℕ) => x.1) A)
(before : Bool)
(hroom : roomLo A le before < roomHi s.P.beta Bs le before)
:
EStateM.run (Model.roomNextTo t e before) s = EStateM.Result.ok ((roomLo A le before + roomHi s.P.beta Bs le before - 1) / 2) s
Enough gap: the insertion succeeds and gaps halve at worst #
Two new entries around one #
theorem
OrderMaintenance.Proof.Top.gaps_room_around
{β B : ℕ}
{A Bs : List (ℕ × ℕ)}
{e le y z : ℕ}
(hB : 2 ≤ B)
(hg : GapsGe β B (List.map (fun (x : ℕ × ℕ) => x.2) (A ++ (e, le) :: Bs)))
:
Room around an entry: with all gaps at least B ≥ 2, both new labels exist, and with both
new entries all gaps stay at least B / 2.
Inserting the entry #
The side list after an insertion next to e in table T.
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
OrderMaintenance.Proof.Top.setTS
(tab : List (ℕ × ℕ))
(side : List (ℕ × Model.Side))
(n : Model.Node)
:
Updates a node table and its side map together.
Equations
- One or more equations did not get rendered due to their size.
Instances For
theorem
OrderMaintenance.Proof.Top.tableInsert_run
{s : Model.Core}
{t e new : ℕ}
{A Bs : List (ℕ × ℕ)}
{le : ℕ}
(htab : (s.nodes.getX t).table = A ++ (e, le) :: Bs)
(hA : e ∉ List.map (fun (x : ℕ × ℕ) => x.1) A)
(before : Bool)
(lab : ℕ)
(hside : (s.nodes.getX t).draining = true → (Model.lookup (s.nodes.getX t).side e).isSome = true)
:
EStateM.run (Model.tableInsert t e new before lab) s = EStateM.Result.ok PUnit.unit
{ 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 t (setTS (insTab A Bs e le new lab before) (sideAfter (s.nodes.getX t) e new)),
path := s.path, cin := s.cin, lpar := s.lpar }