Documentation

LeanPool.OrderMaintenance.Proof.Cost.Chunks

Chunks: Lemmas C1 and C2 (docs/PROOF.md §4.3) #

The chunk-level cost invariant CInvE.

As for groups, δ c counts undriven insertions into chunk c, and δu c the units that the group phase of such an insertion added to c.

Accessors and counts #

@[reducible, inline]

The element count stored in a chunk.

Equations
Instances For
    @[reducible, inline]

    The current split state of a chunk.

    Equations
    Instances For
      @[reducible, inline]

      The source chunk recorded by an overflow chunk.

      Equations
      Instances For
        @[reducible, inline]

        The left sibling recorded by a splitting chunk.

        Equations
        Instances For
          @[reducible, inline]

          The right sibling recorded by a splitting chunk.

          Equations
          Instances For

            A chunk of the chunk list (chunks are never freed).

            Equations
            Instances For

              The elements of chunk c, in list order.

              Equations
              Instances For

                The groups of chunk c that count as its units: not overflow groups.

                Equations
                Instances For

                  Constants #

                  The largest unit: a family.

                  Equations
                  Instances For

                    Units of a chunk of size s₀, at most.

                    Equations
                    Instances For

                      k_C(s₀): insertions into a chunk's family until its split ends.

                      Equations
                      Instances For

                        The size of a freshly quiet chunk, at most.

                        Equations
                        Instances For

                          The parameter conditions for the chunk level (I3, I4).

                          Instances For

                            The invariant #

                            The family of a splitting chunk x.

                            Instances For
                              def OrderMaintenance.Proof.C1 (s : Model.Core) (δ δu s₀ : ℕ → ℕ) (x : ℕ) :

                              Lemma C1's invariant for the family of x, which started splitting with size s₀ x, at the sizes and units before the undriven insertions.

                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                theorem OrderMaintenance.Proof.C1.excess_le {s : Model.Core} {δ δu s₀ : ℕ → ℕ} {x : ℕ} (h : C1 s δ δu s₀ x) (hK : 2 ≤ s.P.chunkBudget) :
                                cSz s (cLl s x) - δ (cLl s x) + (cSz s x - δ x) + (cSz s (cRr s x) - δ (cRr s x)) - s₀ x ≤ unitsOf s.P (s₀ x) / (s.P.chunkBudget - 1)

                                C1 bounds the family-size excess by its initial unit budget.

                                theorem OrderMaintenance.Proof.C1.drive_bounds {s : Model.Core} {δ δu s₀ : ℕ → ℕ} {x : ℕ} (h : C1 s δ δu s₀ x) (hK : 2 ≤ s.P.chunkBudget) (hδs : δ (cLl s x) + δ x + δ (cRr s x) ≤ 1) (hδle : δ (cLl s x) ≤ cSz s (cLl s x) ∧ δ x ≤ cSz s x ∧ δ (cRr s x) ≤ cSz s (cRr s x)) :
                                cSz s (cLl s x) + cSz s x + cSz s (cRr s x) ≤ s.P.T + kC s.P s.P.T ∧ (cSz s (cLl s x) ≤ cSz s (cRr s x) + umax s.P + 1 ∧ cSz s (cRr s x) ≤ cSz s (cLl s x) + umax s.P + 1) ∧ cSz s (cLl s x) + cSz s x + cSz s (cRr s x) ≤ δ (cLl s x) + δ x + δ (cRr s x) + s₀ x + unitsOf s.P (s₀ x) / (s.P.chunkBudget - 1)

                                The common family size and balance bounds used by every chunk-drive simulation.

                                structure OrderMaintenance.Proof.CInvE (s : Model.Core) (L : List ℕ) (δ δu s₀ : ℕ → ℕ) (ex : ℕ) :

                                The chunk-level invariant, exempting the C1 conditions of the family of ex.

                                Instances For
                                  @[reducible, inline]
                                  abbrev OrderMaintenance.Proof.CInv (s : Model.Core) (L : List ℕ) (δ δu s₀ : ℕ → ℕ) :

                                  The chunk-level invariant with no family exempt.

                                  Equations
                                  Instances For

                                    Counting units #

                                    theorem OrderMaintenance.Proof.units_congr {s s' : Model.Core} {c c' : ℕ} (h : ∀ (g : ℕ), UnitG s' c' g ↔ UnitG s c g) :
                                    units s' c' = units s c

                                    Unit counts agree when the counted groups agree.

                                    theorem OrderMaintenance.Proof.units_swap {s s' : Model.Core} {c c' p l r : ℕ} (hp : UnitG s c p) (hl : ¬UnitG s c l) (hr : ¬UnitG s c r) (hlr : l ≠ r) (hl' : UnitG s' c' l) (hr' : UnitG s' c' r) (hp' : ¬UnitG s' c' p) (h : ∀ (g : ℕ), g ≠ p → g ≠ l → g ≠ r → (UnitG s' c' g ↔ UnitG s c g)) :
                                    units s' c' = units s c + 1

                                    A unit count after removing one counted group and adding two.