Documentation

LeanPool.OrderMaintenance.Impl.GlueCore

M6: the glue for the core's parts #

Level F's cost proofs establish the hypotheses of the core's run lemmas inside their proofs (the group drive, the chunk drive, the split starts). Here those places get Level M agreements: each proof is followed, and its run lemma is paired with the Level M lemma for the same branch.

The capacities a group drive needs, at state s.

Instances For
    theorem OrderMaintenance.Impl.GCaps.of_sizes {κ : Caps} {s t : Model.Core} (K : GCaps κ s) (groups : t.Gs.size = s.Gs.size) (elements : t.E.size = s.E.size) (chunks : t.C.size = s.C.size) :
    GCaps κ t

    Transport capacity bounds across changes that preserve the three array sizes.

    theorem OrderMaintenance.Proof.INV.gN_lt {s : Model.Core} {A : Abs} (hI : INV s A) {g : ℕ} (hg : g ∈ A.glist) :
    gN s g < s.Gs.size
    theorem OrderMaintenance.Proof.INV.gP_lt {s : Model.Core} {A : Abs} (hI : INV s A) {g : ℕ} (hg : g ∈ A.glist) :
    gP s g < s.Gs.size
    theorem OrderMaintenance.Proof.INV.gF_lt {s : Model.Core} {A : Abs} (hI : INV s A) {g : ℕ} (hg : g ∈ A.glist) :
    gF s g = Model.NIL ∨ gF s g < s.E.size
    theorem OrderMaintenance.Proof.INV.gLs_lt {s : Model.Core} {A : Abs} (hI : INV s A) {g : ℕ} (hg : g ∈ A.glist) :
    gLs s g = Model.NIL ∨ gLs s g < s.E.size

    The free groups are distinct groups below Gs.size, other than NIL.

    theorem OrderMaintenance.Proof.DriveInv.stepAgree {X Y : Model.Core → Prop} {s : Model.Core} {L : List ℕ} {δ : ℕ → ℕ} {p l r a b c j : ℕ} {t : Model.Core} (hXs : XSteps X Y L δ p (gC s p)) (hP : GParams s.P) (hTlo : s.P.G ≤ a + b + c) (hThi : a + b + c ≤ s.P.G + s.P.G / (s.P.groupBudget - 1) + 1) (hbal0 : a ≤ c + 2 ∧ c ≤ a + 2) (hD : DriveInv X s L δ p l r a b c j t) {κ : Impl.Caps} (hcg : ∀ (g : ℕ), LiveG t g → gC t g < t.C.size) (K : Impl.GCaps κ t) :

    A group split step of a drive agrees (the cases of DriveInv.step).

    theorem OrderMaintenance.Impl.ginv_driveAgree {X Y : Model.Core → Prop} {s : Model.Core} {A : Proof.Abs} {gh : Proof.GGh} {δ : ℕ → ℕ} {p : ℕ} (hI : Proof.INV s A) (hXs : Proof.XSteps X Y A.elist δ p (Proof.gC s p)) (hX : X s) (hG : Proof.GInvE s A.elist gh δ p) (hP : Proof.GParams s.P) (hp : Proof.LiveG s p) (hs : Proof.gSt s p = Model.St.splitting) (hG1 : Proof.G1 s δ p) (hδ : ∀ (z : ℕ), z ≠ Proof.gLl s p → z ≠ p → z ≠ Proof.gRr s p → δ z = 0) (hδs : δ (Proof.gLl s p) + δ p + δ (Proof.gRr s p) ≤ 1) (hδle : δ (Proof.gLl s p) ≤ Proof.gSz s (Proof.gLl s p) ∧ δ p ≤ Proof.gSz s p ∧ δ (Proof.gRr s p) ≤ Proof.gSz s (Proof.gRr s p)) {κ : Caps} (hXc : ∀ (t : Model.Core), X t → ∀ (g : ℕ), Proof.LiveG t g → Proof.gC t g < t.C.size) (K : GCaps κ s) :
    ∃ (s' : Model.Core), DriveAgree κ p s s' ∧ s'.Gs.size = s.Gs.size ∧ s'.C.size = s.C.size ∧ s'.E.size = s.E.size

    The drive of a splitting group agrees (the context of ginv_drive).

    theorem OrderMaintenance.Impl.linkGroupPair_size (s : Model.Core) (g gl gr labL labR : ℕ) :
    (Model.linkGroupPair s g gl gr labL labR).Gs.size = s.Gs.size
    theorem OrderMaintenance.Impl.splitState_size (s : Model.Core) (g labL labR : ℕ) :
    (Proof.splitState s g labL labR).Gs.size ≤ s.Gs.size + 2
    theorem OrderMaintenance.Impl.DriveAgree.eq_of_run {κ : Caps} {q : ℕ} {s s' s'' : Model.Core} (hA : DriveAgree κ q s s'') (h : EStateM.run (Model.driveGroupFrom q) s = EStateM.Result.ok () s') :
    s'' = s'
    theorem OrderMaintenance.Impl.DriveAgree.of_run {κ : Caps} {q : ℕ} {s s' s'' : Model.Core} (hA : DriveAgree κ q s s'') (h : EStateM.run (Model.driveGroupFrom q) s = EStateM.Result.ok () s') :
    DriveAgree κ q s s'

    A drive that agrees, read off a DriveAgree for the run Level F made.

    theorem OrderMaintenance.Impl.groupPhaseAgree {X Y : Model.Core → Prop} {s : Model.Core} {A : Proof.Abs} {gh : Proof.GGh} {g : ℕ} (hI : Proof.INV s A) (hXg : Proof.XGroup X Y A.elist (Proof.gC s g)) (hX : X s) (hG : Proof.GInv s A.elist gh fun (b : ℕ) => if b = g then 1 else 0) (hP : Proof.GParams s.P) (hg : Proof.LiveG s g) (hpos : 1 ≤ Proof.gSz s g) (hroom : Proof.gSt s g = Model.St.quiet → s.P.G ≤ Proof.gSz s g → Proof.SplitRoom s g) {κ : Caps} (hXc : ∀ (t : Model.Core), X t → ∀ (g : ℕ), Proof.LiveG t g → Proof.gC t g < t.C.size) (K : GCaps κ s) (hG2 : s.Gs.size + 2 ≤ κ.tbl Tbl.G) (hF0 : 0 < κ.lrec LK.freeG) (hF : s.freeG.length ≤ κ.lcap LK.freeG) {s1 s' : Model.Core} (h1 : EStateM.run (if ((s.Gs.getX g).st == Model.St.quiet && decide ((s.Gs.getX g).size ≥ s.P.G)) = true then Model.startGroupSplit g else pure ()) s = EStateM.Result.ok () s1) (h2 : EStateM.run (Model.driveGroup g) s1 = EStateM.Result.ok () s') :
    (((s.Gs.getX g).st == Model.St.quiet && decide ((s.Gs.getX g).size ≥ s.P.G)) = true → ∃ (L' : Loc) (n : ℕ), evalF κ startGroupSplitS s (Machine.State.setLocs (fun (x : Machine.Reg) => 0) ["g"] [g]) = Res.ok s1 L' n ∧ n ≤ 600) ∧ (∃ (L' : Loc) (n : ℕ), evalF κ driveGroupS s1 (Machine.State.setLocs (fun (x : Machine.Reg) => 0) ["g"] [g]) = Res.ok s' L' n ∧ n ≤ 30 + s1.P.groupBudget * 401) ∧ s'.Gs.size ≤ s.Gs.size + 2 ∧ s'.C.size = s.C.size ∧ s'.E.size = s.E.size ∧ s1.E = s.E ∧ s1.P = s.P

    The group phase agrees (the context of groupPhase_ok): the split start, when it runs, and the drive.

    theorem OrderMaintenance.Proof.INV.mem_chunks {s : Model.Core} {A : Abs} (hI : INV s A) {c : ℕ} (hc : LiveC s c) :
    theorem OrderMaintenance.Proof.INV.cF_lt {s : Model.Core} {A : Abs} (hI : INV s A) {c : ℕ} (hc : c ∈ A.chunks) :
    cF s c = Model.NIL ∨ cF s c < s.Gs.size
    theorem OrderMaintenance.Proof.INV.cLs_lt {s : Model.Core} {A : Abs} (hI : INV s A) {c : ℕ} (hc : c ∈ A.chunks) :
    theorem OrderMaintenance.Proof.CDriveInv.stepAgree {X Y : Model.Core → Prop} {s : Model.Core} {L : List ℕ} {δ δu s₀ : ℕ → ℕ} {x y z a b c u₀ j : ℕ} {t : Model.Core} (hXs : CXSteps X Y L δ δu s₀ x) (hP : GParams s.P) (hCP : CParams s.P) (hThi : a + b + c ≤ s.P.T + kC s.P s.P.T) (hbal0 : a ≤ c + umax s.P + 1 ∧ c ≤ a + umax s.P + 1) (hfam0 : a + b + c ≤ δ y + δ x + δ z + s₀ x + unitsOf s.P (s₀ x) / (s.P.chunkBudget - 1)) (hδs : δ y + δ x + δ z ≤ 1) (hs0T : s₀ x ≤ s.P.T) (hD : CDriveInv X s L δ δu s₀ x y z a b c u₀ j t) {κ : Impl.Caps} (K : Impl.GCaps κ t) :
    ∃ (bb : Bool) (t' : Model.Core), EStateM.run (Model.chunkSplitStep x) t = EStateM.Result.ok bb t' ∧ Impl.CStepAgree κ x t t' bb ∧ t'.Gs.size = t.Gs.size ∧ t'.C.size = t.C.size ∧ t'.E.size = t.E.size

    A chunk split step of a drive agrees (the cases of CDriveInv.step).

    theorem OrderMaintenance.Impl.cinv_driveAgree {X Y : Model.Core → Prop} {s : Model.Core} {A : Proof.Abs} {gh : Proof.GGh} {δ δu s₀ : ℕ → ℕ} {x : ℕ} (hI : Proof.INV s A) (hG : Proof.GInv s A.elist gh fun (x : ℕ) => 0) (hC : Proof.CInvE s A.elist δ δu s₀ x) (hC1 : Proof.C1 s δ δu s₀ x) (hXs : Proof.CXSteps X Y A.elist δ δu s₀ x) (hX : X s) (hP : Proof.GParams s.P) (hCP : Proof.CParams s.P) (hxL : Proof.LiveC s x) (hst : Proof.cSt s x = Model.St.splitting) (hδ : ∀ (c : ℕ), c ≠ Proof.cLl s x → c ≠ x → c ≠ Proof.cRr s x → δ c = 0) (hδs : δ (Proof.cLl s x) + δ x + δ (Proof.cRr s x) ≤ 1) (hδle : δ (Proof.cLl s x) ≤ Proof.cSz s (Proof.cLl s x) ∧ δ x ≤ Proof.cSz s x ∧ δ (Proof.cRr s x) ≤ Proof.cSz s (Proof.cRr s x)) {κ : Caps} (K : GCaps κ s) :
    ∃ (s' : Model.Core), CDriveAgree κ x s s' ∧ s'.Gs.size = s.Gs.size ∧ s'.C.size = s.C.size ∧ s'.E.size = s.E.size

    The drive of a splitting chunk agrees (the context of cinv_drive).

    theorem OrderMaintenance.Impl.driveChunkAgree {t : Model.Core} {A : Proof.Abs} {L : List ℕ} {gh : Proof.GGh} {s₀ δu e : ℕ → ℕ} {pops c : ℕ} (hI : Proof.INV t A) (hel : A.elist = L) (hG : Proof.GInv t L gh fun (x : ℕ) => 0) (hC : Proof.CInv t L (Proof.δ1 c) δu s₀) (hLX : Proof.LX s₀ (Proof.δ1 c) δu t) (hN : Proof.CountInv t e pops) (hGP : Proof.GParams t.P) (hCP : Proof.CParams t.P) (hcL : Proof.LiveC t c) (hcnd : Proof.cSt t c ≠ Model.St.dead) (hcsz : 1 ≤ Proof.cSz t c) {κ : Caps} (K : GCaps κ t) {t4 : Model.Core} (h : EStateM.run (Model.driveChunk c) t = EStateM.Result.ok () t4) :
    (∃ (L' : Loc) (n : ℕ), evalF κ driveChunkS t (Machine.State.setLocs (fun (x : Machine.Reg) => 0) ["x"] [c]) = Res.ok t4 L' n ∧ n ≤ 30 + t.P.chunkBudget * 751) ∧ t4.Gs.size = t.Gs.size ∧ t4.C.size = t.C.size ∧ t4.E.size = t.E.size

    The chunk phase agrees (the context of driveChunk_ok).

    theorem OrderMaintenance.Impl.ResAgree.mono {κ : Caps} {t t' : Model.Core} {stop : Bool} {D D' : ℕ} (h : ResAgree κ t t' stop D) (hD : D ≤ D') :
    ResAgree κ t t' stop D'
    theorem OrderMaintenance.Impl.reservationAgreeOf {κ : Caps} {s : Model.Core} (L : Loc) (I : ℕ → Model.Core → Prop) (Q : Model.Core → Prop) {DJ DS : ℕ} (h0 : I 0 s) (hstep : ∀ (j : ℕ) (t : Model.Core), I j t → j < s.P.reservationBudget → (t.resJob = none → t.pqHi = 0 ∧ Q t ∨ t.pqHi ≠ 0 ∧ ∃ (c : ℕ) (t1 : Model.Core) (t2 : Model.Core), EStateM.run Model.pqPopMax t = EStateM.Result.ok c t1 ∧ EStateM.run (Model.splitChunkStart c) t1 = EStateM.Result.ok () t2 ∧ I (j + 1) t2) ∧ ∀ (job : Model.Job), t.resJob = some job → ∃ (r : Option Model.Job) (t1 : Model.Core), EStateM.run (Model.jobStep job) t = EStateM.Result.ok r t1 ∧ I (j + 1) { P := t1.P, E := t1.E, Gs := t1.Gs, C := t1.C, freeG := t1.freeG, count := t1.count, head := t1.head, tail := t1.tail, firstGroup := t1.firstGroup, firstChunk := t1.firstChunk, ready := t1.ready, prep := t1.prep, resJob := r, fallbacks := t1.fallbacks, pqHead := t1.pqHead, pqNext := t1.pqNext, pqPrev := t1.pqPrev, pqWhere := t1.pqWhere, nbNext := t1.nbNext, nbPrev := t1.nbPrev, pqHi := t1.pqHi, pqLo := t1.pqLo, nodes := t1.nodes, path := t1.path, cin := t1.cin, lpar := t1.lpar }) (hJ : ∀ (j : ℕ) (t : Model.Core) (job : Model.Job), I j t → j < s.P.reservationBudget → t.resJob = some job → JobAgree κ t job DJ) (hS : ∀ (j : ℕ) (t : Model.Core) (c : ℕ) (t1 : Model.Core), I j t → j < s.P.reservationBudget → t.resJob = none → t.pqHi ≠ 0 → EStateM.run Model.pqPopMax t = EStateM.Result.ok c t1 → PQCaps κ t ∧ SplitAgree κ t1 c DS) :
    ∃ (t' : Model.Core) (L' : Loc) (n : ℕ), EStateM.run (Model.reservation s.P.reservationBudget) s = EStateM.Result.ok () t' ∧ evalF κ reservationS s L = Res.ok t' L' n ∧ n ≤ 5 + s.P.reservationBudget * (DJ + DS + 340 + 6)

    The reservation loop agrees, from Level F's loop invariant and the agreement of each round: a job step at a state with a job, a split start at a state with none.

    def OrderMaintenance.Impl.resBound (reservationBudget : ℕ) :

    The cost bound of the reservation loop of one insertion, from the bounds of a job step and a split start.

    Instances For
      theorem OrderMaintenance.Impl.reservationAgree_top {TI : Model.Core → Prop} {μ : Model.Core → ℕ} {J n R : ℕ} {cap : Model.Params → ℕ} {L : List ℕ} {s : Model.Core} {κ : Caps} (Lc : Loc) (hTC : Proof.TopContract TI μ J cap) (hTI : ∀ (t : Model.Core), TI t → Proof.Top.TopInv t) (h0 : Proof.ResInv TI s.P.reservationBudget J n R μ L s 0 s) (hn : 1 ≤ n) (hsize : 2 + 2 * (s.count / (s.P.theta + 1 - Proof.cmax s.P)) ≤ n + 1) (hcap : 2 + 2 * (s.count / (s.P.theta + 1 - Proof.cmax s.P)) ≤ cap s.P) (hI5 : ↑s.P.theta + ↑R * (Zeroing.Hn (n - 1) + 1) ≤ ↑s.P.T) (hpow : s.P.a = 2 ^ s.P.a.log2) (Mc : Model.Core → Prop) (hM0 : Mc s) (hMc : ∀ (t : Model.Core), Mc t → TopCaps κ t ∧ PQCaps κ t ∧ t.prep = none ∧ ∀ (c : ℕ), t.C.size ≤ c → ∀ (j : ℕ), (t.path.getX c).getX j = 0) (hMpop : ∀ (t : Model.Core) (c : ℕ) (t1 : Model.Core), Mc t → EStateM.run Model.pqPopMax t = EStateM.Result.ok c t1 → Mc t1) (hMjob : ∀ (j : ℕ) (t : Model.Core) (job : Model.Job) (r : Option Model.Job) (t1 : Model.Core), Proof.ResInv TI s.P.reservationBudget J n R μ L s j t → Mc t → t.resJob = some job → EStateM.run (Model.jobStep job) t = EStateM.Result.ok r t1 → Proof.ResInv TI s.P.reservationBudget J n R μ L s (j + 1) { P := t1.P, E := t1.E, Gs := t1.Gs, C := t1.C, freeG := t1.freeG, count := t1.count, head := t1.head, tail := t1.tail, firstGroup := t1.firstGroup, firstChunk := t1.firstChunk, ready := t1.ready, prep := t1.prep, resJob := r, fallbacks := t1.fallbacks, pqHead := t1.pqHead, pqNext := t1.pqNext, pqPrev := t1.pqPrev, pqWhere := t1.pqWhere, nbNext := t1.nbNext, nbPrev := t1.nbPrev, pqHi := t1.pqHi, pqLo := t1.pqLo, nodes := t1.nodes, path := t1.path, cin := t1.cin, lpar := t1.lpar } → Mc { P := t1.P, E := t1.E, Gs := t1.Gs, C := t1.C, freeG := t1.freeG, count := t1.count, head := t1.head, tail := t1.tail, firstGroup := t1.firstGroup, firstChunk := t1.firstChunk, ready := t1.ready, prep := t1.prep, resJob := r, fallbacks := t1.fallbacks, pqHead := t1.pqHead, pqNext := t1.pqNext, pqPrev := t1.pqPrev, pqWhere := t1.pqWhere, nbNext := t1.nbNext, nbPrev := t1.nbPrev, pqHi := t1.pqHi, pqLo := t1.pqLo, nodes := t1.nodes, path := t1.path, cin := t1.cin, lpar := t1.lpar }) (hMsplit : ∀ (j : ℕ) (t : Model.Core) (c : ℕ) (t1 t2 : Model.Core), Proof.ResInv TI s.P.reservationBudget J n R μ L s j t → Mc t → t.resJob = none → EStateM.run Model.pqPopMax t = EStateM.Result.ok c t1 → EStateM.run (Model.splitChunkStart c) t1 = EStateM.Result.ok () t2 → Proof.ResInv TI s.P.reservationBudget J n R μ L s (j + 1) t2 → Mc t2) :

      The reservation agrees (the context of reservation_cost), relative to a predicate Mc on cores that gives the Level M side conditions and that the rounds keep.

      theorem OrderMaintenance.Impl.PQCaps.of_same {κ : Caps} {s s' : Model.Core} (h : PQCaps κ s) (S : Proof.PQSame s s') :
      PQCaps κ s'

      The cost bound of the background work of one insertion at Level M.

      Equations
      Instances For
        theorem OrderMaintenance.Impl.bgAgree {TI : Model.Core → Prop} {μ : Model.Core → ℕ} {J k n R : ℕ} {cap : Model.Params → ℕ} {L : List ℕ} {s0 s1 s2 : Model.Core} {y g c : ℕ} (hTC : Proof.TopContract TI μ J cap) (hTI : ∀ (t : Model.Core), TI t → Proof.Top.TopInv t) (hPost : Proof.InsPost TI k J n R μ L s0 g c s2) (hy : y ∈ L) (heg1 : Proof.eG s1 y = g) (hgc1 : Proof.gC s1 g = c) (hchunk : EStateM.run (Model.chunkSize c true) s1 = EStateM.Result.ok () s2) (hE12 : s2.E = s1.E) (hP1 : s1.P = s0.P) (hkP : s0.P.reservationBudget = k) (hn : 1 ≤ n) (hsize : 2 + 2 * (s2.count / (s0.P.theta + 1 - Proof.cmax s0.P)) ≤ n + 1) (hcap : 2 + 2 * (s2.count / (s0.P.theta + 1 - Proof.cmax s0.P)) ≤ cap s0.P) (hI5 : ↑s0.P.theta + ↑R * (Zeroing.Hn (n - 1) + 1) ≤ ↑s0.P.T) {κ : Caps} (Ly : Loc) (hLy : Ly "y" = y) (hpow : s0.P.a = 2 ^ s0.P.a.log2) (hq1 : PQCaps κ s1) (hcC : c < Ccap κ) (hcB : (s1.C.getX c).size + 1 < Bcap κ) (K1 : GCaps κ s1) (hG2 : s1.Gs.size + 2 ≤ κ.tbl Tbl.G) (hF0 : 0 < κ.lrec LK.freeG) (hF : s1.freeG.length ≤ κ.lcap LK.freeG) (hyE : y < κ.tbl Tbl.E) (Mc : Model.Core → Prop) (hM4 : ∀ (t : Model.Core), Proof.DFrame s2 t → PQCaps κ t → t.Gs.size ≤ s1.Gs.size + 2 → Mc t) (hMc : ∀ (t : Model.Core), Mc t → TopCaps κ t ∧ PQCaps κ t ∧ t.prep = none ∧ ∀ (c : ℕ), t.C.size ≤ c → ∀ (j : ℕ), (t.path.getX c).getX j = 0) (hMpop : ∀ (t : Model.Core) (c : ℕ) (t1 : Model.Core), Mc t → EStateM.run Model.pqPopMax t = EStateM.Result.ok c t1 → Mc t1) (hMjob : ∀ (s : Model.Core) (j : ℕ) (t : Model.Core) (job : Model.Job) (r : Option Model.Job) (t1 : Model.Core), Proof.ResInv TI s.P.reservationBudget J n R μ L s j t → Mc t → t.resJob = some job → EStateM.run (Model.jobStep job) t = EStateM.Result.ok r t1 → Proof.ResInv TI s.P.reservationBudget J n R μ L s (j + 1) { P := t1.P, E := t1.E, Gs := t1.Gs, C := t1.C, freeG := t1.freeG, count := t1.count, head := t1.head, tail := t1.tail, firstGroup := t1.firstGroup, firstChunk := t1.firstChunk, ready := t1.ready, prep := t1.prep, resJob := r, fallbacks := t1.fallbacks, pqHead := t1.pqHead, pqNext := t1.pqNext, pqPrev := t1.pqPrev, pqWhere := t1.pqWhere, nbNext := t1.nbNext, nbPrev := t1.nbPrev, pqHi := t1.pqHi, pqLo := t1.pqLo, nodes := t1.nodes, path := t1.path, cin := t1.cin, lpar := t1.lpar } → Mc { P := t1.P, E := t1.E, Gs := t1.Gs, C := t1.C, freeG := t1.freeG, count := t1.count, head := t1.head, tail := t1.tail, firstGroup := t1.firstGroup, firstChunk := t1.firstChunk, ready := t1.ready, prep := t1.prep, resJob := r, fallbacks := t1.fallbacks, pqHead := t1.pqHead, pqNext := t1.pqNext, pqPrev := t1.pqPrev, pqWhere := t1.pqWhere, nbNext := t1.nbNext, nbPrev := t1.nbPrev, pqHi := t1.pqHi, pqLo := t1.pqLo, nodes := t1.nodes, path := t1.path, cin := t1.cin, lpar := t1.lpar }) (hMsplit : ∀ (s : Model.Core) (j : ℕ) (t : Model.Core) (c : ℕ) (t1 t2 : Model.Core), Proof.ResInv TI s.P.reservationBudget J n R μ L s j t → Mc t → t.resJob = none → EStateM.run Model.pqPopMax t = EStateM.Result.ok c t1 → EStateM.run (Model.splitChunkStart c) t1 = EStateM.Result.ok () t2 → Proof.ResInv TI s.P.reservationBudget J n R μ L s (j + 1) t2 → Mc t2) :
        ∃ (s' : Model.Core), EStateM.run (Model.background y) s1 = EStateM.Result.ok () s' ∧ (∃ (L' : Loc) (m : ℕ), evalF κ backgroundS s1 Ly = Res.ok s' L' m ∧ m ≤ bgBound s0.P) ∧ Mc s'

        The background work agrees (the context of background_ok), relative to a predicate Mc on cores that gives the Level M side conditions of the reservation and that its rounds keep.

        The capacities an insertion needs at its start (besides those of the top structure).

        Instances For
          theorem OrderMaintenance.Impl.linkElem_frame (s : Model.Core) (x y lab h : ℕ) :
          (Model.linkElem s x y lab h).Gs.size = s.Gs.size ∧ (Model.linkElem s x y lab h).C = s.C ∧ (Model.linkElem s x y lab h).freeG = s.freeG ∧ (Model.linkElem s x y lab h).E.size = s.E.size + 1 ∧ Proof.PQSame s (Model.linkElem s x y lab h) ∧ (Model.linkElem s x y lab h).nodes = s.nodes ∧ (Model.linkElem s x y lab h).path = s.path ∧ (Model.linkElem s x y lab h).prep = s.prep ∧ (Model.linkElem s x y lab h).P = s.P

          The cost bound of an insertion at Level M.

          Equations
          Instances For
            theorem OrderMaintenance.Impl.insertAgree {TI : Model.Core → Prop} {μ : Model.Core → ℕ} {J n R : ℕ} {cap : Model.Params → ℕ} {L : List ℕ} {s : Model.Core} {x : ℕ} (hTC : Proof.TopContract TI μ J cap) (hTI : ∀ (t : Model.Core), TI t → Proof.Top.TopInv t) (hC : Proof.CostInv TI μ J n R L s) (hx : x ∈ L) (hk : 1 ≤ s.P.reservationBudget) (hR : J / s.P.reservationBudget + 1 ≤ R) (hn : 1 ≤ n) (hsize : 2 + 2 * ((s.count + 1) / (s.P.theta + 1 - Proof.cmax s.P)) ≤ n + 1) (hcap : 2 + 2 * ((s.count + 1) / (s.P.theta + 1 - Proof.cmax s.P)) ≤ cap s.P) (hI5 : ↑s.P.theta + ↑R * (Zeroing.Hn (n - 1) + 1) ≤ ↑s.P.T) (hh : ℕ) {κ : Caps} (Lx : Loc) (hLx : Lx "x" = x) (hLh : Lx "h" = hh) (hpow : s.P.a = 2 ^ s.P.a.log2) (K : InsCaps κ s) (Mc : Model.Core → Prop) (hM4 : ∀ (t : Model.Core), Proof.Top.ts t = Proof.Top.ts s → t.resJob = s.resJob → t.prep = s.prep → t.C.size = s.C.size → t.count = s.count + 1 → t.Gs.size ≤ s.Gs.size + 2 → PQCaps κ t → Mc t) (hMc : ∀ (t : Model.Core), Mc t → TopCaps κ t ∧ PQCaps κ t ∧ t.prep = none ∧ ∀ (c : ℕ), t.C.size ≤ c → ∀ (j : ℕ), (t.path.getX c).getX j = 0) (hMpop : ∀ (t : Model.Core) (c : ℕ) (t1 : Model.Core), Mc t → EStateM.run Model.pqPopMax t = EStateM.Result.ok c t1 → Mc t1) (hMjob : ∀ (L : List ℕ) (s : Model.Core) (j : ℕ) (t : Model.Core) (job : Model.Job) (r : Option Model.Job) (t1 : Model.Core), Proof.ResInv TI s.P.reservationBudget J n R μ L s j t → Mc t → t.resJob = some job → EStateM.run (Model.jobStep job) t = EStateM.Result.ok r t1 → Proof.ResInv TI s.P.reservationBudget J n R μ L s (j + 1) { P := t1.P, E := t1.E, Gs := t1.Gs, C := t1.C, freeG := t1.freeG, count := t1.count, head := t1.head, tail := t1.tail, firstGroup := t1.firstGroup, firstChunk := t1.firstChunk, ready := t1.ready, prep := t1.prep, resJob := r, fallbacks := t1.fallbacks, pqHead := t1.pqHead, pqNext := t1.pqNext, pqPrev := t1.pqPrev, pqWhere := t1.pqWhere, nbNext := t1.nbNext, nbPrev := t1.nbPrev, pqHi := t1.pqHi, pqLo := t1.pqLo, nodes := t1.nodes, path := t1.path, cin := t1.cin, lpar := t1.lpar } → Mc { P := t1.P, E := t1.E, Gs := t1.Gs, C := t1.C, freeG := t1.freeG, count := t1.count, head := t1.head, tail := t1.tail, firstGroup := t1.firstGroup, firstChunk := t1.firstChunk, ready := t1.ready, prep := t1.prep, resJob := r, fallbacks := t1.fallbacks, pqHead := t1.pqHead, pqNext := t1.pqNext, pqPrev := t1.pqPrev, pqWhere := t1.pqWhere, nbNext := t1.nbNext, nbPrev := t1.nbPrev, pqHi := t1.pqHi, pqLo := t1.pqLo, nodes := t1.nodes, path := t1.path, cin := t1.cin, lpar := t1.lpar }) (hMsplit : ∀ (L : List ℕ) (s : Model.Core) (j : ℕ) (t : Model.Core) (c : ℕ) (t1 t2 : Model.Core), Proof.ResInv TI s.P.reservationBudget J n R μ L s j t → Mc t → t.resJob = none → EStateM.run Model.pqPopMax t = EStateM.Result.ok c t1 → EStateM.run (Model.splitChunkStart c) t1 = EStateM.Result.ok () t2 → Proof.ResInv TI s.P.reservationBudget J n R μ L s (j + 1) t2 → Mc t2) :
            ∃ (s' : Model.Core), EStateM.run (Model.insertAfter x hh) s = EStateM.Result.ok s.E.size s' ∧ (∃ (L' : Loc) (m : ℕ), evalF κ insertAfterP.body s Lx = Res.ok s' L' m ∧ L' "y" = s.E.size ∧ m ≤ insBound s.P) ∧ Proof.CostInv TI μ J n R (Spec.insertAfterL x s.E.size L) s' ∧ s'.count = s.count + 1 ∧ s'.P = s.P ∧ Mc s'

            An insertion agrees (the context of insertAfter_cost), relative to a predicate Mc on cores that gives the Level M side conditions of the reservation and that its rounds keep.