Theorem W, option (A), stage A2: the peak of the background work (backgroundS) #
backgroundS_peak: the peak of background y, part by part, along Level F's trace of the parts
(as in backgroundS_agree): the chunk size (csP_pk), the split start of the group
(startGroupSplit_pk), the group drive (groupPhasePeak), the chunk drive (chunkPhasePeak) and
the reservation (reservation_peak). The state after each part is Level F's (the parts' agreement,
and evalF is a function).
Nothing here is used by Theorems A and B.
theorem
OrderMaintenance.Impl.backgroundS_peak
{K KH W : ℕ}
{κ : Caps}
(hC : CapsW K κ)
(hK : 8 ≤ K)
(hW : 2 * K + 4 ≤ W)
{L : Loc}
{y : ℕ}
{s0 s1 s2 s3 s4 : Model.Core}
(hG : Gd K KH κ (ΓK K) s0 L)
(hy : L "y" = y)
(h2 :
EStateM.run (if bgSplit s1 y s0.P = true then Model.startGroupSplit (gOf s1 y) else pure ()) s1 = EStateM.Result.ok () s2)
(m1 :
∃ (L' : Loc) (n : ℕ),
evalF κ csP.body s0 (Machine.State.setLocs (fun (x : Machine.Reg) => 0) ["c"] [cOf s0 y]) = Res.ok s1 L' n)
(m2 :
bgSplit s1 y s0.P = true →
∃ (L' : Loc) (n : ℕ),
evalF κ sgsP.body s1 (Machine.State.setLocs (fun (x : Machine.Reg) => 0) ["g"] [gOf s1 y]) = Res.ok s2 L' n)
(m3 :
∃ (L' : Loc) (n : ℕ),
evalF κ dgP.body s2 (Machine.State.setLocs (fun (x : Machine.Reg) => 0) ["g"] [gOf s2 y]) = Res.ok s3 L' n)
(m4 :
∃ (L' : Loc) (n : ℕ),
evalF κ dcP.body s3 (Machine.State.setLocs (fun (x : Machine.Reg) => 0) ["x"] [cOf s3 y]) = Res.ok s4 L' n)
(p1 :
Gd K KH κ (ΓK K) s0 (Machine.State.setLocs (fun (x : Machine.Reg) => 0) ["c"] [cOf s0 y]) →
PKok K KH κ (ΓK K) W csP.body s0 (Machine.State.setLocs (fun (x : Machine.Reg) => 0) ["c"] [cOf s0 y]))
(p3 :
Gd K KH κ (ΓK K) s2 (Machine.State.setLocs (fun (x : Machine.Reg) => 0) ["g"] [gOf s2 y]) →
PKok K KH κ (ΓK K) W dgP.body s2 (Machine.State.setLocs (fun (x : Machine.Reg) => 0) ["g"] [gOf s2 y]))
(p4 :
Gd K KH κ (ΓK K) s3 (Machine.State.setLocs (fun (x : Machine.Reg) => 0) ["x"] [cOf s3 y]) →
PKok K KH κ (ΓK K) W dcP.body s3 (Machine.State.setLocs (fun (x : Machine.Reg) => 0) ["x"] [cOf s3 y]))
(p5 :
Gd K KH κ (ΓK K) s4 (Machine.State.setLocs (fun (x : Machine.Reg) => 0) [] []) →
PKok K KH κ (ΓK K) W resP.body s4 (Machine.State.setLocs (fun (x : Machine.Reg) => 0) [] []))
(hP1 : s1.P = s0.P)
(hg1 : gOf s1 y < κ.tbl Tbl.G)
:
PKok K KH κ (ΓK K) W backgroundS s0 L
The background work, part by part: given Level F's trace and the agreement of each part,
the peak of each part's body gives the peak of background y.
theorem
OrderMaintenance.Proof.Word.background_peak
{K KH W : ℕ}
{TI : Model.Core → Prop}
{μ : Model.Core → ℕ}
{J k n R NB0 : ℕ}
{cap : Model.Params → ℕ}
{L : List ℕ}
{s0 s1 s2 : Model.Core}
{y g c : ℕ}
(hTC : TopContract TI μ J cap)
(hT : TopWB K TI μ)
(hTI : ∀ (t : Model.Core), TI t → Top.TopInv t)
(hPost : InsPost TI k J n R μ L s0 g c s2)
(hy : y ∈ L)
(heg1 : eG s1 y = g)
(hgc1 : 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 - cmax s0.P)) ≤ n + 1)
(hcap : 2 + 2 * (s2.count / (s0.P.theta + 1 - cmax s0.P)) ≤ cap s0.P)
(hI5 : ↑s0.P.theta + ↑R * (Zeroing.Hn (n - 1) + 1) ≤ ↑s0.P.T)
{κ : Impl.Caps}
(Ly : Impl.Loc)
(hLy : Ly "y" = y)
(hpow : s0.P.a = 2 ^ s0.P.a.log2)
(hq1 : Impl.PQCaps κ s1)
(hcC : c < Impl.Ccap κ)
(hcB : (s1.C.getX c).size + 1 < Impl.Bcap κ)
(K1 : Impl.GCaps κ s1)
(hG2 : s1.Gs.size + 2 ≤ κ.tbl Impl.Tbl.G)
(hF0 : 0 < κ.lrec Impl.LK.freeG)
(hF : s1.freeG.length ≤ κ.lcap Impl.LK.freeG)
(Mc : Model.Core → Prop)
(hM4 : ∀ (t : Model.Core), DFrame s2 t → Impl.PQCaps κ t → t.Gs.size ≤ s1.Gs.size + 2 → Mc t)
(hMc :
∀ (t : Model.Core),
Mc t →
Impl.TopCaps κ t ∧ Impl.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),
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 →
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),
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 →
ResInv TI s.P.reservationBudget J n R μ L s (j + 1) t2 → Mc t2)
(hW2 : WB K s2)
(hL : LabRoom K s0.P)
(hlen : 4 * L.length + 4 ≤ 2 ^ K)
(hG2' : s2.Gs.size + 2 ≤ 2 ^ K)
(hcnt : 2 * s2.count + 2 ≤ 2 ^ K)
(hNB : s2.nodes.size + μ s2 ≤ NB0 + J * s2.C.size)
(hNK : NB0 + J * (2 + 2 * s2.count) + 2 ≤ 2 ^ K)
(hC : Impl.CapsW K κ)
(hK : 8 ≤ K)
(hW : 2 * K + 4 ≤ W)
(hcapC : κ.lcap Impl.LK.children < 512)
(hcapT : κ.lcap Impl.LK.table < 512)
(hRm : TopRoom K s0.P)
(hcs : (s1.C.getX c).size + 1 < 2 ^ K)
(hGd : Impl.Gd K KH κ (Impl.ΓK K) s1 Ly)
:
Impl.PKok K KH κ (Impl.ΓK K) W Impl.backgroundS s1 Ly
The background work of an insertion (the context of bgAgree and background_wb): its
peak, from the parts' peaks along Level F's trace.