Documentation

LeanPool.OrderMaintenance.Proof.Top.StartCtx

M5: the situation when a drain starts #

The walk is at v, a live non-root node with no source, whose true weight exceeds W_h.

theorem OrderMaintenance.Proof.Top.sd_h_eq (s : Model.Core) (v : ℕ) :
sH (wiC s v) v = ht (ts s) v
theorem OrderMaintenance.Proof.Top.getD_ne_of_nodup {l : List ℕ} (hl : l.Nodup) {i j : ℕ} (hi : i < l.length) (hj : j < l.length) (hij : i ≠ j) :
l.getD i 0 ≠ l.getD j 0

A child's distinct neighbours by index.

theorem OrderMaintenance.Proof.Top.getD_mem' {l : List ℕ} {i : ℕ} (hi : i < l.length) :
l.getD i 0 ∈ l
theorem OrderMaintenance.Proof.Top.sd_live {s : Model.Core} {cl : List ℕ} {ord : ℕ → List ℕ} {dr n0 : ℕ → ℕ} {j : Model.Job} {v : ℕ} (hpc : j.pc = Model.JobPc.walk (some v)) (hv0 : v ≠ Model.NIL) (hI : InvJ (ts s) cl ord dr n0 (some j)) :
liveN (ts s) v ∧ v = anc (ts s) j.y (ht (ts s) v)
theorem OrderMaintenance.Proof.Top.sd_ht {s : Model.Core} {cl : List ℕ} {ord : ℕ → List ℕ} {dr n0 : ℕ → ℕ} {j : Model.Job} {v : ℕ} (hpc : j.pc = Model.JobPc.walk (some v)) (hv0 : v ≠ Model.NIL) (hI : InvJ (ts s) cl ord dr n0 (some j)) (hlp : (nd (ts s) v).livePar ≠ Model.NIL) :
1 ≤ ht (ts s) v ∧ ht (ts s) v < s.P.H
theorem OrderMaintenance.Proof.Top.sd_up {s : Model.Core} {cl : List ℕ} {ord : ℕ → List ℕ} {dr n0 : ℕ → ℕ} {j : Model.Job} {v : ℕ} (hpc : j.pc = Model.JobPc.walk (some v)) (hv0 : v ≠ Model.NIL) (hI : InvJ (ts s) cl ord dr n0 (some j)) (hlp : (nd (ts s) v).livePar ≠ Model.NIL) :
liveN (ts s) (nd (ts s) v).livePar ∧ ht (ts s) (nd (ts s) v).livePar = ht (ts s) v + 1 ∧ v ∈ (nd (ts s) (nd (ts s) v).livePar).children
theorem OrderMaintenance.Proof.Top.sd_pend {s : Model.Core} {cl : List ℕ} {ord : ℕ → List ℕ} {dr n0 : ℕ → ℕ} {j : Model.Job} {v : ℕ} (hpc : j.pc = Model.JobPc.walk (some v)) (hv0 : v ≠ Model.NIL) (hI : InvJ (ts s) cl ord dr n0 (some j)) (hlp : (nd (ts s) v).livePar ≠ Model.NIL) :
pend (ts s) (some j) = v :: upChain (ts s) ((ts s).P.H + 1) (nd (ts s) v).livePar
theorem OrderMaintenance.Proof.Top.sd_notpend {s : Model.Core} {cl : List ℕ} {ord : ℕ → List ℕ} {dr n0 : ℕ → ℕ} {j : Model.Job} {v : ℕ} (hpc : j.pc = Model.JobPc.walk (some v)) (hv0 : v ≠ Model.NIL) (hI : InvJ (ts s) cl ord dr n0 (some j)) (hlp : (nd (ts s) v).livePar ≠ Model.NIL) {u : ℕ} (hh : ht (ts s) u < ht (ts s) v) :
u ∉ pend (ts s) (some j)

Nodes below v do not lag.

theorem OrderMaintenance.Proof.Top.sd_tw {s : Model.Core} {cl : List ℕ} {ord : ℕ → List ℕ} {dr n0 : ℕ → ℕ} {j : Model.Job} {v : ℕ} (hpc : j.pc = Model.JobPc.walk (some v)) (hv0 : v ≠ Model.NIL) (hI : InvJ (ts s) cl ord dr n0 (some j)) (hlp : (nd (ts s) v).livePar ≠ Model.NIL) :
tw (ts s) cl v = (nd (ts s) v).weight + 2
theorem OrderMaintenance.Proof.Top.sd_kid_weight {s : Model.Core} {cl : List ℕ} {ord : ℕ → List ℕ} {dr n0 : ℕ → ℕ} {j : Model.Job} {v : ℕ} (hpc : j.pc = Model.JobPc.walk (some v)) (hv0 : v ≠ Model.NIL) (hI : InvJ (ts s) cl ord dr n0 (some j)) (hlp : (nd (ts s) v).livePar ≠ Model.NIL) {e : ℕ} (he : e ∈ (nd (ts s) v).children) (h2 : 2 ≤ ht (ts s) v) :
(nd (ts s) e).weight = tw (ts s) cl e

A child's stored weight is its true weight.

