Documentation

Examples.Language.Splay.Compiled

Executing the verified splay source on the word RAM #

The source proof establishes successful termination and the mathematical tree result independently of resources. The program only copies or compares stored words, so the shared range-preserving-fragment theorem supplies realization without a second proof of the algorithm or an algorithm-specific register adapter.

Input representation, word ranges, emitted-code capacity and stack capacity remain explicit. The input arrays are preloaded; their loading and external serialization are outside this invocation boundary.

Every declared splay function belongs to the checked copy/compare/read/write fragment. Recursive bodies are checked once, not unfolded along an execution.

theorem Complexity.Language.Examples.Splay.root_fits {w : ℕ} {key : ℕ → ℕ} {keys left right : Buffer CellTy.nat} {heap : Heap} {tree : Tree ℕ} (represented : BufferTree.Rep key keys left right heap tree) (keysFit : keys.length < 2 ^ w) :

A represented root fits whenever its field arrays do; empty input uses the fitting zero sentinel. Node-index safety comes from Rep, not a new hypothesis.

theorem Complexity.Language.Examples.Splay.splay_args_fits {w : ℕ} {key : ℕ → ℕ} {keys left right : Buffer CellTy.nat} {heap : Heap} {tree : Tree ℕ} (represented : BufferTree.Rep key keys left right heap tree) {query : ℕ} (keysFit : keys.length < 2 ^ w) (leftFit : left.length < 2 ^ w) (rightFit : right.length < 2 ^ w) (queryFit : query < 2 ^ w) :

The ordinary buffer lengths and query range suffice for the generated argument environment; root range is inherited from the represented input.

A convenient name for the independently proved full function-body bound.

Equations
  • One or more equations did not get rendered due to their size.
Instances For

    The source domain together with word ranges. The heap range is already a field of the target representation; alias restrictions are those of splay itself.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For

      The shared finite-execution rule supplies realization without another tree correctness induction. The separate nesting bound follows recursive calls, not the instruction count, and is not fuel for source termination.

      The complete invocation bound includes the actual outer call and halt.

      Equations
      • One or more equations did not get rendered due to their size.
      Instances For

        A fixed compiler-derived coefficient for charging each search edge and the initial invocation. This includes the empty-tree and final-halt overhead.

        Equations
        • One or more equations did not get rendered due to their size.
        Instances For

          Absorb the actual fixed invocation overhead into one charge per search edge, retaining one charge when the input tree is empty.

          theorem Complexity.Language.Examples.Splay.splay_execute {w heapLimit : ℕ} {placement : ℕ → Ram.Word w} (key : ℕ → ℕ) (keys left right : Buffer CellTy.nat) (query : ℕ) (tree : Tree ℕ) {heap : Heap} (input : Input key keys left right tree heap) {entry : Ram.Source.State w} (launch : Ram.LanguageCompiler.FunctionLaunch Implementation.program Implementation.splayId (splayDepthBound tree) heapLimit placement (Implementation.splay_args keys left right (BufferTree.root tree) query) heap entry) :
          ∃ (outcome : Ram.LanguageCompiler.FunctionExecution Implementation.program Implementation.splayId heapLimit placement (Implementation.splay_args keys left right (BufferTree.root tree) query) heap entry), Post key keys left right query tree heap outcome.value outcome.heap ∧ outcome.result.steps ≤ splayInvocationBound key query tree ∧ outcome.result.steps ≤ splayInstructionFactor * (searchDepth key query tree + 1)

          Execute the verified access with the shared typed RAM publication interface. The outcome owns the actual halted runner result, source result and final memory; the mathematical tree postcondition and independent step bounds describe it. Launch conditions expose word ranges and code/stack capacity, not a time budget. The preloaded-call boundary includes the call, return and final halt.