Documentation

LeanPool.OrderMaintenance.Proof.Word.Hooks

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 are at most |L| #

theorem OrderMaintenance.Proof.Word.sum_le_of_le {f : ℕ → ℕ} {B : ℕ} (u : List ℕ) :
(∀ g ∈ u, f g ≤ B) → (List.map f u).sum ≤ u.length * B

What the group steps change #

theorem OrderMaintenance.Proof.Word.moveLState_g (t : Model.Core) (p z : ℕ) :
gSt (moveLState t p) z = gSt t z ∧ gA (moveLState t p) z = gA t z ∧ (z ≠ p → z ≠ gLl t p → gSz (moveLState t p) z = gSz t z)
theorem OrderMaintenance.Proof.Word.moveRState_g (t : Model.Core) (p z : ℕ) :
gSt (moveRState t p) z = gSt t z ∧ gA (moveRState t p) z = gA t z ∧ (z ≠ p → z ≠ gRr t p → gSz (moveRState t p) z = gSz t z)
theorem OrderMaintenance.Proof.Word.removeState_g (t : Model.Core) (p : ℕ) {z : ℕ} (hl : gLl t p < t.Gs.size) (hr : gRr t p < t.Gs.size) :
(gSt (removeState t p) z = if z = gLl t p ∨ z = gRr t p then Model.St.quiet else gSt t z) ∧ (gA (removeState t p) z = true → gA t z = true) ∧ gSz (removeState t p) z = gSz t z

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.splitState_P (s : Model.Core) (g labL labR : ℕ) :
    (splitState s g labL labR).P = s.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)
    theorem OrderMaintenance.Proof.Word.xgroup_wb {K : ℕ} {P : Model.Params} {G0 : ℕ} {L : List ℕ} {c : ℕ} (hL : LabRoom K P) (hroom : G0 + 2 ≤ 2 ^ K) (hlen : L.length + 2 ≤ 2 ^ K) :
    XGroup (XG K P G0) (XG K P G0) L c

    The stored-value bound through the group phase.

    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).

    theorem OrderMaintenance.Proof.Word.unit_live {t : Model.Core} {A : Abs} {gh : GGh} {δ : ℕ → ℕ} (hI : INV t A) (hG : GInv t A.elist gh δ) {x : ℕ} (hne : cF t x ≠ Model.NIL) (left : Bool) :
    (∀ g ∈ Model.unitCand t x left, LiveG t g) ∧ (Model.unitCand t x left).length ≤ 3

    The groups of a chunk-split unit are live, and there are at most three.

    theorem OrderMaintenance.Proof.Word.unit_sum_le {t : Model.Core} {A : Abs} {gh : GGh} (hI : INV t A) (hG : GInv t A.elist gh fun (x : ℕ) => 0) {x : ℕ} (hne : cF t x ≠ Model.NIL) (left : Bool) :
    (List.map (fun (g : ℕ) => gSz t g) (Model.unitCand t x left)).sum ≤ 3 * A.elist.length
    theorem OrderMaintenance.Proof.Word.cxsteps_wb {K : ℕ} {X Y : Model.Core → Prop} {P : Model.Params} {L : List ℕ} {δ δu s₀ : ℕ → ℕ} {x : ℕ} (h : CXSteps X Y L δ δu s₀ x) (hL : LabRoom K P) (hlen : 4 * L.length + 1 ≤ 2 ^ K) :
    CXSteps (fun (t : Model.Core) => X t ∧ WB K t ∧ t.P = P) (fun (t : Model.Core) => Y t ∧ WB K t ∧ t.P = P) L δ δu s₀ x

    The stored-value bound through the chunk drive.