M5: the stages of the initial chain's construction #
Stage h (1 ≤ h ≤ H + 1): nodes 1, …, h-1 of the chain are built, node k of height k
above k - 1 (chunk 1 for k = 1); Final: the chain is complete, with chunk 1's path and
tag stored.
The label of every chain entry: the middle of the label range.
Equations
- OrderMaintenance.Proof.Top.center P = 1 <<< (P.beta - 1)
Instances For
The tag of the chain's lowest m levels.
Equations
Instances For
Node k of the chain once nodes 1, …, m are built.
Equations
- One or more equations did not get rendered due to their size.
Instances For
theorem
OrderMaintenance.Proof.Top.Stage.P
{P : Model.Params}
{h : ℕ}
{s : Model.Core}
(S : Stage P h s)
:
theorem
OrderMaintenance.Proof.Top.TopRelR.top
{P : Model.Params}
{s : Model.Core}
(h : TopRelR (Model.initState P) s)
(nodes : Array Model.Node)
(path : Array (Array ℕ))
(cin : Array (List ℕ))
(lpar : Array ℕ)
(pr : Option Model.Prep)
:
TopRelR (Model.initState 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 := s.ready, prep := pr, 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 := nodes, path := path, cin := cin,
lpar := lpar }
A step that only rewrites the top structure keeps the relation to the initial state.
theorem
OrderMaintenance.Proof.Top.initCore_lazy_run
(s : Model.Core)
:
EStateM.run (Model.initCore true) s = EStateM.Result.ok ()
(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,
ready := false, 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 })
The lazy construction starts at stage 1.
theorem
OrderMaintenance.Proof.Top.stage_one
(s : Model.Core)
(r : Bool)
:
Stage s.P 1
(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, ready := r,
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 })
theorem
OrderMaintenance.Proof.Top.stage_first
{P : Model.Params}
{s : Model.Core}
(S : Stage P 1 s)
(hH : 1 ≤ P.H)
(hb : 1 ≤ P.beta)
:
∃ (s' : Model.Core), EStateM.run Model.initStep s = EStateM.Result.ok false s' ∧ Stage P 2 s' ∧ s'.ready = s.ready
The first step: stage 1 to stage 2.
theorem
OrderMaintenance.Proof.Top.stage_mid
{P : Model.Params}
{h : ℕ}
{s : Model.Core}
(S : Stage P h s)
(h2 : 2 ≤ h)
(hH : h ≤ P.H)
(hb : 1 ≤ P.beta)
:
∃ (s' : Model.Core), EStateM.run Model.initStep s = EStateM.Result.ok false s' ∧ Stage P (h + 1) s' ∧ s'.ready = s.ready
A middle step: stage h to stage h + 1.
theorem
OrderMaintenance.Proof.Top.stage_last
{P : Model.Params}
{s : Model.Core}
(S : Stage P (P.H + 1) s)
(hH : 1 ≤ P.H)
:
∃ (s' : Model.Core), EStateM.run Model.initStep s = EStateM.Result.ok true s' ∧ Final P s' ∧ s'.ready = s.ready
The last step: stage H + 1 to the complete chain.
theorem
OrderMaintenance.Proof.Top.stage_next
{P : Model.Params}
{h : ℕ}
{s : Model.Core}
(S : Stage P h s)
(h1 : 1 ≤ h)
(hH : h ≤ P.H)
(hb : 1 ≤ P.beta)
:
∃ (s' : Model.Core), EStateM.run Model.initStep s = EStateM.Result.ok false s' ∧ Stage P (h + 1) s' ∧ s'.ready = s.ready
A building step: stage h to stage h + 1.
The steps left at stage h.
Equations
Instances For
theorem
OrderMaintenance.Proof.Top.Stage.nu
{P : Model.Params}
{h : ℕ}
{s : Model.Core}
(S : Stage P h s)
: