The insertion step #
The element link (insertElem) and the chunk-size update (chunkSize): every guard passes, and
the invariants hold with one undriven insertion in the group and in the chunk.
theorem
OrderMaintenance.Proof.ins_elem_ok
{s : Model.Core}
{A : Abs}
{gh : GGh}
(hI : INV s A)
(hG : GInv s A.elist gh fun (x : ℕ) => 0)
(hP : GParams s.P)
{x : ℕ}
(hx : x ∈ A.elist)
(hh : ℕ)
:
∃ (lab : ℕ),
EStateM.run (Model.insertElem x hh) s = EStateM.Result.ok s.E.size (Model.linkElem s x s.E.size lab hh) ∧ (∃ (A' : Abs), INV (Model.linkElem s x s.E.size lab hh) A' ∧ A'.elist = Spec.insertAfterL x s.E.size A.elist) ∧ ∃ (gh' : GGh),
GInv (Model.linkElem s x s.E.size lab hh) (Spec.insertAfterL x s.E.size A.elist) gh' fun (b : ℕ) =>
if b = eG s x then 1 else 0
The element link succeeds, keeping INV-S and Lemma G4's invariant.
theorem
OrderMaintenance.Proof.chunkSize_ok
{s : Model.Core}
{x lab hh : ℕ}
(hpq : PQC s)
(hcL : LiveC s (gC s (eG s x)))
:
∃ (s2 : Model.Core),
EStateM.run (Model.chunkSize (gC s (eG s x)) true) (Model.linkElem s x s.E.size lab hh) = EStateM.Result.ok () s2 ∧ PQOnly (sizeState (Model.linkElem s x s.E.size lab hh) (gC s (eG s x))) s2 ∧ PQC s2
The chunk-size update succeeds and keeps the queue invariant (Lemma K2: no scan).
structure
OrderMaintenance.Proof.InsPost
(TI : Model.Core → Prop)
(k J n R : ℕ)
(μ : Model.Core → ℕ)
(L : List ℕ)
(s0 : Model.Core)
(g c : ℕ)
(s2 : Model.Core)
:
The invariants right after the insertion of an element into group g of chunk c.
Instances For
theorem
OrderMaintenance.Proof.InsPost.split_room
{TI : Model.Core → Prop}
{μ : Model.Core → ℕ}
{k J n R : ℕ}
{L : List ℕ}
{s0 s2 : Model.Core}
{g c : ℕ}
(hPost : InsPost TI k J n R μ L s0 g c s2)
:
An inserted element's pending chunk budget supplies room for the group split.
theorem
OrderMaintenance.Proof.game_ins
{n R k J : ℕ}
{μ : Model.Core → ℕ}
{s s2 : Model.Core}
{y : Fin n → ℝ}
{i : Fin n}
{a : Fin n → ℝ}
{ip js : ℕ}
(hG : GameInv n R s y i a ip)
(hRO : RoundOK k J μ s ip js)
(hk : 1 ≤ k)
(hR : J / k + 1 ≤ R)
(hn : 1 ≤ n)
{c : ℕ}
(hc1 : 1 ≤ c)
(hcn : c - 1 < n)
(hle : ∀ (d : ℕ), gval s2 d ≤ gval s d + if d = c then 1 else 0)
(hres : s2.resJob = s.resJob)
(hμ : μ s2 = μ s)
:
The game across an insertion: one value grows by at most 1, and the round has room for it.
theorem
OrderMaintenance.Proof.insert_step
{TI : Model.Core → Prop}
{μ : Model.Core → ℕ}
{J k n R : ℕ}
{cap : Model.Params → ℕ}
{L : List ℕ}
{s : Model.Core}
{y : Fin n → ℝ}
{i : Fin n}
{a : Fin n → ℝ}
{ip js x : ℕ}
(hTC : TopContract TI μ J cap)
(hL : LowInv s L)
(hTI : TI s)
(hG : GameInv n R s y i a ip)
(hRO : RoundOK k J μ s ip js)
(hx : x ∈ L)
(hk : 1 ≤ k)
(hR : J / k + 1 ≤ R)
(hn : 1 ≤ n)
(hsize : 2 + 2 * (s.count / (s.P.theta + 1 - cmax s.P)) ≤ n + 1)
(hI5 : ↑s.P.theta + ↑R * (Zeroing.Hn (n - 1) + 1) ≤ ↑s.P.T)
(hh : ℕ)
:
∃ (s1 : Model.Core) (s2 : Model.Core),
EStateM.run (Model.insertElem x hh) s = EStateM.Result.ok s.E.size s1 ∧ EStateM.run (Model.chunkSize (gC s1 (eG s1 s.E.size)) true) s1 = EStateM.Result.ok () s2 ∧ InsPost TI k J n R μ (Spec.insertAfterL x s.E.size L) s (eG s x) (gC s (eG s x)) s2 ∧ eG s1 s.E.size = eG s x ∧ gC s1 (eG s x) = gC s (eG s x) ∧ s2.E = s1.E ∧ s1.P = s.P
The insertion step: the element link and the size update succeed; all invariants hold with one undriven insertion.