Documentation

CslibFrontier.DataStructure.SplayTree.WilberSecond

Arboral Satisfaction, Independent Rectangles, and Wilber's Second Lower Bound #

This module proves Wilber's second lower bound (the Funnel Bound, [Wil89]) on the cost of every binary search tree execution serving an access sequence xs, via the geometric arboral-satisfaction and independent-rectangles framework of [DHI+09].

Proof architecture #

  1. Arboral satisfaction of BST executions (ArborallySatisfied, executionPoints, arborallySatisfied_executionPoints): Any TouchedExecution on xs induces the 2D execution point set E = {(k, i) | k ∈ touchedAt i} ⊆ α × Fin xs.length of size |E| = e.cost, containing all access points X = {(xs[i], i)}. Using topNode and UntouchedPreserved, every pair of points in E not sharing a row or column spans a closed axis-aligned box containing a third point of E.

  2. Independent rectangles lower bound (Rect, IndependentRects, card_independentRects_le): A finite set I of non-degenerate rectangles is independent over X if every R ∈ I has both defining point-corners in X, contains no other point of X, and no two distinct rectangles in I have any of the four geometric corners of one in the strict open interior of the other. By induction on |E \ X| (inserting one extra point r ∈ E \ X at a time and splitting the rectangles containing r into quadrant sub-rectangles while bounding the killed rectangles via a non-crossing bipartite graph lemma and order-duality αᵒᵈ), every arborally satisfied superset E ⊇ X satisfies I.card ≤ 12 * (E \ X).card.

  3. Wilber's Second Lower Bound (funnelScan, funnelOf, funnelAlter, wilberSecond, wilberSecond_le_twelve_mul_cost, wilberSecond_le_twelve_mul_stepCost): For each access j, funnelOf xs j scans backward from j - 1 down to the previous access of xs[j], recording keys that strictly tighten the open interval (lo, hi) around xs[j], and funnelAlter xs j counts left/right alternations in this funnel. Each alternating pair maps injectively to an unsatisfied rectangle of accessPoints xs, and the resulting collection satisfies IndependentRects, yielding wilberSecond xs ≤ 12 * (e.cost - xs.length) and hence wilberSecond xs ≤ 12 * e.touchedCost ≤ 12 * e.stepCost.

Main definitions #

Main results #

References #

Arboral Satisfaction of BST Executions #

def Cslib.DataStructure.SplayTree.inBox {α : Type u_1} {β : Type u_2} [LinearOrder α] [LinearOrder β] (p q r : α × β) :

Point r lies in the closed axis-aligned bounding box of p and q.

A finite 2D point set E is arborally satisfied ([DHI+09]) if every pair of points in E with distinct x- and y-coordinates spans a closed bounding box containing a third point of E.

The 2D access point set {(xs[i], i) | i : Fin xs.length}.

The 2D execution point set {(k, i) | k ∈ e.touchedAt i} of a TouchedExecution.

theorem Cslib.DataStructure.SplayTree.mem_executionPoints {α : Type u_1} [LinearOrder α] {t : BinaryTree α} {xs : List α} (e : TouchedExecution t xs) (k : α) (i : Fin xs.length) :

Every TouchedExecution starting from an Ordered BST yields an arborally satisfied 2D point set executionPoints e ([DHI+09]).

Independent Unsatisfied Rectangles Lower Bound #

structure Cslib.DataStructure.SplayTree.Rect (α : Type u_3) (β : Type u_4) :
Type (max u_3 u_4)

An axis-aligned rectangle spanned by a bottom point-corner bot and top point-corner top.

  • bot : α × β

    Bottom point-corner (x₁, t₁).

  • top : α × β

    Top point-corner (x₂, t₂).

theorem Cslib.DataStructure.SplayTree.Rect.ext_iff {α : Type u_3} {β : Type u_4} {x y : Rect α β} :
x = y ↔ x.bot = y.bot ∧ x.top = y.top
theorem Cslib.DataStructure.SplayTree.Rect.ext {α : Type u_3} {β : Type u_4} {x y : Rect α β} (bot : x.bot = y.bot) (top : x.top = y.top) :
x = y
@[instance_reducible]
instance Cslib.DataStructure.SplayTree.instDecidableEqRect {α✝ : Type u_3} {β✝ : Type u_4} [DecidableEq α✝] [DecidableEq β✝] :
DecidableEq (Rect α✝ β✝)
def Cslib.DataStructure.SplayTree.instDecidableEqRect.decEq {α✝ : Type u_3} {β✝ : Type u_4} [DecidableEq α✝] [DecidableEq β✝] (x✝ x✝¹ : Rect α✝ β✝) :
Decidable (x✝ = x✝¹)
def Cslib.DataStructure.SplayTree.Rect.xLo {α : Type u_1} {β : Type u_2} [LinearOrder α] (R : Rect α β) :
α

Left x-coordinate of R.

def Cslib.DataStructure.SplayTree.Rect.xHi {α : Type u_1} {β : Type u_2} [LinearOrder α] (R : Rect α β) :
α

Right x-coordinate of R.

def Cslib.DataStructure.SplayTree.Rect.tLo {α : Type u_1} {β : Type u_2} (R : Rect α β) :
β

Bottom t-coordinate of R.

def Cslib.DataStructure.SplayTree.Rect.tHi {α : Type u_1} {β : Type u_2} (R : Rect α β) :
β

Top t-coordinate of R.

def Cslib.DataStructure.SplayTree.Rect.Valid {α : Type u_1} {β : Type u_2} [LinearOrder β] (R : Rect α β) :

Non-degeneracy of a rectangle (bot.1 ≠ top.1 and bot.2 < top.2).

def Cslib.DataStructure.SplayTree.Rect.Contains {α : Type u_1} {β : Type u_2} [LinearOrder α] [LinearOrder β] (R : Rect α β) (p : α × β) :

Closed box membership in R.

def Cslib.DataStructure.SplayTree.Rect.InInterior {α : Type u_1} {β : Type u_2} [LinearOrder α] [LinearOrder β] (R : Rect α β) (p : α × β) :

Strict open interior membership in R.

def Cslib.DataStructure.SplayTree.Rect.HasCornerInInterior {α : Type u_1} {β : Type u_2} [LinearOrder α] [LinearOrder β] (R₁ R₂ : Rect α β) :

R₁ has one of its four geometric corners strictly inside the open interior of R₂.

def Cslib.DataStructure.SplayTree.Rect.UnsatisfiedIn {α : Type u_1} {β : Type u_2} [LinearOrder α] [LinearOrder β] (R : Rect α β) (X : Finset (α × β)) :

R is valid, has both point-corners in X, and contains no other point of X.

def Cslib.DataStructure.SplayTree.IndependentRects {α : Type u_1} {β : Type u_2} [LinearOrder α] [LinearOrder β] (X : Finset (α × β)) (I : Finset (Rect α β)) :

I is a finite set of independent unsatisfied rectangles over X ([DHI+09]): every R ∈ I is unsatisfied in X, and no two distinct rectangles in I place a geometric corner of one in the strict interior of the other.

theorem Cslib.DataStructure.SplayTree.card_independentRects_le {α : Type u_1} {β : Type u_2} [LinearOrder α] [LinearOrder β] {X E : Finset (α × β)} (hsub : X ⊆ E) (hE : ArborallySatisfied E) {I : Finset (Rect α β)} (hI : IndependentRects X I) :
I.card ≤ 12 * (E \ X).card

Independent Rectangles Lower Bound (after [DHI+09]): for any finite subset X ⊆ E with E arborally satisfied and any independent set I of unsatisfied rectangles over X, I.card ≤ 12 * (E \ X).card.

Wilber's Second Lower Bound (Funnel Bound) #

def Cslib.DataStructure.SplayTree.funnelScan {α : Type u_1} [LinearOrder α] (x : α) (lo hi : Option α) :
List (α × ℕ) → List (α × ℕ × Bool)

Backward funnel scan for target key x over reversed history entries (key, idx) strictly before the previous access of x, recording (key, idx, isRight) whenever a key strictly tightens the enclosing open interval (lo, hi) around x.

def Cslib.DataStructure.SplayTree.funnelOf {α : Type u_1} [LinearOrder α] (xs : List α) (j : Fin xs.length) :

Backward funnel sequence of access j in xs, scanning j - 1, j - 2, … down to the previous access of xs[j].

Number of left/right alternations in the funnel of access j ([Wil89]).

Wilber's Second Lower Bound (Funnel Bound) ([Wil89]): sum of funnelAlter xs j across all accesses j in xs.

Wilber's Second Lower Bound (Funnel Bound) ([Wil89]) in sharp extra-touch form: for any ordered BST T₀ and any TouchedExecution serving xs from T₀, wilberSecond xs ≤ 12 * (e.cost - xs.length).

Wilber's Second Lower Bound (Funnel Bound) ([Wil89]) for any TouchedExecution: wilberSecond xs ≤ 12 * e.cost.

Wilber's Second Lower Bound (Funnel Bound) ([Wil89]) for the touched-node cost of any pointer-and-rotation BSTExecution.

Wilber's Second Lower Bound (Funnel Bound) ([Wil89]) for the atomic pointer-and-rotation step cost of any BSTExecution.