Documentation

LeanPool.OrderMaintenance.Proof.Word.Serve

Theorem W, stage B3 (first part): a core insertion of the wrapper keeps the bound #

InService.wb: an insertion into a core in service (InService, which the wrapper's Level M invariant provides for every core insertion: into cur, mirrored into nxt, and the copy steps of a rebuild) keeps WB at the core's own word size wK c.P = 64·L. The numeric conditions of insertAfter_wb_top come from the capacity predicate Mc (NodeB, Gs.size ≤ 2 + 2·count), the room count + 1 ≤ N, and E.size ≤ count + 1 (E_size_le); all of them are below 2^(2L + 8), far below 2^(64L).

WB.mono: the bound is monotone in K, so the two cores of the wrapper, each bounded at its own wK, are bounded at the larger one.

Monotonicity in K #

theorem OrderMaintenance.Proof.Word.lt_mono {K K' : ℕ} (hK : K ≤ K') {x : ℕ} (h : x < 2 ^ K) :
x < 2 ^ K'
theorem OrderMaintenance.Proof.Word.ElemB.mono {K K' : ℕ} (hK : K ≤ K') {e : Model.Elem} (h : ElemB K e) :
ElemB K' e
theorem OrderMaintenance.Proof.Word.GroupB.mono {K K' : ℕ} (hK : K ≤ K') {g : Model.Group} (h : GroupB K g) :
GroupB K' g
theorem OrderMaintenance.Proof.Word.ChunkB.mono {K K' : ℕ} (hK : K ≤ K') {c : Model.Chunk} (h : ChunkB K c) :
ChunkB K' c
theorem OrderMaintenance.Proof.Word.NodeB.mono {K K' : ℕ} (hK : K ≤ K') {n : Model.Node} (h : NodeB K n) :
NodeB K' n
theorem OrderMaintenance.Proof.Word.JobB.mono {K K' : ℕ} (hK : K ≤ K') {j : Model.Job} (h : JobB K j) :
JobB K' j
theorem OrderMaintenance.Proof.Word.PrepB.mono {K K' : ℕ} (hK : K ≤ K') {p : Model.Prep} (h : PrepB K p) :
PrepB K' p
theorem OrderMaintenance.Proof.Word.ParamsB.mono {K K' : ℕ} (hK : K ≤ K') {P : Model.Params} (h : ParamsB K P) :
ParamsB K' P
theorem OrderMaintenance.Proof.Word.ArrB.mono {K K' : ℕ} (hK : K ≤ K') {a : Array ℕ} (h : ArrB K a) :
ArrB K' a
theorem OrderMaintenance.Proof.Word.WB.mono {K K' : ℕ} (hK : K ≤ K') {s : Model.Core} (h : WB K s) :
WB K' s

The stored-value bound is monotone in K.

The numeric room at wK #

theorem OrderMaintenance.Proof.Word.lt_wK (N : ℕ) {x : ℕ} (hx : x < 2 ^ (2 * pL N + 8)) :
x < 2 ^ wK (proofParams N)

Everything below 2^(2L + 8) is below 2^wK.

theorem OrderMaintenance.Proof.Word.room_counts (N : ℕ) {E G c : ℕ} (hc : c + 1 ≤ N) (hE : E ≤ c + 1) (hG : G ≤ 2 + 2 * c) :
4 * E + 8 ≤ 2 ^ wK (proofParams N) ∧ G + 2 ≤ 2 ^ wK (proofParams N) ∧ 2 * c + 4 ≤ 2 ^ wK (proofParams N) ∧ Impl.nb0 (proofParams N) + Top.topJ (proofParams N) * (2 + 2 * (c + 1)) + 2 ≤ 2 ^ wK (proofParams N)

The numeric conditions of insertAfter_wb_top at wK, for a core of capacity N with count + 1 ≤ N, E.size ≤ count + 1, Gs.size ≤ 2 + 2·count.

An insertion into a core in service #

theorem OrderMaintenance.Impl.InService.wb {c : Model.Core} {L : List ℕ} (h : InService c L) {x : ℕ} (hx : x ∈ L) (hh : ℕ) (hW : Proof.Word.WB (Proof.Word.wK c.P) c) {c' : Model.Core} (hr : EStateM.run (Model.insertAfter x hh) c = EStateM.Result.ok c.E.size c') :

An insertion into a core in service keeps the stored-value bound at the core's word size wK c.P = 64·L.

The other core operations of the wrapper #

A fresh core at the proof parameters is bounded at its word size.

A preparation step of a core under construction (PrepM) at the proof parameters.

theorem OrderMaintenance.Proof.Word.copy_wb {om om' : Model.OrderMaintenance} {n n' : Model.Core} (hC : Impl.CopyOK om n) (hW : WB (wK n.P) n) (hcp : Model.copyAtCursor om n = Except.ok (om', n')) :
WB (wK n'.P) n'

A copy step of a rebuild (copyAtCursor): the copied element is inserted after the tail of nxt, a core in service (CopyOK).