Binary Search Trees in Lean Check a result Declarations Bibliography Lean source

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 O(log⁡log⁡n)O(\log\log n)-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 A0A_0 and A1A_1, 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.

Key result · Demaine et al. 2013
One online BST is as good as the better of two, on every window

This is the abstract BST-operation counterpart of Theorem 3 of the paper. Fix a nonempty initial tree SS with nn keys. Let A0A_0 and A1A_1 be two interruptible online algorithms starting from SS, each with a pointer-machine interpretation and a request-correctness contract, and let τ0\tau_0, τ1\tau_1 be nonnegative amortized charges, where τs(X,i)\tau_s(X, i) is the charge of the ii-th request of the whole sequence XX. Assume that both charges are well-behaved for their algorithms with a common overhead FF and constants C0,C1C_0, C_1, and that

n≤F.n \le F.

Then there is one online pointer policy, chosen before any request is known, such that for every sequence X=x0,…,xm−1X = x_0, \dots, x_{m-1} of keys in {0,…,n−1}\{0, \dots, n-1\} its run from SS is a legal pointer execution serving XX, and for every window 0≤lo≤hi≤m0 \le lo \le hi \le m the run splits exactly into the part before lolo, the window, and the part after hihi, with additive costs. The window part is a legal pointer execution of xlo,…,xhi−1x_{lo}, \dots, x_{hi-1} between the trees the run actually reaches, and its cost is at most

8384 (C1+58)(2 C02min⁡(∑lo≤i<hiτ0(X,i), ∑lo≤i<hiτ1(X,i))+(2 C0C1+73) F).8384\,(C_1 + 58)\Bigl(2\,C_0^2 \min\Bigl(\sum_{lo \le i < hi} \tau_0(X, i),\ \sum_{lo \le i < hi} \tau_1(X, i)\Bigr) + (2\,C_0 C_1 + 73)\,F\Bigr).

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 SS. 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 lo=0lo = 0, hi=mhi = m 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
theoremCombo.Online.Results.window_policypropext · Classical.choice · Quot.soundAlgorithms/Combination/Online/Abstract.lean:136
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 oldData
Statement reads only Models.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
139 definitions in 12 chapters · reading list
Main result · Demaine et al. 2013
One online BST is as good as the best of a finite family, on every window

The paper combines kk algorithms two at a time in a balanced binary tree (Section 1.2). Fix a nonempty initial tree SS with nn keys and a nonempty finite family A1,…,AkA_1, \dots, A_k of interruptible algorithms on SS, possibly with different state types, each with a pointer interpretation and request correctness, and each well-behaved for its own charge τj\tau_j, with common F≥nF \ge n, C0C_0 and C1C_1. Let d=⌈log⁡2k⌉d = \lceil \log_2 k \rceil. Then there is one online pointer policy such that for every valid sequence XX its run from SS is legal, its total cost is at most αmin⁡j∑iτj(X,i)+βF\alpha \min_j \sum_i \tau_j(X, i) + \beta F, and for every window [lo,hi)[lo, hi) the run splits additively as in the box above and the window costs at most

α min⁡j∑lo≤i<hiτj(X,i)  +  β F,\alpha \, \min_{j} \sum_{lo \le i < hi} \tau_j(X, i) \;+\; \beta\, F,

with α=8384 (C1+d+58)⋅2C02⋅Sd\alpha = 8384\,(C_1 + d + 58)\cdot 2C_0^2\cdot S_d and β=8384 (C1+d+58) (2C0(C1+d)+73)⋅Od\beta = 8384\,(C_1 + d + 58)\,(2C_0(C_1 + d) + 73)\cdot O_d. The scales start at S0=O0=1S_0 = O_0 = 1 and grow by one factor per level of the combination tree, Sj+1=33536 C0 (C1+j+58) SjS_{j+1} = 33536\,C_0\,(C_1 + j + 58)\,S_j and Oj+1=(33536 C0 (C1+j+58)+16768 (5(C1+j)+301)+1) OjO_{j+1} = \bigl(33536\,C_0\,(C_1 + j + 58) + 16768\,(5(C_1 + j) + 301) + 1\bigr)\,O_j. For fixed kk, C0C_0 and C1C_1 these are constants, as in the paper; they are not the paper’s sharper O(k)O(k).

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
theoremCombo.Family.Physical.Results.finite_policypropext · Classical.choice · Quot.soundAlgorithms/Combination/Family/Physical/Abstract.lean:87
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 oldData
Statement reads only Models.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.Definitions
153 definitions in 12 chapters · reading list

