Documentation

LeanPool.OrderMaintenance.Proof.Top.PresIns

M5: a chunk split keeps the invariant (the contract's start) #

insertAround x y z on the linked core succeeds, writes tags that pass their guards, and the top structure with the job's path copy completed satisfies the invariant, with the job at its start.

Room for an insertion event #

theorem OrderMaintenance.Proof.Top.gapsGe_mono {β B B' : ℕ} {ls : List ℕ} (h : B' ≤ B) (hg : GapsGe β B ls) :
GapsGe β B' ls
theorem OrderMaintenance.Proof.Top.gapB_succ (β n d : ℕ) :
gapB β n (d + 1) = gapB β n d / 2
theorem OrderMaintenance.Proof.Top.gap_two {β n0 dr D nmax : ℕ} (hn0 : n0 ≤ nmax) (hdr : dr + 1 ≤ D) (hroom : 2 ^ D * (nmax + 1) ≤ 2 ^ β) :
2 ≤ gapB β n0 dr

Between jobs #

theorem OrderMaintenance.Proof.Top.Timing.fund_lt {s : TS} {cl : List ℕ} (Ti : Timing s cl none) (hTP : TopParams s.P) {v : ℕ} (hg : ghostN s v) :
fundOf s cl v + 1 ≤ Kd s.P (ht s v)

Between jobs, a running drain has had fewer than K_h funding jobs.

theorem OrderMaintenance.Proof.Top.Timing.tw_live {s : TS} {cl : List ℕ} {ord : ℕ → List ℕ} (S : Shape s cl ord) (Ti : Timing s cl none) (hTP : TopParams s.P) {u : ℕ} (hu : liveN s u) (hp : (nd s u).livePar ≠ Model.NIL) :
tw s cl u ≤ Wd s.P (ht s u)

Between jobs, a live non-root node weighs at most W_h.

The split's tables have room #

theorem OrderMaintenance.Proof.Top.table_split {t : List (ℕ × ℕ)} {e : ℕ} (he : e ∈ List.map (fun (x : ℕ × ℕ) => x.1) t) :
∃ (A : List (ℕ × ℕ)) (le : ℕ) (Bs : List (ℕ × ℕ)), t = A ++ (e, le) :: Bs ∧ e ∉ List.map (fun (x : ℕ × ℕ) => x.1) A
theorem OrderMaintenance.Proof.Top.start_room {s : TS} {cl : List ℕ} {ord : ℕ → List ℕ} {dr n0 : ℕ → ℕ} (hI : InvJ s cl ord dr n0 none) (hTP : TopParams s.P) {x T : ℕ} (hx : x ∈ cl) (hT : T ∈ cinT s x) (y z : ℕ) :
∃ (A : List (ℕ × ℕ)) (le : ℕ) (Bs : List (ℕ × ℕ)), (nd s T).table = A ++ (x, le) :: Bs ∧ x ∉ List.map (fun (x : ℕ × ℕ) => x.1) A ∧ ((nd s T).draining = true → (Model.lookup (nd s T).side x).isSome = true) ∧ roomLo A le true < roomHi s.P.beta Bs le true ∧ roomLo A le false < roomHi s.P.beta Bs le false ∧ 2 ≤ gapB s.P.beta (n0 T) (dr T) ∧ GapsGe s.P.beta (gapB s.P.beta (n0 T) (dr T) / 2) (List.map (fun (x : ℕ × ℕ) => x.2) (A ++ (y, (roomLo A le true + roomHi s.P.beta Bs le true - 1) / 2) :: (x, le) :: (z, (roomLo A le false + roomHi s.P.beta Bs le false - 1) / 2) :: Bs))

The tables of the split chunk have room on both sides of it.

Views of the state after the split #

theorem OrderMaintenance.Proof.Top.InsFrame.height {s : Model.Core} {x f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) (u : ℕ) :
(nd t u).height = (nd (ts s) u).height
theorem OrderMaintenance.Proof.Top.InsFrame.livePar {s : Model.Core} {x f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) (u : ℕ) :
(nd t u).livePar = (nd (ts s) u).livePar
theorem OrderMaintenance.Proof.Top.InsFrame.weight {s : Model.Core} {x f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) (u : ℕ) :
(nd t u).weight = (nd (ts s) u).weight
theorem OrderMaintenance.Proof.Top.InsFrame.inTables {s : Model.Core} {x f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) (u : ℕ) :
(nd t u).inTables = (nd (ts s) u).inTables
theorem OrderMaintenance.Proof.Top.InsFrame.draining {s : Model.Core} {x f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) (u : ℕ) :
(nd t u).draining = (nd (ts s) u).draining
theorem OrderMaintenance.Proof.Top.InsFrame.t1 {s : Model.Core} {x f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) (u : ℕ) :
(nd t u).t1 = (nd (ts s) u).t1
theorem OrderMaintenance.Proof.Top.InsFrame.t2 {s : Model.Core} {x f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) (u : ℕ) :
(nd t u).t2 = (nd (ts s) u).t2
theorem OrderMaintenance.Proof.Top.InsFrame.overflowOf {s : Model.Core} {x f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) (u : ℕ) :
(nd t u).overflowOf = (nd (ts s) u).overflowOf
theorem OrderMaintenance.Proof.Top.InsFrame.alive {s : Model.Core} {x f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) (u : ℕ) :
(nd t u).alive = (nd (ts s) u).alive
theorem OrderMaintenance.Proof.Top.InsFrame.first {s : Model.Core} {x f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) (u : ℕ) :
(nd t u).first = insFirst s x u
theorem OrderMaintenance.Proof.Top.InsFrame.last {s : Model.Core} {x f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) (u : ℕ) :
(nd t u).last = insLast s x u
theorem OrderMaintenance.Proof.Top.InsFrame.table {s : Model.Core} {x f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) (u : ℕ) :
(nd t u).table = if u ∈ s.cin.getX x ∧ u < s.nodes.size then aroundT (s.nodes.getX u).table x s.C.size (s.C.size + 1) (insF s x u).1 (insF s x u).2 else (s.nodes.getX u).table
theorem OrderMaintenance.Proof.Top.InsFrame.side {s : Model.Core} {x f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) (u : ℕ) :
(nd t u).side = if u ∈ s.cin.getX x ∧ u < s.nodes.size then sideAround (s.nodes.getX u) x s.C.size (s.C.size + 1) else (s.nodes.getX u).side
theorem OrderMaintenance.Proof.Top.InsFrame.children {s : Model.Core} {x f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) (u : ℕ) :
theorem OrderMaintenance.Proof.Top.InsFrame.par_pos {s : Model.Core} {x f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) {h : ℕ} (hh : 1 ≤ h) (e : ℕ) :
par t h e = par (ts s) h e
theorem OrderMaintenance.Proof.Top.InsFrame.ht {s : Model.Core} {x f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) (u : ℕ) :
Top.ht t u = Top.ht (ts s) u
theorem OrderMaintenance.Proof.Top.InsFrame.isN {s : Model.Core} {x f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) (u : ℕ) :
Top.isN t u ↔ Top.isN (ts s) u
theorem OrderMaintenance.Proof.Top.InsFrame.liveN {s : Model.Core} {x f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) (u : ℕ) :
theorem OrderMaintenance.Proof.Top.InsFrame.ghostN {s : Model.Core} {x f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) (u : ℕ) :
theorem OrderMaintenance.Proof.Top.InsFrame.srcOf {s : Model.Core} {x f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) (u : ℕ) :
theorem OrderMaintenance.Proof.Top.InsFrame.anc_old {s : Model.Core} {x f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) (c : ℕ) (hy : c ≠ s.C.size) (hz : c ≠ s.C.size + 1) (j : ℕ) :
anc t c j = anc (ts s) c j
theorem OrderMaintenance.Proof.Top.InsFrame.anc_new {s : Model.Core} {x f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) (c : ℕ) (hc : c = s.C.size ∨ c = s.C.size + 1) (j : ℕ) :
1 ≤ j → anc t c j = anc (ts s) x j
theorem OrderMaintenance.Proof.Top.InsFrame.pp_old {s : Model.Core} {x f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) (c : ℕ) (hy : c ≠ s.C.size) (hz : c ≠ s.C.size + 1) (j : ℕ) :
pp t c j = pp (ts s) c j
theorem OrderMaintenance.Proof.Top.InsFrame.pp_new {s : Model.Core} {x f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) (c : ℕ) (hc : c = s.C.size ∨ c = s.C.size + 1) (j : ℕ) (hj1 : 1 ≤ j) (hj : j ≤ s.P.H) :
pp t c j = pp (ts s) x j