Chapter 30Deamortization
Most of the good BST bounds are amortized. Splaying costs per access on average over a sequence, but a single access can cost . Balanced trees guarantee per access, but none of the adaptive bounds. Bose, Collette, Fagerberg and Langerman (2012a) showed that this trade-off is not necessary. Any BST algorithm can be transformed into one that has the same total cost on every sequence, up to a constant factor, and in addition serves every single access with operations. Applied to splay trees, this gives one BST with all of splaying’s amortized bounds and logarithmic worst-case accesses.
The library formalizes the abstract BST-operation part of the paper: the counterpart of its Theorem 6 for every online rotation-model algorithm, and its application to splaying. Like the paper’s Theorem 6, it counts BST operations only; the private computation and storage that choose them are not bounded (Section 30.11).
This is the abstract BST-operation counterpart of Theorem 6 of the paper. Let be any online BST algorithm in the rotation model, and any nonempty initial tree on keys. Then there is a single deamortized program, fixed from and before any request is known, made of two parts.
- Setup. A pointer-machine trace of at most instructions turns , cursor at the root, into a tree , cursor at the root.
- Responses. For every sequence of keys in , the program emits one stream of pointer instructions for a single persistent finger, starting at the root of . The stream is cut into consecutive segments, one per request. During segment the finger stands on at least once, and response costs . Every response is cheap, and the total is within a constant factor of :
where is the number of rotations performs on from . With the setup included, the total is at most , and any upper bound on gives the total bound .
The program is online: if is a prefix of , then the instruction stream and the list of response costs for are prefixes of those for .
In Lean, is an Algorithm with cost Algorithm.totalCost, and the program is a Algorithm.Implementation. implementation_exists constructs one; its fields carry the setup, the correctness and cost guarantees, and causality. total_bound adds the setup, and transfer replaces by any real upper bound.
The Lean statements
theorem implementation_exists (source : RotationBST.Algorithm) (saved : Tree) (nonempty : saved ≠ .nil) : Nonempty (Implementation source saved) := … RotationBST.Deamortization.Algorithm.implementation_exists source saved nonemptyModels.Rotation, Models.Online, Models.Pointer.Machine, Models.Multifinger.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Bounds.StaticTree.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Algorithm.Definitionstheorem total_bound {source : RotationBST.Algorithm} {saved : Tree} (d : Implementation source saved) {keys : List Nat} (valid : ∀ x ∈ keys, x < saved.size) {out : Scheduler.Output} (completed : d.program keys = some out) : d.startup + out.costs.sum ≤ 16 * saved.size + 79360 * source.totalCost saved keys := … RotationBST.Deamortization.Algorithm.Implementation.total_bound d valid completedModels.Rotation, Models.Online, Models.Pointer.Machine, Models.Multifinger.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Bounds.StaticTree.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Algorithm.Definitionstheorem transfer {source : RotationBST.Algorithm} {saved : Tree} (d : Implementation source saved) {keys : List Nat} (valid : ∀ x ∈ keys, x < saved.size) {out : Scheduler.Output} (completed : d.program keys = some out) {bound : ℝ} (sourceBound : (source.totalCost saved keys : ℝ) ≤ bound) : (d.startup + out.costs.sum : ℝ) ≤ 16 * saved.size + 79360 * bound := … RotationBST.Deamortization.Algorithm.Implementation.transfer d valid completed sourceBoundModels.Rotation, Models.Online, Models.Pointer.Machine, Models.Multifinger.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Bounds.StaticTree.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Algorithm.DefinitionsFor every nonempty initial tree on keys there is a deamortized splay program as in the box above, with splaying as the source algorithm . Every response costs less than . For every such program and every sequence of keys in , let be the setup cost plus the sum of the response costs. Then all of the following hold, for the same program and the same run:
- Scanning. For : .
- Balance. .
- Working set. , where is the working-set number of request .
- Static optimality, if requests every key: for every BST on the keys.
- Static finger, if requests every key: for every natural number .
- Without the coverage hypothesis, there are constants and , the same for all , all programs and all sequences, such that , where key is requested times. Likewise, with constants of its own, for every finger .
In Lean, splaying is Splay.algorithm, is d.startup + out.costs.sum, and the bounds are workingSetSum, StaticTree.cost, Bounds.staticCost and Bounds.fingerCost of Chapter 14.
The Lean statements
theorem implementation_exists (saved : Tree) (nonempty : saved ≠ .nil) : Nonempty (Algorithm.Implementation Splay.algorithm saved) := … RotationBST.Splay.Deamortization.implementation_exists saved nonemptyModels.Rotation, Models.Online, Models.Pointer.Machine, Models.Multifinger.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Bounds.StaticTree.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Algorithm.Definitions, Algorithms.Splay.Algorithm, Algorithms.Splay.Online, Bounds, Bounds.WorkingSettheorem scanning {saved : Tree} (d : Algorithm.Implementation Splay.algorithm saved) {out : Scheduler.Output} (completed : d.program (List.range saved.size) = some out) : d.startup + out.costs.sum ≤ 1111056 * saved.size := … RotationBST.Splay.Deamortization.scanning d completedModels.Rotation, Models.Online, Models.Pointer.Machine, Models.Multifinger.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Bounds.StaticTree.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Algorithm.Definitions, Algorithms.Splay.Algorithm, Algorithms.Splay.Online, Bounds, Bounds.WorkingSettheorem balance {saved : Tree} (d : Algorithm.Implementation Splay.algorithm saved) {xs : List Nat} (valid : ∀ x ∈ xs, x < saved.size) {out : Scheduler.Output} (completed : d.program xs = some out) : (d.startup + out.costs.sum : ℝ) ≤ 16 * saved.size + 79360 * (xs.length * (2 + 3 * Real.logb 2 saved.size) + saved.size * Real.logb 2 saved.size) := … RotationBST.Splay.Deamortization.balance d valid completedModels.Rotation, Models.Online, Models.Pointer.Machine, Models.Multifinger.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Bounds.StaticTree.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Algorithm.Definitions, Algorithms.Splay.Algorithm, Algorithms.Splay.Online, Bounds, Bounds.WorkingSettheorem working_set {saved : Tree} (d : Algorithm.Implementation Splay.algorithm saved) {xs : List Nat} (valid : ∀ x ∈ xs, x < saved.size) {out : Scheduler.Output} (completed : d.program xs = some out) : d.startup + out.costs.sum ≤ 16 * saved.size + 79360 * (11 * workingSetSum saved.size [] xs + 6 * saved.size * (1 + saved.size.log2)) := … RotationBST.Splay.Deamortization.working_set d valid completedModels.Rotation, Models.Online, Models.Pointer.Machine, Models.Multifinger.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Bounds.StaticTree.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Algorithm.Definitions, Algorithms.Splay.Algorithm, Algorithms.Splay.Online, Bounds, Bounds.WorkingSettheorem static_optimality {saved : Tree} (d : Algorithm.Implementation Splay.algorithm saved) (reference : Tree) (same : saved.size = reference.size) {xs : List Nat} (valid : ∀ x ∈ xs, x < saved.size) (covers : ∀ x < saved.size, x ∈ xs) {out : Scheduler.Output} (completed : d.program xs = some out) : (d.startup + out.costs.sum : ℝ) ≤ 16 * saved.size + 952320 * (StaticTree.cost reference xs : ℝ) := … RotationBST.Splay.Deamortization.static_optimality d reference same valid covers completedModels.Rotation, Models.Online, Models.Pointer.Machine, Models.Multifinger.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Bounds.StaticTree.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Algorithm.Definitions, Algorithms.Splay.Algorithm, Algorithms.Splay.Online, Bounds, Bounds.WorkingSettheorem static_finger {saved : Tree} (d : Algorithm.Implementation Splay.algorithm saved) (finger : Nat) {xs : List Nat} (valid : ∀ x ∈ xs, x < saved.size) (covers : ∀ x < saved.size, x ∈ xs) {out : Scheduler.Output} (completed : d.program xs = some out) : (d.startup + out.costs.sum : ℝ) ≤ 16 * saved.size + 952320 * Bounds.fingerCost finger xs := … RotationBST.Splay.Deamortization.static_finger d finger valid covers completedModels.Rotation, Models.Online, Models.Pointer.Machine, Models.Multifinger.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Bounds.StaticTree.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Algorithm.Definitions, Algorithms.Splay.Algorithm, Algorithms.Splay.Online, Bounds, Bounds.WorkingSettheorem static_optimality_general : ∃ C D : Nat, ∀ saved : Tree, ∀ d : Algorithm.Implementation Splay.algorithm saved, ∀ xs : List Nat, (∀ x ∈ xs, x < saved.size) → ∀ out, d.program xs = some out → (d.startup + out.costs.sum : ℝ) ≤ 16 * saved.size + C * Bounds.staticCost saved.size xs + D * saved.size * (1 + (saved.size.log2 : ℝ)) := … RotationBST.Splay.Deamortization.static_optimality_generalModels.Rotation, Models.Online, Models.Pointer.Machine, Models.Multifinger.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Bounds.StaticTree.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Algorithm.Definitions, Algorithms.Splay.Algorithm, Algorithms.Splay.Online, Bounds, Bounds.WorkingSettheorem static_finger_general : ∃ C D : Nat, ∀ saved : Tree, ∀ d : Algorithm.Implementation Splay.algorithm saved, ∀ (xs : List Nat) (finger : Nat), finger < saved.size → (∀ x ∈ xs, x < saved.size) → ∀ out, d.program xs = some out → (d.startup + out.costs.sum : ℝ) ≤ 16 * saved.size + C * Bounds.fingerCost finger xs + D * saved.size * (1 + (saved.size.log2 : ℝ)) := … RotationBST.Splay.Deamortization.static_finger_generalModels.Rotation, Models.Online, Models.Pointer.Machine, Models.Multifinger.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Bounds.StaticTree.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Algorithm.Definitions, Algorithms.Splay.Algorithm, Algorithms.Splay.Online, Bounds, Bounds.WorkingSetThe two boxes are all a reader needs to confirm the results. Their statements use the rotation model, the online algorithms of Chapter 5, the pointer instructions of Chapter 7 and Chapter 10, the replay function of Chapter 36, and the three definitions of Section 30.2. None of the machinery that builds the program appears in them.
The rest of the chapter has two layers. Section 30.1 is a bird’s-eye view of the construction, with its constants. Section 30.2 to Section 30.4 state the transformation theorem and its splay consequences again, in English and in Lean, with what each hypothesis means. Section 30.5 to Section 30.10 open the construction: the bounded-depth simulation, the scheduler, and how they are composed. The structures they rely on are built in Part V. A reader who trusts the construction can skip those sections; a reader who wants to see where each constant comes from should read them. Section 30.11 lists what is not formalized. The definitions are in Algorithms/Deamortization/{Scheduler,Finger,Algorithm}/Definitions/Abstract.lean, the theorems in the Abstract.lean files of Algorithms/Deamortization/{Weighted,Window,Scheduler,Finger,Replay,Algorithm} and Algorithms/Splay/Deamortization.
30.1 The plan
The paper’s idea fits in two sentences. First, simulate the algorithm in a tree whose depth stays at all times, at a constant factor in total cost (the paper’s Theorem 5). Second, run that simulation, and whenever it has spent operations without reaching the next requested key, walk to that key and back, which costs another because the tree is shallow (Theorem 6). Every request is then served within operations, and the detours at most triple the total.
The second step needs a shallow tree at every intermediate moment, not just between requests, because a detour can interrupt the simulation anywhere. This is what the first step provides, and it is where most of the work is. The library’s chain has five links:
weighted stacks pop-tarts: BSTs that implement a stack whose top is shallow
│ (Chapter 37)
▼
heavy paths the source tree, stored as pairs of pop-tarts along heavy paths,
│ rebuilt locally after each source instruction (Sections 38.1–38.3)
▼
bounded-depth every source instruction becomes O(1) amortized physical
simulation instructions, and every intermediate tree has depth
│ ≤ 49 + 39 log₂ n (Section 38.4; Theorem 5)
▼
scheduled responses each request consumes at most a budget of pending simulation
│ work, then detours to the key; the simulation may lag behind
▼ (this chapter; Theorem 6)
applications any rotation-model algorithm, splaying, and the combined
finger bound of Chapter 31
Weighted stacks. A pop-tart (Section 37.1) is a BST that implements a stack of nodes, pushed in decreasing key order at the root, with amortized BST operations per push and pop. Its leaves may carry weights. The chocolate pop-tart of the paper’s Section 2 (Section 37.2) keeps every leaf of weight at depth , where is the total leaf weight, whatever the weights of the pushed leaves.
Heavy paths. The simulation keeps the source algorithm’s tree, but stores it differently (Section 38.1 and Section 38.2). Each heavy path is split at its bottom node into its nodes smaller and larger than that node. These two monotone sequences are stored as two pop-tarts below the bottom node, and the subtrees hanging off the path are leaves of the pop-tarts, represented recursively. Depths telescope along the dotted edges to . The source’s finger is represented the same way, by the path from the root to the finger turned upside down (Section 38.3), so the simulated finger is always at the physical root.
Bounded-depth simulation. Section 38.4 packages this into a policy: a function that receives one source instruction (a move or a rotation of the source’s finger) and emits a physical instruction stream that updates the representation. With unit weights it costs at most amortized physical instructions per source instruction, and at most in the worst case. Every intermediate physical tree, at every instruction boundary, has all depths at most (Results.response_uniform). Measured from the cheapest representation of the starting tree, the factor is .
Scheduled responses. The scheduler of this chapter fixes an integer budget with . For each request it executes at most instructions of the pending simulated work. If the simulation reaches the requested key within these, the response ends there. Otherwise the finger walks to the key and back, which is cheap because the tree it walks in has depth at most . The library bounds each response by five times the work it consumed, so it emits at most instructions and costs at most . The work that was not executed stays pending, so the simulation lags behind the requests. Each emitted instruction is charged to executed simulation work at most five times over.
Applications. A rotation-model algorithm is first turned into a pointer program whose recorded work is at most times its total cost (the replay planners of Section 29.2, built on the lazy online simulation of Chapter 7). The constants then multiply:
| Step | Constant |
|---|---|
| Building the initial representation | setup |
| Rotation algorithm → pointer program | total cost |
| Pointer program → bounded-depth simulation | instructions |
| Simulation → scheduled responses | executed work |
| Altogether | |
| Per response |
These are explicit witnesses, not optimized constants. The splay applications multiply further by splaying’s own constants: and .
30.2 Physical programs and their responses
The deamortized program works in the BST model of the paper: one finger that persists between requests, moves along edges and rotates at the node it stands on, each instruction at unit cost. This is the one-finger case of the model of Chapter 10. Unlike the root-restarting pointer machine of Chapter 7, returning to the root is not free. Instructions are Multifinger.Opcodes, executed on a single cursor by Multifinger.replay (Chapter 36), which returns none at the first illegal instruction.
A program’s output for a request sequence is one instruction stream. To speak of the cost of each response, the library records how the stream is cut:
/-- Each charged request has its own contiguous physical instruction segment,with a recorded visit and the exact segment length. Adjacent segments shareone actual cursor; concatenation is the emitted program. -/inductive ServedStream : Pointer.Config → List Nat → Pointer.Config → List Multifinger.Opcode → List Nat → Prop where | nil {cursor : Pointer.Config} : ServedStream cursor [] cursor [] [] | cons {a visited b c : Pointer.Config} {key : Nat} {keys costs : List Nat} {before after rest : List Multifinger.Opcode} : Multifinger.replay before a = some visited → visited.key? = some key → Multifinger.replay after visited = some b → ServedStream b keys c rest costs → ServedStream a (key :: keys) c ((before ++ after) ++ rest) ((1 + (before ++ after).length) :: costs)ServedStream a keys c ops costs says that the stream ops leads from cursor a to cursor c and serves keys, cut into one segment before ++ after per key. Within its segment, the cursor reaches a configuration visited whose key is the request, after the before part. The segments are contiguous: each starts at the cursor where the previous one ended. The cost of a response is , the request unit plus every instruction, exactly as in Multifinger.Serves. So the cost list has one entry per request, and sums to the number of requests plus the length of the stream.
The relation fixes the segmentation, which is what makes a per-response bound meaningful: without it, a total cost could be split into small “responses” arbitrarily. A visit may occur at the very start of the segment, with before = [], if the cursor already stands on the key.
/-- Existing persistent single-finger semantics, with the actual cursor key. -/def cursorState (c : Pointer.Config) : Multifinger.State 1 := ⟨c.tree, fun _ => c.key?.getD 0⟩cursorState c reads a cursor as a one-finger state of Chapter 10: the tree of c, and one finger on the key under the cursor. The key is totalized to on an empty focus, which never occurs in the theorems below, since their cursors stand on actual nodes. Through it, the output is also stated as an ordinary Multifinger.Execution.
structure Output where state : State instructions : List Multifinger.Opcode consumed : Nat costs : List NatAn Output is what the scheduler returns for a whole request sequence: its final internal state (Section 30.6), the emitted instructions, the number of source instructions it consumed, and the list of response costs. Only instructions and costs matter for the main theorems; the state.cursor field is the physical cursor at the end.
The deamortized program itself is a structure:
/-- One causal deamortized physical program for a rotation-model algorithm.The source and saved tree are fixed before requests and cost benchmarks.Setup is a separate linear trace; computation and storage are abstract. -/structure Implementation (source : RotationBST.Algorithm) (saved : Tree) where initial : Tree startup : Nat program : List Nat → Option Scheduler.Output setup : Pointer.Trace ⟨saved, []⟩ ⟨initial, []⟩ startup setup_bound : startup ≤ 16 * saved.size correct : ∀ keys, (∀ x ∈ keys, x < saved.size) → ∃ out, program keys = some out ∧ Multifinger.replay out.instructions ⟨initial, []⟩ = some out.state.cursor ∧ Scheduler.ServedStream ⟨initial, []⟩ keys out.state.cursor out.instructions out.costs ∧ Multifinger.Execution (Scheduler.cursorState ⟨initial, []⟩) keys (Scheduler.cursorState out.state.cursor) (keys.length + out.instructions.length) ∧ out.costs.length = keys.length ∧ out.costs.sum = keys.length + out.instructions.length ∧ out.costs.sum ≤ 79360 * source.totalCost saved keys ∧ ∀ cost ∈ out.costs, (cost : ℝ) < 251 + 195 * Real.logb 2 saved.size causal : ∀ xs ys out, program (xs ++ ys) = some out → ∃ first, program xs = some first ∧ first.instructions <+: out.instructions ∧ first.costs <+: out.costsAn Implementation source saved fixes the source algorithm and the initial tree saved as parameters. Everything else is chosen once, before any request sequence and before any cost bound that one might compare with:
initialandstartup: the physical tree on which the responses begin, and the cost of reaching it.setupis aPointer.Tracefromsavedtoinitial, both with the cursor at the root, of exactlystartupinstructions, andsetup_boundsays . The setup is not part of any response. It restructures the arbitrary initial tree into the shallow representation, as the paper also requires when is unbalanced.program: a function from request sequences to outputs. Its value on a sequence is what the program does on that sequence.correct: for every sequencekeysof valid ranks, the program produces an outputoutsuch that- its instructions replay legally from
initialto the final cursor; - they form a
ServedStreamofkeyswith the response costsout.costs; - the same run is a one-finger
Multifinger.Executionofkeysfrom the root ofinitial, of costkeys.length + out.instructions.length; - there is one cost per request, and the costs sum to
keys.length + out.instructions.length; - the sum is at most
79360 * source.totalCost saved keys, whereAlgorithm.totalCostcounts one unit per request plus the source’s rotations, from the original treesaved; and - every response cost is below , with =
saved.sizeand the real logarithm.
- its instructions replay legally from
causal: ifprogram (xs ++ ys)returns an output, thenprogram xsreturns one whose instructions and costs are prefixes of it.
causal is the paper’s definition of an online algorithm, “ is a prefix of whenever is a prefix of ”. Because the program is a function of the whole sequence, causality is what makes it online. Prefix preservation of the instructions alone would allow the response to to be split differently once later requests are known. The cost prefix fixes the segmentation as well: the first responses, as segments of the stream with their visits and costs, are the same for every continuation. Nothing done for depends on . The comparison benchmarks of the next section are applied to this one program afterwards, so a single deamortized execution meets all of them at once.
- Two trees. The source cost is measured from
saved, the tree the source starts from. The responses start frominitial, after the setup. The final physical tree is not required to be the source’s final tree: work that the scheduler has not yet executed when the sequence ends is never executed, and it is not needed. - Validity.
correctsays nothing about sequences with a key outside ; the program may fail on them. Nonemptiness ofsavedis a hypothesis of the existence theorems, not a convention. - What is counted. The fields count BST instructions only.
programis an arbitrary Lean function: the computation that chooses the instructions, and whatever it remembers, are free, as in the paper’s BST model. Section 30.11 comes back to this.
30.3 The transformation theorem
Theorem (deamortization). For every online rotation-model algorithm and every nonempty initial tree, a deamortized implementation exists.
theorem implementation_exists (source : RotationBST.Algorithm) (saved : Tree) (nonempty : saved ≠ .nil) : Nonempty (Implementation source saved) := RotationBST.Deamortization.Algorithm.implementation_exists source saved nonemptyModels.Rotation, Models.Online, Models.Pointer.Machine, Models.Multifinger.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Bounds.StaticTree.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Algorithm.DefinitionsAll guarantees are in the fields of Algorithm.Implementation, so this one statement is the counterpart of Theorem 6. It is stated as Nonempty: the implementation is shown to exist, by choices made inside the proof (Section 30.10), and is not claimed to be computable.
The next two theorems apply to every implementation, in particular the one just constructed. They add the setup to the response costs.
Theorem (total cost). For every implementation and every valid sequence , the setup plus all response costs is at most .
theorem total_bound {source : RotationBST.Algorithm} {saved : Tree} (d : Implementation source saved) {keys : List Nat} (valid : ∀ x ∈ keys, x < saved.size) {out : Scheduler.Output} (completed : d.program keys = some out) : d.startup + out.costs.sum ≤ 16 * saved.size + 79360 * source.totalCost saved keys := RotationBST.Deamortization.Algorithm.Implementation.total_bound d valid completedModels.Rotation, Models.Online, Models.Pointer.Machine, Models.Multifinger.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Bounds.StaticTree.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Algorithm.DefinitionsTheorem (transfer of bounds). If the source’s total cost on is at most a real number , then the setup plus all response costs is at most .
theorem transfer {source : RotationBST.Algorithm} {saved : Tree} (d : Implementation source saved) {keys : List Nat} (valid : ∀ x ∈ keys, x < saved.size) {out : Scheduler.Output} (completed : d.program keys = some out) {bound : ℝ} (sourceBound : (source.totalCost saved keys : ℝ) ≤ bound) : (d.startup + out.costs.sum : ℝ) ≤ 16 * saved.size + 79360 * bound := RotationBST.Deamortization.Algorithm.Implementation.transfer d valid completed sourceBoundModels.Rotation, Models.Online, Models.Pointer.Machine, Models.Multifinger.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Bounds.StaticTree.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Algorithm.Definitionstransfer is the tool for applications: any proved bound on the source, such as an entropy or working-set bound, becomes a bound on the deamortized program with the extra . The splay theorems of the next section are proved this way.
The paper’s abstract also states a consequence for dynamic optimality: if a dynamically optimal BST algorithm exists, then one exists that answers every search in operations. The library proves this implication.
Theorem (dynamic optimality is preserved). Suppose an online rotation-model algorithm is dynamically optimal for total cost: there are constants such that, from every tree, its total cost is at most for every offline rotation-model execution of the same requests with rotations. Then there are constants and such that for every nonempty tree there is a deamortized implementation of from whose setup plus response costs, on every sequence, is at most for every offline execution of the sequence from with rotations.
theorem dynamic_optimal (source : RotationBST.Algorithm) (optimal : TotallyDynamicallyOptimal source) : ∃ C D : Nat, ∀ saved : Tree, saved ≠ .nil → ∃ d : Implementation source saved, ∀ (xs : List Nat) (finish : Tree) (k : Nat), RotationBST.Execution saved xs finish k → ∀ out, d.program xs = some out → d.startup + out.costs.sum ≤ C * (xs.length + k) + D * saved.size := RotationBST.Deamortization.Algorithm.dynamic_optimal source optimalModels.Rotation, Models.Online, Models.Pointer.Machine, Models.Multifinger.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Bounds.StaticTree.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Algorithm.DefinitionsThe hypothesis is TotallyDynamicallyOptimal of Chapter 5, and the comparator is any Execution, so ranges over the offline optimum and everything above it. The proof is transfer with and . The constants do not depend on ; the implementation does.
This theorem is conditional. It preserves dynamic optimality of an algorithm that is supplied with a proof of it. It asserts nothing about splaying, or about any other specific algorithm: no algorithm is known to satisfy the hypothesis.
30.4 Deamortized splay trees
Splaying is the paper’s first application, and its abstract’s first claim: a BST with the same asymptotic cost as splay trees on every sequence, and worst-case cost per search. With Splay.algorithm as the source, the transformation theorem gives the program.
Theorem (a deamortized splay program). For every nonempty initial tree there is a deamortized implementation of splaying.
theorem implementation_exists (saved : Tree) (nonempty : saved ≠ .nil) : Nonempty (Algorithm.Implementation Splay.algorithm saved) := RotationBST.Splay.Deamortization.implementation_exists saved nonemptyModels.Rotation, Models.Online, Models.Pointer.Machine, Models.Multifinger.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Bounds.StaticTree.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Algorithm.Definitions, Algorithms.Splay.Algorithm, Algorithms.Splay.Online, Bounds, Bounds.WorkingSetEach of the following theorems holds for every implementation d of splaying and every completed run, so they hold simultaneously for one program on one run. They are the bounds of Section 24.2 and Section 24.3, passed through transfer, with the setup cost included. In all of them, = d.startup + out.costs.sum.
Theorem (scanning). Requesting all keys in increasing order costs at most , setup included.
theorem scanning {saved : Tree} (d : Algorithm.Implementation Splay.algorithm saved) {out : Scheduler.Output} (completed : d.program (List.range saved.size) = some out) : d.startup + out.costs.sum ≤ 1111056 * saved.size := RotationBST.Splay.Deamortization.scanning d completedModels.Rotation, Models.Online, Models.Pointer.Machine, Models.Multifinger.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Bounds.StaticTree.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Algorithm.Definitions, Algorithms.Splay.Algorithm, Algorithms.Splay.Online, Bounds, Bounds.WorkingSetThe sequence is List.range saved.size, so validity is automatic. The constant is , from splaying’s sequential-access bound of (Results.scanning), which holds from every initial tree.
Theorem (balance). .
theorem balance {saved : Tree} (d : Algorithm.Implementation Splay.algorithm saved) {xs : List Nat} (valid : ∀ x ∈ xs, x < saved.size) {out : Scheduler.Output} (completed : d.program xs = some out) : (d.startup + out.costs.sum : ℝ) ≤ 16 * saved.size + 79360 * (xs.length * (2 + 3 * Real.logb 2 saved.size) + saved.size * Real.logb 2 saved.size) := RotationBST.Splay.Deamortization.balance d valid completedModels.Rotation, Models.Online, Models.Pointer.Machine, Models.Multifinger.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Bounds.StaticTree.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Algorithm.Definitions, Algorithms.Splay.Algorithm, Algorithms.Splay.Online, Bounds, Bounds.WorkingSetTheorem (working set). , where is workingSetSum.
theorem working_set {saved : Tree} (d : Algorithm.Implementation Splay.algorithm saved) {xs : List Nat} (valid : ∀ x ∈ xs, x < saved.size) {out : Scheduler.Output} (completed : d.program xs = some out) : d.startup + out.costs.sum ≤ 16 * saved.size + 79360 * (11 * workingSetSum saved.size [] xs + 6 * saved.size * (1 + saved.size.log2)) := RotationBST.Splay.Deamortization.working_set d valid completedModels.Rotation, Models.Online, Models.Pointer.Machine, Models.Multifinger.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Bounds.StaticTree.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Algorithm.Definitions, Algorithms.Splay.Algorithm, Algorithms.Splay.Online, Bounds, Bounds.WorkingSetSplaying’s working-set theorem bounds rotations by (Results.workingSet). The eleventh copy of pays for the request units, since . The startup term is part of the statement, multiplied like the rest.
The static bounds come in two versions, depending on whether the sequence requests every key. This coverage premise matters because unused keys still sit in the initial tree. Splaying’s static-optimality proof uses the weights , and its potential drops by at most over the sequence. When every key is requested, every , and this is at most , a part of the bound itself (Section 24.2). A key that is never requested has no term to pay for it, and an additive startup term is needed.
Theorem (static optimality, every key requested). If requests every key, then for every BST on the same keys, .
theorem static_optimality {saved : Tree} (d : Algorithm.Implementation Splay.algorithm saved) (reference : Tree) (same : saved.size = reference.size) {xs : List Nat} (valid : ∀ x ∈ xs, x < saved.size) (covers : ∀ x < saved.size, x ∈ xs) {out : Scheduler.Output} (completed : d.program xs = some out) : (d.startup + out.costs.sum : ℝ) ≤ 16 * saved.size + 952320 * (StaticTree.cost reference xs : ℝ) := RotationBST.Splay.Deamortization.static_optimality d reference same valid covers completedModels.Rotation, Models.Online, Models.Pointer.Machine, Models.Multifinger.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Bounds.StaticTree.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Algorithm.Definitions, Algorithms.Splay.Algorithm, Algorithms.Splay.Online, Bounds, Bounds.WorkingSetThe right side is StaticTree.cost reference xs, the cost of serving by root searches in the fixed tree . The constant is , from Results.staticOptimality_fixedTree. Apart from the of the setup, there is no startup term.
Theorem (static finger, every key requested). If requests every key, then for every natural number , .
theorem static_finger {saved : Tree} (d : Algorithm.Implementation Splay.algorithm saved) (finger : Nat) {xs : List Nat} (valid : ∀ x ∈ xs, x < saved.size) (covers : ∀ x < saved.size, x ∈ xs) {out : Scheduler.Output} (completed : d.program xs = some out) : (d.startup + out.costs.sum : ℝ) ≤ 16 * saved.size + 952320 * Bounds.fingerCost finger xs := RotationBST.Splay.Deamortization.static_finger d finger valid covers completedModels.Rotation, Models.Online, Models.Pointer.Machine, Models.Multifinger.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Bounds.StaticTree.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Algorithm.Definitions, Algorithms.Splay.Algorithm, Algorithms.Splay.Online, Bounds, Bounds.WorkingSetAs in Results.staticFinger_all_accessed, the finger is not required to be a key.
Theorem (static optimality and static finger, general). There are constants and such that for every tree on keys, every implementation and every valid sequence, . Likewise, with possibly other constants, for every finger .
theorem static_optimality_general : ∃ C D : Nat, ∀ saved : Tree, ∀ d : Algorithm.Implementation Splay.algorithm saved, ∀ xs : List Nat, (∀ x ∈ xs, x < saved.size) → ∀ out, d.program xs = some out → (d.startup + out.costs.sum : ℝ) ≤ 16 * saved.size + C * Bounds.staticCost saved.size xs + D * saved.size * (1 + (saved.size.log2 : ℝ)) := RotationBST.Splay.Deamortization.static_optimality_generalModels.Rotation, Models.Online, Models.Pointer.Machine, Models.Multifinger.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Bounds.StaticTree.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Algorithm.Definitions, Algorithms.Splay.Algorithm, Algorithms.Splay.Online, Bounds, Bounds.WorkingSettheorem static_finger_general : ∃ C D : Nat, ∀ saved : Tree, ∀ d : Algorithm.Implementation Splay.algorithm saved, ∀ (xs : List Nat) (finger : Nat), finger < saved.size → (∀ x ∈ xs, x < saved.size) → ∀ out, d.program xs = some out → (d.startup + out.costs.sum : ℝ) ≤ 16 * saved.size + C * Bounds.fingerCost finger xs + D * saved.size * (1 + (saved.size.log2 : ℝ)) := RotationBST.Splay.Deamortization.static_finger_generalModels.Rotation, Models.Online, Models.Pointer.Machine, Models.Multifinger.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Bounds.StaticTree.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Algorithm.Definitions, Algorithms.Splay.Algorithm, Algorithms.Splay.Online, Bounds, Bounds.WorkingSetThese versions drop the coverage premise. In exchange they keep the startup term , and the constants are existential, inherited from Results.staticOptimality and Results.staticFinger. They are uniform: and are chosen before the tree, the implementation and the sequence. The bracket is Bounds.staticCost, which is at most times the cost of every static tree, and the finger sum is Bounds.fingerCost.
The same transformation is applied, through the replay planners of Section 30.10, to the combination of GreedyASS and Tango in Chapter 31. That chapter obtains one BST with the weighted dynamic finger bound, -competitiveness and worst-case responses (Results.combined).
30.5 Bounded-depth simulation
The rest of the chapter opens the construction. This section is the library’s form of the paper’s Theorem 5, in the weighted version. It is a self-contained statement about the simulation of Section 38.4, and the scheduler below uses its unit-weight form.
The source algorithm here is more general than a rotation-model algorithm. It is a Requests.Algorithm: an online rule that, given the past requests, its current labelled cursor (LabelledCursor.Config, a tree whose nodes carry labels in some type , with a persistent cursor) and the next request, emits a list of source instructions that legally visits the requested key, and may keep working afterwards. Its cost is the number of instructions it emits, (a.runFrom past c keys).1.length. The labels carry the weights: is a function on labels, and is the total weight HeavyPath.mass of the source tree. HeavyPath.Positive asks for positive weights on the tree’s labels.
Theorem (bounded-depth simulation). Let be a labelled source cursor on a nonempty tree, with positive weights. There are a fixed simulation policy, an initial representation and a setup trace of at most instructions such that, for every source algorithm and every valid sequence, simulating the algorithm request by request:
- produces the source’s own final cursor, and a valid representation of it;
- is a legal physical program from the root of the representation to its root, and a
Pointer.Executionof the requests of cost plus its length; - costs at most physical instructions per source instruction;
- leaves the source finger’s key at the physical root; and
- at every cut of the emitted stream, the intermediate physical tree has every key at depth at most .
theorem simulation {α : Type} (weight : α → ℝ) (c : LabelledCursor.Config α) (live : c.focus ≠ .nil) (positive : HeavyPath.Positive weight c.tree) : ∃ (p : Simulation.Policy α) (start : State α) (startup : Nat), Simulation.PolicyWithin weight p ∧ Simulation.ConfigValid weight c start ∧ Pointer.Trace ⟨c.tree.erase, []⟩ ⟨start.pair.tree, []⟩ startup ∧ startup ≤ 16 * c.tree.erase.size ∧ ∀ (a : Simulation.Requests.Algorithm α) (past keys : List Nat), (∀ x ∈ keys, x < c.tree.erase.size) → ∃ out, Simulation.Requests.run p a past c start keys = some out ∧ out.source = (a.runFrom past c keys).2 ∧ Simulation.ConfigValid weight out.source out.state ∧ Multifinger.replay out.instructions ⟨start.pair.tree, []⟩ = some ⟨out.state.pair.tree, []⟩ ∧ Pointer.Execution start.pair.tree keys out.state.pair.tree (keys.length + out.cost) ∧ out.cost ≤ 248 * (a.runFrom past c keys).1.length ∧ (Pointer.Config.mk out.state.pair.tree []).key? = out.source.erase.key? ∧ ∀ cut, ∃ middle, Multifinger.replay (out.instructions.take cut) ⟨start.pair.tree, []⟩ = some middle ∧ Multifinger.replay (out.instructions.drop cut) middle = some ⟨out.state.pair.tree, []⟩ ∧ ∀ rank : Fin c.tree.inorder.length, (Tree.depth middle.tree rank.val : ℝ) ≤ 336 + 240 * Real.logb 2 (HeavyPath.mass weight c.tree / weight (c.tree.inorder[rank.val]'rank.isLt)) := RotationBST.Deamortization.Weighted.simulation weight c live positiveModels.Rotation, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Pointer.Machine, Models.Pointer.Mirror.Definitions, Models.Pointer.Lazy.Skeleton, Models.Labelled.Cursor.Definitions, Models.Labelled.Ordering.Definitions, Structures.PopTart.Definitions, Structures.PopTart.Mirror.Definitions, Structures.PopTart.Chocolate.Definitions, Structures.PopTart.Located.Definitions, Structures.HeavyPath.Definitions, Structures.HeavyPath.Paired.Definitions, Structures.HeavyPath.Paired.Substitution.Definitions, Structures.HeavyPath.Recursive.Definitions, Structures.HeavyPath.Finger.Definitions, Structures.PopTart.Chocolate.Top.Definitions, Structures.HeavyPath.Paired.Exposure.Definitions, Structures.HeavyPath.Recursive.History.Definitions, Structures.HeavyPath.Finger.Transfer.Definitions, Structures.HeavyPath.Finger.History.Definitions, Structures.HeavyPath.Finger.History.Simulation.Definitions, Structures.HeavyPath.Finger.History.Simulation.Requests.Definitions, Bounds.StaticTree.DefinitionsItem 5 is the strong form of Theorem 5’s depth claim: it holds not only between source instructions, but at every physical instruction boundary of the emitted program. Item 4 is the paper’s “the finger is always at the root of ”. The policy and the initial representation are chosen before the source algorithm, and they are Simulation.PolicyWithin, the bounded policies of Section 38.4 with a structural depth certificate.
Theorem (the simulation is online). If simulating on xs ++ ys succeeds, then simulating on xs succeeds with a prefix of the instructions.
theorem online_prefix {α : Type} (p : Simulation.Policy α) (a : Simulation.Requests.Algorithm α) (past : List Nat) (c : LabelledCursor.Config α) (start : State α) (xs ys : List Nat) {out : Simulation.Output α} (completed : Simulation.Requests.run p a past c start (xs ++ ys) = some out) : ∃ first, Simulation.Requests.run p a past c start xs = some first ∧ first.instructions <+: out.instructions := RotationBST.Deamortization.Weighted.online_prefix p a past c start xs ys completedModels.Rotation, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Pointer.Machine, Models.Pointer.Mirror.Definitions, Models.Pointer.Lazy.Skeleton, Models.Labelled.Cursor.Definitions, Models.Labelled.Ordering.Definitions, Structures.PopTart.Definitions, Structures.PopTart.Mirror.Definitions, Structures.PopTart.Chocolate.Definitions, Structures.PopTart.Located.Definitions, Structures.HeavyPath.Definitions, Structures.HeavyPath.Paired.Definitions, Structures.HeavyPath.Paired.Substitution.Definitions, Structures.HeavyPath.Recursive.Definitions, Structures.HeavyPath.Finger.Definitions, Structures.PopTart.Chocolate.Top.Definitions, Structures.HeavyPath.Paired.Exposure.Definitions, Structures.HeavyPath.Recursive.History.Definitions, Structures.HeavyPath.Finger.Transfer.Definitions, Structures.HeavyPath.Finger.History.Definitions, Structures.HeavyPath.Finger.History.Simulation.Definitions, Structures.HeavyPath.Finger.History.Simulation.Requests.Definitions, Bounds.StaticTree.DefinitionsTheorem (the simulation program, Theorem 5). For a family of source algorithms, one for each request sequence, there is one simulation program with the guarantees above, for the source chosen by the sequence. If the family is constant, the program is online.
theorem transform {α : Type} (family : List Nat → Simulation.Requests.Algorithm α) (weight : α → ℝ) (c : LabelledCursor.Config α) (live : c.focus ≠ .nil) (positive : HeavyPath.Positive weight c.tree) : ∃ (program : List Nat → Option (Simulation.Output α)) (start : State α) (startup : Nat), Pointer.Trace ⟨c.tree.erase, []⟩ ⟨start.pair.tree, []⟩ startup ∧ startup ≤ 16 * c.tree.erase.size ∧ (∀ keys, (∀ x ∈ keys, x < c.tree.erase.size) → ∃ out, program keys = some out ∧ out.source = ((family keys).runFrom [] c keys).2 ∧ Simulation.ConfigValid weight out.source out.state ∧ Multifinger.replay out.instructions ⟨start.pair.tree, []⟩ = some ⟨out.state.pair.tree, []⟩ ∧ Pointer.Execution start.pair.tree keys out.state.pair.tree (keys.length + out.cost) ∧ out.cost ≤ 248 * ((family keys).runFrom [] c keys).1.length ∧ (Pointer.Config.mk out.state.pair.tree []).key? = out.source.erase.key? ∧ ∀ cut, ∃ middle, Multifinger.replay (out.instructions.take cut) ⟨start.pair.tree, []⟩ = some middle ∧ Multifinger.replay (out.instructions.drop cut) middle = some ⟨out.state.pair.tree, []⟩ ∧ ∀ rank : Fin c.tree.inorder.length, (Tree.depth middle.tree rank.val : ℝ) ≤ 336 + 240 * Real.logb 2 (HeavyPath.mass weight c.tree / weight (c.tree.inorder[rank.val]'rank.isLt))) ∧ ((∃ a, ∀ keys, family keys = a) → ∀ xs ys out, program (xs ++ ys) = some out → ∃ first, program xs = some first ∧ first.instructions <+: out.instructions) := RotationBST.Deamortization.Weighted.transform family weight c live positiveModels.Rotation, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Pointer.Machine, Models.Pointer.Mirror.Definitions, Models.Pointer.Lazy.Skeleton, Models.Labelled.Cursor.Definitions, Models.Labelled.Ordering.Definitions, Structures.PopTart.Definitions, Structures.PopTart.Mirror.Definitions, Structures.PopTart.Chocolate.Definitions, Structures.PopTart.Located.Definitions, Structures.HeavyPath.Definitions, Structures.HeavyPath.Paired.Definitions, Structures.HeavyPath.Paired.Substitution.Definitions, Structures.HeavyPath.Recursive.Definitions, Structures.HeavyPath.Finger.Definitions, Structures.PopTart.Chocolate.Top.Definitions, Structures.HeavyPath.Paired.Exposure.Definitions, Structures.HeavyPath.Recursive.History.Definitions, Structures.HeavyPath.Finger.Transfer.Definitions, Structures.HeavyPath.Finger.History.Definitions, Structures.HeavyPath.Finger.History.Simulation.Definitions, Structures.HeavyPath.Finger.History.Simulation.Requests.Definitions, Bounds.StaticTree.DefinitionsThe family lets the source depend on the whole sequence, which covers offline source algorithms, as in the paper’s statement “for any BST algorithm … if is online, so is ”. The emitted instructions are prefix-preserving only when the family is constant, that is, when the source is one online algorithm.
The weighted results are not used by the deamortization theorems below, which need only unit weights. Those use the sharper unit-weight depth bound of Section 38.4, proved directly for the same kind of policies.
30.6 Pending work and lag
The scheduler turns a stream of prepared request programs into responses. It knows nothing about heavy paths or pop-tarts. Its input is, for each request, the physical instruction stream that the simulation would execute for it, with two guarantees: the stream visits the requested key, and every intermediate tree along it is shallow.
/-- A pending program keeps every intermediate physical tree within the budget. -/def Height (budget : Nat) (start : Pointer.Config) (ops : List Multifinger.Opcode) : Prop := ∀ cut middle, Multifinger.replay (ops.take cut) start = some middle → ∀ x < middle.tree.size, Tree.depth middle.tree x ≤ budgetHeight budget start ops says that every prefix of ops that replays from start reaches a tree in which every key has depth at most budget. This is the property a detour needs: from any point of the pending work, any key can be reached and left in instructions.
/-- The original algorithm supplies only the next request's physical program. -/structure Request where target : Nat instructions : List Multifinger.Opcode/-- A prepared original request contains an actual visit in its recorded code. -/def Prepared (budget : Nat) (start : Pointer.Config) (request : Request) (finish : Pointer.Config) : Prop := Multifinger.replay request.instructions start = some finish ∧ (∃ cut visited, cut ≤ request.instructions.length ∧ Multifinger.replay (request.instructions.take cut) start = some visited ∧ visited.key? = some request.target) ∧ Height budget start request.instructions/-- Preparation follows the original cursor, independently of scheduler lag. -/inductive PreparedStream (budget : Nat) : Pointer.Config → List Request → Pointer.Config → Prop where | nil {cursor : Pointer.Config} : PreparedStream budget cursor [] cursor | cons {a b c : Pointer.Config} {request : Request} {requests : List Request} : Prepared budget a request b → PreparedStream budget b requests c → PreparedStream budget a (request :: requests) cA Request is the target key with its physical program. Prepared budget start request finish says that the program replays from start to finish, that some prefix of it reaches a cursor on the target (so the program contains an actual visit), and that it satisfies Height. A PreparedStream chains prepared requests, each starting where the previous one’s program ends. This chain follows the source’s cursor, independently of what the scheduler has executed so far.
/-- The actual cursor can lag behind the planned endpoint by exactly pending.No original operation is lost when a new request is appended. -/structure State where cursor : Pointer.Config pending : List Multifinger.Opcode planned : Pointer.Configdef Valid (budget : Nat) (s : State) : Prop := s.cursor.focus ≠ .nil ∧ Multifinger.replay s.pending s.cursor = some s.planned ∧ Height budget s.cursor s.pendingdef initial (cursor : Pointer.Config) : State := ⟨cursor, [], cursor⟩The scheduler’s state has three parts:
executed pending
─────────────────────|─────────────────────────────|
cursor planned
cursor is the actual physical cursor. pending is the simulation work not yet executed, and planned is where the simulation will be once it has all been executed. Valid says that the cursor is on an actual node, that pending replays from cursor to planned, and that it satisfies Height. initial c has nothing pending.
The gap between cursor and planned is the lag of the paper’s proof: the deamortized algorithm can be ahead of the simulation in the input sequence. When a new request arrives, its program is appended after pending and starts at planned. No source instruction is ever dropped while requests keep arriving.
Theorem (initial validity). An initial state is valid if the cursor is on an actual node and every key of its tree has depth at most the budget.
theorem initial_valid {budget : Nat} {cursor : Pointer.Config} (live : cursor.focus ≠ .nil) (depths : ∀ x < cursor.tree.size, Tree.depth cursor.tree x ≤ budget) : Valid budget (initial cursor) := RotationBST.Deamortization.Scheduler.initial_valid live depths30.7 Serving one request
The core of a response is a statement about one window of pending work.
Theorem (one window). Let ops be a legal program from start to finish that visits the target and keeps every intermediate depth at most budget, with start on an actual node. Then there is a number consumed of instructions to execute, at most the budget, and a physical response before ++ after such that:
- executing the first
consumedinstructions ofopsreaches a cursormiddle, and the rest ofopsstill leads frommiddletofinish; beforeleads fromstartto a cursor on the target, andafterfrom there tomiddle;- the response has at most instructions, and at most ; and
- either all of the budget was consumed, or
middleitself is on the target.
theorem serve {start finish : Config} {ops : List Multifinger.Opcode} (executed : Multifinger.replay ops start = some finish) (live : start.focus ≠ .nil) {target budget : Nat} (valid : target < start.tree.size) (visits : ∃ cut visited, cut ≤ ops.length ∧ Multifinger.replay (ops.take cut) start = some visited ∧ visited.key? = some target) (height : ∀ cut middle, Multifinger.replay (ops.take cut) start = some middle → ∀ x < middle.tree.size, Tree.depth middle.tree x ≤ budget) : ∃ (consumed : Nat) (middle visited : Config) (before after : List Multifinger.Opcode), consumed ≤ budget ∧ consumed ≤ ops.length ∧ Multifinger.replay (ops.take consumed) start = some middle ∧ Multifinger.replay (ops.drop consumed) middle = some finish ∧ Multifinger.replay before start = some visited ∧ visited.key? = some target ∧ Multifinger.replay after visited = some middle ∧ before.length + after.length ≤ 5 * consumed ∧ 1 + before.length + after.length ≤ 1 + 5 * budget ∧ (consumed = budget ∨ middle.key? = some target) := RotationBST.Deamortization.Window.serve executed live valid visits heightThis is the paper’s rule, read for one request. Execute the source work; if the target is reached within the budget, stop there. Otherwise stop after the budget, and walk to the target and back. The walk stays within the tree reached after consumed instructions, whose depths are at most the budget, so it costs , and the library bounds the whole response by five times what it consumed. After the response, the physical cursor is exactly where the source work stands after consumed instructions: the detour returns precisely to it, so the remaining work can continue unchanged.
structure Response where state : State visited : Pointer.Config before : List Multifinger.Opcode after : List Multifinger.Opcode consumed : Natdef Response.instructions (out : Response) : List Multifinger.Opcode := out.before ++ out.afterdef Correct (budget : Nat) (s : State) (request : Request) (out : Response) : Prop := Valid budget out.state ∧ Multifinger.replay request.instructions s.planned = some out.state.planned ∧ out.consumed ≤ budget ∧ out.consumed ≤ (s.pending ++ request.instructions).length ∧ out.state.pending = (s.pending ++ request.instructions).drop out.consumed ∧ Multifinger.replay ((s.pending ++ request.instructions).take out.consumed) s.cursor = some out.state.cursor ∧ Multifinger.replay out.before s.cursor = some out.visited ∧ out.visited.key? = some request.target ∧ Multifinger.replay out.after out.visited = some out.state.cursor ∧ out.instructions.length ≤ 5 * out.consumed ∧ 1 + out.instructions.length ≤ 1 + 5 * budgetA Response records the new state, the visited cursor, the two parts of the physical response and the number of pending instructions consumed. Its instructions are before ++ after. Correct budget s request out lists what a response must satisfy:
- the new state is valid;
- the planned endpoint advances by the request’s whole program;
- at most
budgetinstructions are consumed, and no more than are pending, counting the new request’s program; - the new pending work is what remains after them;
- executing the consumed instructions leads from the old cursor to the new one;
beforeleads from the old cursor to a cursor on the target, andafterfrom there to the new cursor; and- the response has at most instructions, and its cost is at most .
Three consequences are used repeatedly.
Theorem (a correct response). A correct response replays from the old cursor to the new one. It conserves work: pending plus consumed after the response equals pending before it plus the request’s program. And, from a valid state, it is a one-finger Multifinger.Serves of the target at cost .
theorem response_replay {budget : Nat} {s : State} {request : Request} {out : Response} (correct : Correct budget s request out) : Multifinger.replay out.instructions s.cursor = some out.state.cursor := RotationBST.Deamortization.Scheduler.response_replay correcttheorem response_account {budget : Nat} {s : State} {request : Request} {out : Response} (correct : Correct budget s request out) : out.state.pending.length + out.consumed = s.pending.length + request.instructions.length := RotationBST.Deamortization.Scheduler.response_account correcttheorem response_serves {budget : Nat} {s : State} {request : Request} {out : Response} (valid : Valid budget s) (correct : Correct budget s request out) : Multifinger.Serves (cursorState s.cursor) (cursorState out.state.cursor) request.target (1 + out.instructions.length) := RotationBST.Deamortization.Scheduler.response_serves valid correct30.8 Running the scheduler
abbrev Policy := State → Request → Option Responsedef PolicyValid (budget : Nat) (p : Policy) : Prop := ∀ s request, Valid budget s → (∃ finish, Prepared budget s.planned request finish) → ∃ out, p s request = some out ∧ Correct budget s request outA scheduling Policy is a function of the current state and the current request only, returning a response or none. It never sees later requests. PolicyValid budget p asks that, from every valid state, for every request prepared from the planned endpoint, the policy returns a correct response.
Theorem (a valid policy exists). For every budget there is a valid scheduling policy.
theorem policy_exists (budget : Nat) : ∃ p : Policy, PolicyValid budget p := RotationBST.Deamortization.Scheduler.policy_exists budgetThe proof applies the window theorem to the pending work followed by the new request’s program, which is legal, visits the target and has bounded height, and chooses the result.
def run (p : Policy) (s : State) : List Request → Option Output | [] => some ⟨s, [], 0, []⟩ | request :: requests => (p s request).bind fun first => (run p first.state requests).map fun last => ⟨last.state, first.instructions ++ last.instructions, first.consumed + last.consumed, (1 + first.instructions.length) :: last.costs⟩run p s requests threads the state through the requests. It concatenates the response instructions, adds the consumed counts, and records the cost of each response.
Theorem (scheduled run). Let the policy be valid, the state valid, and the requests a prepared stream from its planned endpoint. Then the run succeeds, and:
- it ends planned at the end of the stream, in a valid state;
- its instructions replay from the cursor, and form a one-finger execution of the targets of cost plus their length;
- pending plus consumed equals the initial pending plus all request programs;
- it emits at most times what it consumed, and consumes at most the budget times the number of requests; and
- it has one cost per request, summing to plus the number of instructions, each at most .
theorem run_spec {budget : Nat} {p : Policy} (policyValid : PolicyValid budget p) {s : State} {requests : List Request} {finish : Pointer.Config} (valid : Valid budget s) (ready : PreparedStream budget s.planned requests finish) : ∃ out, run p s requests = some out ∧ out.state.planned = finish ∧ Valid budget out.state ∧ Multifinger.replay out.instructions s.cursor = some out.state.cursor ∧ Multifinger.Execution (cursorState s.cursor) (requests.map Request.target) (cursorState out.state.cursor) (requests.length + out.instructions.length) ∧ out.state.pending.length + out.consumed = s.pending.length + (requests.map (fun request => request.instructions.length)).sum ∧ out.instructions.length ≤ 5 * out.consumed ∧ out.costs.length = requests.length ∧ out.costs.sum = requests.length + out.instructions.length ∧ (∀ cost ∈ out.costs, cost ≤ 1 + 5 * budget) ∧ out.consumed ≤ budget * requests.length := RotationBST.Deamortization.Scheduler.run_spec policyValid valid readyTheorem (scheduled run, served). Under the same hypotheses, the emitted instructions and the costs form a served stream of the targets.
theorem run_served {budget : Nat} {p : Policy} (policyValid : PolicyValid budget p) {s : State} {requests : List Request} {finish : Pointer.Config} {out : Output} (valid : Valid budget s) (ready : PreparedStream budget s.planned requests finish) (completed : run p s requests = some out) : ServedStream s.cursor (requests.map Request.target) out.state.cursor out.instructions out.costs := RotationBST.Deamortization.Scheduler.run_served policyValid valid ready completedTheorem (prefixes). Running on xs ++ ys is running on xs and continuing from its final state on ys, with outputs concatenated. Hence a run on xs ++ ys that succeeds extends a successful run on xs, in both instructions and costs.
theorem run_append (p : Policy) (s : State) (xs ys : List Request) : run p s (xs ++ ys) = (run p s xs).bind fun first => (run p first.state ys).map fun last => ⟨last.state, first.instructions ++ last.instructions, first.consumed + last.consumed, first.costs ++ last.costs⟩ := RotationBST.Deamortization.Scheduler.run_append p s xs ystheorem run_prefix (p : Policy) (s : State) (xs ys : List Request) {out : Output} (completed : run p s (xs ++ ys) = some out) : ∃ first, run p s xs = some first ∧ first.instructions <+: out.instructions ∧ first.costs <+: out.costs := RotationBST.Deamortization.Scheduler.run_prefix p s xs ys completedrun_prefix holds for every policy, valid or not: causality comes from the shape of run alone, because a policy sees only its state and the current request. This is where the causality of the final program comes from, once the preparation of the requests is causal as well.
30.9 Preparing the source
This section composes the simulation of Section 38.4 with the scheduler, for a source algorithm with labelled cursors, as in Section 30.5, and unit weights.
/-- The original source simulation plans request programs causally. Thescheduler may still be executing a prefix of the accumulated programs. -/structure PreparedOutput (α : Type) where source : LabelledCursor.Config α history : State α requests : List Scheduler.Requestdef prepare {α : Type} (p : Simulation.Policy α) (a : Simulation.Requests.Algorithm α) (past : List Nat) (c : LabelledCursor.Config α) (s : State α) : List Nat → Option (PreparedOutput α) | [] => some ⟨c, s, []⟩ | key :: keys => (Simulation.run p c s (a.step past c key).1).bind fun first => (prepare p a (past ++ [key]) first.source first.state keys).map fun last => ⟨last.source, last.history, ⟨key, first.instructions⟩ :: last.requests⟩/-- Both policies are fixed before the input sequence. Planning time followsthe abstract BST model; the output counts every executed pointer instruction. -/def transform {α : Type} (sourcePolicy : Simulation.Policy α) (scheduler : Scheduler.Policy) (a : Simulation.Requests.Algorithm α) (past : List Nat) (c : LabelledCursor.Config α) (s : State α) (keys : List Nat) : Option Scheduler.Output := (prepare sourcePolicy a past c s keys).bind fun ready => Scheduler.run scheduler (Scheduler.initial ⟨s.pair.tree, []⟩) ready.requestsprepare runs the source algorithm on the keys, request by request. For each key it takes the source’s instructions for that key, simulates them with the policy Simulation.run, and records the resulting physical program as a Scheduler.Request for that key. It returns the final source cursor, the final representation and the list of requests. transform prepares the requests and schedules them, starting with the physical cursor at the root of the initial representation. The scheduler executes a prefix of the accumulated programs, so it may lag behind the preparation. Both policies are fixed before the keys, and the preparation sees each key only when it is requested.
The first group of results describes the preparation. The budget must be at least , the unit-weight depth bound of the simulation; is a valid representation of the source cursor , and the simulation policy is Simulation.PolicyBounded.
Theorem (preparation). The preparation succeeds on valid keys. It ends at the source’s own final cursor, with a valid representation, one request per key, and a prepared stream from the root of the initial representation. Its total physical work plus the final potential is at most times the source’s instructions plus the initial potential. Measured by the excess over the cheapest representation of the same source cursor (Minimum.excess), the factor is .
theorem prepare_spec {α : Type} {p : Simulation.Policy α} (bounded : Simulation.PolicyBounded (fun _ => 1) p) (a : Simulation.Requests.Algorithm α) (past : List Nat) {c : LabelledCursor.Config α} {s : State α} (valid : Simulation.ConfigValid (fun _ => 1) c s) {budget : Nat} (budgetBound : 49 + 39 * Real.logb 2 s.pair.tree.size ≤ budget) (keys : List Nat) (validKeys : ∀ x ∈ keys, x < c.tree.erase.size) : ∃ out, prepare p a past c s keys = some out ∧ out.source = (a.runFrom past c keys).2 ∧ Simulation.ConfigValid (fun _ => 1) out.source out.history ∧ out.requests.map Scheduler.Request.target = keys ∧ Scheduler.PreparedStream budget ⟨s.pair.tree, []⟩ out.requests ⟨out.history.pair.tree, []⟩ ∧ (out.requests.map (fun request => request.instructions.length)).sum + out.history.potential ≤ 62 * (a.runFrom past c keys).1.length + s.potential := RotationBST.Deamortization.Finger.prepare_spec bounded a past valid budgetBound keys validKeysModels.Rotation, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Pointer.Machine, Models.Pointer.Mirror.Definitions, Models.Pointer.Lazy.Skeleton, Models.Labelled.Cursor.Definitions, Models.Labelled.Ordering.Definitions, Structures.PopTart.Definitions, Structures.PopTart.Mirror.Definitions, Structures.PopTart.Chocolate.Definitions, Structures.PopTart.Located.Definitions, Structures.HeavyPath.Definitions, Structures.HeavyPath.Paired.Definitions, Structures.HeavyPath.Paired.Substitution.Definitions, Structures.HeavyPath.Recursive.Definitions, Structures.HeavyPath.Finger.Definitions, Structures.PopTart.Chocolate.Top.Definitions, Structures.HeavyPath.Paired.Exposure.Definitions, Structures.HeavyPath.Recursive.History.Definitions, Structures.HeavyPath.Finger.Transfer.Definitions, Structures.HeavyPath.Finger.History.Definitions, Structures.HeavyPath.Finger.History.Simulation.Definitions, Bounds.StaticTree.Definitions, Structures.HeavyPath.Finger.History.Simulation.Requests.Definitions, Models.Multifinger.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Finger.Definitions, Structures.HeavyPath.Finger.History.Simulation.Minimum.Definitionstheorem prepare_excess {α : Type} {p : Simulation.Policy α} (bounded : Simulation.PolicyBounded (fun _ => 1) p) (a : Simulation.Requests.Algorithm α) (past : List Nat) {c : LabelledCursor.Config α} {s : State α} (valid : Simulation.ConfigValid (fun _ => 1) c s) {budget : Nat} (budgetBound : 49 + 39 * Real.logb 2 s.pair.tree.size ≤ budget) (keys : List Nat) (validKeys : ∀ x ∈ keys, x < c.tree.erase.size) : ∃ out, prepare p a past c s keys = some out ∧ out.source = (a.runFrom past c keys).2 ∧ Simulation.ConfigValid (fun _ => 1) out.source out.history ∧ out.requests.map Scheduler.Request.target = keys ∧ Scheduler.PreparedStream budget ⟨s.pair.tree, []⟩ out.requests ⟨out.history.pair.tree, []⟩ ∧ (out.requests.map (fun request => request.instructions.length)).sum + Simulation.Minimum.excess (fun _ => 1) out.source out.history ≤ 248 * (a.runFrom past c keys).1.length + Simulation.Minimum.excess (fun _ => 1) c s := RotationBST.Deamortization.Finger.prepare_excess bounded a past valid budgetBound keys validKeysModels.Rotation, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Pointer.Machine, Models.Pointer.Mirror.Definitions, Models.Pointer.Lazy.Skeleton, Models.Labelled.Cursor.Definitions, Models.Labelled.Ordering.Definitions, Structures.PopTart.Definitions, Structures.PopTart.Mirror.Definitions, Structures.PopTart.Chocolate.Definitions, Structures.PopTart.Located.Definitions, Structures.HeavyPath.Definitions, Structures.HeavyPath.Paired.Definitions, Structures.HeavyPath.Paired.Substitution.Definitions, Structures.HeavyPath.Recursive.Definitions, Structures.HeavyPath.Finger.Definitions, Structures.PopTart.Chocolate.Top.Definitions, Structures.HeavyPath.Paired.Exposure.Definitions, Structures.HeavyPath.Recursive.History.Definitions, Structures.HeavyPath.Finger.Transfer.Definitions, Structures.HeavyPath.Finger.History.Definitions, Structures.HeavyPath.Finger.History.Simulation.Definitions, Bounds.StaticTree.Definitions, Structures.HeavyPath.Finger.History.Simulation.Requests.Definitions, Models.Multifinger.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Finger.Definitions, Structures.HeavyPath.Finger.History.Simulation.Minimum.DefinitionsTheorem (preparation is causal). Preparing xs ++ ys is preparing xs and continuing with history past ++ xs. Its requests extend those of xs.
theorem prepare_append {α : Type} (p : Simulation.Policy α) (a : Simulation.Requests.Algorithm α) (past : List Nat) (c : LabelledCursor.Config α) (s : State α) (xs ys : List Nat) : prepare p a past c s (xs ++ ys) = (prepare p a past c s xs).bind fun first => (prepare p a (past ++ xs) first.source first.history ys).map fun last => ⟨last.source, last.history, first.requests ++ last.requests⟩ := RotationBST.Deamortization.Finger.prepare_append p a past c s xs ysModels.Rotation, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Pointer.Machine, Models.Pointer.Mirror.Definitions, Models.Pointer.Lazy.Skeleton, Models.Labelled.Cursor.Definitions, Models.Labelled.Ordering.Definitions, Structures.PopTart.Definitions, Structures.PopTart.Mirror.Definitions, Structures.PopTart.Chocolate.Definitions, Structures.PopTart.Located.Definitions, Structures.HeavyPath.Definitions, Structures.HeavyPath.Paired.Definitions, Structures.HeavyPath.Paired.Substitution.Definitions, Structures.HeavyPath.Recursive.Definitions, Structures.HeavyPath.Finger.Definitions, Structures.PopTart.Chocolate.Top.Definitions, Structures.HeavyPath.Paired.Exposure.Definitions, Structures.HeavyPath.Recursive.History.Definitions, Structures.HeavyPath.Finger.Transfer.Definitions, Structures.HeavyPath.Finger.History.Definitions, Structures.HeavyPath.Finger.History.Simulation.Definitions, Bounds.StaticTree.Definitions, Structures.HeavyPath.Finger.History.Simulation.Requests.Definitions, Models.Multifinger.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Finger.Definitions, Structures.HeavyPath.Finger.History.Simulation.Minimum.Definitionstheorem prepare_prefix {α : Type} (p : Simulation.Policy α) (a : Simulation.Requests.Algorithm α) (past : List Nat) (c : LabelledCursor.Config α) (s : State α) (xs ys : List Nat) {out : PreparedOutput α} (completed : prepare p a past c s (xs ++ ys) = some out) : ∃ first, prepare p a past c s xs = some first ∧ first.requests <+: out.requests := RotationBST.Deamortization.Finger.prepare_prefix p a past c s xs ys completedModels.Rotation, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Pointer.Machine, Models.Pointer.Mirror.Definitions, Models.Pointer.Lazy.Skeleton, Models.Labelled.Cursor.Definitions, Models.Labelled.Ordering.Definitions, Structures.PopTart.Definitions, Structures.PopTart.Mirror.Definitions, Structures.PopTart.Chocolate.Definitions, Structures.PopTart.Located.Definitions, Structures.HeavyPath.Definitions, Structures.HeavyPath.Paired.Definitions, Structures.HeavyPath.Paired.Substitution.Definitions, Structures.HeavyPath.Recursive.Definitions, Structures.HeavyPath.Finger.Definitions, Structures.PopTart.Chocolate.Top.Definitions, Structures.HeavyPath.Paired.Exposure.Definitions, Structures.HeavyPath.Recursive.History.Definitions, Structures.HeavyPath.Finger.Transfer.Definitions, Structures.HeavyPath.Finger.History.Definitions, Structures.HeavyPath.Finger.History.Simulation.Definitions, Bounds.StaticTree.Definitions, Structures.HeavyPath.Finger.History.Simulation.Requests.Definitions, Models.Multifinger.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Finger.Definitions, Structures.HeavyPath.Finger.History.Simulation.Minimum.DefinitionsThe second group describes the composed transform.
Theorem (initial validity). The scheduler’s initial state at the root of a valid representation is valid for every budget of at least .
theorem initial_valid {α : Type} {p : Simulation.Policy α} (bounded : Simulation.PolicyBounded (fun _ => 1) p) {c : LabelledCursor.Config α} {s : State α} (valid : Simulation.ConfigValid (fun _ => 1) c s) {budget : Nat} (budgetBound : 49 + 39 * Real.logb 2 s.pair.tree.size ≤ budget) : Scheduler.Valid budget (Scheduler.initial ⟨s.pair.tree, []⟩) := RotationBST.Deamortization.Finger.initial_valid bounded valid budgetBoundModels.Rotation, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Pointer.Machine, Models.Pointer.Mirror.Definitions, Models.Pointer.Lazy.Skeleton, Models.Labelled.Cursor.Definitions, Models.Labelled.Ordering.Definitions, Structures.PopTart.Definitions, Structures.PopTart.Mirror.Definitions, Structures.PopTart.Chocolate.Definitions, Structures.PopTart.Located.Definitions, Structures.HeavyPath.Definitions, Structures.HeavyPath.Paired.Definitions, Structures.HeavyPath.Paired.Substitution.Definitions, Structures.HeavyPath.Recursive.Definitions, Structures.HeavyPath.Finger.Definitions, Structures.PopTart.Chocolate.Top.Definitions, Structures.HeavyPath.Paired.Exposure.Definitions, Structures.HeavyPath.Recursive.History.Definitions, Structures.HeavyPath.Finger.Transfer.Definitions, Structures.HeavyPath.Finger.History.Definitions, Structures.HeavyPath.Finger.History.Simulation.Definitions, Bounds.StaticTree.Definitions, Structures.HeavyPath.Finger.History.Simulation.Requests.Definitions, Models.Multifinger.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Finger.Definitions, Structures.HeavyPath.Finger.History.Simulation.Minimum.DefinitionsTheorem (transform). With a bounded simulation policy and a valid scheduling policy, the transform succeeds on valid keys. Its instructions are legal, serve the keys as a one-finger execution and, with the excess version, as a served stream. The responses cost at most each. The physical instructions, plus times the pending work and the final potential, are at most times the source’s instructions plus times the initial potential. Measured by excess, the factor is .
theorem transform_spec {α : Type} {sourcePolicy : Simulation.Policy α} {scheduler : Scheduler.Policy} (bounded : Simulation.PolicyBounded (fun _ => 1) sourcePolicy) {budget : Nat} (schedulerValid : Scheduler.PolicyValid budget scheduler) (a : Simulation.Requests.Algorithm α) (past : List Nat) {c : LabelledCursor.Config α} {s : State α} (valid : Simulation.ConfigValid (fun _ => 1) c s) (budgetBound : 49 + 39 * Real.logb 2 s.pair.tree.size ≤ budget) (keys : List Nat) (validKeys : ∀ x ∈ keys, x < c.tree.erase.size) : ∃ (out : Scheduler.Output) (planned : PreparedOutput α), prepare sourcePolicy a past c s keys = some planned ∧ transform sourcePolicy scheduler a past c s keys = some out ∧ out.state.planned = ⟨planned.history.pair.tree, []⟩ ∧ Scheduler.Valid budget out.state ∧ Multifinger.replay out.instructions ⟨s.pair.tree, []⟩ = some out.state.cursor ∧ Multifinger.Execution (Scheduler.cursorState ⟨s.pair.tree, []⟩) keys (Scheduler.cursorState out.state.cursor) (keys.length + out.instructions.length) ∧ out.instructions.length + 5 * out.state.pending.length + 5 * planned.history.potential ≤ 310 * (a.runFrom past c keys).1.length + 5 * s.potential ∧ out.costs.length = keys.length ∧ out.costs.sum = keys.length + out.instructions.length ∧ ∀ cost ∈ out.costs, cost ≤ 1 + 5 * budget := RotationBST.Deamortization.Finger.transform_spec bounded schedulerValid a past valid budgetBound keys validKeysModels.Rotation, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Pointer.Machine, Models.Pointer.Mirror.Definitions, Models.Pointer.Lazy.Skeleton, Models.Labelled.Cursor.Definitions, Models.Labelled.Ordering.Definitions, Structures.PopTart.Definitions, Structures.PopTart.Mirror.Definitions, Structures.PopTart.Chocolate.Definitions, Structures.PopTart.Located.Definitions, Structures.HeavyPath.Definitions, Structures.HeavyPath.Paired.Definitions, Structures.HeavyPath.Paired.Substitution.Definitions, Structures.HeavyPath.Recursive.Definitions, Structures.HeavyPath.Finger.Definitions, Structures.PopTart.Chocolate.Top.Definitions, Structures.HeavyPath.Paired.Exposure.Definitions, Structures.HeavyPath.Recursive.History.Definitions, Structures.HeavyPath.Finger.Transfer.Definitions, Structures.HeavyPath.Finger.History.Definitions, Structures.HeavyPath.Finger.History.Simulation.Definitions, Bounds.StaticTree.Definitions, Structures.HeavyPath.Finger.History.Simulation.Requests.Definitions, Models.Multifinger.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Finger.Definitions, Structures.HeavyPath.Finger.History.Simulation.Minimum.Definitionstheorem transform_excess {α : Type} {sourcePolicy : Simulation.Policy α} {scheduler : Scheduler.Policy} (bounded : Simulation.PolicyBounded (fun _ => 1) sourcePolicy) {budget : Nat} (schedulerValid : Scheduler.PolicyValid budget scheduler) (a : Simulation.Requests.Algorithm α) (past : List Nat) {c : LabelledCursor.Config α} {s : State α} (valid : Simulation.ConfigValid (fun _ => 1) c s) (budgetBound : 49 + 39 * Real.logb 2 s.pair.tree.size ≤ budget) (keys : List Nat) (validKeys : ∀ x ∈ keys, x < c.tree.erase.size) : ∃ (out : Scheduler.Output) (planned : PreparedOutput α), prepare sourcePolicy a past c s keys = some planned ∧ transform sourcePolicy scheduler a past c s keys = some out ∧ out.state.planned = ⟨planned.history.pair.tree, []⟩ ∧ Scheduler.Valid budget out.state ∧ Multifinger.replay out.instructions ⟨s.pair.tree, []⟩ = some out.state.cursor ∧ Scheduler.ServedStream ⟨s.pair.tree, []⟩ keys out.state.cursor out.instructions out.costs ∧ Multifinger.Execution (Scheduler.cursorState ⟨s.pair.tree, []⟩) keys (Scheduler.cursorState out.state.cursor) (keys.length + out.instructions.length) ∧ out.instructions.length + 5 * out.state.pending.length + 5 * Simulation.Minimum.excess (fun _ => 1) planned.source planned.history ≤ 1240 * (a.runFrom past c keys).1.length + 5 * Simulation.Minimum.excess (fun _ => 1) c s ∧ out.costs.length = keys.length ∧ out.costs.sum = keys.length + out.instructions.length ∧ ∀ cost ∈ out.costs, cost ≤ 1 + 5 * budget := RotationBST.Deamortization.Finger.transform_excess bounded schedulerValid a past valid budgetBound keys validKeysModels.Rotation, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Pointer.Machine, Models.Pointer.Mirror.Definitions, Models.Pointer.Lazy.Skeleton, Models.Labelled.Cursor.Definitions, Models.Labelled.Ordering.Definitions, Structures.PopTart.Definitions, Structures.PopTart.Mirror.Definitions, Structures.PopTart.Chocolate.Definitions, Structures.PopTart.Located.Definitions, Structures.HeavyPath.Definitions, Structures.HeavyPath.Paired.Definitions, Structures.HeavyPath.Paired.Substitution.Definitions, Structures.HeavyPath.Recursive.Definitions, Structures.HeavyPath.Finger.Definitions, Structures.PopTart.Chocolate.Top.Definitions, Structures.HeavyPath.Paired.Exposure.Definitions, Structures.HeavyPath.Recursive.History.Definitions, Structures.HeavyPath.Finger.Transfer.Definitions, Structures.HeavyPath.Finger.History.Definitions, Structures.HeavyPath.Finger.History.Simulation.Definitions, Bounds.StaticTree.Definitions, Structures.HeavyPath.Finger.History.Simulation.Requests.Definitions, Models.Multifinger.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Finger.Definitions, Structures.HeavyPath.Finger.History.Simulation.Minimum.DefinitionsTheorem (transform is causal). A successful transform on xs ++ ys extends a successful transform on xs, in instructions and costs.
theorem transform_prefix {α : Type} (sourcePolicy : Simulation.Policy α) (scheduler : Scheduler.Policy) (a : Simulation.Requests.Algorithm α) (past : List Nat) (c : LabelledCursor.Config α) (s : State α) (xs ys : List Nat) {out : Scheduler.Output} (completed : transform sourcePolicy scheduler a past c s (xs ++ ys) = some out) : ∃ first, transform sourcePolicy scheduler a past c s xs = some first ∧ first.instructions <+: out.instructions ∧ first.costs <+: out.costs := RotationBST.Deamortization.Finger.transform_prefix sourcePolicy scheduler a past c s xs ys completedModels.Rotation, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Pointer.Machine, Models.Pointer.Mirror.Definitions, Models.Pointer.Lazy.Skeleton, Models.Labelled.Cursor.Definitions, Models.Labelled.Ordering.Definitions, Structures.PopTart.Definitions, Structures.PopTart.Mirror.Definitions, Structures.PopTart.Chocolate.Definitions, Structures.PopTart.Located.Definitions, Structures.HeavyPath.Definitions, Structures.HeavyPath.Paired.Definitions, Structures.HeavyPath.Paired.Substitution.Definitions, Structures.HeavyPath.Recursive.Definitions, Structures.HeavyPath.Finger.Definitions, Structures.PopTart.Chocolate.Top.Definitions, Structures.HeavyPath.Paired.Exposure.Definitions, Structures.HeavyPath.Recursive.History.Definitions, Structures.HeavyPath.Finger.Transfer.Definitions, Structures.HeavyPath.Finger.History.Definitions, Structures.HeavyPath.Finger.History.Simulation.Definitions, Bounds.StaticTree.Definitions, Structures.HeavyPath.Finger.History.Simulation.Requests.Definitions, Models.Multifinger.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Finger.Definitions, Structures.HeavyPath.Finger.History.Simulation.Minimum.DefinitionsThe last group chooses the policies, the budget and the initial representation. Two versions differ in the starting representation.
Theorem (an initialized transform). For a source algorithm and a source cursor on a nonempty tree, there are a bounded simulation policy, a valid scheduling policy, a budget below , a valid representation and a setup trace of at most instructions to reach it, such that on every valid sequence, setup and responses together cost at most , and every response costs less than .
Theorem (a minimized transform). As above, but the representation is the cheapest one, with zero excess, and everything is chosen before the source algorithm. Then for every source algorithm the physical instructions are at most times the source’s, with a served stream, and every response costs less than .
theorem initialized_transform {α : Type} (a : Simulation.Requests.Algorithm α) (c : LabelledCursor.Config α) (live : c.focus ≠ .nil) : ∃ (sourcePolicy : Simulation.Policy α) (scheduler : Scheduler.Policy) (budget : Nat) (s : State α) (startup : Nat), Simulation.PolicyBounded (fun _ => 1) sourcePolicy ∧ Scheduler.PolicyValid budget scheduler ∧ Simulation.ConfigValid (fun _ => 1) c s ∧ Pointer.Trace ⟨c.tree.erase, []⟩ ⟨s.pair.tree, []⟩ startup ∧ startup ≤ 16 * c.tree.erase.size ∧ (budget : ℝ) < 50 + 39 * Real.logb 2 c.tree.erase.size ∧ ∀ (past keys : List Nat), (∀ x ∈ keys, x < c.tree.erase.size) → ∃ out, transform sourcePolicy scheduler a past c s keys = some out ∧ Multifinger.replay out.instructions ⟨s.pair.tree, []⟩ = some out.state.cursor ∧ Multifinger.Execution (Scheduler.cursorState ⟨s.pair.tree, []⟩) keys (Scheduler.cursorState out.state.cursor) (keys.length + out.instructions.length) ∧ startup + keys.length + out.instructions.length ≤ 131 * c.tree.erase.size + keys.length + 310 * (a.runFrom past c keys).1.length ∧ out.costs.length = keys.length ∧ out.costs.sum = keys.length + out.instructions.length ∧ ∀ cost ∈ out.costs, (cost : ℝ) < 251 + 195 * Real.logb 2 c.tree.erase.size := RotationBST.Deamortization.Finger.initialized_transform a c liveModels.Rotation, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Pointer.Machine, Models.Pointer.Mirror.Definitions, Models.Pointer.Lazy.Skeleton, Models.Labelled.Cursor.Definitions, Models.Labelled.Ordering.Definitions, Structures.PopTart.Definitions, Structures.PopTart.Mirror.Definitions, Structures.PopTart.Chocolate.Definitions, Structures.PopTart.Located.Definitions, Structures.HeavyPath.Definitions, Structures.HeavyPath.Paired.Definitions, Structures.HeavyPath.Paired.Substitution.Definitions, Structures.HeavyPath.Recursive.Definitions, Structures.HeavyPath.Finger.Definitions, Structures.PopTart.Chocolate.Top.Definitions, Structures.HeavyPath.Paired.Exposure.Definitions, Structures.HeavyPath.Recursive.History.Definitions, Structures.HeavyPath.Finger.Transfer.Definitions, Structures.HeavyPath.Finger.History.Definitions, Structures.HeavyPath.Finger.History.Simulation.Definitions, Bounds.StaticTree.Definitions, Structures.HeavyPath.Finger.History.Simulation.Requests.Definitions, Models.Multifinger.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Finger.Definitions, Structures.HeavyPath.Finger.History.Simulation.Minimum.Definitionstheorem minimized_transform {α : Type} (c : LabelledCursor.Config α) (live : c.focus ≠ .nil) : ∃ (sourcePolicy : Simulation.Policy α) (scheduler : Scheduler.Policy) (budget : Nat) (s : State α) (startup : Nat), Simulation.PolicyBounded (fun _ => 1) sourcePolicy ∧ Scheduler.PolicyValid budget scheduler ∧ Simulation.ConfigValid (fun _ => 1) c s ∧ Simulation.Minimum.excess (fun _ => 1) c s = 0 ∧ Pointer.Trace ⟨c.tree.erase, []⟩ ⟨s.pair.tree, []⟩ startup ∧ startup ≤ 16 * c.tree.erase.size ∧ (budget : ℝ) < 50 + 39 * Real.logb 2 c.tree.erase.size ∧ ∀ (a : Simulation.Requests.Algorithm α) (past keys : List Nat), (∀ x ∈ keys, x < c.tree.erase.size) → ∃ out, transform sourcePolicy scheduler a past c s keys = some out ∧ Multifinger.replay out.instructions ⟨s.pair.tree, []⟩ = some out.state.cursor ∧ Scheduler.ServedStream ⟨s.pair.tree, []⟩ keys out.state.cursor out.instructions out.costs ∧ Multifinger.Execution (Scheduler.cursorState ⟨s.pair.tree, []⟩) keys (Scheduler.cursorState out.state.cursor) (keys.length + out.instructions.length) ∧ out.instructions.length ≤ 1240 * (a.runFrom past c keys).1.length ∧ out.costs.length = keys.length ∧ out.costs.sum = keys.length + out.instructions.length ∧ ∀ cost ∈ out.costs, (cost : ℝ) < 251 + 195 * Real.logb 2 c.tree.erase.size := RotationBST.Deamortization.Finger.minimized_transform c liveModels.Rotation, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Pointer.Machine, Models.Pointer.Mirror.Definitions, Models.Pointer.Lazy.Skeleton, Models.Labelled.Cursor.Definitions, Models.Labelled.Ordering.Definitions, Structures.PopTart.Definitions, Structures.PopTart.Mirror.Definitions, Structures.PopTart.Chocolate.Definitions, Structures.PopTart.Located.Definitions, Structures.HeavyPath.Definitions, Structures.HeavyPath.Paired.Definitions, Structures.HeavyPath.Paired.Substitution.Definitions, Structures.HeavyPath.Recursive.Definitions, Structures.HeavyPath.Finger.Definitions, Structures.PopTart.Chocolate.Top.Definitions, Structures.HeavyPath.Paired.Exposure.Definitions, Structures.HeavyPath.Recursive.History.Definitions, Structures.HeavyPath.Finger.Transfer.Definitions, Structures.HeavyPath.Finger.History.Definitions, Structures.HeavyPath.Finger.History.Simulation.Definitions, Bounds.StaticTree.Definitions, Structures.HeavyPath.Finger.History.Simulation.Requests.Definitions, Models.Multifinger.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Finger.Definitions, Structures.HeavyPath.Finger.History.Simulation.Minimum.DefinitionsThe first version pays the setup and the initial potential, which is linear, in the term. The second avoids any additive term by starting from a representation of least potential; the setup still pays to build it. In minimized_transform, the policies, the budget and the representation are fixed before the source algorithm is named, so the physical machinery is the same for all sources.
Theorem (abstract deamortization). For a family of source algorithms, one per request sequence, and a source cursor on a nonempty tree, there are an initial representation, a setup trace of at most instructions and one program such that on every valid sequence the program serves it as a one-finger execution and a served stream, emits at most times the instructions of the source chosen for that sequence, and costs less than per response. If the family is constant, the program is causal in instructions and costs.
theorem deamortize {α : Type} (family : List Nat → Simulation.Requests.Algorithm α) (c : LabelledCursor.Config α) (live : c.focus ≠ .nil) : ∃ (s : State α) (startup : Nat) (program : List Nat → Option Scheduler.Output), Simulation.ConfigValid (fun _ => 1) c s ∧ Pointer.Trace ⟨c.tree.erase, []⟩ ⟨s.pair.tree, []⟩ startup ∧ startup ≤ 16 * c.tree.erase.size ∧ (∀ keys, (∀ x ∈ keys, x < c.tree.erase.size) → ∃ out, program keys = some out ∧ Multifinger.replay out.instructions ⟨s.pair.tree, []⟩ = some out.state.cursor ∧ Scheduler.ServedStream ⟨s.pair.tree, []⟩ keys out.state.cursor out.instructions out.costs ∧ Multifinger.Execution (Scheduler.cursorState ⟨s.pair.tree, []⟩) keys (Scheduler.cursorState out.state.cursor) (keys.length + out.instructions.length) ∧ out.instructions.length ≤ 1240 * ((family keys).runFrom [] c keys).1.length ∧ out.costs.length = keys.length ∧ out.costs.sum = keys.length + out.instructions.length ∧ ∀ cost ∈ out.costs, (cost : ℝ) < 251 + 195 * Real.logb 2 c.tree.erase.size) ∧ ((∃ a, ∀ keys, family keys = a) → ∀ xs ys out, program (xs ++ ys) = some out → ∃ first, program xs = some first ∧ first.instructions <+: out.instructions ∧ first.costs <+: out.costs) := RotationBST.Deamortization.Finger.deamortize family c liveModels.Rotation, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Pointer.Machine, Models.Pointer.Mirror.Definitions, Models.Pointer.Lazy.Skeleton, Models.Labelled.Cursor.Definitions, Models.Labelled.Ordering.Definitions, Structures.PopTart.Definitions, Structures.PopTart.Mirror.Definitions, Structures.PopTart.Chocolate.Definitions, Structures.PopTart.Located.Definitions, Structures.HeavyPath.Definitions, Structures.HeavyPath.Paired.Definitions, Structures.HeavyPath.Paired.Substitution.Definitions, Structures.HeavyPath.Recursive.Definitions, Structures.HeavyPath.Finger.Definitions, Structures.PopTart.Chocolate.Top.Definitions, Structures.HeavyPath.Paired.Exposure.Definitions, Structures.HeavyPath.Recursive.History.Definitions, Structures.HeavyPath.Finger.Transfer.Definitions, Structures.HeavyPath.Finger.History.Definitions, Structures.HeavyPath.Finger.History.Simulation.Definitions, Bounds.StaticTree.Definitions, Structures.HeavyPath.Finger.History.Simulation.Requests.Definitions, Models.Multifinger.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Finger.Definitions, Structures.HeavyPath.Finger.History.Simulation.Minimum.DefinitionsThis is the library’s most general form of Theorem 6. As in Weighted.Results.transform, the family covers sources that depend on the whole sequence, and causality is claimed only for a single online source, matching the paper’s “if is online, so is ”.
30.10 From rotation algorithms to a deamortized program
The last step connects the abstract theorem to the algorithms of the book, which are rotation-model algorithms or root-restarting pointer programs. The bridge is the replay planner of Section 29.2, Replay.Planner: a causal rule that, for each request, plans a pointer program from the root of its current tree back to the root, visiting the key. Replay.run counts its recorded work, the length of each plan plus per request. A planner has two sides (a Bool), because the combination of Section 29.1 runs two of them; here one side is used.
Theorem (deamortizing a planner). For every planner on a nonempty tree, and either side, there are an initial tree, a setup trace of at most instructions and one causal program such that on every valid sequence the program serves it as a served stream and a one-finger execution, its costs sum to at most times the planner’s recorded work, and each response costs less than .
theorem deamortize {σ : Type} {saved : Tree} (planner : Combo.Worker.Replay.Planner σ saved) (side : Bool) (nonempty : saved ≠ .nil) : ∃ (initial : Tree) (startup : Nat) (program : List Nat → Option Scheduler.Output), Pointer.Trace ⟨saved, []⟩ ⟨initial, []⟩ startup ∧ startup ≤ 16 * saved.size ∧ (∀ keys, (∀ x ∈ keys, x < saved.size) → ∃ out, program keys = some out ∧ Multifinger.replay out.instructions ⟨initial, []⟩ = some out.state.cursor ∧ Scheduler.ServedStream ⟨initial, []⟩ keys out.state.cursor out.instructions out.costs ∧ Multifinger.Execution (Scheduler.cursorState ⟨initial, []⟩) keys (Scheduler.cursorState out.state.cursor) (keys.length + out.instructions.length) ∧ out.costs.length = keys.length ∧ out.costs.sum = keys.length + out.instructions.length ∧ out.costs.sum ≤ 1240 * (Combo.Worker.Replay.run planner side (planner.initial side) keys).2 ∧ ∀ cost ∈ out.costs, (cost : ℝ) < 251 + 195 * Real.logb 2 saved.size) ∧ (∀ xs ys out, program (xs ++ ys) = some out → ∃ first, program xs = some first ∧ first.instructions <+: out.instructions ∧ first.costs <+: out.costs) := RotationBST.Deamortization.Replay.deamortize planner side nonemptyModels.Rotation, Models.Online, Models.Pointer.Lazy.Online.Definitions, Algorithms.Combination.Analysis.Definitions, Models.Pointer.Machine, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Shared.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Refinement.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Models.Pointer.Mirror.Definitions, Models.Pointer.Lazy.Skeleton, Models.Labelled.Ordering.Definitions, Structures.PopTart.Definitions, Structures.PopTart.Mirror.Definitions, Structures.PopTart.Chocolate.Definitions, Structures.PopTart.Located.Definitions, Structures.HeavyPath.Definitions, Structures.HeavyPath.Paired.Definitions, Structures.HeavyPath.Paired.Substitution.Definitions, Structures.HeavyPath.Recursive.Definitions, Structures.HeavyPath.Finger.Definitions, Structures.PopTart.Chocolate.Top.Definitions, Structures.HeavyPath.Paired.Exposure.Definitions, Structures.HeavyPath.Recursive.History.Definitions, Structures.HeavyPath.Finger.Transfer.Definitions, Structures.HeavyPath.Finger.History.Definitions, Structures.HeavyPath.Finger.History.Simulation.Definitions, Bounds.StaticTree.Definitions, Structures.HeavyPath.Finger.History.Simulation.Requests.Definitions, Models.Multifinger.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Finger.Definitions, Structures.HeavyPath.Finger.History.Simulation.Minimum.DefinitionsThe proof labels the tree by its ranks, reads the planner as a source algorithm with a persistent cursor, and applies Finger.Results.deamortize with a constant family, which gives causality. Each plan starts and ends at the root, so consecutive plans chain into one program of a persistent cursor.
implementation_exists then takes the planner of Results.algorithm_planner, which runs a rotation-model algorithm through the lazy online simulation of Chapter 7 and records at most times its total cost. Composing gives , the constant of Algorithm.Implementation. Chapter 31 uses Replay.Results.deamortize directly, with its own planner.
30.11 What is not formalized
The library proves the abstract BST-operation result of Theorem 6, its unit-weight and weighted simulations (Theorem 5), and the Splay bounds above. The following parts of the paper are not formalized.
- Theorem 7. The paper’s Theorem 7 strengthens Theorem 6 for algorithms with an amortized bound , : the deamortized algorithm works in the pointer machine model with words per node and global variables, and computes each access in time proportional to its BST operations. None of these clauses is formalized: the bounds on private computation, on auxiliary storage (the paper’s queue of pending keys, stored in the tree nodes, and its overflow argument), and execution on a finite-word machine. In the library,
programis an arbitrary function, and the pending work of the scheduler is an unbounded list. The machine model for these clauses is defined in Chapter 13, with a compiler to the pointer machine; the deamortization is not yet given in it. - Cole’s dynamic finger theorem for splaying. The paper deamortizes all of splaying’s known bounds, including the dynamic finger bound (Cole et al. 2000; Cole 2000). The library has no proof of the dynamic finger theorem for splay trees, so it does not state it for the deamortized program. (The weighted dynamic finger bound for a different deamortized BST is the subject of Chapter 31.)
- Key-independent optimality of splay trees (Iacono 2005), and therefore its deamortized form, is not formalized.
- Multi-splay trees. The paper’s application to multi-splay trees (Wang et al. 2006), a deamortized BST that is -competitive and has the scanning, static optimality, static finger and working-set bounds, is not formalized, since the library has no multi-splay trees. Chapter 31 obtains a deamortized -competitive BST by a different route, combining GreedyASS with Tango.
- Dynamic optimality.
Results.dynamic_optimalis an implication. No dynamically optimal algorithm is known, and none is claimed.