Documentation

LeanPool.OrderMaintenance.Proof.Top.InsTime

M5: weights, drain timing and label room after a chunk split #

After the split, y and z sit below x's live ancestors, so those weigh 2 more while their stored weights lag: they are the job's pending nodes. A ghost one of whose targets is above x is funded by the job.

The live ancestors as an up-chain #

theorem OrderMaintenance.Proof.Top.Shape.upChain_anc {s : TS} {cl : List ℕ} {ord : ℕ → List ℕ} (S : Shape s cl ord) {c : ℕ} (hc : c ∈ cl) (n j : ℕ) :
1 ≤ j → j + n = s.P.H → ∀ (v : ℕ), v ∈ upChain s (n + 2) (anc s c j) ↔ ∃ (k : ℕ), j ≤ k ∧ k ≤ s.P.H ∧ v = anc s c k
theorem OrderMaintenance.Proof.Top.Shape.upChain_lpr {s : TS} {cl : List ℕ} {ord : ℕ → List ℕ} (S : Shape s cl ord) {c : ℕ} (hc : c ∈ cl) {v : ℕ} (hv : liveN s v) :
v ∈ upChain s (s.P.H + 1) (lpr s c) ↔ anc s c (ht s v) = v

A live node is on the up-chain from chunk c's parent iff it is an ancestor of c.

Sums over entries #

theorem OrderMaintenance.Proof.Top.foldr_bump {l : List ℕ} (hl : l.Nodup) (f g : ℕ → ℕ) (e0 : ℕ) (hfg : ∀ e ∈ l, e ≠ e0 → g e ≤ f e) (h0 : g e0 ≤ f e0 + 2) :
List.foldr (fun (e acc : ℕ) => acc + g e) 0 l ≤ List.foldr (fun (e acc : ℕ) => acc + f e) 0 l + if e0 ∈ l then 2 else 0

Raising one entry's term by at most 2 raises a sum over distinct entries by at most 2.

Weights after the split #

theorem OrderMaintenance.Proof.Top.ins_filter_len {s : Model.Core} {cl : List ℕ} {ord : ℕ → List ℕ} {dr n0 : ℕ → ℕ} (hI : InvJ (ts s) cl ord dr n0 none) (hcs : ∀ (c : ℕ), c ∈ cl ↔ 1 ≤ c ∧ c < s.C.size) {x : ℕ} (hx : x ∈ cl) (p : ℕ → ℕ → Prop) [(a b : ℕ) → Decidable (p a b)] (u : ℕ) :
(List.filter (fun (c : ℕ) => decide (p (if c = s.C.size ∨ c = s.C.size + 1 then x else c) u)) (clIns cl x s.C.size (s.C.size + 1))).length = (List.filter (fun (c : ℕ) => decide (p c u)) cl).length + if p x u then 2 else 0

Filtering the chunk list after the split, for a predicate on the chunk each one stands for.

theorem OrderMaintenance.Proof.Top.ins_tw {s : Model.Core} {cl : List ℕ} {ord : ℕ → List ℕ} {dr n0 : ℕ → ℕ} (hI : InvJ (ts s) cl ord dr n0 none) (hcs : ∀ (c : ℕ), c ∈ cl ↔ 1 ≤ c ∧ c < s.C.size) {x : ℕ} (hx : x ∈ cl) {f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) {u : ℕ} (hu : 1 ≤ ht (ts s) u) :
tw t (clIns cl x s.C.size (s.C.size + 1)) u = tw (ts s) cl u + if anc (ts s) x (ht (ts s) u) = u then 2 else 0
theorem OrderMaintenance.Proof.Top.ins_rng_len {s : Model.Core} {cl : List ℕ} {ord : ℕ → List ℕ} {dr n0 : ℕ → ℕ} (hI : InvJ (ts s) cl ord dr n0 none) (hcs : ∀ (c : ℕ), c ∈ cl ↔ 1 ≤ c ∧ c < s.C.size) {x : ℕ} (hx : x ∈ cl) {f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) {u : ℕ} (hu : 1 ≤ ht (ts s) u) (hH : ht (ts s) u ≤ s.P.H) :
(rng t (clIns cl x s.C.size (s.C.size + 1)) u).length = (rng (ts s) cl u).length + if pp (ts s) x (ht (ts s) u) = u then 2 else 0
theorem OrderMaintenance.Proof.Top.ins_ew_live {s : Model.Core} {cl : List ℕ} {ord : ℕ → List ℕ} {dr n0 : ℕ → ℕ} (hI : InvJ (ts s) cl ord dr n0 none) (hcs : ∀ (c : ℕ), c ∈ cl ↔ 1 ≤ c ∧ c < s.C.size) {x : ℕ} (hx : x ∈ cl) {f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) {u : ℕ} (hu : liveN (ts s) u) :
ew t (clIns cl x s.C.size (s.C.size + 1)) u = ew (ts s) cl u + if anc (ts s) x (ht (ts s) u) = u then 2 else 0
theorem OrderMaintenance.Proof.Top.ins_ew_ghost {s : Model.Core} {cl : List ℕ} {ord : ℕ → List ℕ} {dr n0 : ℕ → ℕ} (hI : InvJ (ts s) cl ord dr n0 none) (hcs : ∀ (c : ℕ), c ∈ cl ↔ 1 ≤ c ∧ c < s.C.size) {x : ℕ} (hx : x ∈ cl) {f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) {u : ℕ} (hu : ghostN (ts s) u) :
ew t (clIns cl x s.C.size (s.C.size + 1)) u = ew (ts s) cl u + if anc (ts s) x (ht (ts s) u) = (nd (ts s) u).t1 ∨ anc (ts s) x (ht (ts s) u) = (nd (ts s) u).t2 then 2 else 0
theorem OrderMaintenance.Proof.Top.ins_upChain {s : Model.Core} {x f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) (f v : ℕ) :
upChain t f v = upChain (ts s) f v
theorem OrderMaintenance.Proof.Top.ins_pend {s : Model.Core} {cl : List ℕ} {ord : ℕ → List ℕ} {dr n0 : ℕ → ℕ} (hI : InvJ (ts s) cl ord dr n0 none) {x : ℕ} (hx : x ∈ cl) {f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) {v : ℕ} (hv : liveN (ts s) v) :
v ∈ pend t (some (insJob s x)) ↔ anc (ts s) x (ht (ts s) v) = v

