Chunk-split steps, field by field #
What a chunk-split move (moveUnit with moveSizes) and chunk removal do, under the conditions
that make their guards pass.
Running a chunk-split move #
Transfers the total size of the moved groups from the source chunk to the destination.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The state after moving unit u from the front of x to the end of its left sibling.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The state after moving unit u from the back of x to the front of its right sibling.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The labels pushed at the end of the left sibling.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The labels pushed at the front of the right sibling.
Equations
- One or more equations did not get rendered due to their size.
Instances For
theorem
OrderMaintenance.Proof.unit_ok
{s : Model.Core}
{x : ℕ}
{left : Bool}
(h : (Model.unitCand s x left).length = 1 ∨ Model.unitOK s x (Model.unitCand s x left) = true)
:
theorem
OrderMaintenance.Proof.moveUnit_left_ok
{s : Model.Core}
{x : ℕ}
{labs : List ℕ}
(hne : cF s x ≠ Model.NIL)
(hu : (Model.unitCand s x true).length = 1 ∨ Model.unitOK s x (Model.unitCand s x true) = true)
(hadj : cN s (cLl s x) = x)
(hlabs : EStateM.run (pushLabsL s x (Model.unitCand s x true).length) s = EStateM.Result.ok labs s)
:
EStateM.run (Model.moveUnit x true) s = EStateM.Result.ok (cLl s x, Model.unitCand s x true)
(Model.moveGroupsLeft s x (cLl s x) (Model.unitCand s x true) labs)
theorem
OrderMaintenance.Proof.moveUnit_right_ok
{s : Model.Core}
{x : ℕ}
{labs : List ℕ}
(hne : cF s x ≠ Model.NIL)
(hu : (Model.unitCand s x false).length = 1 ∨ Model.unitOK s x (Model.unitCand s x false) = true)
(hadj : cP s (cRr s x) = x)
(hlabs : EStateM.run (pushLabsR s x (Model.unitCand s x false).length) s = EStateM.Result.ok labs s)
:
EStateM.run (Model.moveUnit x false) s = EStateM.Result.ok (cRr s x, Model.unitCand s x false)
(Model.moveGroupsRight s x (cRr s x) (Model.unitCand s x false) labs)
theorem
OrderMaintenance.Proof.chunkSplitStep_left
{s : Model.Core}
{x : ℕ}
{labs : List ℕ}
(hne : cF s x ≠ Model.NIL)
(hdir : cSz s (cLl s x) ≤ cSz s (cRr s x))
(hu : (Model.unitCand s x true).length = 1 ∨ Model.unitOK s x (Model.unitCand s x true) = true)
(hadj : cN s (cLl s x) = x)
(hlabs : EStateM.run (pushLabsL s x (Model.unitCand s x true).length) s = EStateM.Result.ok labs s)
:
EStateM.run (Model.chunkSplitStep x) s = EStateM.Result.ok true (cmoveLState s x (Model.unitCand s x true) labs)
theorem
OrderMaintenance.Proof.chunkSplitStep_right
{s : Model.Core}
{x : ℕ}
{labs : List ℕ}
(hne : cF s x ≠ Model.NIL)
(hdir : cSz s (cRr s x) < cSz s (cLl s x))
(hu : (Model.unitCand s x false).length = 1 ∨ Model.unitOK s x (Model.unitCand s x false) = true)
(hadj : cP s (cRr s x) = x)
(hlabs : EStateM.run (pushLabsR s x (Model.unitCand s x false).length) s = EStateM.Result.ok labs s)
:
EStateM.run (Model.chunkSplitStep x) s = EStateM.Result.ok true (cmoveRState s x (Model.unitCand s x false) labs)
Chunk removal #
Marks an emptied chunk as dead while retaining its other fields.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Finishes a chunk split by clearing its state and source pointer.
Equations
Instances For
The state after removing the emptied chunk x: it is dead, its siblings are quiet.
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[simp]
theorem
OrderMaintenance.Proof.removeChunk_ok
{s : Model.Core}
{x : ℕ}
(hlr : cLl s x ≠ cRr s x)
(hlx : cLl s x ≠ x)
(hrx : cRr s x ≠ x)
(hx : x < s.C.size)
(hl : cSt s (cLl s x) = Model.St.overflow ∧ cSrc s (cLl s x) = x)
(hr : cSt s (cRr s x) = Model.St.overflow ∧ cSrc s (cRr s x) = x)
(hszl : cSz s (cLl s x) ≤ s.P.theta)
(hszr : cSz s (cRr s x) ≤ s.P.theta)
:
theorem
OrderMaintenance.Proof.chunkSplitStep_remove
{s : Model.Core}
{x : ℕ}
(he : cF s x = Model.NIL)
(hlr : cLl s x ≠ cRr s x)
(hlx : cLl s x ≠ x)
(hrx : cRr s x ≠ x)
(hx : x < s.C.size)
(hl : cSt s (cLl s x) = Model.St.overflow ∧ cSrc s (cLl s x) = x)
(hr : cSt s (cRr s x) = Model.St.overflow ∧ cSrc s (cRr s x) = x)
(hszl : cSz s (cLl s x) ≤ s.P.theta)
(hszr : cSz s (cRr s x) ≤ s.P.theta)
:
The unit at an end of a chunk #
The records after a chunk-split move #
What a chunk-split move of unit u from x to dst does.
- G (g : ℕ) : s'.Gs.getX g = if g ∈ u then let __src := s.Gs.getX g; { next := __src.next, prev := __src.prev, first := __src.first, last := __src.last, chk := dst, lab := labs.getD (List.idxOf g u) 0, size := __src.size, st := __src.st, src := __src.src, l := __src.l, r := __src.r, alive := __src.alive } else s.Gs.getX g
- rest : s'.pqHead = s.pqHead ∧ s'.pqNext = s.pqNext ∧ s'.pqPrev = s.pqPrev ∧ s'.pqWhere = s.pqWhere ∧ s'.nbNext = s.nbNext ∧ s'.nbPrev = s.nbPrev ∧ s'.pqHi = s.pqHi ∧ s'.pqLo = s.pqLo ∧ s'.resJob = s.resJob ∧ s'.nodes = s.nodes ∧ s'.path = s.path ∧ s'.cin = s.cin ∧ s'.lpar = s.lpar ∧ s'.count = s.count ∧ s'.firstChunk = s.firstChunk ∧ s'.firstGroup = s.firstGroup ∧ s'.freeG = s.freeG ∧ s'.tail = s.tail
Instances For
theorem
OrderMaintenance.Proof.cmoveSizes_C
{t : Model.Core}
{x dst : ℕ}
{u : List ℕ}
(hxd : x ≠ dst)
(hx : x < t.C.size)
(hd : dst < t.C.size)
(c : ℕ)
:
(cmoveSizes t x dst u).C.getX c = if c = x then
have __src := t.C.getX c;
{ next := __src.next, prev := __src.prev, first := __src.first, last := __src.last,
size := (t.C.getX c).size - (List.map (fun (g : ℕ) => gSz t g) u).sum, st := __src.st, src := __src.src,
l := __src.l, r := __src.r, tag := __src.tag, alive := __src.alive }
else if c = dst then
have __src := t.C.getX c;
{ next := __src.next, prev := __src.prev, first := __src.first, last := __src.last,
size := (t.C.getX c).size + (List.map (fun (g : ℕ) => gSz t g) u).sum, st := __src.st, src := __src.src,
l := __src.l, r := __src.r, tag := __src.tag, alive := __src.alive }
else t.C.getX c