M5: startDrain runs, at a drain start #
theorem
OrderMaintenance.Proof.Top.sr_hyps
{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)
:
SDHyps s v side
theorem
OrderMaintenance.Proof.Top.sr_run
{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)}
(hside : sSideO (wiC s v) v = some 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)
:
startDrain runs to the pure state, its guards passing.
theorem
OrderMaintenance.Proof.Top.sr_topRel
{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)}
(hside : sSideO (wiC s v) v = some 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)
: