Theorem W, stage B1: the size bounds from the cost invariants #
The cost proof threads extra invariants through the group drive (XGroup, XSteps) and the
chunk drive (CXSteps). Each hook sees the step's context: INV-S, GInv, CInv, the family.
Here the stored-value bound rides on those hooks.
- Sizes (Sz). A live group's size is its run in the element list
L(GInv.sz), a live chunk's is its element count (CInv.csz); both are at most|L|. A move adds one element to a live sibling (≤ |L| + 1); a chunk move adds at most three live groups to a live sibling (≤ 4·|L|). So4·|L| + 4 ≤ 2^Kcovers every size written by a drive. - Fresh groups (F). A group phase allocates at most two groups: one split start, at its
beginning. The predicate
XGrecords the room:Gs.size ≤ G0before the split; after it every quiet group is belowG, so no further split can start.
Sizes are at most |L| #
What the group steps change #
The group phase #
The group phase's extra invariant: stored values, the parameters P, and room for its one
split start (G0 is the group count when the phase starts).
Equations
- One or more equations did not get rendered due to their size.
Instances For
theorem
OrderMaintenance.Proof.Word.xg_moveL
{K : ℕ}
{P : Model.Params}
{G0 : ℕ}
{L : List ℕ}
(hL : LabRoom K P)
(hlen : L.length + 2 ≤ 2 ^ K)
{t : Model.Core}
{gh : GGh}
{δ : ℕ → ℕ}
{p : ℕ}
(hG : GInvE t L gh δ p)
(hok : MoveLOK t p)
(hst : gSt t p = Model.St.splitting)
(hX : XG K P G0 t)
:
XG K P G0 (moveLState t p)
theorem
OrderMaintenance.Proof.Word.xg_moveR
{K : ℕ}
{P : Model.Params}
{G0 : ℕ}
{L : List ℕ}
(hL : LabRoom K P)
(hlen : L.length + 2 ≤ 2 ^ K)
{t : Model.Core}
{gh : GGh}
{δ : ℕ → ℕ}
{p : ℕ}
(hG : GInvE t L gh δ p)
(hok : MoveROK t p)
(hst : gSt t p = Model.St.splitting)
(hX : XG K P G0 t)
:
XG K P G0 (moveRState t p)
theorem
OrderMaintenance.Proof.Word.xg_rem
{K : ℕ}
{P : Model.Params}
{G0 : ℕ}
(hroom : G0 + 2 ≤ 2 ^ K)
{t : Model.Core}
{p : ℕ}
(hp : LiveG t p)
(hlL : LiveG t (gLl t p))
(hrL : LiveG t (gRr t p))
(hl : gSz t (gLl t p) < t.P.G)
(hr : gSz t (gRr t p) < t.P.G)
(hX : XG K P G0 t)
:
XG K P G0 (removeState t p)
theorem
OrderMaintenance.Proof.Word.xg_split
{K : ℕ}
{P : Model.Params}
{G0 : ℕ}
(hL : LabRoom K P)
(hroom : G0 + 2 ≤ 2 ^ K)
{s : Model.Core}
{A : Abs}
{gh : GGh}
{g labL labR : ℕ}
(hI : INV s A)
(hG : GInv s A.elist gh fun (b : ℕ) => if b = g then 1 else 0)
(hg : LiveG s g)
(hq : gSt s g = Model.St.quiet)
(hsz : gSz s g = s.P.G)
(hLb : EStateM.run (Model.labBefore g) s = EStateM.Result.ok labL s)
(hLa : EStateM.run (Model.labAfter g) s = EStateM.Result.ok labR s)
(hX : XG K P G0 s)
:
XG K P G0 (splitState s g labL labR)
The chunk phase #
theorem
OrderMaintenance.Proof.CXSteps.andRun
{X Y W : Model.Core → Prop}
{L : List ℕ}
{δ δu s₀ : ℕ → ℕ}
{x : ℕ}
(h : CXSteps X Y L δ δu s₀ x)
(hl :
∀ (t : Model.Core) (A : Abs) (gh : GGh) (labs : List ℕ),
INV t A →
A.elist = L →
(GInv t L gh fun (x : ℕ) => 0) →
CInvE t L δ δu s₀ x →
LiveC t x →
cSt t x = Model.St.splitting →
cF t x ≠ Model.NIL →
EStateM.run (pushLabsL t x (Model.unitCand t x true).length) t = EStateM.Result.ok labs t →
W t → W (cmoveLState t x (Model.unitCand t x true) labs))
(hr :
∀ (t : Model.Core) (A : Abs) (gh : GGh) (labs : List ℕ),
INV t A →
A.elist = L →
(GInv t L gh fun (x : ℕ) => 0) →
CInvE t L δ δu s₀ x →
LiveC t x →
cSt t x = Model.St.splitting →
cF t x ≠ Model.NIL →
EStateM.run (pushLabsR t x (Model.unitCand t x false).length) t = EStateM.Result.ok labs t →
W t → W (cmoveRState t x (Model.unitCand t x false) labs))
(hrem : ∀ (t : Model.Core), W t → W (cremoveState t x))
:
CXSteps (fun (t : Model.Core) => X t ∧ W t) (fun (t : Model.Core) => Y t ∧ W t) L δ δu s₀ x
Combine a chunk-drive invariant with one that needs the labels of the move (which the first one's run provides).