Documentation

LeanPool.OrderMaintenance.Proof.Top.PrepContract

M5: the deferred construction's contract (PrepContract) #

initCore builds the chain at once (eager) or one prepareStep at a time (lazy); topPI describes the core while it is being built and topNu counts the steps left.

What the construction needs of the parameters.

Equations
Instances For
    theorem OrderMaintenance.Proof.Top.loop_run {P : Model.Params} (hPP : topPP P) (l : List ℕ) (h : ℕ) (s : Model.Core) :
    Stage P h s → 1 ≤ h → h ≤ P.H + 1 → P.H + 2 - h ≤ l.length → ∃ (s' : Model.Core), EStateM.run (forIn l PUnit.unit fun (x : ℕ) (x_1 : PUnit.{1}) => do let b ← Model.initStep if b = true then pure (ForInStep.done PUnit.unit) else pure (ForInStep.yield PUnit.unit)) s = EStateM.Result.ok () s' ∧ Final P s'

    The eager construction's loop.

    theorem OrderMaintenance.Proof.Top.Final.ready {P : Model.Params} {s : Model.Core} (F : Final P s) (r : Bool) :
    Final P { 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 := r, prep := s.prep, resJob := s.resJob, 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 }
    theorem OrderMaintenance.Proof.Top.initCore_eager_eq (s : Model.Core) :
    EStateM.run (Model.initCore false) s = EStateM.run (do forIn (List.range (s.P.H + 1)) PUnit.unit fun (x : ℕ) (x_1 : PUnit.{1}) => do let b ← Model.initStep if b = true then pure (ForInStep.done PUnit.unit) else pure (ForInStep.yield PUnit.unit) modify fun (t : Model.Core) => { P := t.P, E := t.E, Gs := t.Gs, C := t.C, freeG := t.freeG, count := t.count, head := t.head, tail := t.tail, firstGroup := t.firstGroup, firstChunk := t.firstChunk, prep := t.prep, resJob := t.resJob, fallbacks := t.fallbacks, pqHead := t.pqHead, pqNext := t.pqNext, pqPrev := t.pqPrev, pqWhere := t.pqWhere, nbNext := t.nbNext, nbPrev := t.nbPrev, pqHi := t.pqHi, pqLo := t.pqLo, nodes := t.nodes, path := t.path, cin := t.cin, lpar := t.lpar }) (have __src := Model.initState s.P; { P := __src.P, E := __src.E, Gs := __src.Gs, C := __src.C, freeG := __src.freeG, count := __src.count, head := __src.head, tail := __src.tail, firstGroup := __src.firstGroup, firstChunk := __src.firstChunk, prep := some { chunk := 1, below := 1, path := Array.replicate (s.P.H + 1) Model.NIL }, resJob := __src.resJob, fallbacks := __src.fallbacks, pqHead := __src.pqHead, pqNext := __src.pqNext, pqPrev := __src.pqPrev, pqWhere := __src.pqWhere, nbNext := __src.nbNext, nbPrev := __src.nbPrev, pqHi := __src.pqHi, pqLo := __src.pqLo, nodes := __src.nodes, path := __src.path, cin := __src.cin, lpar := __src.lpar })