Documentation

LeanPool.OrderMaintenance.Proof.Cost.Game

Lemma R: chunk sizes through the zeroing game (docs/PROOF.md §4.4) #

The game's variables are the chunks 1 … n. The value of a quiet chunk is how far its size exceeds θ; other chunks have value 0. A round runs from one pop of the priority queue to the next: the pop zeroes a maximal value, and the round's insertions add at most R. GameInv is Theorem Z's invariant at the start of the current round, together with this round's adds so far. It bounds every quiet chunk's size by θ + R·(H_{n−1} + 1) (Lemma R).

noncomputable def OrderMaintenance.Proof.gvec (n : ℕ) (s : Model.Core) :
Fin n → ℝ

The game's variables: chunk i + 1 for i < n.

Equations
Instances For
    structure OrderMaintenance.Proof.GameInv (n R : ℕ) (s : Model.Core) (y : Fin n → ℝ) (i : Fin n) (a : Fin n → ℝ) (ip : ℕ) :

    The game's state in the current round: Theorem Z's invariant at the round's start (y, with i zeroed by the pop), and the adds a of the ip insertions since.

    Instances For
      theorem OrderMaintenance.Proof.GameInv.round {n R : ℕ} {s : Model.Core} {y : Fin n → ℝ} {i : Fin n} {a : Fin n → ℝ} {ip : ℕ} (h : GameInv n R s y i a ip) :
      Zeroing.Round (↑R) y (gvec n s)
      theorem OrderMaintenance.Proof.GameInv.cur {n R : ℕ} {s : Model.Core} {y : Fin n → ℝ} {i : Fin n} {a : Fin n → ℝ} {ip : ℕ} (h : GameInv n R s y i a ip) :
      Zeroing.Inv (↑R) (gvec n s)

      The current values satisfy Theorem Z's invariant.

      theorem OrderMaintenance.Proof.GameInv.bound {n R : ℕ} {s : Model.Core} {y : Fin n → ℝ} {i : Fin n} {a : Fin n → ℝ} {ip : ℕ} (h : GameInv n R s y i a ip) (j : Fin n) :
      gvec n s j ≤ ↑R * (Zeroing.Hn (n - 1) + 1)

      Lemma R (the bound): every game value is at most R·(H_{n−1} + 1).

      theorem OrderMaintenance.Proof.GameInv.mono {n R : ℕ} {s s' : Model.Core} {y : Fin n → ℝ} {i : Fin n} {a : Fin n → ℝ} {ip : ℕ} (h : GameInv n R s y i a ip) (hle : ∀ (j : Fin n), gvec n s' j ≤ gvec n s j) :
      GameInv n R s' y i a ip

      Values that did not grow keep the invariant.

      theorem OrderMaintenance.Proof.GameInv.insert {n R : ℕ} {s s' : Model.Core} {y : Fin n → ℝ} {i : Fin n} {a : Fin n → ℝ} {ip : ℕ} (h : GameInv n R s y i a ip) (jc : Fin n) (hle : ∀ (j : Fin n), gvec n s' j ≤ gvec n s j + if j = jc then 1 else 0) (hip : ip + 1 ≤ R) :
      GameInv n R s' y i (fun (j : Fin n) => a j + if j = jc then 1 else 0) (ip + 1)

      An insertion: one value grows by at most one; one more insertion in the round.

      theorem OrderMaintenance.Proof.GameInv.insert0 {n R : ℕ} {s s' : Model.Core} {y : Fin n → ℝ} {i : Fin n} {a : Fin n → ℝ} {ip : ℕ} (h : GameInv n R s y i a ip) (hle : ∀ (j : Fin n), gvec n s' j ≤ gvec n s j) (hip : ip + 1 ≤ R) :
      GameInv n R s' y i a (ip + 1)

      An insertion into no game variable.

      theorem OrderMaintenance.Proof.GameInv.pop {n R : ℕ} {s s' : Model.Core} {y : Fin n → ℝ} {i : Fin n} {a : Fin n → ℝ} {ip : ℕ} (h : GameInv n R s y i a ip) (jm : Fin n) (hmax : ∀ (j : Fin n), gvec n s j ≤ gvec n s jm) (hle : ∀ (j : Fin n), gvec n s' j ≤ if j = jm then 0 else gvec n s j) :
      GameInv n R s' (gvec n s) jm (fun (x : Fin n) => 0) 0

      The pop: zeroing a maximal value starts a new round.

      theorem OrderMaintenance.Proof.GameInv.reset {n R : ℕ} {s : Model.Core} (hz : ∀ (j : Fin n), gvec n s j = 0) (i : Fin n) :
      GameInv n R s 0 i (fun (x : Fin n) => 0) 0

      Idle: when every value is 0, a new round may start.