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_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)
:
Nodes below v do not lag.
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)
:
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)
:
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)
:
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)
:
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.