Documentation

LeanPool.OrderMaintenance.Proof.Cost.ResCost

The reservation of one insertion (Lemma R's rounds) #

A round runs from one pop to the next. Its job takes at most J steps, and every insertion runs k of them. So a round has at most J / k + 1 insertions, each adding at most 1 to one game value: the game's R. The round accounting (RoundOK) carries this from insertion to insertion.

def OrderMaintenance.Proof.RoundAt (k J m : ℕ) (r : Option Model.Job) (ip js j : ℕ) :

Round accounting at the start of an insertion's reservation, with ip insertions in the round (this one included), js job steps so far, and j iterations of this reservation done.

Equations
Instances For
    def OrderMaintenance.Proof.RoundOK (k J : ℕ) (μ : Model.Core → ℕ) (s : Model.Core) (ip js : ℕ) :

    Round accounting between insertions.

    Equations
    Instances For
      def OrderMaintenance.Proof.ResInv (TI : Model.Core → Prop) (k J n R : ℕ) (μ : Model.Core → ℕ) (L : List ℕ) (s : Model.Core) (j : ℕ) (t : Model.Core) :

      The reservation's iteration invariant.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        theorem OrderMaintenance.Proof.cSz_le_T {n R : ℕ} {t : Model.Core} {y : Fin n → ℝ} {i : Fin n} {a : Fin n → ℝ} {ip : ℕ} (hG : GameInv n R t y i a ip) (hI5 : ↑t.P.theta + ↑R * (Zeroing.Hn (n - 1) + 1) ≤ ↑t.P.T) {c : ℕ} (hc1 : 1 ≤ c) (hcn : c - 1 < n) (hcq : LiveC t c ∧ cSt t c = Model.St.quiet) :
        cSz t c ≤ t.P.T

        The quiet sizes are within T, by Lemma R.

        theorem OrderMaintenance.Proof.resInv_step {TI : Model.Core → Prop} {μ : Model.Core → ℕ} {J k n R : ℕ} {cap : Model.Params → ℕ} {L : List ℕ} {s : Model.Core} (hTC : TopContract TI μ J cap) (hn : 1 ≤ n) (hsize : 2 + 2 * (s.count / (s.P.theta + 1 - cmax s.P)) ≤ n + 1) (hcap : 2 + 2 * (s.count / (s.P.theta + 1 - cmax s.P)) ≤ cap s.P) (hI5 : ↑s.P.theta + ↑R * (Zeroing.Hn (n - 1) + 1) ≤ ↑s.P.T) (j : ℕ) (t : Model.Core) :
        ResInv TI k J n R μ L s j t → j < k → (t.resJob = none → (t.pqHi = 0 ∧ LowInv t L ∧ TI t ∧ t.count = s.count ∧ t.P = s.P ∧ t.resJob = none ∧ ∀ (c : ℕ), gval t c = 0) ∨ 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 ∧ ResInv TI k J n R μ L s (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 ∧ ResInv TI k 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 }

        The iteration step of reservation_cost (its proof, as a lemma).

        theorem OrderMaintenance.Proof.reservation_cost {TI : Model.Core → Prop} {μ : Model.Core → ℕ} {J k n R : ℕ} {cap : Model.Params → ℕ} {L : List ℕ} {s : Model.Core} (hTC : TopContract TI μ J cap) (h0 : ResInv TI k J n R μ L s 0 s) (hn : 1 ≤ n) (hsize : 2 + 2 * (s.count / (s.P.theta + 1 - cmax s.P)) ≤ n + 1) (hcap : 2 + 2 * (s.count / (s.P.theta + 1 - cmax s.P)) ≤ cap s.P) (hI5 : ↑s.P.theta + ↑R * (Zeroing.Hn (n - 1) + 1) ≤ ↑s.P.T) :
        ∃ (t' : Model.Core), EStateM.run (Model.reservation k) s = EStateM.Result.ok () t' ∧ LowInv t' L ∧ TI t' ∧ t'.count = s.count ∧ t'.P = s.P ∧ ∃ (y : Fin n → ℝ) (i : Fin n) (a : Fin n → ℝ) (ip : ℕ) (js : ℕ), GameInv n R t' y i a ip ∧ RoundOK k J μ t' ip js

        The reservation of one insertion succeeds, keeps the lower invariants and the top structure's invariant, and carries the zeroing game and its round accounting.