Documentation

LeanPool.OrderMaintenance.Proof.Cost.Background

The background work of one insertion #

After the insertion step: the optional group split start and the group drive, the chunk phase, and the reservation. Every guard passes, and the cost invariant holds again.

The background work after the group split start.

theorem OrderMaintenance.Proof.background_ok {TI : Model.Core → Prop} {μ : Model.Core → ℕ} {J k n R : ℕ} {cap : Model.Params → ℕ} {L : List ℕ} {s0 s1 s2 : Model.Core} {y g c : ℕ} (hTC : TopContract TI μ J cap) (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) :
∃ (s' : Model.Core), EStateM.run (Model.background y) s1 = EStateM.Result.ok () s' ∧ LowInv s' L ∧ TI s' ∧ s'.count = s2.count ∧ s'.P = s0.P ∧ ∃ (y' : Fin n → ℝ) (i : Fin n) (a : Fin n → ℝ) (ip : ℕ) (js : ℕ), GameInv n R s' y' i a ip ∧ RoundOK k J μ s' ip js

The background work of one insertion succeeds and restores the cost invariant.