theorem OrderMaintenance.Proof.Top.sd_kid_le {s : Model.Core} {cl : List ℕ} {ord : ℕ → List ℕ} {dr n0 : ℕ → ℕ} {j : Model.Job} {v : ℕ} (hpc : j.pc = Model.JobPc.walk (some v)) (hv0 : v ≠ Model.NIL) (hI : InvJ (ts s) cl ord dr n0 (some j)) (hlp : (nd (ts s) v).livePar ≠ Model.NIL) (hTP : TopParams s.P) {e : ℕ} (he : e ∈ (nd (ts s) v).children) (h2 : 2 ≤ ht (ts s) v) :
tw (ts s) cl e ≤ Wd s.P (ht (ts s) v - 1)

A child weighs at most W_{h-1}.

theorem OrderMaintenance.Proof.Top.sd_pair {s : Model.Core} {cl : List ℕ} {ord : ℕ → List ℕ} {dr n0 : ℕ → ℕ} {j : Model.Job} {v : ℕ} (hpc : j.pc = Model.JobPc.walk (some v)) (hv0 : v ≠ Model.NIL) (hI : InvJ (ts s) cl ord dr n0 (some j)) (h2 : 2 ≤ ht (ts s) v) {k : ℕ} (hk1 : 1 ≤ k) (hkn : k < (nd (ts s) v).children.length) (hp : sPr (wiC s v) v k = true) :
∃ (g : ℕ), ghostN (ts s) g ∧ srcOf (ts s) ((nd (ts s) v).children.getD (k - 1) 0) = g ∧ srcOf (ts s) ((nd (ts s) v).children.getD k 0) = g ∧ {(nd (ts s) v).children.getD (k - 1) 0, (nd (ts s) v).children.getD k 0} = {(nd (ts s) g).t1, (nd (ts s) g).t2}

A pair of children is a drain's two targets.

theorem OrderMaintenance.Proof.Top.sd_ws {s : Model.Core} {cl : List ℕ} {ord : ℕ → List ℕ} {dr n0 : ℕ → ℕ} {j : Model.Job} {v : ℕ} (hpc : j.pc = Model.JobPc.walk (some v)) (hv0 : v ≠ Model.NIL) (hI : InvJ (ts s) cl ord dr n0 (some j)) (hlp : (nd (ts s) v).livePar ≠ Model.NIL) (h2 : 2 ≤ ht (ts s) v) :
sWs (wiC s v) v = List.map (tw (ts s) cl) (nd (ts s) v).children

The children's weights, as startDrain reads them (above height 1).

theorem OrderMaintenance.Proof.Top.sd_cut2 {s : Model.Core} {cl : List ℕ} {ord : ℕ → List ℕ} {dr n0 : ℕ → ℕ} {j : Model.Job} {v : ℕ} (hpc : j.pc = Model.JobPc.walk (some v)) (hv0 : v ≠ Model.NIL) (hI : InvJ (ts s) cl ord dr n0 (some j)) (hlp : (nd (ts s) v).livePar ≠ Model.NIL) (hTP : TopParams s.P) (h2 : 2 ≤ ht (ts s) v) (hof : (nd (ts s) v).overflowOf = Model.NIL) (hW : Wd s.P (ht (ts s) v) < (nd (ts s) v).weight + 2) :
2 ≤ (nd (ts s) v).children.length ∧ 1 ≤ sK (wiC s v) v ∧ sK (wiC s v) v ≤ (nd (ts s) v).children.length - 1 ∧ sPr (wiC s v) v (sK (wiC s v) v) = false ∧ lamd s.P (ht (ts s) v) ≤ (List.map (tw (ts s) cl) (List.take (sK (wiC s v) v) (nd (ts s) v).children)).sum ∧ (List.map (tw (ts s) cl) (List.take (sK (wiC s v) v) (nd (ts s) v).children)).sum ≤ taud s.P (ht (ts s) v) ∧ lamd s.P (ht (ts s) v) ≤ (List.map (tw (ts s) cl) (List.drop (sK (wiC s v) v) (nd (ts s) v).children)).sum ∧ (List.map (tw (ts s) cl) (List.drop (sK (wiC s v) v) (nd (ts s) v).children)).sum ≤ taud s.P (ht (ts s) v)

Lemma T0 at a drain (above height 1).

theorem OrderMaintenance.Proof.Top.sd_cut1 {s : Model.Core} {cl : List ℕ} {ord : ℕ → List ℕ} {dr n0 : ℕ → ℕ} {j : Model.Job} {v : ℕ} (hpc : j.pc = Model.JobPc.walk (some v)) (hv0 : v ≠ Model.NIL) (hI : InvJ (ts s) cl ord dr n0 (some j)) (hlp : (nd (ts s) v).livePar ≠ Model.NIL) (h1 : ht (ts s) v = 1) (hof : (nd (ts s) v).overflowOf = Model.NIL) (hW : Wd s.P (ht (ts s) v) < (nd (ts s) v).weight + 2) :
2 ≤ (nd (ts s) v).children.length ∧ 1 ≤ sK (wiC s v) v ∧ sK (wiC s v) v ≤ (nd (ts s) v).children.length - 1 ∧ lamd s.P 1 ≤ (List.take (sK (wiC s v) v) (nd (ts s) v).children).length ∧ (List.take (sK (wiC s v) v) (nd (ts s) v).children).length ≤ taud s.P 1 ∧ lamd s.P 1 ≤ (List.drop (sK (wiC s v) v) (nd (ts s) v).children).length ∧ (List.drop (sK (wiC s v) v) (nd (ts s) v).children).length ≤ taud s.P 1

The cut at height 1: unit weights, the halves.