Documentation

Examples.Language.Splay.Sequence

Amortized bounds for consecutive actual RAM splay calls #

The history records equations of the existing unbounded function runner. Each next invocation uses the previous result's entire actual memory and I/O state, including private stack contents, and the returned mathematical root. It is not a second interpreter or a sum of independently reset executions.

The sequence theorem constructs this history from shared typed execution outcomes. Its instruction bounds are conclusions of those actual calls, not an assumed price for mathematical rotations. Telescoping retains the initial and final logarithmic potentials. The fixed stack capacity is a conservative bound uniform over all trees with the initial node count. This is a sufficient launch condition, not a separate theorem about exact peak or reachable live storage.

The invocation boundary is the existing preloaded function trampoline. Every call includes its call/return and halt instructions. Host scheduling, supplying query words and initial data loading remain outside that boundary; no memory copy or hidden heap reset is performed by the state projection.

A sufficient address envelope for every access to a tree of this size. The nesting allowance follows two-level recursive descent, independently of the instruction bound. It is not a bit-space or exact live-storage bound.

Equations
  • One or more equations did not get rendered due to their size.
Instances For
    structure Complexity.Language.Examples.Splay.SplayRunHistory {w : ℕ} (heapLimit : ℕ) (placement : ℕ → Ram.Word w) (key : ℕ → ℕ) (keys left right : Buffer CellTy.nat) (queries : ℕ → ℕ) (count : ℕ) (initialTree : Tree ℕ) (initialHeap : Heap) (initialEntry : Ram.Source.State w) :

    Witnesses of actual calls, with source meaning and target state linked at every index. The functions beyond count carry no execution requirement. This is a record of existing runner equations, not an execution semantics.

    Instances For
      theorem Complexity.Language.Examples.Splay.splay_sequence_runUntil {w heapLimit : ℕ} {placement : ℕ → Ram.Word w} (key : ℕ → ℕ) (keys left right : Buffer CellTy.nat) (queries : ℕ → ℕ) (count : ℕ) (initialTree : Tree ℕ) {initialHeap : Heap} (input : Input key keys left right initialTree initialHeap) (capacity : Ram.LanguageCompiler.FunctionCapacity Implementation.program Implementation.splayId w (initialTree.numNodes / 2) heapLimit) (keysFit : keys.length < 2 ^ w) (leftFit : left.length < 2 ^ w) (rightFit : right.length < 2 ^ w) (queriesFit : ∀ i < count, queries i < 2 ^ w) (initialEntry : Ram.Source.State w) (memory : Ram.LanguageCompiler.HeapRep placement heapLimit initialHeap initialEntry) :
      ∃ (history : SplayRunHistory heapLimit placement key keys left right queries count initialTree initialHeap initialEntry), ↑(∑ i ∈ Finset.range count, history.steps i) + ↑splayInstructionFactor * potential (history.trees count) ≤ ↑splayInstructionFactor * (↑count * (3 * Real.logb 2 ↑(initialTree.numNodes + 1) + 2) + potential initialTree)

      Consecutive actual runner invocations admit the logarithmic amortized bound. Only initial representation and explicit word/code/stack capacities are assumed; every per-access instruction bound is proved by splay_execute. The initial potential is charged and final potential retained, including for empty trees and zero accesses.

      theorem Complexity.Language.Examples.Splay.splay_sequence_runUntil_log {w heapLimit : ℕ} {placement : ℕ → Ram.Word w} (key : ℕ → ℕ) (keys left right : Buffer CellTy.nat) (queries : ℕ → ℕ) (count : ℕ) (initialTree : Tree ℕ) {initialHeap : Heap} (input : Input key keys left right initialTree initialHeap) (capacity : Ram.LanguageCompiler.FunctionCapacity Implementation.program Implementation.splayId w (initialTree.numNodes / 2) heapLimit) (keysFit : keys.length < 2 ^ w) (leftFit : left.length < 2 ^ w) (rightFit : right.length < 2 ^ w) (queriesFit : ∀ i < count, queries i < 2 ^ w) (initialEntry : Ram.Source.State w) (memory : Ram.LanguageCompiler.HeapRep placement heapLimit initialHeap initialEntry) :
      ∃ (history : SplayRunHistory heapLimit placement key keys left right queries count initialTree initialHeap initialEntry), ↑(∑ i ∈ Finset.range count, history.steps i) ≤ ↑splayInstructionFactor * (↑count * (3 * Real.logb 2 ↑(initialTree.numNodes + 1) + 2) + ↑initialTree.numNodes * Real.logb 2 ↑(initialTree.numNodes + 1))

      A shape-uniform total instruction bound for the constructed actual RAM history. The initial tree contributes its n log₂ (n + 1) credit; final credit is nonnegative and discarded. No per-call cost assumption is an input.