Documentation

LeanPool.OrderMaintenance.Proof.Top.Step

M5: a step of the running job #

Every resumption of the job (jobStep) succeeds and keeps the invariant, and the job measure decreases (top_step). The cases: a copy step; a walk step (with or without a drain start); the step after a drain start; a step of the funding loop.

The chunk list across top-structure steps #

theorem OrderMaintenance.Proof.Top.CLok.topRel {s s' : Model.Core} {cl : List ℕ} (h : CLok s cl) (hr : TopRel s s') :
CLok s' cl

The job measure #

theorem OrderMaintenance.Proof.Top.walkLeft_lt (P : Model.Params) {h : ℕ} (hh : h ≤ P.H) :
walkLeft P (h + 1) + P.s < walkLeft P h

The funding loop #

theorem OrderMaintenance.Proof.Top.fund_run {s : Model.Core} {cl : List ℕ} {ord : ℕ → List ℕ} {dr n0 : ℕ → ℕ} {j : Model.Job} {v up src k : ℕ} (hTP : TopParams s.P) (hcl : CLok s cl) (hI : InvJ (ts s) cl ord dr n0 (some { x := j.x, y := j.y, z := j.z, pc := Model.JobPc.fund v up src k })) :
∃ (j' : Model.Job) (s' : Model.Core) (ord' : ℕ → List ℕ), EStateM.run (Model.fundLoop j v up src k) s = EStateM.Result.ok (some j') s' ∧ TopRel s s' ∧ InvJ (ts s') cl ord' dr n0 (some j') ∧ jobLeft (ts s') j' < jobLeft (ts s) { x := j.x, y := j.y, z := j.z, pc := Model.JobPc.fund v up src k } ∧ ∀ (l : ℕ), j'.pc ≠ Model.JobPc.copy l

The funding loop moves a chunk, ends the drain, or finishes its remaining work.

The end of a job #

theorem OrderMaintenance.Proof.Top.inv_end {t : TS} {cl : List ℕ} {ord : ℕ → List ℕ} {dr n0 : ℕ → ℕ} {j : Model.Job} (hpc : j.pc = Model.JobPc.walk (some Model.NIL)) (hI : InvJ t cl ord dr n0 (some j)) :
InvJ t cl ord dr n0 none

The job ends: the walk has passed the root.

The walk #

What startDrain must do: the statement M5 proves in PresStart.lean.

Equations
  • One or more equations did not get rendered due to their size.
Instances For

    The walk at v ≠ NIL, when v starts no drain.

    theorem OrderMaintenance.Proof.Top.run_walkBody_drain (j : Model.Job) (s : Model.Core) (v : ℕ) (hv : v ≠ Model.NIL) (h1 : (nd (ts s) v).livePar ≠ Model.NIL) (h2 : (nd (ts s) v).draining = false) (h3 : (nd (ts s) v).overflowOf = Model.NIL) (h4 : Wd s.P (ht (ts s) v) < (nd (ts s) v).weight + 2) {s' : Model.Core} (hsd : EStateM.run (Model.startDrain v) (wiC s v) = EStateM.Result.ok () s') :
    EStateM.run (Model.walkBody j v) s = EStateM.Result.ok (some { x := j.x, y := j.y, z := j.z, pc := Model.JobPc.afterDrain v (nd (ts s) v).livePar }) s'

    The walk at v ≠ NIL, when v starts a drain.

    theorem OrderMaintenance.Proof.Top.walk_run (hSD : SDOK) {s : Model.Core} {cl : List ℕ} {ord : ℕ → List ℕ} {dr n0 : ℕ → ℕ} {j : Model.Job} {v : ℕ} (hpc : j.pc = Model.JobPc.walk (some v)) (hTP : TopParams s.P) (hcl : CLok s cl) (hI : InvJ (ts s) cl ord dr n0 (some j)) :
    ∃ (r : Option Model.Job) (s' : Model.Core) (ord' : ℕ → List ℕ) (dr' : ℕ → ℕ) (n0' : ℕ → ℕ), EStateM.run (Model.walkBody j v) s = EStateM.Result.ok r s' ∧ TopRel s s' ∧ InvJ (ts s') cl ord' dr' n0' r ∧ ∀ (j' : Model.Job), r = some j' → jobLeft (ts s') j' < jobLeft (ts s) j ∧ ∀ (l : ℕ), j'.pc ≠ Model.JobPc.copy l

    A walk step.

    The step after a drain start #

    theorem OrderMaintenance.Proof.Top.afterDrain_step {s : Model.Core} {cl : List ℕ} {ord : ℕ → List ℕ} {dr n0 : ℕ → ℕ} {j : Model.Job} {v up : ℕ} (hpc : j.pc = Model.JobPc.afterDrain v up) (hI : InvJ (ts s) cl ord dr n0 (some j)) :
    EStateM.run (Model.jobStep j) s = EStateM.Result.ok (some { x := j.x, y := j.y, z := j.z, pc := Model.JobPc.walk (some up) }) s ∧ InvJ (ts s) cl ord dr n0 (some { x := j.x, y := j.y, z := j.z, pc := Model.JobPc.walk (some up) }) ∧ jobLeft (ts s) { x := j.x, y := j.y, z := j.z, pc := Model.JobPc.walk (some up) } < jobLeft (ts s) j

    The walk's start #

    theorem OrderMaintenance.Proof.Top.walkNone_inv {t : TS} {cl : List ℕ} {ord : ℕ → List ℕ} {dr n0 : ℕ → ℕ} {j : Model.Job} (hpc : j.pc = Model.JobPc.walk none) (hI : InvJ t cl ord dr n0 (some j)) :
    InvJ t cl ord dr n0 (some { x := j.x, y := j.y, z := j.z, pc := Model.JobPc.walk (some (lpr t j.y)) }) ∧ liveN t (lpr t j.y) ∧ ht t (lpr t j.y) = 1

    A step of the running job #

    theorem OrderMaintenance.Proof.Top.job_eta {j : Model.Job} {p : Model.JobPc} (h : j.pc = p) :
    j = { x := j.x, y := j.y, z := j.z, pc := p }
    theorem OrderMaintenance.Proof.Top.top_step (hSD : SDOK) {s : Model.Core} {job : Model.Job} (hT : TopInv s) (hres : s.resJob = some job) :
    ∃ (r : Option Model.Job) (s' : Model.Core), EStateM.run (Model.jobStep job) s = EStateM.Result.ok r s' ∧ TopInv { P := s'.P, E := s'.E, Gs := s'.Gs, C := s'.C, freeG := s'.freeG, count := s'.count, head := s'.head, tail := s'.tail, firstGroup := s'.firstGroup, firstChunk := s'.firstChunk, ready := s'.ready, prep := s'.prep, resJob := r, fallbacks := s'.fallbacks, pqHead := s'.pqHead, pqNext := s'.pqNext, pqPrev := s'.pqPrev, pqWhere := s'.pqWhere, nbNext := s'.nbNext, nbPrev := s'.nbPrev, pqHi := s'.pqHi, pqLo := s'.pqLo, nodes := s'.nodes, path := s'.path, cin := s'.cin, lpar := s'.lpar } ∧ ∀ (j' : Model.Job), r = some j' → 1 ≤ topMu { P := s'.P, E := s'.E, Gs := s'.Gs, C := s'.C, freeG := s'.freeG, count := s'.count, head := s'.head, tail := s'.tail, firstGroup := s'.firstGroup, firstChunk := s'.firstChunk, ready := s'.ready, prep := s'.prep, resJob := r, fallbacks := s'.fallbacks, pqHead := s'.pqHead, pqNext := s'.pqNext, pqPrev := s'.pqPrev, pqWhere := s'.pqWhere, nbNext := s'.nbNext, nbPrev := s'.nbPrev, pqHi := s'.pqHi, pqLo := s'.pqLo, nodes := s'.nodes, path := s'.path, cin := s'.cin, lpar := s'.lpar } ∧ topMu { P := s'.P, E := s'.E, Gs := s'.Gs, C := s'.C, freeG := s'.freeG, count := s'.count, head := s'.head, tail := s'.tail, firstGroup := s'.firstGroup, firstChunk := s'.firstChunk, ready := s'.ready, prep := s'.prep, resJob := r, fallbacks := s'.fallbacks, pqHead := s'.pqHead, pqNext := s'.pqNext, pqPrev := s'.pqPrev, pqWhere := s'.pqWhere, nbNext := s'.nbNext, nbPrev := s'.nbPrev, pqHi := s'.pqHi, pqLo := s'.pqLo, nodes := s'.nodes, path := s'.path, cin := s'.cin, lpar := s'.lpar } < topMu s

    A step of the running job keeps the top invariant and decreases the job measure.