The split's pending nodes are x's live ancestors.

theorem OrderMaintenance.Proof.Top.ins_anc_y {s : Model.Core} {x f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) (h : ℕ) (hh : 1 ≤ h) :
anc t (insJob s x).y h = anc (ts s) x h
theorem OrderMaintenance.Proof.Top.ins_funded {s : Model.Core} {cl : List ℕ} {ord : ℕ → List ℕ} {dr n0 : ℕ → ℕ} (hI : InvJ (ts s) cl ord dr n0 none) {x f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) {v : ℕ} (hv : ghostN (ts s) v) :
funded t (some (insJob s x)) v ↔ anc (ts s) x (ht (ts s) v) = (nd (ts s) v).t1 ∨ anc (ts s) x (ht (ts s) v) = (nd (ts s) v).t2
theorem OrderMaintenance.Proof.Top.ins_slack {s : Model.Core} {cl : List ℕ} {ord : ℕ → List ℕ} {dr n0 : ℕ → ℕ} (hI : InvJ (ts s) cl ord dr n0 none) {x f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) {v : ℕ} (hv : ghostN (ts s) v) :
slack t (some (insJob s x)) v = if anc (ts s) x (ht (ts s) v) = (nd (ts s) v).t1 ∨ anc (ts s) x (ht (ts s) v) = (nd (ts s) v).t2 then s.P.s else 0
theorem OrderMaintenance.Proof.Top.ins_time {s : Model.Core} {cl : List ℕ} {ord : ℕ → List ℕ} {dr n0 : ℕ → ℕ} (hI : InvJ (ts s) cl ord dr n0 none) (hcs : ∀ (c : ℕ), c ∈ cl ↔ 1 ≤ c ∧ c < s.C.size) {x : ℕ} (hx : x ∈ cl) {f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) (hTP : TopParams s.P) :
Timing t (clIns cl x s.C.size (s.C.size + 1)) (some (insJob s x))

The drain timing after the split, the job at its start.

theorem OrderMaintenance.Proof.Top.ins_ew_ge {s : Model.Core} {cl : List ℕ} {ord : ℕ → List ℕ} {dr n0 : ℕ → ℕ} (hI : InvJ (ts s) cl ord dr n0 none) (hcs : ∀ (c : ℕ), c ∈ cl ↔ 1 ≤ c ∧ c < s.C.size) {x : ℕ} (hx : x ∈ cl) {f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) {u : ℕ} (hu : isN (ts s) u) :
ew (ts s) cl u ≤ ew t (clIns cl x s.C.size (s.C.size + 1)) u
theorem OrderMaintenance.Proof.Top.ins_ew_up {s : Model.Core} {cl : List ℕ} {ord : ℕ → List ℕ} {dr n0 : ℕ → ℕ} (hI : InvJ (ts s) cl ord dr n0 none) (hcs : ∀ (c : ℕ), c ∈ cl ↔ 1 ≤ c ∧ c < s.C.size) {x : ℕ} (hx : x ∈ cl) {f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) {X h : ℕ} (hX : isN (ts s) X) (hh : ht (ts s) X = h) (h1 : 1 ≤ h) (hH : h ≤ s.P.H) (hm : anc (ts s) x (h - 1) ∈ order (ts s) X) (hl : h = 1 ∨ liveN (ts s) (anc (ts s) x (h - 1))) :
ew (ts s) cl X + 2 ≤ ew t (clIns cl x s.C.size (s.C.size + 1)) X

A node whose table holds x's live ancestor of height h - 1 serves 2 more after the split.

def OrderMaintenance.Proof.Top.drIns (dr : ℕ → ℕ) (tabs : List ℕ) (T : ℕ) :

The insertion events of the split: one more in each table holding x.

Equations
Instances For
    theorem OrderMaintenance.Proof.Top.ins_room {s : Model.Core} {cl : List ℕ} {ord : ℕ → List ℕ} {dr n0 : ℕ → ℕ} (hI : InvJ (ts s) cl ord dr n0 none) (hcs : ∀ (c : ℕ), c ∈ cl ↔ 1 ≤ c ∧ c < s.C.size) {x : ℕ} (hx : x ∈ cl) {f1x i1 : ℕ} {t : TS} (F : InsFrame s x f1x i1 t) (hTP : TopParams s.P) :
    Room t (clIns cl x s.C.size (s.C.size + 1)) (drIns dr (s.cin.getX x)) n0

    The label room after the split.