Theorem W, option (A), stage A2: the peak of insertAfter #
insertAfter_peakG: in the context ofinsertAgree(Theorem A) andinsertAfter_wb(option (B)): the element insertion (insertElem_pkok, its sizes bounded by the end state throughfin_insertElem), then the background work (background_peak), each in itscatch … bug.insertAfter_peakM: at the cost proof's top invariant (TIat TopInv P, the context ofinsertAgreeM), with the capacity predicateMc.InService.peak: for a core in service (the wrapper's Level M invariant,InService), at any word sizeK ≥ wK c.P(64·L).
Nothing here is used by Theorems A and B.
theorem
OrderMaintenance.Proof.Word.insertAfter_peakG
{K KH W : ℕ}
{TI : Model.Core → Prop}
{μ : Model.Core → ℕ}
{J n R NB0 : ℕ}
{cap : Model.Params → ℕ}
{L : List ℕ}
{s : Model.Core}
{x : ℕ}
(hTC : TopContract TI μ J cap)
(hT : TopWB K TI μ)
(hTI : ∀ (t : Model.Core), TI t → Top.TopInv t)
(hC : 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 - cmax s.P)) ≤ n + 1)
(hcap : 2 + 2 * ((s.count + 1) / (s.P.theta + 1 - cmax s.P)) ≤ cap s.P)
(hI5 : ↑s.P.theta + ↑R * (Zeroing.Hn (n - 1) + 1) ≤ ↑s.P.T)
(hh : ℕ)
{κ : Impl.Caps}
(Lx : Impl.Loc)
(hLx : Lx "x" = x)
(hLh : Lx "h" = hh)
(hpow : s.P.a = 2 ^ s.P.a.log2)
(KI : Impl.InsCaps κ s)
(Mc : Model.Core → Prop)
(hM4 :
∀ (t : Model.Core),
Top.ts t = 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 → Impl.PQCaps κ t → 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 :
∀ (L : List ℕ) (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 :
∀ (L : List ℕ) (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)
(hW : WB K s)
(hL : LabRoom K s.P)
(hE : 4 * s.E.size + 8 ≤ 2 ^ K)
(hG : s.Gs.size + 2 ≤ 2 ^ K)
(hcnt : 2 * s.count + 4 ≤ 2 ^ K)
(hNB : s.nodes.size + μ s ≤ NB0 + J * s.C.size)
(hNK : NB0 + J * (2 + 2 * (s.count + 1)) + 2 ≤ 2 ^ K)
(hCw : Impl.CapsW K κ)
(hK : 8 ≤ K)
(hWK : 2 * K + 4 ≤ W)
(hKH : KH ≤ W)
(hcapC : κ.lcap Impl.LK.children < 512)
(hcapT : κ.lcap Impl.LK.table < 512)
(hRm : TopRoom K s.P)
(hGd : Impl.Gd K KH κ (Impl.ΓH K KH) s Lx)
:
Impl.PKok K KH κ (Impl.ΓH K KH) W Impl.insertAfterP.body s Lx
An insertion (the context of insertAgree and insertAfter_wb): its peak.
theorem
OrderMaintenance.Proof.Word.insertAfter_peakM
{K KH W : ℕ}
{P : Model.Params}
{n R : ℕ}
{L : List ℕ}
{s : Model.Core}
{x : ℕ}
(hC : CostInv (TIat Top.TopInv P) Top.topMu (Top.topJ P) n R L s)
(hsP : s.P = P)
(hx : x ∈ L)
(hk : 1 ≤ s.P.reservationBudget)
(hR : Top.topJ P / s.P.reservationBudget + 1 ≤ R)
(hn : 1 ≤ n)
(hsize : 2 + 2 * ((s.count + 1) / (s.P.theta + 1 - cmax s.P)) ≤ n + 1)
(hcap : 2 + 2 * ((s.count + 1) / (s.P.theta + 1 - cmax s.P)) ≤ Top.capT s.P)
(hI5 : ↑s.P.theta + ↑R * (Zeroing.Hn (n - 1) + 1) ≤ ↑s.P.T)
(hh : ℕ)
{κ : Impl.Caps}
(Lx : Impl.Loc)
(hLx : Lx "x" = x)
(hLh : Lx "h" = hh)
(hpow : s.P.a = 2 ^ s.P.a.log2)
(Kc : Impl.CapsOK κ P)
(hcntL : s.count = L.length)
(hcnt : s.count + 1 ≤ P.N)
(hM0 : Impl.Mc κ P s)
(hW : WB K s)
(hL : LabRoom K s.P)
(hTR : TopRoom K P)
(hE : 4 * s.E.size + 8 ≤ 2 ^ K)
(hG : s.Gs.size + 2 ≤ 2 ^ K)
(hcnt' : 2 * s.count + 4 ≤ 2 ^ K)
(hNK : Impl.nb0 P + Top.topJ P * (2 + 2 * (s.count + 1)) + 2 ≤ 2 ^ K)
(hCw : Impl.CapsW K κ)
(hK8 : 8 ≤ K)
(hWK : 2 * K + 4 ≤ W)
(hKH : KH ≤ W)
(hcapC : κ.lcap Impl.LK.children < 512)
(hcapT : κ.lcap Impl.LK.table < 512)
(hGd : Impl.Gd K KH κ (Impl.ΓH K KH) s Lx)
:
Impl.PKok K KH κ (Impl.ΓH K KH) W Impl.insertAfterP.body s Lx
An insertion at the cost proof's top invariant (the context of insertAgreeM and
insertAfter_wb_top): its peak.
theorem
OrderMaintenance.Impl.InService.room_at
{K : ℕ}
{c : Model.Core}
{L : List ℕ}
(h : InService c L)
(hKw : Proof.Word.wK c.P ≤ K)
:
The numeric room of a core in service at a word size K ≥ wK c.P.
theorem
OrderMaintenance.Impl.InService.peak
{K KH W : ℕ}
{c : Model.Core}
{L : List ℕ}
(h : InService c L)
{x : ℕ}
(hx : x ∈ L)
(hh : ℕ)
(Lx : Loc)
(hLx : Lx "x" = x)
(hLh : Lx "h" = hh)
(hKw : Proof.Word.wK c.P ≤ K)
(hW : Proof.Word.WB K c)
(hCw : CapsW K (capsOf c.P))
(hK8 : 8 ≤ K)
(hWK : 2 * K + 4 ≤ W)
(hKH : KH ≤ W)
(hGd : Gd K KH (capsOf c.P) (ΓH K KH) c Lx)
:
An insertion into a core in service: its peak, at any word size K ≥ wK c.P at which
the core's stored values are small.
theorem
OrderMaintenance.Impl.PRoom.mono
{K K' : ℕ}
{P : Model.Params}
(h : PRoom K P)
(hK : K ≤ K')
:
PRoom K' P
PRoom is monotone in the word size (for proom_wK at a larger K).
theorem
OrderMaintenance.Impl.insertAfter_peak
{K KH p : ℕ}
{m : Machine.State}
{s : Model.Core}
{L : List ℕ}
{x hb : ℕ}
(hC : CapsW K (capsOf s.P))
(hK : 8 ≤ K)
(hE : Enc p (capsOf s.P) s m)
(hWB : Proof.Word.WB K s)
(hh : ∀ (i : ℕ), (s.E.getX i).h < 2 ^ KH)
(hR : PRoom K s.P)
(hS : InService s L)
(hx : x ∈ L)
(hKw : Proof.Word.wK s.P ≤ K)
(hbK : hb < 2 ^ KH)
{s' : Model.Core}
{L' : Loc}
{n : ℕ}
(he :
evalF (capsOf s.P) insertAfterP.body s
(Machine.State.setLocs (fun (x : Machine.Reg) => 0) insertAfterP.params [x, hb]) = Res.ok s' L' n)
:
pkF (capsOf s.P) insertAfterP.body s (Machine.State.setLocs (fun (x : Machine.Reg) => 0) insertAfterP.params [x, hb]) < 2 ^ wPk K KH
insertAfter, into a core in service (InService, the wrapper's Level M invariant for
every core insertion), at a word size K ≥ wK s.P, after an element x of its list, with a
handle hb < 2^KH: the peak bound of the other wrappers (PeakTop.lean), 2^(max (2K+4) KH).