Chapter 29 · Combining search trees · Section 29.1The combination theorem
Different BST algorithms are good on different sequences. Splay trees have the working-set and dynamic-finger bounds, Tango trees are -competitive, GreedyASS is competitive with the best lazy-finger tree, and no single analysis gives all of these at once. Demaine, Iacono, Langerman and Özkan (2013) showed that this is no obstacle: given two online BSTs and , one online BST costs, on every sequence and in fact on every contiguous window of every sequence, at most a constant times the cheaper of the two, plus an additive overhead. Their construction, ComboBST, runs the two algorithms in alternating rounds of fixed length, each round starting again from a saved copy of the initial tree, and it simulates the extra fingers it needs inside a single-finger BST.
This section is the entry point to the formalization of that paper. It states the abstract counterpart of the paper’s Theorem 3 and its extension to finite families, explains the hypotheses carefully, and develops the part of the proof that is pure accounting: well-behaved charges, the counting of rounds, and the window bounds. The machinery that makes the combination a real pointer-machine execution is in the next three sections and in Chapter 39, in Part V.
This is the abstract BST-operation counterpart of Theorem 3 of the paper. Fix a nonempty initial tree with keys. Let and be two interruptible online algorithms starting from , each with a pointer-machine interpretation and a request-correctness contract, and let , be nonnegative amortized charges, where is the charge of the -th request of the whole sequence . Assume that both charges are well-behaved for their algorithms with a common overhead and constants , and that
Then there is one online pointer policy, chosen before any request is known, such that for every sequence of keys in its run from is a legal pointer execution serving , and for every window the run splits exactly into the part before , the window, and the part after , with additive costs. The window part is a legal pointer execution of between the trees the run actually reaches, and its cost is at most
The charges in the bound are those of the original sequence, at the original indices, with its whole history: the window is not rerun from . Costs are pointer-machine costs, one per request plus one per instruction, so they include rotations and moves. Preparation of the saved snapshot is paid once, on the first request, and is absorbed in the overhead; the window , is the whole run.
In Lean, the algorithms are one Controller.Worker with a side bit, its interpretation is a Refinement.WorkerModel with Visits.Correct, well-behavedness is Analysis.WellBehaved, the window charge is Analysis.mass, the policy is an Online.Prepared run by Online.execute, and legality is Pointer.Execution.
The Lean statement
theorem window_policy (model : Refinement.WorkerModel worker saved) (correct : Refinement.Visits.Correct model) {overhead C₀ C₁ : Nat} {charges : Analysis.Charges} (well : Analysis.WellBehaved worker saved.size overhead C₀ C₁ charges) (nonempty : saved ≠ .nil) (size : saved.size ≤ overhead) (fields : Nat → IntervalMetadata.Bounds) (oldData : Nat → Nat) : ∃ p : Prepared model (Analysis.budget overhead C₁) (57 * overhead) fields oldData, ∀ xs, (∀ x ∈ xs, x < saved.size) → Pointer.Execution saved xs (p.current (execute p none xs).1) (execute p none xs).2 ∧ ∀ lo hi, lo ≤ hi → hi ≤ xs.length → let first := … execute p none (xs.take lo) let middle := execute p first.1 (Analysis.segment xs lo hi) let last := execute p middle.1 (xs.drop hi) execute p none xs = (last.1, first.2 + middle.2 + last.2) ∧ Pointer.Execution (p.current first.1) (Analysis.segment xs lo hi) (p.current middle.1) middle.2 ∧ (middle.2 : ℝ) ≤ 8384 * (C₁ + 1 + 57 : Nat) * (2 * C₀ * C₀ * min (Analysis.mass charges false xs lo hi) (Analysis.mass charges true xs lo hi) + (2 * C₀ * C₁ + 73) * overhead) := RotationBST.Combo.Online.window_policy model correct well nonempty size fields oldDataModels.Rotation, Models.Pointer.Machine, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Shared.Definitions, Structures.TreeBuffer.Snapshot.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Structures.TreeBuffer.Snapshot.Controller.Definitions, Structures.TreeBuffer.Scan.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Definitions, Structures.TreeBuffer.Snapshot.CellIO.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Refinement.Definitions, Structures.TreeBuffer.Snapshot.Startup.Definitions, Models.Pointer.Walk.Definitions, Models.Pointer.Routing.Definitions, Models.Labelled.Intervals.Access.Definitions, Models.Labelled.Intervals.Maintenance.Definitions, Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Rounds.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Analysis.Definitions, Algorithms.Combination.Refinement.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Models.Pointer.Lazy.Skeleton, Structures.BSTDeque.Definitions, Structures.BSTDeque.Boundary.Definitions, Structures.Tendon.Definitions, Structures.FingerHand.Definitions, Structures.FingerHand.Packed.Definitions, Algorithms.Combination.Online.Definitions, Algorithms.Combination.Online.Startup.Definitions, Algorithms.Combination.Online.AlgorithmThe paper combines algorithms two at a time in a balanced binary tree (Section 1.2). Fix a nonempty initial tree with keys and a nonempty finite family of interruptible algorithms on , possibly with different state types, each with a pointer interpretation and request correctness, and each well-behaved for its own charge , with common , and . Let . Then there is one online pointer policy such that for every valid sequence its run from is legal, its total cost is at most , and for every window the run splits additively as in the box above and the window costs at most
with and . The scales start at and grow by one factor per level of the combination tree, and . For fixed , and these are constants, as in the paper; they are not the paper’s sharper .
In Lean, the family is a function into Family.Algorithm, the scales are Family.chargeScale and Family.overheadScale, and the guarantee is Physical.Bounded.
The Lean statement
theorem finite_policy {ι : Type} [Fintype ι] [Nonempty ι] {saved : Tree} (overhead C₀ C₁ : Nat) (inputs : ι → Algorithm saved) (charges : ι → Charge) (well : ∀ i, Analysis.WellBehaved (inputs i).worker saved.size overhead C₀ C₁ (fun _ => charges i)) (nonempty : saved ≠ .nil) (size : saved.size ≤ overhead) (fields : Nat → IntervalMetadata.Bounds) (oldData : Nat → Nat) : let depth := … Nat.clog 2 (Fintype.card ι) ∃ output : Algorithm saved, Guarantees output (overheadScale C₀ C₁ depth * overhead) C₀ (C₁ + depth) (chargeScale C₀ C₁ depth) charges ∧ ∃ p : Online.Prepared output.model (Analysis.budget (overheadScale C₀ C₁ depth * overhead) (C₁ + depth)) (57 * (overheadScale C₀ C₁ depth * overhead)) fields oldData, Bounded p (chargeFactor C₀ (C₁ + depth) (chargeScale C₀ C₁ depth)) (overheadFactor C₀ (C₁ + depth) * (overheadScale C₀ C₁ depth * overhead)) charges := RotationBST.Combo.Family.Physical.finite_policy overhead C₀ C₁ inputs charges well nonempty size fields oldDataModels.Rotation, Models.Pointer.Machine, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Shared.Definitions, Structures.TreeBuffer.Snapshot.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Structures.TreeBuffer.Snapshot.Controller.Definitions, Structures.TreeBuffer.Scan.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Definitions, Structures.TreeBuffer.Snapshot.CellIO.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Refinement.Definitions, Structures.TreeBuffer.Snapshot.Startup.Definitions, Models.Pointer.Walk.Definitions, Models.Pointer.Routing.Definitions, Models.Labelled.Intervals.Access.Definitions, Models.Labelled.Intervals.Maintenance.Definitions, Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Rounds.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Analysis.Definitions, Algorithms.Combination.Refinement.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Models.Pointer.Lazy.Skeleton, Structures.BSTDeque.Definitions, Structures.BSTDeque.Boundary.Definitions, Structures.Tendon.Definitions, Structures.FingerHand.Definitions, Structures.FingerHand.Packed.Definitions, Algorithms.Combination.Online.Definitions, Algorithms.Combination.Online.Startup.Definitions, Algorithms.Combination.Online.Algorithm, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Online.Replay.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Algorithms.Combination.Family.Definitions, Algorithms.Combination.Family.Physical.DefinitionsThe section has two layers. To confirm the results, the boxes are enough, together with the reading list on the checking page. Be aware that much of what the statements mention is a hypothesis about the input algorithms, not something the theorems prove: Section 29.1.2 lists precisely what a caller has to supply. To see why the results hold, read on. Section 29.1.1 is a map of the whole construction across chapters, Section 29.1.3 gives the definition at the heart of both theorems, Section 29.1.4 and Section 29.1.5 prove the round-counting argument of the paper at the level of the controller, Section 29.1.6 gives the two concrete charges used in Chapter 31, and Section 29.1.7 builds the families.
The definitions of this section are in Algorithms/Combination/Analysis/Definitions/Abstract.lean, Charges/Definitions/Abstract.lean, Family/Definitions/Abstract.lean and Family/Physical/Definitions/Abstract.lean; the theorems are in the Abstract.lean files next to them.
29.1.1 The construction at a glance
ComboBST is built in layers, and the library follows the paper’s layers closely. Each layer has its own page.
A₀, A₁ interruptible workers: one charged step at a time Section 29.2
│
▼
controller: rounds of budget (C₁+1)·F, alternating A₀ and A₁, Section 29.3
each round restarting from the saved initial tree
│ accounting: well-behaved charges, rounds, this section
│ windows
▼
save and restore the initial tree in O(n) operations Chapter 39
│
▼
one pointer execution: the controller, the snapshot finger and Section 29.4
the worker's finger on a single tree, simulated with one finger (and 35.2)
│
▼
Theorem 3 on every window ──► finite families ──► Theorem 4.3 this section,
Chapter 31
Workers (Section 29.2). The paper’s input is two online BSTs , . ComboBST must be able to stop either of them in the middle of a request, after a fixed number of operations, and later throw the partial work away. The library therefore takes the inputs as interruptible workers: a Controller.Worker has a restart state for each side and a step function that performs one charged unit of work on the current request and reports whether the request is finished. A complete standalone request is Worker.Access, and a standalone run from the restart state is Worker.Requests. Two algorithms with different state types are packed into one worker by Pair.worker.
Rounds (Section 29.3). This is Section 4 of the paper. Each round runs one worker, from the initial tree, for at most operations. When the budget runs out in the middle of request , ComboBST restores the initial tree, switches to the other worker and re-runs there. In the library, is the budget Analysis.budget F C₁ , the restore is charged an explicit in the final theorem, and one request is served by Controller.serve: one attempt with the remaining budget, then, if it fails, a fresh attempt on the other side with the full budget. The paper’s choice guarantees that a fresh round always completes its first request, so the second attempt never fails.
Snapshots (Section 39.1 and Section 39.2). This is Section 3 of the paper: with bits per node, a tree can store a description of another tree on the same keys, and saving or loading it takes operations (Lemmas 9 and 10). The library’s tree buffers and snapshots implement these scans, including scans interleaved with rotations by another finger.
One online execution (Section 29.4). This is Section 2 and Definition 12 of the paper. The controller, the worker’s finger and the snapshot finger are refined onto shared nodes of one tree, and the two fingers are simulated by a single pointer with the finger hands of Section 35.2. Each controller step costs at most pointer operations, amortized. The result is a prepared policy, chosen once, whose execution Online.execute is a legal Pointer.Execution.
Windows and families (this section). The paper’s Section 5 counts the rounds. The analysis below proves its bound for the controller, on every prefix and on every window. Section 29.4 transfers it to the physical execution, which gives the first box. The finite families of the second box nest the construction: the combined policy is replayed as a new worker and combined again.
Applications (Chapter 31). Theorem 4.3 of Iacono and Langerman combines GreedyASS with Tango through this construction and then deamortizes the result (Chapter 30).
| Paper | Library | Section |
|---|---|---|
| Definition 2, well-behaved bounds | Analysis.WellBehaved |
this one |
| Section 4, rounds of operations | Controller.serve, budget |
Section 29.3 |
| Section 5, proof of Theorem 13 | minimum_bound, window_minimum |
this one |
| Section 3, Lemmas 9 and 10 | tree buffers and snapshots | Section 39.1, Section 39.2 |
| Section 2, Theorem 5 | finger hands, refinement, online policy | Section 35.2, Section 29.4 |
| Theorem 3 | window_policy |
Section 29.4 (stated here) |
| Section 1.2, algorithms | finite_policy |
this one |
29.1.2 What is assumed and what is proved
The first box has the shape if the inputs satisfy these contracts, then there is a policy with this bound. Every contract is an explicit hypothesis of Results.window_policy. None is automatic for an arbitrary BST algorithm, and a reader who wants to apply the theorem has to prove each of them for the algorithms at hand.
Supplied by the caller.
- The workers. A
Controller.Worker: a deterministic step function for each side, which sees the current state and request and nothing else. This is the paper’s “online” requirement, made operational: a round can be interrupted after any step. - A pointer interpretation. A
Refinement.WorkerModel: each step performs one legal pointer instruction or none (local bookkeeping), both sides restart with the cursor at the root of the same saved tree , and the tree keeps its keys. - Request correctness.
Visits.Correct: from every request boundary that a standalone run can reach, a completed access visits the requested key among the steps it performs. - Well-behaved charges.
Analysis.WellBehavedfor the given , , and charges (Section 29.1.3). This includes that the charges bound the actual standalone cost, that each single request from any reachable boundary costs at most , and that the charges of a window, taken standalone, are close to its charges inside the whole sequence. - Sizes. The saved tree is nonempty and . The theorem also takes arbitrary initial contents of the per-node fields (
fields,oldData), which the preparation overwrites; the bound holds for every choice.
Proved by the library. Everything else: that a fixed preparation exists and costs , that the controller never fails on valid requests, that the single physical execution is legal and visits every requested key, that its cost splits exactly over any window, and the bound itself.
Which workers are proved to satisfy the contracts. In this book, two: GreedyASS, well-behaved against the lazy-finger charges of every fixed tree with , and (Results.greedy_worker), and Tango with linear startup, well-behaved against interleave charges of the balanced reference with , and (Results.linear_balanced_worker). Both are in Chapter 31, with the startup analysis of Section 26.3, and both use the charges of Section 29.1.6. Splay trees and the other algorithms of Corollary 4 are not provided as workers, so Corollary 4 itself is not a consequence of the library.
The policy is a fixed function of the current state and request, so the combination is online. It is defined with classical choice, and its internal planning is not charged: the abstract pointer model counts pointer operations and requests, not private computation or memory. The storage clauses of the paper (“if and are real-world BSTs, so is ComboBST”, with bits per node) are not formalized.
29.1.3 Well-behaved charges
This section gives the definition that both boxes are built on. It is the paper’s Definition 2, made precise in the operational worker model.
29.1.3.1 Charges, windows and masses
A charge function gives each request of a sequence an amortized cost, for each of the two sides:
abbrev Charges := Bool → List Nat → Nat → ℝdef segment (xs : List Nat) (lo hi : Nat) : List Nat := (xs.drop lo).take (hi - lo)def mass (charges : Charges) (side : Bool) (xs : List Nat) (lo hi : Nat) : ℝ := ∑ i ∈ Finset.Ico lo hi, charges side xs idef total (charges : Charges) (side : Bool) (xs : List Nat) : ℝ := mass charges side xs 0 xs.lengthcharges side xs i is , the charge of the -th request when the whole sequence is ; side false is and side true is . A charge may depend on the entire sequence, past and future: it is only used in bounds, never by the algorithm. segment xs lo hi is the window as a list of its own. mass charges side xs lo hi sums the charges of the original sequence over the indices , which is the paper’s for $X’ = $ segment xs lo hi. total is the mass of the whole sequence.
Two different numbers are attached to a window, and the distinction runs through the whole section:
mass charges side xs lo hi: the requests of the window, charged as part of , with their original indices and history;total charges side (segment xs lo hi): the window charged as a sequence of its own, starting from scratch.
For a working-set charge, for example, the first request of each key inside the window is more expensive standalone than in context. Well-behavedness bounds the second number by the first.
29.1.3.2 The definition
/-- Well-behaved amortized bounds in the operational worker model. `upper`includes the one-time overhead, `stable` compares a standalone contiguoussegment with its original charges, and `single` bounds every valid accessfrom any reachable request boundary. Charges are explicitly nonnegative. -/structure WellBehaved {σ : Type} (worker : Controller.Worker σ) (n overhead C₀ C₁ : Nat) (charges : Charges) : Prop where nonneg : ∀ side xs i, 0 ≤ charges side xs i single : ∀ side earlier state spent, Worker.Requests worker side (worker.restart side) earlier state spent → (∀ x ∈ earlier, x < n) → ∀ x, x < n → ∃ final cost, Worker.Access worker side state x final cost ∧ cost ≤ C₁ * overhead upper : ∀ side xs, (∀ x ∈ xs, x < n) → ∃ final cost, Worker.Requests worker side (worker.restart side) xs final cost ∧ (cost : ℝ) ≤ total charges side xs + overhead stable : ∀ side xs, (∀ x ∈ xs, x < n) → ∀ lo hi, lo ≤ hi → hi ≤ xs.length → total charges side (segment xs lo hi) + overhead ≤ C₀ * mass charges side xs lo hi + C₁ * overheadThe four fields correspond to the paper’s definition as follows. The paper writes for an upper bound on the running time of on from tree ; here is overhead, written .
nonneg: every charge is nonnegative. The paper assumes this implicitly.single: from any state that a standalone run of either side can reach on valid requests, every valid request completes, at a cost of at most worker steps. This is the paper’s “the cost of executing any single access is at most ”. It also asserts that the request terminates.upper: a standalone run from the restart state on any valid sequence completes all of it, at a cost of at most . This is the paper’s statement that bounds the running time.stable: for every valid sequence and every window, the window’s standalone charge plus is at most times its mass in the original sequence plus : $$ This is the paper’s .
Only single and upper mention the worker. nonneg and stable are properties of the charge function alone. The costs in single and upper are worker steps, which include bookkeeping steps, so they are at least the number of pointer instructions. Both sides share the constants and the overhead; a worker built from two inputs with different constants can use the larger of each, by overhead_mono below for and directly for and .
Lean also generates one projection per field, which the proofs use to extract a property from a hypothesis well : WellBehaved …:
nonnegAlgorithms/Combination/Analysis/Definitions/Abstract.lean and its importssingleAlgorithms/Combination/Analysis/Definitions/Abstract.lean and its importsupperAlgorithms/Combination/Analysis/Definitions/Abstract.lean and its importsstableAlgorithms/Combination/Analysis/Definitions/Abstract.lean and its importsThe round budget is fixed in terms of the same constants:
/-- A round budget strictly exceeds the per-access/segment overhead factor. -/def budget (overhead C₁ : Nat) : Nat := (C₁ + 1) * overheadis the paper’s with , the least integer choice with . The docstring states the point: the budget strictly exceeds the cost of any single request, so that every round finishes at least one request.
29.1.3.3 First consequences
Theorem (fresh rounds complete). If the charges are well-behaved, then from the restart state of either side, every valid request completes within steps.
theorem fresh {σ : Type} {worker : Controller.Worker σ} {n overhead C₀ C₁ : Nat} {charges : Charges} (well : WellBehaved worker n overhead C₀ C₁ charges) : Controller.FreshBound worker n (C₁ * overhead) := RotationBST.Combo.Analysis.WellBehaved.fresh wellController.FreshBound is the controller’s form of this property, stated with the executable Controller.attempt. It is what the online contract of Section 29.4 requires, and it holds for every larger budget, in particular for .
Theorem (standalone windows). If the charges are well-behaved, then a standalone run of either side on any window of a valid sequence completes, at cost at most times the window’s original mass plus .
theorem segment_bound {σ : Type} {worker : Controller.Worker σ} {n overhead C₀ C₁ : Nat} {charges : Charges} (well : WellBehaved worker n overhead C₀ C₁ charges) (side : Bool) (xs : List Nat) (valid : ∀ x ∈ xs, x < n) (lo hi : Nat) (ordered : lo ≤ hi) (inside : hi ≤ xs.length) : ∃ final cost, Worker.Requests worker side (worker.restart side) (segment xs lo hi) final cost ∧ (cost : ℝ) ≤ C₀ * mass charges side xs lo hi + C₁ * overhead := RotationBST.Combo.Analysis.WellBehaved.segment_bound well side xs valid lo hi ordered insideThis is upper applied to the window, followed by stable. It is the inequality the paper uses for each round: a round runs a contiguous piece of the sequence from the initial tree, which is exactly a standalone run of a window.
Theorem (larger overhead). If the charges are well-behaved with overhead and , they are well-behaved with every larger overhead.
theorem overhead_mono {σ : Type} {worker : Controller.Worker σ} {n overhead larger C₀ C₁ : Nat} {charges : Charges} (well : WellBehaved worker n overhead C₀ C₁ charges) (increased : overhead ≤ larger) (constant : 1 ≤ C₁) : WellBehaved worker n larger C₀ C₁ charges := well.overhead_mono increased constantThe hypothesis is needed for stable, whose right-hand side gains while the left gains . Theorem 4.3 uses this to bring GreedyASS and Tango to a common overhead.
29.1.4 Charging the rounds
This section proves the paper’s main counting argument for the controller (Section 29.3), before any pointer machine is involved. Throughout, the budget is Analysis.budget F C₁ and the restore charge is restoreFactor * F. A run is a Controller.Execution, and its rounds are the spans Rounds.spans of request positions served by one side between two switches. Consecutive rounds share the interrupted request, which belongs to both.
The argument in the paper is short. Let be the side with the smaller total charge. Every round except the last runs out of budget, so it spends at least steps on a contiguous piece of the sequence that it could not finish. By the standalone-window bound, finishing that piece would cost at most times its charge plus . So the piece’s charge is at least . The pieces of one side are disjoint, so there are at most closed rounds of , the two sides alternate, and each round costs at most a budget plus a restore.
Theorem (a closed round is expensive). In a run from the initial controller state on valid requests, every round except the last has original charge at least on its own side.
theorem closed_span_charge {σ : Type} {worker : Controller.Worker σ} {n overhead C₀ C₁ restore : Nat} {charges : Charges} (well : WellBehaved worker n overhead C₀ C₁ charges) {final : Controller.State σ} {xs : List Nat} {cost switches : Nat} (valid : ∀ x ∈ xs, x < n) (execution : Controller.Execution worker (budget overhead C₁) restore (Controller.initial worker (budget overhead C₁)) xs final cost switches) (span : Rounds.Span) (member : span ∈ (Rounds.spans worker (budget overhead C₁) restore (Controller.initial worker (budget overhead C₁)) 0 xs).dropLast) : (overhead : ℝ) ≤ C₀ * span.charge (charges span.side xs) := RotationBST.Combo.Analysis.closed_span_charge well valid execution span memberdropLast removes the last round, the only one that may end without exhausting its budget. Span.charge sums the given weights over the span’s positions, here charges span.side xs, the original charges of the round’s side.
Theorem (few closed rounds). In the same setting, for either side, the number of closed rounds of that side times is at most times that side’s total charge.
theorem closed_count_bound {σ : Type} {worker : Controller.Worker σ} {n overhead C₀ C₁ restore : Nat} {charges : Charges} (well : WellBehaved worker n overhead C₀ C₁ charges) {final : Controller.State σ} {xs : List Nat} {cost switches : Nat} (valid : ∀ x ∈ xs, x < n) (execution : Controller.Execution worker (budget overhead C₁) restore (Controller.initial worker (budget overhead C₁)) xs final cost switches) (selected : Bool) : (Rounds.count selected (Rounds.spans worker (budget overhead C₁) restore (Controller.initial worker (budget overhead C₁)) 0 xs).dropLast : ℝ) * overhead ≤ C₀ * total charges selected xs := RotationBST.Combo.Analysis.closed_count_bound well valid execution selectedThis sums the previous inequality over the rounds of one side, which are disjoint (Rounds.Separated), and uses nonneg to bound the sum of their charges by the total.
For a run that starts in the middle of a round, at an arbitrary controller state, the first round is not fresh. The same bounds hold for the interior rounds, those that are neither first nor last:
theorem interior_span_charge {σ : Type} {worker : Controller.Worker σ} {n overhead C₀ C₁ restore : Nat} {charges : Charges} (well : WellBehaved worker n overhead C₀ C₁ charges) {s t : Controller.State σ} {xs : List Nat} {cost switches : Nat} (valid : ∀ x ∈ xs, x < n) (execution : Controller.Execution worker (budget overhead C₁) restore s xs t cost switches) (span : Rounds.Span) (member : span ∈ (Rounds.spans worker (budget overhead C₁) restore s 0 xs).dropLast.tail) : (overhead : ℝ) ≤ C₀ * span.charge (charges span.side xs) := RotationBST.Combo.Analysis.interior_span_charge well valid execution span membertheorem interior_count_bound {σ : Type} {worker : Controller.Worker σ} {n overhead C₀ C₁ restore : Nat} {charges : Charges} (well : WellBehaved worker n overhead C₀ C₁ charges) {s t : Controller.State σ} {xs : List Nat} {cost switches : Nat} (valid : ∀ x ∈ xs, x < n) (execution : Controller.Execution worker (budget overhead C₁) restore s xs t cost switches) (selected : Bool) : (Rounds.count selected (Rounds.spans worker (budget overhead C₁) restore s 0 xs).dropLast.tail : ℝ) * overhead ≤ C₀ * total charges selected xs := RotationBST.Combo.Analysis.interior_count_bound well valid execution selecteddropLast.tail removes both ends. An interior round starts with a switch, from the restart state with the full budget, which is all the argument needs.
Theorem (prefix bound, two sides). For a run from the initial controller state on valid requests, and for either side , the cost is at most , where is the restore charge.
theorem prefix_bound {σ : Type} {worker : Controller.Worker σ} {n overhead C₀ C₁ restoreFactor : Nat} {charges : Charges} (well : WellBehaved worker n overhead C₀ C₁ charges) {final : Controller.State σ} {xs : List Nat} {cost switches : Nat} (valid : ∀ x ∈ xs, x < n) (execution : Controller.Execution worker (budget overhead C₁) (restoreFactor * overhead) (Controller.initial worker (budget overhead C₁)) xs final cost switches) (selected : Bool) : (cost : ℝ) ≤ (C₁ + 1 + restoreFactor : Nat) * (2 * C₀ * total charges selected xs + 3 * overhead) := RotationBST.Combo.Analysis.prefix_bound well valid execution selectedEach round costs at most its budget plus a restore . The rounds alternate between the sides, so if is the number of closed rounds of side , the run pays at most budgets and restores, and by closed_count_bound.
Theorem (prefix minimum). The cost of such a run is at most . Moreover the executable controller Controller.run does not fail on valid requests.
theorem minimum_bound {σ : Type} {worker : Controller.Worker σ} {n overhead C₀ C₁ restoreFactor : Nat} {charges : Charges} (well : WellBehaved worker n overhead C₀ C₁ charges) {final : Controller.State σ} {xs : List Nat} {cost switches : Nat} (valid : ∀ x ∈ xs, x < n) (execution : Controller.Execution worker (budget overhead C₁) (restoreFactor * overhead) (Controller.initial worker (budget overhead C₁)) xs final cost switches) : (cost : ℝ) ≤ (C₁ + 1 + restoreFactor : Nat) * (2 * C₀ * min (total charges false xs) (total charges true xs) + 3 * overhead) := RotationBST.Combo.Analysis.minimum_bound well valid executiontheorem execute {σ : Type} (worker : Controller.Worker σ) (n overhead C₀ C₁ restoreFactor : Nat) (charges : Charges) (well : WellBehaved worker n overhead C₀ C₁ charges) (xs : List Nat) (valid : ∀ x ∈ xs, x < n) : ∃ final cost switches, Controller.run worker (budget overhead C₁) (restoreFactor * overhead) (Controller.initial worker (budget overhead C₁)) xs = some (final, cost) ∧ Controller.Execution worker (budget overhead C₁) (restoreFactor * overhead) (Controller.initial worker (budget overhead C₁)) xs final cost switches ∧ (cost : ℝ) ≤ (C₁ + 1 + restoreFactor : Nat) * (2 * C₀ * min (total charges false xs) (total charges true xs) + 3 * overhead) := RotationBST.Combo.Analysis.execute worker n overhead C₀ C₁ restoreFactor charges well xs validminimum_bound is prefix_bound for the better side. execute adds that the executable run returns a result and that this result is certified by an Execution: by fresh, a fresh attempt always completes its request, so the second attempt of Controller.serve never fails. Together they are the controller form of the paper’s Theorem 13 for prefixes. Its physical counterpart is Results.prefix_policy.
29.1.5 Windows
Theorem 3 is about windows: a contiguous piece of the online sequence, served inside the run on all of . When the window starts, the controller is in whatever state the prefix left it: in the middle of a round, possibly of the worse side, with part of its budget used.
Theorem (from any state). For a run of the controller from any state whose remaining budget is at most the round budget, on valid requests, and for either side , the cost is at most .
theorem state_bound {σ : Type} {worker : Controller.Worker σ} {n overhead C₀ C₁ restoreFactor : Nat} {charges : Charges} (well : WellBehaved worker n overhead C₀ C₁ charges) {s t : Controller.State σ} {xs : List Nat} {cost switches : Nat} (limit : s.left ≤ budget overhead C₁) (valid : ∀ x ∈ xs, x < n) (execution : Controller.Execution worker (budget overhead C₁) (restoreFactor * overhead) s xs t cost switches) (selected : Bool) : (cost : ℝ) ≤ (C₁ + 1 + restoreFactor : Nat) * (2 * C₀ * total charges selected xs + 5 * overhead) := RotationBST.Combo.Analysis.state_bound well limit valid execution selectedCompared with prefix_bound, the first round is not fresh, so only interior rounds are charged and the additive term grows from to . The hypothesis limit excludes states with more budget left than a round can have; every state reached by the controller satisfies it.
Theorem (window bound). Let be a valid sequence and . Any run of the controller on the window , from any state whose remaining budget is at most the round budget, costs at most
for either side , and so at most the same with the minimum over the two sides.
theorem window_bound {σ : Type} {worker : Controller.Worker σ} {n overhead C₀ C₁ restoreFactor : Nat} {charges : Charges} (well : WellBehaved worker n overhead C₀ C₁ charges) {s t : Controller.State σ} {xs : List Nat} {lo hi cost switches : Nat} (limit : s.left ≤ budget overhead C₁) (valid : ∀ x ∈ xs, x < n) (ordered : lo ≤ hi) (inside : hi ≤ xs.length) (execution : Controller.Execution worker (budget overhead C₁) (restoreFactor * overhead) s (segment xs lo hi) t cost switches) (selected : Bool) : (cost : ℝ) ≤ (C₁ + 1 + restoreFactor : Nat) * (2 * C₀ * C₀ * mass charges selected xs lo hi + (2 * C₀ * C₁ + 5) * overhead) := RotationBST.Combo.Analysis.window_bound well limit valid ordered inside execution selectedtheorem window_minimum {σ : Type} {worker : Controller.Worker σ} {n overhead C₀ C₁ restoreFactor : Nat} {charges : Charges} (well : WellBehaved worker n overhead C₀ C₁ charges) {s t : Controller.State σ} {xs : List Nat} {lo hi cost switches : Nat} (limit : s.left ≤ budget overhead C₁) (valid : ∀ x ∈ xs, x < n) (ordered : lo ≤ hi) (inside : hi ≤ xs.length) (execution : Controller.Execution worker (budget overhead C₁) (restoreFactor * overhead) s (segment xs lo hi) t cost switches) : (cost : ℝ) ≤ (C₁ + 1 + restoreFactor : Nat) * (2 * C₀ * C₀ * min (mass charges false xs lo hi) (mass charges true xs lo hi) + (2 * C₀ * C₁ + 5) * overhead) := RotationBST.Combo.Analysis.window_minimum well limit valid ordered inside executionThe proof applies state_bound to the window as a sequence of its own, which gives its standalone charge total charges s (segment xs lo hi). Then stable converts the standalone charge into the original mass: , where is the window. This is where and come from.
Theorem (the window inside the run). Let a controller run on a valid sequence start from a state with remaining budget at most the round budget, and let . Then the run is the composition of three runs, on , on the window, and on , each starting where the previous one ended, the costs and switch counts add up exactly, and the window’s cost satisfies the bound of window_minimum.
theorem executed_window {σ : Type} {worker : Controller.Worker σ} {n overhead C₀ C₁ restoreFactor : Nat} {charges : Charges} (well : WellBehaved worker n overhead C₀ C₁ charges) {s t : Controller.State σ} {xs : List Nat} {cost switches : Nat} (limit : s.left ≤ budget overhead C₁) (valid : ∀ x ∈ xs, x < n) (execution : Controller.Execution worker (budget overhead C₁) (restoreFactor * overhead) s xs t cost switches) (lo hi : Nat) (ordered : lo ≤ hi) (inside : hi ≤ xs.length) : ∃ beforeState afterState beforeCost windowCost afterCost beforeSwitches windowSwitches afterSwitches, Controller.Execution worker (budget overhead C₁) (restoreFactor * overhead) s (xs.take lo) beforeState beforeCost beforeSwitches ∧ Controller.Execution worker (budget overhead C₁) (restoreFactor * overhead) beforeState (segment xs lo hi) afterState windowCost windowSwitches ∧ Controller.Execution worker (budget overhead C₁) (restoreFactor * overhead) afterState (xs.drop hi) t afterCost afterSwitches ∧ cost = beforeCost + windowCost + afterCost ∧ switches = beforeSwitches + windowSwitches + afterSwitches ∧ (windowCost : ℝ) ≤ (C₁ + 1 + restoreFactor : Nat) * (2 * C₀ * C₀ * min (mass charges false xs lo hi) (mass charges true xs lo hi) + (2 * C₀ * C₁ + 5) * overhead) := RotationBST.Combo.Analysis.executed_window well limit valid execution lo hi ordered insideBoth sides of the inequality refer to the original run on the original sequence.
- The cost is the cost of the middle piece of the actual run, from the state
beforeStatethat the actual prefix produced. The window is not rerun from the saved tree, and the controller is not reset at . - The comparator is the mass of the original charges over the indices :
mass charges side xs lo hi, wherexsis the whole sequence. A request of the window is charged as the -th request of , with all of ’s history.
Neither side is the cost or the charge of the window as a fresh sequence. The standalone charge only appears inside the proof, as an intermediate step, through stable. This is the reading of the paper’s , and it is what lets Theorem 4.3 apply the window bound to a comparator, such as an offline execution or a weighted-finger cost, defined on the whole sequence.
The physical counterpart, Results.executed_window in Section 29.4, has the same shape for the prepared pointer policy. It multiplies the controller cost by for the pointer simulation and adds for the carried potential of the finger hand, or the preparation when . With the restore charge and , this additive term is absorbed: , which turns into . The result is Results.window_policy, the theorem of the first box.
Theorem 3, restated. For two workers with a pointer interpretation and request correctness, on a common nonempty saved tree with keys, and charges that are well-behaved with overhead and constants , , there is one prepared policy with budget and restore charge , such that for every sequence of valid keys its execution from the saved tree is a legal pointer execution, and every window of it is a legal pointer execution between the trees reached at and , with exactly additive costs, of cost at most , where is the original mass of side over . Its Lean statement is shown in the first box and in Section 29.4.
29.1.6 Charges of the original sequence
The hypotheses of the first box are about charges. This section provides two concrete charge functions, defined as increments of a cost on prefixes of the original sequence, and proves their well-behavedness properties. Chapter 31 uses them to show that GreedyASS and Tango are well-behaved workers: GreedyASS against lazy-finger charges, Tango against interleave charges.
29.1.6.1 Lazy-finger cost on prefixes and windows
Four facts about the lazy-finger cost of Chapter 15 are needed. Recall that LazyFinger.costFrom t p xs charges each request with , and LazyFinger.cost starts at the root.
theorem costFrom_append (t : Tree) (p : Nat) (xs ys : List Nat) : costFrom t p (xs ++ ys) = costFrom t p xs + costFrom t (xs.getLastD p) ys := RotationBST.LazyFinger.costFrom_append t p xs ystheorem cost_le_append (t : Tree) (xs ys : List Nat) : cost t xs ≤ cost t (xs ++ ys) := RotationBST.LazyFinger.cost_le_append t xs ystheorem cost_take_mono (t : Tree) (xs : List Nat) (lo hi : Nat) (ordered : lo ≤ hi) : cost t (xs.take lo) ≤ cost t (xs.take hi) := RotationBST.LazyFinger.cost_take_mono t xs lo hi orderedcostFrom_append splits a sequence: the second part starts where the first ended, at its last request (or at p if the first part is empty, which is getLastD p). Since every term is nonnegative, the root-start cost is monotone under extension, and so is the cost of the prefixes xs.take lo as lo grows.
Theorem (a window costs its share). For valid requests and , the lazy-finger cost of the window , as a sequence of its own, is at most the increase of the cost of the prefixes of from to , plus .
theorem cost_segment (t : Tree) (xs : List Nat) (lo hi : Nat) (ordered : lo ≤ hi) (valid : ∀ x ∈ xs, x < t.size) : cost t ((xs.drop lo).take (hi - lo)) ≤ cost t (xs.take hi) - cost t (xs.take lo) + t.size := RotationBST.LazyFinger.cost_segment t xs lo hi ordered validThe window alone starts its first search at the root of , while inside it starts at . Only the first move differs, and the move from the root costs at most . The subtraction is on natural numbers, but it does not truncate, by cost_take_mono.
29.1.6.2 Lazy-finger charges
/-- The actual cost increments of a fixed lazy-finger tree. Taking realprefix differences makes contiguous sums telescope; monotonicity provesnonnegativity. The scale absorbs the source-algorithm simulation constant. -/noncomputable def lazyFinger (factor : Nat) (t : Tree) (xs : List Nat) (i : Nat) : ℝ := factor * ((LazyFinger.cost t (xs.take (i + 1)) : ℝ) - LazyFinger.cost t (xs.take i))lazyFinger factor t xs i is , the cost increment of the -th request in the original sequence, computed on prefixes. Because it is a difference of prefix costs, its sums over windows telescope; the subtraction is in the reals, and monotonicity makes it nonnegative. The factor absorbs the constant of the algorithm that is compared with the lazy-finger tree. The charge ignores the side, so the same function serves both sides when it is used as fun _ => lazyFinger factor t.
theorem lazyFinger_nonneg (factor : Nat) (t : Tree) (xs : List Nat) (i : Nat) : 0 ≤ lazyFinger factor t xs i := RotationBST.Combo.Charges.lazyFinger_nonneg factor t xs itheorem lazyFinger_mass (factor : Nat) (t : Tree) (side : Bool) (xs : List Nat) (lo hi : Nat) (ordered : lo ≤ hi) : Analysis.mass (fun _ => lazyFinger factor t) side xs lo hi = factor * ((LazyFinger.cost t (xs.take hi) : ℝ) - LazyFinger.cost t (xs.take lo)) := RotationBST.Combo.Charges.lazyFinger_mass factor t side xs lo hi orderedtheorem lazyFinger_total (factor : Nat) (t : Tree) (side : Bool) (xs : List Nat) : Analysis.total (fun _ => lazyFinger factor t) side xs = factor * LazyFinger.cost t xs := RotationBST.Combo.Charges.lazyFinger_total factor t side xstheorem lazyFinger_stable (factor overhead : Nat) (t : Tree) (side : Bool) (xs : List Nat) (lo hi : Nat) (ordered : lo ≤ hi) (valid : ∀ x ∈ xs, x < t.size) (paid : factor * t.size ≤ overhead) : Analysis.total (fun _ => lazyFinger factor t) side (Analysis.segment xs lo hi) + overhead ≤ Analysis.mass (fun _ => lazyFinger factor t) side xs lo hi + 2 * overhead := RotationBST.Combo.Charges.lazyFinger_stable factor overhead t side xs lo hi ordered valid paidThe four results say: the charge is nonnegative; the mass of a window is times the increase of the prefix cost; the total is ; and the charge is stable with and , provided . Stability is cost_segment multiplied by factor. These are the nonneg and stable fields of Analysis.WellBehaved; the fields single and upper depend on the worker and are proved for GreedyASS in Chapter 31.
29.1.6.3 Interleave charges
/-- Normalized Wilber increments, with one unit per request. A contiguouswindow retains every switch internal to that window. -/noncomputable def interleave (factor : Nat) (t : Tree) (xs : List Nat) (i : Nat) : ℝ := factor * (1 + (Wilber.interleave t (xs.take (i + 1)) : ℝ) - Wilber.interleave t (xs.take i))interleave factor t xs i is , where is Wilber’s interleave quantity Wilber.interleave for the reference tree (Chapter 17). The is a unit charge per request. The increment counts the alternations that request creates along its search path in .
theorem interleave_nonneg (factor : Nat) (t : Tree) (xs : List Nat) (i : Nat) : 0 ≤ interleave factor t xs i := RotationBST.Combo.Charges.interleave_nonneg factor t xs itheorem interleave_mass (factor : Nat) (t : Tree) (side : Bool) (xs : List Nat) (lo hi : Nat) (ordered : lo ≤ hi) : Analysis.mass (fun _ => interleave factor t) side xs lo hi = factor * ((hi - lo : Nat) + (Wilber.interleave t (xs.take hi) : ℝ) - Wilber.interleave t (xs.take lo)) := RotationBST.Combo.Charges.interleave_mass factor t side xs lo hi orderedtheorem interleave_total (factor : Nat) (t : Tree) (side : Bool) (xs : List Nat) : Analysis.total (fun _ => interleave factor t) side xs = factor * (xs.length + Wilber.interleave t xs : Nat) := RotationBST.Combo.Charges.interleave_total factor t side xstheorem interleave_stable (factor : Nat) (t : Tree) (side : Bool) (xs : List Nat) (lo hi : Nat) (ordered : lo ≤ hi) : Analysis.total (fun _ => interleave factor t) side (Analysis.segment xs lo hi) ≤ Analysis.mass (fun _ => interleave factor t) side xs lo hi := RotationBST.Combo.Charges.interleave_stable factor t side xs lo hi orderedThe charge is nonnegative, the mass of a window is , and the total is . Stability holds without any overhead: a window, as a sequence of its own, has at most the alternations that its requests create inside , since an alternation of the window is an alternation of at the same node and the same pair of requests. So of the window is at most the increase, and the standalone total is at most the mass.
Theorem (interleave charges and offline executions). Let have the same size as the initial tree , and let an offline execution serve from with rotations. Then the total interleave charge of is at most .
theorem interleave_comparator (factor : Nat) (reference : Tree) {s t : Tree} {xs : List Nat} {k : Nat} (same : reference.size = s.size) (execution : RotationBST.Execution s xs t k) : Analysis.total (fun _ => interleave factor reference) false xs ≤ (4 * factor : Nat) * (xs.length + k : Nat) := RotationBST.Combo.Charges.interleave_comparator factor reference same executionThis is Wilber’s lower bound (Results.rotation_lower_bound, Chapter 17) with the unit charges added: . Execution counts rotations only, so is the rotation cost plus one per request. It is how Theorem 4.3 turns a window bound in interleave charges into a bound in terms of .
29.1.7 Finite families
The paper’s Section 1.2 combines algorithms two at a time in a balanced binary tree. The library does the same, with a recursion that closes because the output of a combination is again an interruptible worker: Section 29.4 replays the prepared policy as a worker (Replay.Implementation), which can be combined again.
29.1.7.1 Members, comparators and guarantees
/-- An interruptible online BST with its actual pointer interpretation andrequest correctness. The state type may differ between family members. -/structure Algorithm (saved : Tree) where State : Type worker : Controller.Worker State model : Refinement.WorkerModel worker saved correct : Refinement.Visits.Correct modelcorrectAlgorithms/Combination/Family/Definitions/Abstract.lean and its importsA family member bundles everything that the first box assumes about one input: a state type, a Controller.Worker, its Refinement.WorkerModel on the common saved tree, and the proof correct of request correctness. The state type is part of the member, so members may have different state types.
/-- A comparator assigns a nonnegative amortized charge to each request. -/abbrev Charge := List Nat → Nat → ℝ/-- Leaves of a full binary combination tree of the given depth. -/abbrev Index (depth : Nat) := Fin depth → BoolA comparator for a family is a single charge function , without the side bit. The docstring calls the charges nonnegative; that is not part of the type, but of Analysis.WellBehaved, which every theorem assumes. Index depth is the set of leaves of a full binary combination tree of depth depth: a path of left/right choices.
/-- One fixed worker retains a well-behaved bound against every listedcomparator. Its execution is independent of the comparator index. -/def Guarantees {ι : Type} {saved : Tree} (algorithm : Algorithm saved) (overhead C₀ C₁ factor : Nat) (charges : ι → Charge) : Prop := ∀ i, Analysis.WellBehaved algorithm.worker saved.size overhead C₀ C₁ (fun _ xs t => (factor : ℝ) * charges i xs t)Guarantees algorithm F C₀ C₁ factor charges says that one fixed worker is well-behaved, with overhead and constants , against factor times every comparator charges i of the family, on both of its sides. The worker does not depend on i: one execution satisfies all the bounds at once. This is the property the combination preserves, level by level.
/-- The original total amortized charge, without any combination factor. -/def total (charge : Charge) (xs : List Nat) : ℝ := Analysis.total (fun _ => charge) false xs/-- The least original total charge among a nonempty finite family. -/noncomputable def minimum {ι : Type} [Fintype ι] [Nonempty ι] (charges : ι → Charge) (xs : List Nat) : ℝ := Finset.univ.inf' Finset.univ_nonempty (fun i => total (charges i) xs)total charge xs is the original total charge, and minimum charges xs is the least total over the family, a minimum over a nonempty finite set, so it is attained.
/-- Uniform charge expansion after a fixed number of combination levels. -/def chargeScale (C₀ C₁ : Nat) : Nat → Nat | 0 => 1 | depth + 1 => Online.Replay.chargeFactor C₀ (C₁ + depth) 57 * chargeScale C₀ C₁ depth/-- Uniform overhead expansion; all leaves use the same initial overhead. -/def overheadScale (C₀ C₁ : Nat) : Nat → Nat | 0 => 1 | depth + 1 => Online.Replay.overheadFactor C₀ (C₁ + depth) 57 * overheadScale C₀ C₁ depthEach level of the combination tree runs the construction of the first box on two workers and replays the result. A level with constant multiplies the charge factor by Replay.chargeFactor C₀ (C₁ + j) 57 and the overhead by Replay.overheadFactor, which is that factor plus . The constant is unchanged and grows by one per level.
theorem overheadScale_pos (C₀ C₁ depth : Nat) : 0 < overheadScale C₀ C₁ depth := RotationBST.Combo.Family.overheadScale_pos C₀ C₁ depthModels.Rotation, Models.Pointer.Machine, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Shared.Definitions, Structures.TreeBuffer.Snapshot.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Structures.TreeBuffer.Snapshot.Controller.Definitions, Structures.TreeBuffer.Scan.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Definitions, Structures.TreeBuffer.Snapshot.CellIO.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Refinement.Definitions, Structures.TreeBuffer.Snapshot.Startup.Definitions, Models.Pointer.Walk.Definitions, Models.Pointer.Routing.Definitions, Models.Labelled.Intervals.Access.Definitions, Models.Labelled.Intervals.Maintenance.Definitions, Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Rounds.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Analysis.Definitions, Algorithms.Combination.Refinement.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Models.Pointer.Lazy.Skeleton, Structures.BSTDeque.Definitions, Structures.BSTDeque.Boundary.Definitions, Structures.Tendon.Definitions, Structures.FingerHand.Definitions, Structures.FingerHand.Packed.Definitions, Algorithms.Combination.Online.Definitions, Algorithms.Combination.Online.Startup.Definitions, Algorithms.Combination.Online.Algorithm, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Online.Replay.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Algorithms.Combination.Family.Definitions29.1.7.2 Worker-level combination
Theorem (balanced combination). Let members, indexed by the leaves of the depth- tree, be well-behaved with common , , , each against its own comparator, on a nonempty saved tree. Then there is one member that guarantees every comparator, with overhead , constants and , and factor .
theorem balanced {saved : Tree} (depth overhead C₀ C₁ : Nat) (inputs : Index depth → Algorithm saved) (charges : Index depth → Charge) (well : ∀ i, Analysis.WellBehaved (inputs i).worker saved.size overhead C₀ C₁ (fun _ => charges i)) (nonempty : saved ≠ .nil) (size : saved.size ≤ overhead) (fields : Nat → IntervalMetadata.Bounds) (oldData : Nat → Nat) : ∃ output : Algorithm saved, Guarantees output (overheadScale C₀ C₁ depth * overhead) C₀ (C₁ + depth) (chargeScale C₀ C₁ depth) charges := RotationBST.Combo.Family.balanced depth overhead C₀ C₁ inputs charges well nonempty size fields oldDataModels.Rotation, Models.Pointer.Machine, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Shared.Definitions, Structures.TreeBuffer.Snapshot.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Structures.TreeBuffer.Snapshot.Controller.Definitions, Structures.TreeBuffer.Scan.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Definitions, Structures.TreeBuffer.Snapshot.CellIO.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Refinement.Definitions, Structures.TreeBuffer.Snapshot.Startup.Definitions, Models.Pointer.Walk.Definitions, Models.Pointer.Routing.Definitions, Models.Labelled.Intervals.Access.Definitions, Models.Labelled.Intervals.Maintenance.Definitions, Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Rounds.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Analysis.Definitions, Algorithms.Combination.Refinement.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Models.Pointer.Lazy.Skeleton, Structures.BSTDeque.Definitions, Structures.BSTDeque.Boundary.Definitions, Structures.Tendon.Definitions, Structures.FingerHand.Definitions, Structures.FingerHand.Packed.Definitions, Algorithms.Combination.Online.Definitions, Algorithms.Combination.Online.Startup.Definitions, Algorithms.Combination.Online.Algorithm, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Online.Replay.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Algorithms.Combination.Family.DefinitionsTheorem (any finite family). The same holds for any nonempty finite family of at most members, and in particular with for members.
theorem finite {ι : Type} [Fintype ι] [Nonempty ι] {saved : Tree} (depth overhead C₀ C₁ : Nat) (capacity : Fintype.card ι ≤ 2 ^ depth) (inputs : ι → Algorithm saved) (charges : ι → Charge) (well : ∀ i, Analysis.WellBehaved (inputs i).worker saved.size overhead C₀ C₁ (fun _ => charges i)) (nonempty : saved ≠ .nil) (size : saved.size ≤ overhead) (fields : Nat → IntervalMetadata.Bounds) (oldData : Nat → Nat) : ∃ output : Algorithm saved, Guarantees output (overheadScale C₀ C₁ depth * overhead) C₀ (C₁ + depth) (chargeScale C₀ C₁ depth) charges := RotationBST.Combo.Family.finite depth overhead C₀ C₁ capacity inputs charges well nonempty size fields oldDataModels.Rotation, Models.Pointer.Machine, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Shared.Definitions, Structures.TreeBuffer.Snapshot.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Structures.TreeBuffer.Snapshot.Controller.Definitions, Structures.TreeBuffer.Scan.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Definitions, Structures.TreeBuffer.Snapshot.CellIO.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Refinement.Definitions, Structures.TreeBuffer.Snapshot.Startup.Definitions, Models.Pointer.Walk.Definitions, Models.Pointer.Routing.Definitions, Models.Labelled.Intervals.Access.Definitions, Models.Labelled.Intervals.Maintenance.Definitions, Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Rounds.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Analysis.Definitions, Algorithms.Combination.Refinement.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Models.Pointer.Lazy.Skeleton, Structures.BSTDeque.Definitions, Structures.BSTDeque.Boundary.Definitions, Structures.Tendon.Definitions, Structures.FingerHand.Definitions, Structures.FingerHand.Packed.Definitions, Algorithms.Combination.Online.Definitions, Algorithms.Combination.Online.Startup.Definitions, Algorithms.Combination.Online.Algorithm, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Online.Replay.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Algorithms.Combination.Family.Definitionstheorem exists_combination {ι : Type} [Fintype ι] [Nonempty ι] {saved : Tree} (overhead C₀ C₁ : Nat) (inputs : ι → Algorithm saved) (charges : ι → Charge) (well : ∀ i, Analysis.WellBehaved (inputs i).worker saved.size overhead C₀ C₁ (fun _ => charges i)) (nonempty : saved ≠ .nil) (size : saved.size ≤ overhead) (fields : Nat → IntervalMetadata.Bounds) (oldData : Nat → Nat) : ∃ output : Algorithm saved, Guarantees output (overheadScale C₀ C₁ (Nat.clog 2 (Fintype.card ι)) * overhead) C₀ (C₁ + Nat.clog 2 (Fintype.card ι)) (chargeScale C₀ C₁ (Nat.clog 2 (Fintype.card ι))) charges := RotationBST.Combo.Family.exists_combination overhead C₀ C₁ inputs charges well nonempty size fields oldDataModels.Rotation, Models.Pointer.Machine, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Shared.Definitions, Structures.TreeBuffer.Snapshot.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Structures.TreeBuffer.Snapshot.Controller.Definitions, Structures.TreeBuffer.Scan.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Definitions, Structures.TreeBuffer.Snapshot.CellIO.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Refinement.Definitions, Structures.TreeBuffer.Snapshot.Startup.Definitions, Models.Pointer.Walk.Definitions, Models.Pointer.Routing.Definitions, Models.Labelled.Intervals.Access.Definitions, Models.Labelled.Intervals.Maintenance.Definitions, Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Rounds.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Analysis.Definitions, Algorithms.Combination.Refinement.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Models.Pointer.Lazy.Skeleton, Structures.BSTDeque.Definitions, Structures.BSTDeque.Boundary.Definitions, Structures.Tendon.Definitions, Structures.FingerHand.Definitions, Structures.FingerHand.Packed.Definitions, Algorithms.Combination.Online.Definitions, Algorithms.Combination.Online.Startup.Definitions, Algorithms.Combination.Online.Algorithm, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Online.Replay.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Algorithms.Combination.Family.DefinitionsA family with fewer than members is padded by repeating members at unused leaves. For , , both scales are , and the single member keeps its original constants.
Theorem (standalone costs of a guaranteed worker). If a worker guarantees a family, then a standalone run of either side from its restart state on any valid sequence completes, and its cost is at most times the total of each comparator, plus ; hence at most times their minimum, plus .
theorem requests {ι : Type} [Nonempty ι] {saved : Tree} (algorithm : Algorithm saved) {overhead C₀ C₁ factor : Nat} {charges : ι → Charge} (guaranteed : Guarantees algorithm overhead C₀ C₁ factor charges) (side : Bool) (xs : List Nat) (valid : ∀ x ∈ xs, x < saved.size) : ∃ final cost, Worker.Requests algorithm.worker side (algorithm.worker.restart side) xs final cost ∧ ∀ i, (cost : ℝ) ≤ (factor : ℝ) * total (charges i) xs + overhead := RotationBST.Combo.Family.requests algorithm guaranteed side xs validModels.Rotation, Models.Pointer.Machine, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Shared.Definitions, Structures.TreeBuffer.Snapshot.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Structures.TreeBuffer.Snapshot.Controller.Definitions, Structures.TreeBuffer.Scan.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Definitions, Structures.TreeBuffer.Snapshot.CellIO.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Refinement.Definitions, Structures.TreeBuffer.Snapshot.Startup.Definitions, Models.Pointer.Walk.Definitions, Models.Pointer.Routing.Definitions, Models.Labelled.Intervals.Access.Definitions, Models.Labelled.Intervals.Maintenance.Definitions, Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Rounds.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Analysis.Definitions, Algorithms.Combination.Refinement.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Models.Pointer.Lazy.Skeleton, Structures.BSTDeque.Definitions, Structures.BSTDeque.Boundary.Definitions, Structures.Tendon.Definitions, Structures.FingerHand.Definitions, Structures.FingerHand.Packed.Definitions, Algorithms.Combination.Online.Definitions, Algorithms.Combination.Online.Startup.Definitions, Algorithms.Combination.Online.Algorithm, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Online.Replay.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Algorithms.Combination.Family.Definitionstheorem minimum_bound {ι : Type} [Fintype ι] [Nonempty ι] {saved : Tree} (algorithm : Algorithm saved) {overhead C₀ C₁ factor : Nat} {charges : ι → Charge} (guaranteed : Guarantees algorithm overhead C₀ C₁ factor charges) (side : Bool) (xs : List Nat) (valid : ∀ x ∈ xs, x < saved.size) : ∃ final cost, Worker.Requests algorithm.worker side (algorithm.worker.restart side) xs final cost ∧ (cost : ℝ) ≤ (factor : ℝ) * minimum charges xs + overhead := RotationBST.Combo.Family.minimum_bound algorithm guaranteed side xs validModels.Rotation, Models.Pointer.Machine, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Shared.Definitions, Structures.TreeBuffer.Snapshot.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Structures.TreeBuffer.Snapshot.Controller.Definitions, Structures.TreeBuffer.Scan.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Definitions, Structures.TreeBuffer.Snapshot.CellIO.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Refinement.Definitions, Structures.TreeBuffer.Snapshot.Startup.Definitions, Models.Pointer.Walk.Definitions, Models.Pointer.Routing.Definitions, Models.Labelled.Intervals.Access.Definitions, Models.Labelled.Intervals.Maintenance.Definitions, Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Rounds.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Analysis.Definitions, Algorithms.Combination.Refinement.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Models.Pointer.Lazy.Skeleton, Structures.BSTDeque.Definitions, Structures.BSTDeque.Boundary.Definitions, Structures.Tendon.Definitions, Structures.FingerHand.Definitions, Structures.FingerHand.Packed.Definitions, Algorithms.Combination.Online.Definitions, Algorithms.Combination.Online.Startup.Definitions, Algorithms.Combination.Online.Algorithm, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Online.Replay.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Algorithms.Combination.Family.DefinitionsThis is upper for each i, with the same run: the worker is fixed, so the run does not depend on the comparator.
theorem combine {ι : Type} [Fintype ι] [Nonempty ι] {saved : Tree} (depth overhead C₀ C₁ : Nat) (capacity : Fintype.card ι ≤ 2 ^ depth) (inputs : ι → Algorithm saved) (charges : ι → Charge) (well : ∀ i, Analysis.WellBehaved (inputs i).worker saved.size overhead C₀ C₁ (fun _ => charges i)) (nonempty : saved ≠ .nil) (size : saved.size ≤ overhead) (fields : Nat → IntervalMetadata.Bounds) (oldData : Nat → Nat) : ∃ output : Algorithm saved, Guarantees output (overheadScale C₀ C₁ depth * overhead) C₀ (C₁ + depth) (chargeScale C₀ C₁ depth) charges ∧ ∀ side xs, (∀ x ∈ xs, x < saved.size) → ∃ final cost, Worker.Requests output.worker side (output.worker.restart side) xs final cost ∧ ∀ i, (cost : ℝ) ≤ (chargeScale C₀ C₁ depth : ℝ) * total (charges i) xs + (overheadScale C₀ C₁ depth * overhead : Nat) := RotationBST.Combo.Family.combine depth overhead C₀ C₁ capacity inputs charges well nonempty size fields oldDataModels.Rotation, Models.Pointer.Machine, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Shared.Definitions, Structures.TreeBuffer.Snapshot.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Structures.TreeBuffer.Snapshot.Controller.Definitions, Structures.TreeBuffer.Scan.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Definitions, Structures.TreeBuffer.Snapshot.CellIO.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Refinement.Definitions, Structures.TreeBuffer.Snapshot.Startup.Definitions, Models.Pointer.Walk.Definitions, Models.Pointer.Routing.Definitions, Models.Labelled.Intervals.Access.Definitions, Models.Labelled.Intervals.Maintenance.Definitions, Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Rounds.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Analysis.Definitions, Algorithms.Combination.Refinement.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Models.Pointer.Lazy.Skeleton, Structures.BSTDeque.Definitions, Structures.BSTDeque.Boundary.Definitions, Structures.Tendon.Definitions, Structures.FingerHand.Definitions, Structures.FingerHand.Packed.Definitions, Algorithms.Combination.Online.Definitions, Algorithms.Combination.Online.Startup.Definitions, Algorithms.Combination.Online.Algorithm, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Online.Replay.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Algorithms.Combination.Family.Definitionstheorem minimum_policy {ι : Type} [Fintype ι] [Nonempty ι] {saved : Tree} (overhead C₀ C₁ : Nat) (inputs : ι → Algorithm saved) (charges : ι → Charge) (well : ∀ i, Analysis.WellBehaved (inputs i).worker saved.size overhead C₀ C₁ (fun _ => charges i)) (nonempty : saved ≠ .nil) (size : saved.size ≤ overhead) (fields : Nat → IntervalMetadata.Bounds) (oldData : Nat → Nat) : ∃ output : Algorithm saved, Guarantees output (overheadScale C₀ C₁ (Nat.clog 2 (Fintype.card ι)) * overhead) C₀ (C₁ + Nat.clog 2 (Fintype.card ι)) (chargeScale C₀ C₁ (Nat.clog 2 (Fintype.card ι))) charges ∧ ∀ side xs, (∀ x ∈ xs, x < saved.size) → ∃ final cost, Worker.Requests output.worker side (output.worker.restart side) xs final cost ∧ (cost : ℝ) ≤ (chargeScale C₀ C₁ (Nat.clog 2 (Fintype.card ι)) : ℝ) * minimum charges xs + (overheadScale C₀ C₁ (Nat.clog 2 (Fintype.card ι)) * overhead : Nat) := RotationBST.Combo.Family.minimum_policy overhead C₀ C₁ inputs charges well nonempty size fields oldDataModels.Rotation, Models.Pointer.Machine, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Shared.Definitions, Structures.TreeBuffer.Snapshot.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Structures.TreeBuffer.Snapshot.Controller.Definitions, Structures.TreeBuffer.Scan.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Definitions, Structures.TreeBuffer.Snapshot.CellIO.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Refinement.Definitions, Structures.TreeBuffer.Snapshot.Startup.Definitions, Models.Pointer.Walk.Definitions, Models.Pointer.Routing.Definitions, Models.Labelled.Intervals.Access.Definitions, Models.Labelled.Intervals.Maintenance.Definitions, Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Rounds.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Analysis.Definitions, Algorithms.Combination.Refinement.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Models.Pointer.Lazy.Skeleton, Structures.BSTDeque.Definitions, Structures.BSTDeque.Boundary.Definitions, Structures.Tendon.Definitions, Structures.FingerHand.Definitions, Structures.FingerHand.Packed.Definitions, Algorithms.Combination.Online.Definitions, Algorithms.Combination.Online.Startup.Definitions, Algorithms.Combination.Online.Algorithm, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Online.Replay.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Algorithms.Combination.Family.Definitionscombine and minimum_policy package the two steps: there is one member that guarantees the family, and its standalone runs cost at most times the least total charge plus . These are statements about the combined worker, counted in worker steps. A worker is not yet a pointer execution, which is what the next subsection provides.
29.1.7.3 The physical policy
The last step runs one more ComboBST, with the physical online execution of Section 29.4, on the combined worker, and transfers the bounds to the pointer machine and to windows.
/-- Original comparator charges on a window of the original sequence. Theindices and history are retained, rather than recomputed on the slice. -/def mass (charge : Charge) (xs : List Nat) (lo hi : Nat) : ℝ := Analysis.mass (fun _ => charge) false xs lo hi/-- Least original window charge in a nonempty finite family. -/noncomputable def minimumMass {ι : Type} [Fintype ι] [Nonempty ι] (charges : ι → Charge) (xs : List Nat) (lo hi : Nat) : ℝ := Finset.univ.inf' Finset.univ_nonempty (fun i => mass (charges i) xs lo hi)mass charge xs lo hi is the mass of a family comparator over the original indices , as in Section 29.1.3, and minimumMass is the least over the family. As for two algorithms, the indices and the history are those of the whole sequence; the window is not recharged as a fresh sequence.
/-- Physical window-charge coefficient of the final policy wrapper. -/def chargeFactor (C₀ C₁ factor : Nat) : Nat := 8384 * (C₁ + 1 + 57) * (2 * C₀ * C₀) * factor/-- Physical window overhead, including preparation or carried potential. -/def overheadFactor (C₀ C₁ : Nat) : Nat := 8384 * (C₁ + 1 + 57) * (2 * C₀ * C₁ + 73)These are the constants of the first box, for a worker with constants that guarantees factor times each comparator: the window bound is chargeFactor C₀ C₁ factor * M + overheadFactor C₀ C₁ * F.
/-- Uniform prefix and actual-window guarantees for one already chosen policy.The window cost is part of the original execution, with exact boundary statesand additive splitting. Comparators retain the original sequence's history. -/def Bounded {ι : Type} [Fintype ι] [Nonempty ι] {σ : Type} {worker : Controller.Worker σ} {saved : Tree} {model : Refinement.WorkerModel worker saved} {budget restore : Nat} {fields : Nat → IntervalMetadata.Bounds} {oldData : Nat → Nat} (p : Online.Prepared model budget restore fields oldData) (factor overhead : Nat) (charges : ι → Charge) : Prop := ∀ xs, (∀ x ∈ xs, x < saved.size) → Pointer.Execution saved xs (p.current (Online.execute p none xs).1) (Online.execute p none xs).2 ∧ ((Online.execute p none xs).2 : ℝ) ≤ (factor : ℝ) * Family.minimum charges xs + overhead ∧ ∀ lo hi, lo ≤ hi → hi ≤ xs.length → let first := Online.execute p none (xs.take lo) let middle := Online.execute p first.1 (Analysis.segment xs lo hi) let last := Online.execute p middle.1 (xs.drop hi) Online.execute p none xs = (last.1, first.2 + middle.2 + last.2) ∧ Pointer.Execution (p.current first.1) (Analysis.segment xs lo hi) (p.current middle.1) middle.2 ∧ (middle.2 : ℝ) ≤ (factor : ℝ) * minimumMass charges xs lo hi + overheadBounded p factor overhead charges is the guarantee of the second box for one prepared policy p, fixed in advance. For every valid sequence: the run from the saved tree is a legal pointer execution; its total cost is at most factor times the least total charge plus overhead; and every window splits the run exactly, is a legal pointer execution between the trees actually reached, and costs at most factor times the least original window mass plus overhead. As in the first box, the comparator is chosen after the run, separately for each window: different windows may be bounded by different members.
Theorem (physical bounds of a guaranteed worker). Let a member guarantee a family with overhead , constants and some factor, and let p be any prepared policy for it with budget and restore charge . Then for every valid sequence, every window of the run is legal, splits additively, and costs at most chargeFactor times each comparator’s mass, and so at most chargeFactor times the least mass, plus overheadFactor ; the whole run is bounded in the same way by the least total.
theorem executed_window {ι : Type} [Nonempty ι] {saved : Tree} (algorithm : Algorithm saved) {overhead C₀ C₁ factor : Nat} {charges : ι → Charge} (guaranteed : Guarantees algorithm overhead C₀ C₁ factor charges) {fields : Nat → IntervalMetadata.Bounds} {oldData : Nat → Nat} (p : Online.Prepared algorithm.model (Analysis.budget overhead C₁) (57 * overhead) fields oldData) (size : saved.size ≤ overhead) (xs : List Nat) (valid : ∀ x ∈ xs, x < saved.size) (lo hi : Nat) (ordered : lo ≤ hi) (inside : hi ≤ xs.length) : let first := Online.execute p none (xs.take lo) let middle := Online.execute p first.1 (Analysis.segment xs lo hi) let last := Online.execute p middle.1 (xs.drop hi) Online.execute p none xs = (last.1, first.2 + middle.2 + last.2) ∧ Pointer.Execution (p.current first.1) (Analysis.segment xs lo hi) (p.current middle.1) middle.2 ∧ ∀ i, (middle.2 : ℝ) ≤ (chargeFactor C₀ C₁ factor : ℝ) * mass (charges i) xs lo hi + (overheadFactor C₀ C₁ * overhead : Nat) := RotationBST.Combo.Family.Physical.executed_window algorithm guaranteed p size xs valid lo hi ordered insideModels.Rotation, Models.Pointer.Machine, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Shared.Definitions, Structures.TreeBuffer.Snapshot.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Structures.TreeBuffer.Snapshot.Controller.Definitions, Structures.TreeBuffer.Scan.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Definitions, Structures.TreeBuffer.Snapshot.CellIO.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Refinement.Definitions, Structures.TreeBuffer.Snapshot.Startup.Definitions, Models.Pointer.Walk.Definitions, Models.Pointer.Routing.Definitions, Models.Labelled.Intervals.Access.Definitions, Models.Labelled.Intervals.Maintenance.Definitions, Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Rounds.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Analysis.Definitions, Algorithms.Combination.Refinement.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Models.Pointer.Lazy.Skeleton, Structures.BSTDeque.Definitions, Structures.BSTDeque.Boundary.Definitions, Structures.Tendon.Definitions, Structures.FingerHand.Definitions, Structures.FingerHand.Packed.Definitions, Algorithms.Combination.Online.Definitions, Algorithms.Combination.Online.Startup.Definitions, Algorithms.Combination.Online.Algorithm, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Online.Replay.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Algorithms.Combination.Family.Definitions, Algorithms.Combination.Family.Physical.Definitionstheorem window_minimum {ι : Type} [Fintype ι] [Nonempty ι] {saved : Tree} (algorithm : Algorithm saved) {overhead C₀ C₁ factor : Nat} {charges : ι → Charge} (guaranteed : Guarantees algorithm overhead C₀ C₁ factor charges) {fields : Nat → IntervalMetadata.Bounds} {oldData : Nat → Nat} (p : Online.Prepared algorithm.model (Analysis.budget overhead C₁) (57 * overhead) fields oldData) (size : saved.size ≤ overhead) (xs : List Nat) (valid : ∀ x ∈ xs, x < saved.size) (lo hi : Nat) (ordered : lo ≤ hi) (inside : hi ≤ xs.length) : let first := Online.execute p none (xs.take lo) let middle := Online.execute p first.1 (Analysis.segment xs lo hi) let last := Online.execute p middle.1 (xs.drop hi) Online.execute p none xs = (last.1, first.2 + middle.2 + last.2) ∧ Pointer.Execution (p.current first.1) (Analysis.segment xs lo hi) (p.current middle.1) middle.2 ∧ (middle.2 : ℝ) ≤ (chargeFactor C₀ C₁ factor : ℝ) * minimumMass charges xs lo hi + (overheadFactor C₀ C₁ * overhead : Nat) := RotationBST.Combo.Family.Physical.window_minimum algorithm guaranteed p size xs valid lo hi ordered insideModels.Rotation, Models.Pointer.Machine, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Shared.Definitions, Structures.TreeBuffer.Snapshot.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Structures.TreeBuffer.Snapshot.Controller.Definitions, Structures.TreeBuffer.Scan.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Definitions, Structures.TreeBuffer.Snapshot.CellIO.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Refinement.Definitions, Structures.TreeBuffer.Snapshot.Startup.Definitions, Models.Pointer.Walk.Definitions, Models.Pointer.Routing.Definitions, Models.Labelled.Intervals.Access.Definitions, Models.Labelled.Intervals.Maintenance.Definitions, Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Rounds.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Analysis.Definitions, Algorithms.Combination.Refinement.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Models.Pointer.Lazy.Skeleton, Structures.BSTDeque.Definitions, Structures.BSTDeque.Boundary.Definitions, Structures.Tendon.Definitions, Structures.FingerHand.Definitions, Structures.FingerHand.Packed.Definitions, Algorithms.Combination.Online.Definitions, Algorithms.Combination.Online.Startup.Definitions, Algorithms.Combination.Online.Algorithm, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Online.Replay.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Algorithms.Combination.Family.Definitions, Algorithms.Combination.Family.Physical.Definitionstheorem prefix_minimum {ι : Type} [Fintype ι] [Nonempty ι] {saved : Tree} (algorithm : Algorithm saved) {overhead C₀ C₁ factor : Nat} {charges : ι → Charge} (guaranteed : Guarantees algorithm overhead C₀ C₁ factor charges) {fields : Nat → IntervalMetadata.Bounds} {oldData : Nat → Nat} (p : Online.Prepared algorithm.model (Analysis.budget overhead C₁) (57 * overhead) fields oldData) (size : saved.size ≤ overhead) (xs : List Nat) (valid : ∀ x ∈ xs, x < saved.size) : Pointer.Execution saved xs (p.current (Online.execute p none xs).1) (Online.execute p none xs).2 ∧ ((Online.execute p none xs).2 : ℝ) ≤ (chargeFactor C₀ C₁ factor : ℝ) * Family.minimum charges xs + (overheadFactor C₀ C₁ * overhead : Nat) := RotationBST.Combo.Family.Physical.prefix_minimum algorithm guaranteed p size xs validModels.Rotation, Models.Pointer.Machine, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Shared.Definitions, Structures.TreeBuffer.Snapshot.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Structures.TreeBuffer.Snapshot.Controller.Definitions, Structures.TreeBuffer.Scan.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Definitions, Structures.TreeBuffer.Snapshot.CellIO.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Refinement.Definitions, Structures.TreeBuffer.Snapshot.Startup.Definitions, Models.Pointer.Walk.Definitions, Models.Pointer.Routing.Definitions, Models.Labelled.Intervals.Access.Definitions, Models.Labelled.Intervals.Maintenance.Definitions, Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Rounds.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Analysis.Definitions, Algorithms.Combination.Refinement.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Models.Pointer.Lazy.Skeleton, Structures.BSTDeque.Definitions, Structures.BSTDeque.Boundary.Definitions, Structures.Tendon.Definitions, Structures.FingerHand.Definitions, Structures.FingerHand.Packed.Definitions, Algorithms.Combination.Online.Definitions, Algorithms.Combination.Online.Startup.Definitions, Algorithms.Combination.Online.Algorithm, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Online.Replay.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Algorithms.Combination.Family.Definitions, Algorithms.Combination.Family.Physical.Definitionstheorem bounded {ι : Type} [Fintype ι] [Nonempty ι] {saved : Tree} (algorithm : Algorithm saved) {overhead C₀ C₁ factor : Nat} {charges : ι → Charge} (guaranteed : Guarantees algorithm overhead C₀ C₁ factor charges) {fields : Nat → IntervalMetadata.Bounds} {oldData : Nat → Nat} (p : Online.Prepared algorithm.model (Analysis.budget overhead C₁) (57 * overhead) fields oldData) (size : saved.size ≤ overhead) : Bounded p (chargeFactor C₀ C₁ factor) (overheadFactor C₀ C₁ * overhead) charges := RotationBST.Combo.Family.Physical.bounded algorithm guaranteed p sizeModels.Rotation, Models.Pointer.Machine, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Shared.Definitions, Structures.TreeBuffer.Snapshot.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Structures.TreeBuffer.Snapshot.Controller.Definitions, Structures.TreeBuffer.Scan.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Definitions, Structures.TreeBuffer.Snapshot.CellIO.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Refinement.Definitions, Structures.TreeBuffer.Snapshot.Startup.Definitions, Models.Pointer.Walk.Definitions, Models.Pointer.Routing.Definitions, Models.Labelled.Intervals.Access.Definitions, Models.Labelled.Intervals.Maintenance.Definitions, Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Rounds.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Analysis.Definitions, Algorithms.Combination.Refinement.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Models.Pointer.Lazy.Skeleton, Structures.BSTDeque.Definitions, Structures.BSTDeque.Boundary.Definitions, Structures.Tendon.Definitions, Structures.FingerHand.Definitions, Structures.FingerHand.Packed.Definitions, Algorithms.Combination.Online.Definitions, Algorithms.Combination.Online.Startup.Definitions, Algorithms.Combination.Online.Algorithm, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Online.Replay.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Algorithms.Combination.Family.Definitions, Algorithms.Combination.Family.Physical.DefinitionsThese hold for every prepared policy p, not only for a chosen one: a preparation only fixes the snapshot and the initial physical state, and all preparations obey the bounds. bounded packages the three into Physical.Bounded.
Theorem (a policy exists). Under the same hypotheses, with a nonempty saved tree, a prepared policy exists, and it is bounded.
theorem policy_exists {ι : Type} [Fintype ι] [Nonempty ι] {saved : Tree} (algorithm : Algorithm saved) {overhead C₀ C₁ factor : Nat} {charges : ι → Charge} (guaranteed : Guarantees algorithm overhead C₀ C₁ factor charges) (nonempty : saved ≠ .nil) (size : saved.size ≤ overhead) (fields : Nat → IntervalMetadata.Bounds) (oldData : Nat → Nat) : ∃ p : Online.Prepared algorithm.model (Analysis.budget overhead C₁) (57 * overhead) fields oldData, Bounded p (chargeFactor C₀ C₁ factor) (overheadFactor C₀ C₁ * overhead) charges := RotationBST.Combo.Family.Physical.policy_exists algorithm guaranteed nonempty size fields oldDataModels.Rotation, Models.Pointer.Machine, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Shared.Definitions, Structures.TreeBuffer.Snapshot.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Structures.TreeBuffer.Snapshot.Controller.Definitions, Structures.TreeBuffer.Scan.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Definitions, Structures.TreeBuffer.Snapshot.CellIO.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Refinement.Definitions, Structures.TreeBuffer.Snapshot.Startup.Definitions, Models.Pointer.Walk.Definitions, Models.Pointer.Routing.Definitions, Models.Labelled.Intervals.Access.Definitions, Models.Labelled.Intervals.Maintenance.Definitions, Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Rounds.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Analysis.Definitions, Algorithms.Combination.Refinement.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Models.Pointer.Lazy.Skeleton, Structures.BSTDeque.Definitions, Structures.BSTDeque.Boundary.Definitions, Structures.Tendon.Definitions, Structures.FingerHand.Definitions, Structures.FingerHand.Packed.Definitions, Algorithms.Combination.Online.Definitions, Algorithms.Combination.Online.Startup.Definitions, Algorithms.Combination.Online.Algorithm, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Online.Replay.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Algorithms.Combination.Family.Definitions, Algorithms.Combination.Family.Physical.DefinitionsTheorem (finite families). For a nonempty finite family of members, well-behaved with common , and , on a nonempty saved tree, there is a combined member that guarantees the whole family with the scales of depth , and a prepared policy for it that is bounded with factor chargeFactor C₀ (C₁ + d) (chargeScale C₀ C₁ d) and overhead overheadFactor C₀ (C₁ + d) * (overheadScale C₀ C₁ d * F). In combine, is any depth with ; in finite_policy, .
theorem combine {ι : Type} [Fintype ι] [Nonempty ι] {saved : Tree} (depth overhead C₀ C₁ : Nat) (capacity : Fintype.card ι ≤ 2 ^ depth) (inputs : ι → Algorithm saved) (charges : ι → Charge) (well : ∀ i, Analysis.WellBehaved (inputs i).worker saved.size overhead C₀ C₁ (fun _ => charges i)) (nonempty : saved ≠ .nil) (size : saved.size ≤ overhead) (fields : Nat → IntervalMetadata.Bounds) (oldData : Nat → Nat) : ∃ output : Algorithm saved, Guarantees output (overheadScale C₀ C₁ depth * overhead) C₀ (C₁ + depth) (chargeScale C₀ C₁ depth) charges ∧ ∃ p : Online.Prepared output.model (Analysis.budget (overheadScale C₀ C₁ depth * overhead) (C₁ + depth)) (57 * (overheadScale C₀ C₁ depth * overhead)) fields oldData, Bounded p (chargeFactor C₀ (C₁ + depth) (chargeScale C₀ C₁ depth)) (overheadFactor C₀ (C₁ + depth) * (overheadScale C₀ C₁ depth * overhead)) charges := RotationBST.Combo.Family.Physical.combine depth overhead C₀ C₁ capacity inputs charges well nonempty size fields oldDataModels.Rotation, Models.Pointer.Machine, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Shared.Definitions, Structures.TreeBuffer.Snapshot.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Structures.TreeBuffer.Snapshot.Controller.Definitions, Structures.TreeBuffer.Scan.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Definitions, Structures.TreeBuffer.Snapshot.CellIO.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Refinement.Definitions, Structures.TreeBuffer.Snapshot.Startup.Definitions, Models.Pointer.Walk.Definitions, Models.Pointer.Routing.Definitions, Models.Labelled.Intervals.Access.Definitions, Models.Labelled.Intervals.Maintenance.Definitions, Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Rounds.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Analysis.Definitions, Algorithms.Combination.Refinement.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Models.Pointer.Lazy.Skeleton, Structures.BSTDeque.Definitions, Structures.BSTDeque.Boundary.Definitions, Structures.Tendon.Definitions, Structures.FingerHand.Definitions, Structures.FingerHand.Packed.Definitions, Algorithms.Combination.Online.Definitions, Algorithms.Combination.Online.Startup.Definitions, Algorithms.Combination.Online.Algorithm, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Online.Replay.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Algorithms.Combination.Family.Definitions, Algorithms.Combination.Family.Physical.Definitionstheorem finite_policy {ι : Type} [Fintype ι] [Nonempty ι] {saved : Tree} (overhead C₀ C₁ : Nat) (inputs : ι → Algorithm saved) (charges : ι → Charge) (well : ∀ i, Analysis.WellBehaved (inputs i).worker saved.size overhead C₀ C₁ (fun _ => charges i)) (nonempty : saved ≠ .nil) (size : saved.size ≤ overhead) (fields : Nat → IntervalMetadata.Bounds) (oldData : Nat → Nat) : let depth := Nat.clog 2 (Fintype.card ι) ∃ output : Algorithm saved, Guarantees output (overheadScale C₀ C₁ depth * overhead) C₀ (C₁ + depth) (chargeScale C₀ C₁ depth) charges ∧ ∃ p : Online.Prepared output.model (Analysis.budget (overheadScale C₀ C₁ depth * overhead) (C₁ + depth)) (57 * (overheadScale C₀ C₁ depth * overhead)) fields oldData, Bounded p (chargeFactor C₀ (C₁ + depth) (chargeScale C₀ C₁ depth)) (overheadFactor C₀ (C₁ + depth) * (overheadScale C₀ C₁ depth * overhead)) charges := RotationBST.Combo.Family.Physical.finite_policy overhead C₀ C₁ inputs charges well nonempty size fields oldDataModels.Rotation, Models.Pointer.Machine, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Shared.Definitions, Structures.TreeBuffer.Snapshot.Definitions, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Structures.TreeBuffer.Snapshot.Controller.Definitions, Structures.TreeBuffer.Scan.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Definitions, Structures.TreeBuffer.Snapshot.CellIO.Definitions, Structures.TreeBuffer.Snapshot.Streaming.Refinement.Definitions, Structures.TreeBuffer.Snapshot.Startup.Definitions, Models.Pointer.Walk.Definitions, Models.Pointer.Routing.Definitions, Models.Labelled.Intervals.Access.Definitions, Models.Labelled.Intervals.Maintenance.Definitions, Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Rounds.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Analysis.Definitions, Algorithms.Combination.Refinement.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Models.Pointer.Lazy.Skeleton, Structures.BSTDeque.Definitions, Structures.BSTDeque.Boundary.Definitions, Structures.Tendon.Definitions, Structures.FingerHand.Definitions, Structures.FingerHand.Packed.Definitions, Algorithms.Combination.Online.Definitions, Algorithms.Combination.Online.Startup.Definitions, Algorithms.Combination.Online.Algorithm, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Online.Replay.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Algorithms.Combination.Family.Definitions, Algorithms.Combination.Family.Physical.Definitionsfinite_policy is the theorem of the second box. The final policy runs the controller once more, on the two sides of the combined member, so even a singleton family pays the physical factor once.
29.1.8 What is not formalized
- Real-world storage. The paper’s clauses that ComboBST is a real-world BST when and are, and that OneFinger-BST preserves this (Theorems 3 and 5), are not formalized. The library’s model charges pointer operations and requests only; the policy uses classical choice and uncharged private planning. The machine model for these clauses is defined in Chapter 13; ComboBST is not yet given in it.
- The overhead. The paper states an overhead for algorithms. The library’s scales grow by a factor of order per level, which is a constant for fixed but much larger than .
- Corollary 4. The paper’s application combines splay trees, multi-splay trees (Wang et al. 2006) and layered working-set trees (Bose et al. 2012b). None of these is provided as a well-behaved worker, so Corollary 4 is not formalized. The applications that are formalized are GreedyASS and Tango, in Chapter 31.
- Arbitrary BSTs. No theorem turns an arbitrary
Algorithminto a well-behaved worker. The worker, its interpretation, correctness and charges are always supplied.