M5: the deferred construction of the initial chain (runs of initStep) #
Arrays as total maps #
The new chain node of height pr.h, before it is linked from below.
Equations
- One or more equations did not get rendered due to their size.
Instances For
The prep record after building height pr.h as node v.
Equations
Instances For
theorem
OrderMaintenance.Proof.Top.initStep_mid
(s : Model.Core)
(pr : Model.Prep)
(hp : s.prep = some pr)
(h1 : pr.h ≠ 1)
(hH : pr.h ≤ s.P.H)
:
EStateM.run Model.initStep s = EStateM.Result.ok false
{ 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 := some (prepNext s.P pr s.nodes.size), 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.push { height := pr.h }).modify s.nodes.size (chainNew s.P pr)).modify pr.below
fun (n : Model.Node) =>
{ height := n.height, livePar := s.nodes.size, children := n.children, weight := n.weight, table := n.table,
inTables := [s.nodes.size], first := n.first, last := n.last, draining := n.draining, t1 := n.t1,
t2 := n.t2, side := n.side, overflowOf := n.overflowOf, alive := n.alive },
path := s.path, cin := s.cin, lpar := s.lpar }
A middle step: node v = |nodes| of height pr.h ≥ 2.
theorem
OrderMaintenance.Proof.Top.initStep_first
(s : Model.Core)
(pr : Model.Prep)
(hp : s.prep = some pr)
(h1 : pr.h = 1)
(hH : 1 ≤ s.P.H)
:
EStateM.run Model.initStep s = EStateM.Result.ok false
{ 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 := some (prepNext s.P pr 1),
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 := (#[default].push { height := 1 }).modify 1 (chainNew s.P pr),
cin := (#[].setX pr.chunk []).setX pr.chunk [1], lpar := #[].setX pr.chunk 1 }
The first step: reset, then node 1 of height 1 above chunk pr.chunk.
theorem
OrderMaintenance.Proof.Top.initStep_last
(s : Model.Core)
(pr : Model.Prep)
(hp : s.prep = some pr)
(h1 : pr.h ≠ 1)
(hH : s.P.H < pr.h)
:
EStateM.run Model.initStep s = EStateM.Result.ok true
{ P := s.P, E := s.E, Gs := s.Gs,
C :=
s.C.modify pr.chunk fun (C : Model.Chunk) =>
{ next := C.next, prev := C.prev, first := C.first, last := C.last, size := C.size, st := C.st, src := C.src,
l := C.l, r := C.r, tag := pr.tag, alive := C.alive },
freeG := s.freeG, count := s.count, head := s.head, tail := s.tail, firstGroup := s.firstGroup,
firstChunk := s.firstChunk, ready := s.ready, 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.setX pr.chunk pr.path, cin := s.cin,
lpar := s.lpar }
The last step: store the path and the tag.