The 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 A0A_0, A1A_1. 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 C3f(n)C_3 f(n) operations. When the budget runs out in the middle of request xix_i, ComboBST restores the initial tree, switches to the other worker and re-runs xix_i there. In the library, C3f(n)C_3 f(n) is the budget Analysis.budget F C₁ =(C1+1)F= (C_1 + 1) F, the restore is charged an explicit 57F57F 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 C3>C1C_3 > C_1 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 O(log⁡n)O(\log n) bits per node, a tree can store a description of another tree on the same keys, and saving or loading it takes O(n)O(n) 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 83848384 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 C3f(n)C_3 f(n) 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, kk 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.

  1. 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.
  2. 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 SS, and the tree keeps its nn keys.
  3. 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.
  4. Well-behaved charges. Analysis.WellBehaved for the given FF, C0C_0, C1C_1 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 C1FC_1 F, and that the charges of a window, taken standalone, are close to its charges inside the whole sequence.
  5. Sizes. The saved tree is nonempty and n≤Fn \le F. 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 O(n)O(n), 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 C0=1C_0 = 1, C1=20C_1 = 20 and F=46225920 nF = 46225920\,n (Results.greedy_worker), and Tango with linear startup, well-behaved against interleave charges of the balanced reference with C0=1C_0 = 1, C1=20C_1 = 20 and F=2816 nF = 2816\,n (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.

Caveat

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 A0A_0 and A1A_1 are real-world BSTs, so is ComboBST”, with O(log⁡n)O(\log n) 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:

defCombo.Analysis.Chargespropext · Classical.choice · Quot.soundAlgorithms/Combination/Analysis/Definitions/Abstract.lean:9
abbrev Charges := Bool → List Nat → Nat → ℝ
defCombo.Analysis.segmentno axiomsAlgorithms/Combination/Analysis/Definitions/Abstract.lean:11
def segment (xs : List Nat) (lo hi : Nat) : List Nat := (xs.drop lo).take (hi - lo)
defCombo.Analysis.masspropext · Classical.choice · Quot.soundAlgorithms/Combination/Analysis/Definitions/Abstract.lean:12
def mass (charges : Charges) (side : Bool) (xs : List Nat) (lo hi : Nat) : ℝ :=  ∑ i ∈ Finset.Ico lo hi, charges side xs i
defCombo.Analysis.totalpropext · Classical.choice · Quot.soundAlgorithms/Combination/Analysis/Definitions/Abstract.lean:15
def total (charges : Charges) (side : Bool) (xs : List Nat) : ℝ := mass charges side xs 0 xs.length

charges side xs i is τside(X,i)\tau_{side}(X, i), the charge of the ii-th request when the whole sequence is XX; side false is A0A_0 and side true is A1A_1. 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 xlo,…,xhi−1x_{lo}, \dots, x_{hi-1} as a list of its own. mass charges side xs lo hi sums the charges of the original sequence over the indices [lo,hi)[lo, hi), which is the paper’s TX′(A,T,X)T_{X'}(A, T, X) 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 XX, 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

structureCombo.Analysis.WellBehavedpropext · Classical.choice · Quot.soundAlgorithms/Combination/Analysis/Definitions/Abstract.lean:17
/-- 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₁ * overhead

The four fields correspond to the paper’s definition as follows. The paper writes T(A,T,X)=∑iτ(A,T,X,i)+f(n)T(A, T, X) = \sum_i \tau(A, T, X, i) + f(n) for an upper bound on the running time of AA on XX from tree TT; here f(n)f(n) is overhead, written FF.

  1. nonneg: every charge is nonnegative. The paper assumes this implicitly.
  2. 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 C1FC_1 F worker steps. This is the paper’s “the cost of executing any single access xix_i is at most C1f(n)C_1 f(n)”. It also asserts that the request terminates.
  3. upper: a standalone run from the restart state on any valid sequence completes all of it, at a cost of at most ∑iτ(X,i)+F\sum_i \tau(X, i) + F. This is the paper’s statement that TT bounds the running time.
  4. stable: for every valid sequence and every window, the window’s standalone charge plus FF is at most C0C_0 times its mass in the original sequence plus C1FC_1 F: $∑iτ(X′,i)+F  ≤  C0∑lo≤i<hiτ(X,i)+C1F,X′=xlo…xhi−1.\sum_{i} \tau\bigl(X', i\bigr) + F \;\le\; C_0 \sum_{lo \le i < hi} \tau(X, i) + C_1 F, \qquad X' = x_{lo} \dots x_{hi-1}.$ This is the paper’s T(A,T,X′)≤C0 TX′(A,T,X)+C1f(n)T(A, T, X') \le C_0\,T_{X'}(A, T, X) + C_1 f(n).

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 FF and directly for C0C_0 and C1C_1.

Lean also generates one projection per field, which the proofs use to extract a property from a hypothesis well : WellBehaved …:

theoremCombo.Analysis.WellBehaved.nonnegpropext · Classical.choice · Quot.soundAlgorithms/Combination/Analysis/Definitions/Abstract.lean:22
nonneg
Statement reads only Algorithms/Combination/Analysis/Definitions/Abstract.lean and its imports
theoremCombo.Analysis.WellBehaved.singlepropext · Classical.choice · Quot.soundAlgorithms/Combination/Analysis/Definitions/Abstract.lean:23
single
Statement reads only Algorithms/Combination/Analysis/Definitions/Abstract.lean and its imports
theoremCombo.Analysis.WellBehaved.upperpropext · Classical.choice · Quot.soundAlgorithms/Combination/Analysis/Definitions/Abstract.lean:26
upper
Statement reads only Algorithms/Combination/Analysis/Definitions/Abstract.lean and its imports
theoremCombo.Analysis.WellBehaved.stablepropext · Classical.choice · Quot.soundAlgorithms/Combination/Analysis/Definitions/Abstract.lean:29
stable
Statement reads only Algorithms/Combination/Analysis/Definitions/Abstract.lean and its imports

The round budget is fixed in terms of the same constants:

defCombo.Analysis.budgetno axiomsAlgorithms/Combination/Analysis/Definitions/Abstract.lean:32
/-- A round budget strictly exceeds the per-access/segment overhead factor. -/def budget (overhead C₁ : Nat) : Nat := (C₁ + 1) * overhead

(C1+1)F(C_1 + 1) F is the paper’s C3f(n)C_3 f(n) with C3=C1+1C_3 = C_1 + 1, the least integer choice with C3>C1C_3 > C_1. The docstring states the point: the budget strictly exceeds the cost C1FC_1 F 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 C1FC_1 F steps.

theoremCombo.Analysis.Results.freshpropext · Classical.choice · Quot.soundAlgorithms/Combination/Analysis/Abstract.lean:9
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 well

Controller.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 (C1+1)F(C_1 + 1) F.

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 C0C_0 times the window’s original mass plus C1FC_1 F.

theoremCombo.Analysis.Results.segment_boundpropext · Classical.choice · Quot.soundAlgorithms/Combination/Analysis/Abstract.lean:13
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 inside

This 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 FF and C1≥1C_1 \ge 1, they are well-behaved with every larger overhead.

theoremCombo.Analysis.Results.overhead_monopropext · Classical.choice · Quot.soundAlgorithms/Combination/Analysis/Abstract.lean:128
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 constant

The hypothesis C1≥1C_1 \ge 1 is needed for stable, whose right-hand side gains C1(F′−F)C_1(F' - F) while the left gains F′−FF' - F. 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 Amin⁡A_{\min} be the side with the smaller total charge. Every round except the last runs out of budget, so it spends at least (C1+1)F(C_1 + 1) F 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 C0C_0 times its charge plus C1FC_1 F. So the piece’s charge is at least F/C0F / C_0. The pieces of one side are disjoint, so there are at most C0⋅total/FC_0 \cdot \mathrm{total} / F closed rounds of Amin⁡A_{\min}, 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 F/C0F / C_0 on its own side.

theoremCombo.Analysis.Results.closed_span_chargepropext · Classical.choice · Quot.soundAlgorithms/Combination/Analysis/Abstract.lean:20
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 member

dropLast 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 FF is at most C0C_0 times that side’s total charge.

theoremCombo.Analysis.Results.closed_count_boundpropext · Classical.choice · Quot.soundAlgorithms/Combination/Analysis/Abstract.lean:31
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 selected

This 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:

theoremCombo.Analysis.Results.interior_span_chargepropext · Classical.choice · Quot.soundAlgorithms/Combination/Analysis/Abstract.lean:68
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 member
theoremCombo.Analysis.Results.interior_count_boundpropext · Classical.choice · Quot.soundAlgorithms/Combination/Analysis/Abstract.lean:77
theorem 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 selected

dropLast.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 ss, the cost is at most (C1+1+r)(2C0∑iτs(X,i)+3F)(C_1 + 1 + r)\bigl(2 C_0 \sum_i \tau_s(X, i) + 3F\bigr), where rFrF is the restore charge.

theoremCombo.Analysis.Results.prefix_boundpropext · Classical.choice · Quot.soundAlgorithms/Combination/Analysis/Abstract.lean:40
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 selected

Each round costs at most its budget (C1+1)F(C_1+1)F plus a restore rFrF. The rounds alternate between the sides, so if cc is the number of closed rounds of side ss, the run pays at most 2c+32c + 3 budgets and restores, and cF≤C0∑iτs(X,i)c F \le C_0 \sum_i \tau_s(X,i) by closed_count_bound.

Theorem (prefix minimum). The cost of such a run is at most (C1+1+r)(2C0min⁡(∑iτ0(X,i),∑iτ1(X,i))+3F)(C_1 + 1 + r)\bigl(2 C_0 \min(\sum_i \tau_0(X, i), \sum_i \tau_1(X, i)) + 3F\bigr). Moreover the executable controller Controller.run does not fail on valid requests.

theoremCombo.Analysis.Results.minimum_boundpropext · Classical.choice · Quot.soundAlgorithms/Combination/Analysis/Abstract.lean:48
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 execution
theoremCombo.Analysis.Results.executepropext · Classical.choice · Quot.soundAlgorithms/Combination/Analysis/Abstract.lean:57
theorem 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 valid

minimum_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 X′=xlo…xhi−1X' = x_{lo} \dots x_{hi-1} of the online sequence, served inside the run on all of XX. 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 ss, the cost is at most (C1+1+r)(2C0∑iτs(X,i)+5F)(C_1 + 1 + r)\bigl(2 C_0 \sum_i \tau_s(X, i) + 5F\bigr).

theoremCombo.Analysis.Results.state_boundpropext · Classical.choice · Quot.soundAlgorithms/Combination/Analysis/Abstract.lean:85
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 selected

Compared with prefix_bound, the first round is not fresh, so only interior rounds are charged and the additive term grows from 3F3F to 5F5F. 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 XX be a valid sequence and lo≤hi≤∣X∣lo \le hi \le |X|. Any run of the controller on the window xlo…xhi−1x_{lo} \dots x_{hi-1}, from any state whose remaining budget is at most the round budget, costs at most

(C1+1+r)(2 C02∑lo≤i<hiτs(X,i)+(2C0C1+5) F)(C_1 + 1 + r)\Bigl(2\,C_0^2 \sum_{lo \le i < hi} \tau_s(X, i) + (2 C_0 C_1 + 5)\,F\Bigr)

for either side ss, and so at most the same with the minimum over the two sides.

theoremCombo.Analysis.Results.window_boundpropext · Classical.choice · Quot.soundAlgorithms/Combination/Analysis/Abstract.lean:93
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 selected
theoremCombo.Analysis.Results.window_minimumpropext · Classical.choice · Quot.soundAlgorithms/Combination/Analysis/Abstract.lean:102
theorem 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 execution

The 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: 2C0 total(X′)+5F≤2C0 (C0 mass+C1F−F)+5F≤2C02 mass+(2C0C1+5) F2C_0\,\mathrm{total}(X') + 5F \le 2C_0\,(C_0\,\mathrm{mass} + C_1 F - F) + 5F \le 2C_0^2\,\mathrm{mass} + (2C_0C_1 + 5)\,F, where X′X' is the window. This is where C02C_0^2 and 2C0C12C_0C_1 come from.

Theorem (the window inside the run). Let a controller run on a valid sequence XX start from a state with remaining budget at most the round budget, and let lo≤hi≤∣X∣lo \le hi \le |X|. Then the run is the composition of three runs, on x0…xlo−1x_0 \dots x_{lo-1}, on the window, and on xhi…x_{hi} \dots, 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.

theoremCombo.Analysis.Results.executed_windowpropext · Classical.choice · Quot.soundAlgorithms/Combination/Analysis/Abstract.lean:111
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 inside
What the window bound compares

Both 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 beforeState that the actual prefix produced. The window is not rerun from the saved tree, and the controller is not reset at lolo.
  • The comparator is the mass of the original charges over the indices [lo,hi)[lo, hi): mass charges side xs lo hi, where xs is the whole sequence. A request of the window is charged as the ii-th request of XX, with all of XX’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 TX′(Combo-BST,T,X)T_{X'}(\text{Combo-BST}, T, X), 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 83848384 for the pointer simulation and adds 570112 n570112\,n for the carried potential of the finger hand, or the preparation when lo=0lo = 0. With the restore charge r=57r = 57 and n≤Fn \le F, this additive term is absorbed: 570112 n=8384⋅68 n≤8384 (C1+58)⋅68 F570112\,n = 8384 \cdot 68\,n \le 8384\,(C_1 + 58) \cdot 68\,F, which turns 2C0C1+52C_0C_1 + 5 into 2C0C1+732C_0C_1 + 73. 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 nn keys, and charges that are well-behaved with overhead F≥nF \ge n and constants C0C_0, C1C_1, there is one prepared policy with budget (C1+1)F(C_1+1)F and restore charge 57F57F, such that for every sequence of valid keys its execution from the saved tree is a legal pointer execution, and every window [lo,hi)[lo, hi) of it is a legal pointer execution between the trees reached at lolo and hihi, with exactly additive costs, of cost at most 8384 (C1+58)(2C02min⁡(M0,M1)+(2C0C1+73) F)8384\,(C_1 + 58)\bigl(2 C_0^2 \min(M_0, M_1) + (2C_0C_1 + 73)\,F\bigr), where MsM_s is the original mass of side ss over [lo,hi)[lo, hi). 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 1+dT(xi−1,xi)1 + d_T(x_{i-1}, x_i) with x−1=px_{-1} = p, and LazyFinger.cost starts at the root.

costFrom_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 lo≤hilo \le hi, the lazy-finger cost of the window xlo…xhi−1x_{lo} \dots x_{hi-1}, as a sequence of its own, is at most the increase of the cost of the prefixes of XX from lolo to hihi, plus ∣T∣|T|.

theoremLazyFinger.Results.cost_segmentpropext · Classical.choice · Quot.soundBounds/LazyFinger/Abstract.lean:153
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 valid

The window alone starts its first search at the root of TT, while inside XX it starts at xlo−1x_{lo-1}. Only the first move differs, and the move from the root costs at most ∣T∣|T|. The subtraction is on natural numbers, but it does not truncate, by cost_take_mono.

29.1.6.2 Lazy-finger charges

defCombo.Charges.lazyFingerpropext · Classical.choice · Quot.soundAlgorithms/Combination/Charges/Definitions/Abstract.lean:10
/-- 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 factor⋅(LFT(x0…xi)−LFT(x0…xi−1))\mathit{factor}\cdot\bigl(\mathrm{LF}_T(x_0 \dots x_i) - \mathrm{LF}_T(x_0 \dots x_{i-1})\bigr), the cost increment of the ii-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.

theoremCombo.Charges.Results.lazyFinger_nonnegpropext · Classical.choice · Quot.soundAlgorithms/Combination/Charges/Abstract.lean:9
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 i
theoremCombo.Charges.Results.lazyFinger_masspropext · Classical.choice · Quot.soundAlgorithms/Combination/Charges/Abstract.lean:13
theorem 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 ordered
theoremCombo.Charges.Results.lazyFinger_totalpropext · Classical.choice · Quot.soundAlgorithms/Combination/Charges/Abstract.lean:19
theorem 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 xs
theoremCombo.Charges.Results.lazyFinger_stablepropext · Classical.choice · Quot.soundAlgorithms/Combination/Charges/Abstract.lean:23
theorem 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 paid

The four results say: the charge is nonnegative; the mass of a window [lo,hi)[lo, hi) is factor\mathit{factor} times the increase of the prefix cost; the total is factor⋅LFT(X)\mathit{factor}\cdot\mathrm{LF}_T(X); and the charge is stable with C0=1C_0 = 1 and C1=2C_1 = 2, provided factor⋅∣T∣≤F\mathit{factor}\cdot|T| \le F. 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

defCombo.Charges.interleavepropext · Classical.choice · Quot.soundAlgorithms/Combination/Charges/Definitions/Abstract.lean:16
/-- 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 factor⋅(1+IBP(x0…xi)−IBP(x0…xi−1))\mathit{factor}\cdot\bigl(1 + \mathrm{IB}_P(x_0 \dots x_i) - \mathrm{IB}_P(x_0 \dots x_{i-1})\bigr), where IBP\mathrm{IB}_P is Wilber’s interleave quantity Wilber.interleave for the reference tree PP (Chapter 17). The 11 is a unit charge per request. The increment counts the alternations that request ii creates along its search path in PP.

theoremCombo.Charges.Results.interleave_nonnegpropext · Classical.choice · Quot.soundAlgorithms/Combination/Charges/Abstract.lean:30
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 i
theoremCombo.Charges.Results.interleave_masspropext · Classical.choice · Quot.soundAlgorithms/Combination/Charges/Abstract.lean:34
theorem 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 ordered
theoremCombo.Charges.Results.interleave_totalpropext · Classical.choice · Quot.soundAlgorithms/Combination/Charges/Abstract.lean:40
theorem 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 xs
theoremCombo.Charges.Results.interleave_stablepropext · Classical.choice · Quot.soundAlgorithms/Combination/Charges/Abstract.lean:44
theorem 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 ordered

The charge is nonnegative, the mass of a window is factor⋅((hi−lo)+IBP(x0…xhi−1)−IBP(x0…xlo−1))\mathit{factor}\cdot\bigl((hi - lo) + \mathrm{IB}_P(x_0 \dots x_{hi-1}) - \mathrm{IB}_P(x_0 \dots x_{lo-1})\bigr), and the total is factor⋅(m+IBP(X))\mathit{factor}\cdot(m + \mathrm{IB}_P(X)). Stability holds without any overhead: a window, as a sequence of its own, has at most the alternations that its requests create inside XX, since an alternation of the window is an alternation of XX at the same node and the same pair of requests. So IBP\mathrm{IB}_P of the window is at most the increase, and the standalone total is at most the mass.

Theorem (interleave charges and offline executions). Let PP have the same size as the initial tree ss, and let an offline execution serve XX from ss with kk rotations. Then the total interleave charge of XX is at most 4⋅factor⋅(m+k)4\cdot\mathit{factor}\cdot(m + k).

theoremCombo.Charges.Results.interleave_comparatorpropext · Classical.choice · Quot.soundAlgorithms/Combination/Charges/Abstract.lean:50
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 execution

This is Wilber’s lower bound IBP(X)≤4k+2m\mathrm{IB}_P(X) \le 4k + 2m (Results.rotation_lower_bound, Chapter 17) with the unit charges added: m+IBP(X)≤4(m+k)m + \mathrm{IB}_P(X) \le 4(m + k). Execution counts rotations only, so m+km + k 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 OPT\mathrm{OPT}.

29.1.7 Finite families

The paper’s Section 1.2 combines kk 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

structureCombo.Family.AlgorithmpropextAlgorithms/Combination/Family/Definitions/Abstract.lean:10
/-- 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 model
theoremCombo.Family.Algorithm.correctpropextAlgorithms/Combination/Family/Definitions/Abstract.lean:16
correct
Statement reads only Algorithms/Combination/Family/Definitions/Abstract.lean and its imports

A 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.

defCombo.Family.Chargepropext · Classical.choice · Quot.soundAlgorithms/Combination/Family/Definitions/Abstract.lean:18
/-- A comparator assigns a nonnegative amortized charge to each request. -/abbrev Charge := List Nat → Nat → ℝ
defCombo.Family.Indexno axiomsAlgorithms/Combination/Family/Definitions/Abstract.lean:21
/-- Leaves of a full binary combination tree of the given depth. -/abbrev Index (depth : Nat) := Fin depth → Bool

A comparator for a family is a single charge function τ(X,i)\tau(X, i), 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.

defCombo.Family.Guaranteespropext · Classical.choice · Quot.soundAlgorithms/Combination/Family/Definitions/Abstract.lean:34
/-- 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 FF and constants C0,C1C_0, C_1, 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.

defCombo.Family.totalpropext · Classical.choice · Quot.soundAlgorithms/Combination/Family/Definitions/Abstract.lean:41
/-- The original total amortized charge, without any combination factor. -/def total (charge : Charge) (xs : List Nat) : ℝ :=  Analysis.total (fun _ => charge) false xs
defCombo.Family.minimumpropext · Classical.choice · Quot.soundAlgorithms/Combination/Family/Definitions/Abstract.lean:45
/-- 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.

defCombo.Family.chargeScaleno axiomsAlgorithms/Combination/Family/Definitions/Abstract.lean:24
/-- 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
defCombo.Family.overheadScaleno axiomsAlgorithms/Combination/Family/Definitions/Abstract.lean:29
/-- 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₁ depth

Each level of the combination tree runs the construction of the first box on two workers and replays the result. A level with constant C1+jC_1 + j multiplies the charge factor by Replay.chargeFactor C₀ (C₁ + j) 57 =33536 C0 (C1+j+58)= 33536\,C_0\,(C_1 + j + 58) and the overhead by Replay.overheadFactor, which is that factor plus 16768 (5(C1+j)+301)+116768\,(5(C_1 + j) + 301) + 1. The constant C0C_0 is unchanged and C1C_1 grows by one per level.

theoremCombo.Family.Results.overheadScale_pospropext · Quot.soundAlgorithms/Combination/Family/Abstract.lean:9
theorem overheadScale_pos (C₀ C₁ depth : Nat) : 0 < overheadScale C₀ C₁ depth :=  RotationBST.Combo.Family.overheadScale_pos C₀ C₁ depth
Statement reads only Models.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

29.1.7.2 Worker-level combination

Theorem (balanced combination). Let 2d2^d members, indexed by the leaves of the depth-dd tree, be well-behaved with common F≥nF \ge n, C0C_0, C1C_1, each against its own comparator, on a nonempty saved tree. Then there is one member that guarantees every comparator, with overhead OdFO_d F, constants C0C_0 and C1+dC_1 + d, and factor SdS_d.

theoremCombo.Family.Results.balancedpropext · Classical.choice · Quot.soundAlgorithms/Combination/Family/Abstract.lean:12
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 oldData
Statement reads only Models.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

Theorem (any finite family). The same holds for any nonempty finite family of at most 2d2^d members, and in particular with d=⌈log⁡2k⌉d = \lceil \log_2 k \rceil for kk members.

theoremCombo.Family.Results.finitepropext · Classical.choice · Quot.soundAlgorithms/Combination/Family/Abstract.lean:22
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 oldData
Statement reads only Models.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
theoremCombo.Family.Results.exists_combinationpropext · Classical.choice · Quot.soundAlgorithms/Combination/Family/Abstract.lean:33
theorem 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 oldData
Statement reads only Models.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

A family with fewer than 2d2^d members is padded by repeating members at unused leaves. For k=1k = 1, d=0d = 0, both scales are 11, 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 factor\mathit{factor} times the total of each comparator, plus FF; hence at most factor\mathit{factor} times their minimum, plus FF.

theoremCombo.Family.Results.requestspropext · Classical.choice · Quot.soundAlgorithms/Combination/Family/Abstract.lean:43
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 valid
Statement reads only Models.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
theoremCombo.Family.Results.minimum_boundpropext · Classical.choice · Quot.soundAlgorithms/Combination/Family/Abstract.lean:51
theorem 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 valid
Statement reads only Models.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

This is upper for each i, with the same run: the worker is fixed, so the run does not depend on the comparator.

theoremCombo.Family.Results.combinepropext · Classical.choice · Quot.soundAlgorithms/Combination/Family/Abstract.lean:59
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 oldData
Statement reads only Models.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
theoremCombo.Family.Results.minimum_policypropext · Classical.choice · Quot.soundAlgorithms/Combination/Family/Abstract.lean:74
theorem 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 oldData
Statement reads only Models.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

combine and minimum_policy package the two steps: there is one member that guarantees the family, and its standalone runs cost at most SdS_d times the least total charge plus OdFO_d F. 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.

defCombo.Family.Physical.masspropext · Classical.choice · Quot.soundAlgorithms/Combination/Family/Physical/Definitions/Abstract.lean:8
/-- 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
defCombo.Family.Physical.minimumMasspropext · Classical.choice · Quot.soundAlgorithms/Combination/Family/Physical/Definitions/Abstract.lean:13
/-- 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 [lo,hi)[lo, hi), 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.

defCombo.Family.Physical.chargeFactorno axiomsAlgorithms/Combination/Family/Physical/Definitions/Abstract.lean:18
/-- Physical window-charge coefficient of the final policy wrapper. -/def chargeFactor (C₀ C₁ factor : Nat) : Nat :=  8384 * (C₁ + 1 + 57) * (2 * C₀ * C₀) * factor
defCombo.Family.Physical.overheadFactorno axiomsAlgorithms/Combination/Family/Physical/Definitions/Abstract.lean:22
/-- 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 C0,C1C_0, C_1 that guarantees factor times each comparator: the window bound 8384 (C1+58)(2C02⋅factor⋅M+(2C0C1+73) F)8384\,(C_1+58)\bigl(2C_0^2\cdot\mathit{factor}\cdot M + (2C_0C_1 + 73)\,F\bigr) is chargeFactor C₀ C₁ factor * M + overheadFactor C₀ C₁ * F.

defCombo.Family.Physical.Boundedpropext · Classical.choice · Quot.soundAlgorithms/Combination/Family/Physical/Definitions/Abstract.lean:26
/-- 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 + overhead

Bounded 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 F≥nF \ge n, constants C0,C1C_0, C_1 and some factor, and let p be any prepared policy for it with budget (C1+1)F(C_1+1)F and restore charge 57F57F. 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 ⋅F\cdot F; the whole run is bounded in the same way by the least total.

theoremCombo.Family.Physical.Results.executed_windowpropext · Classical.choice · Quot.soundAlgorithms/Combination/Family/Physical/Abstract.lean:9
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 inside
Statement reads only Models.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.Definitions
theoremCombo.Family.Physical.Results.window_minimumpropext · Classical.choice · Quot.soundAlgorithms/Combination/Family/Physical/Abstract.lean:26
theorem 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 inside
Statement reads only Models.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.Definitions
theoremCombo.Family.Physical.Results.prefix_minimumpropext · Classical.choice · Quot.soundAlgorithms/Combination/Family/Physical/Abstract.lean:43
theorem 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 valid
Statement reads only Models.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.Definitions
theoremCombo.Family.Physical.Results.boundedpropext · Classical.choice · Quot.soundAlgorithms/Combination/Family/Physical/Abstract.lean:54
theorem 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 size
Statement reads only Models.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.Definitions

These 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.

theoremCombo.Family.Physical.Results.policy_existspropext · Classical.choice · Quot.soundAlgorithms/Combination/Family/Physical/Abstract.lean:63
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 oldData
Statement reads only Models.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.Definitions

Theorem (finite families). For a nonempty finite family of kk members, well-behaved with common F≥nF \ge n, C0C_0 and C1C_1, on a nonempty saved tree, there is a combined member that guarantees the whole family with the scales of depth dd, 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, dd is any depth with k≤2dk \le 2^d; in finite_policy, d=⌈log⁡2k⌉d = \lceil \log_2 k \rceil.

theoremCombo.Family.Physical.Results.combinepropext · Classical.choice · Quot.soundAlgorithms/Combination/Family/Physical/Abstract.lean:72
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 oldData
Statement reads only Models.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.Definitions
theoremCombo.Family.Physical.Results.finite_policypropext · Classical.choice · Quot.soundAlgorithms/Combination/Family/Physical/Abstract.lean:87
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 oldData
Statement reads only Models.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.Definitions

finite_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 A0A_0 and A1A_1 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 O(k)O(k) overhead. The paper states an O(k)O(k) overhead for kk algorithms. The library’s scales grow by a factor of order C0(C1+d)C_0(C_1 + d) per level, which is a constant for fixed kk but much larger than O(k)O(k).
  • 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 Algorithm into a well-behaved worker. The worker, its interpretation, correctness and charges are always supplied.