M5: the sides and the parts at a drain start #
Children before the boundary go left, the others right; a ghost entry goes with its targets.
Lists #
At a drain start #
theorem
OrderMaintenance.Proof.Top.sp_k
{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)
(hof : (nd (ts s) v).overflowOf = Model.NIL)
(hW : Wd s.P (ht (ts s) v) < (nd (ts s) v).weight + 2)
:
The cut is inside.
theorem
OrderMaintenance.Proof.Top.sp_b
{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)
(hof : (nd (ts s) v).overflowOf = Model.NIL)
(hW : Wd s.P (ht (ts s) v) < (nd (ts s) v).weight + 2)
:
The boundary child.
theorem
OrderMaintenance.Proof.Top.sp_par
{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 ∈ order (ts s) v)
:
An entry of v's table has v as its parent.
theorem
OrderMaintenance.Proof.Top.sp_entry
{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 ∈ order (ts s) v)
:
theorem
OrderMaintenance.Proof.Top.sp_ghost
{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)
{g : ℕ}
(hg : g ∈ order (ts s) v)
(hgd : (nd (ts s) g).draining = true)
:
theorem
OrderMaintenance.Proof.Top.sp_side_len
{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)
(hof : (nd (ts s) v).overflowOf = Model.NIL)
(hW : Wd s.P (ht (ts s) v) < (nd (ts s) v).weight + 2)
{side : List (ℕ × Model.Side)}
(hs : sSideO (wiC s v) v = some side)
:
The drain's side list is no longer than v's table.
theorem
OrderMaintenance.Proof.Top.sp_side
{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)
(hof : (nd (ts s) v).overflowOf = Model.NIL)
(hW : Wd s.P (ht (ts s) v) < (nd (ts s) v).weight + 2)
:
∃ (side : List (ℕ × Model.Side)),
sSideO (wiC s v) v = some side ∧ ∀ (x : ℕ),
Model.lookup side x = if 2 ≤ ht (ts s) v ∧ x ∈ sEntries (wiC s v) v ∧ (nd (ts s) x).draining = true then
Model.lookup (Model.sidesOf (order (ts s) v) ((nd (ts s) v).children.getD (sK (wiC s v) v) 0))
(nd (ts s) x).t1
else Model.lookup (Model.sidesOf (order (ts s) v) ((nd (ts s) v).children.getD (sK (wiC s v) v) 0)) x
The sides startDrain computes.
theorem
OrderMaintenance.Proof.Top.sw_kid
{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)
(hof : (nd (ts s) v).overflowOf = Model.NIL)
(hW : Wd s.P (ht (ts s) v) < (nd (ts s) v).weight + 2)
{side : List (ℕ × Model.Side)}
(hlook :
∀ (x : ℕ),
Model.lookup side x = if 2 ≤ ht (ts s) v ∧ x ∈ sEntries (wiC s v) v ∧ (nd (ts s) x).draining = true then
Model.lookup (Model.sidesOf (order (ts s) v) ((nd (ts s) v).children.getD (sK (wiC s v) v) 0)) (nd (ts s) x).t1
else Model.lookup (Model.sidesOf (order (ts s) v) ((nd (ts s) v).children.getD (sK (wiC s v) v) 0)) x)
{e : ℕ}
(he : e ∈ (nd (ts s) v).children)
:
Model.lookup side e = some (if e ∈ List.take (sK (wiC s v) v) (nd (ts s) v).children then Model.Side.left else Model.Side.right)
A child's side: left before the boundary.
theorem
OrderMaintenance.Proof.Top.sw_nosep'
{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)
(hof : (nd (ts s) v).overflowOf = Model.NIL)
(hW : Wd s.P (ht (ts s) v) < (nd (ts s) v).weight + 2)
(h2 : 2 ≤ ht (ts s) v)
{a b g : ℕ}
(hinf : [a, b] <:+: (nd (ts s) v).children)
(hg : g ≠ Model.NIL)
(ha : srcOf (ts s) a = g)
(hb : srcOf (ts s) b = g)
:
A drain's targets among the children are not separated.
theorem
OrderMaintenance.Proof.Top.sw_nosep
{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)
(hof : (nd (ts s) v).overflowOf = Model.NIL)
(hW : Wd s.P (ht (ts s) v) < (nd (ts s) v).weight + 2)
(h2 : 2 ≤ ht (ts s) v)
{g : ℕ}
(hg : g ∈ order (ts s) v)
(hgd : (nd (ts s) g).draining = true)
:
Pairs are not separated.
theorem
OrderMaintenance.Proof.Top.sw_ghost
{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)
(hof : (nd (ts s) v).overflowOf = Model.NIL)
(hW : Wd s.P (ht (ts s) v) < (nd (ts s) v).weight + 2)
{side : List (ℕ × Model.Side)}
(hlook :
∀ (x : ℕ),
Model.lookup side x = if 2 ≤ ht (ts s) v ∧ x ∈ sEntries (wiC s v) v ∧ (nd (ts s) x).draining = true then
Model.lookup (Model.sidesOf (order (ts s) v) ((nd (ts s) v).children.getD (sK (wiC s v) v) 0)) (nd (ts s) x).t1
else Model.lookup (Model.sidesOf (order (ts s) v) ((nd (ts s) v).children.getD (sK (wiC s v) v) 0)) x)
(h2 : 2 ≤ ht (ts s) v)
{g : ℕ}
(hg : g ∈ order (ts s) v)
(hgd : (nd (ts s) g).draining = true)
:
A ghost entry goes with its first target.
theorem
OrderMaintenance.Proof.Top.sw_ch
{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)
(hof : (nd (ts s) v).overflowOf = Model.NIL)
(hW : Wd s.P (ht (ts s) v) < (nd (ts s) v).weight + 2)
{side : List (ℕ × Model.Side)}
(hlook :
∀ (x : ℕ),
Model.lookup side x = if 2 ≤ ht (ts s) v ∧ x ∈ sEntries (wiC s v) v ∧ (nd (ts s) x).draining = true then
Model.lookup (Model.sidesOf (order (ts s) v) ((nd (ts s) v).children.getD (sK (wiC s v) v) 0)) (nd (ts s) x).t1
else Model.lookup (Model.sidesOf (order (ts s) v) ((nd (ts s) v).children.getD (sK (wiC s v) v) 0)) x)
:
The children of the two new nodes.
theorem
OrderMaintenance.Proof.Top.sw_left
{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)
(hof : (nd (ts s) v).overflowOf = Model.NIL)
(hW : Wd s.P (ht (ts s) v) < (nd (ts s) v).weight + 2)
{side : List (ℕ × Model.Side)}
(hlook :
∀ (x : ℕ),
Model.lookup side x = if 2 ≤ ht (ts s) v ∧ x ∈ sEntries (wiC s v) v ∧ (nd (ts s) x).draining = true then
Model.lookup (Model.sidesOf (order (ts s) v) ((nd (ts s) v).children.getD (sK (wiC s v) v) 0)) (nd (ts s) x).t1
else Model.lookup (Model.sidesOf (order (ts s) v) ((nd (ts s) v).children.getD (sK (wiC s v) v) 0)) x)
{e : ℕ}
:
Children before the boundary and ghosts whose ranges lie between them.
theorem
OrderMaintenance.Proof.Top.sw_right
{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)
(hof : (nd (ts s) v).overflowOf = Model.NIL)
(hW : Wd s.P (ht (ts s) v) < (nd (ts s) v).weight + 2)
{side : List (ℕ × Model.Side)}
(hlook :
∀ (x : ℕ),
Model.lookup side x = if 2 ≤ ht (ts s) v ∧ x ∈ sEntries (wiC s v) v ∧ (nd (ts s) x).draining = true then
Model.lookup (Model.sidesOf (order (ts s) v) ((nd (ts s) v).children.getD (sK (wiC s v) v) 0)) (nd (ts s) x).t1
else Model.lookup (Model.sidesOf (order (ts s) v) ((nd (ts s) v).children.getD (sK (wiC s v) v) 0)) x)
{e : ℕ}
:
Children from the boundary onward and ghosts whose ranges lie between them.