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

Chapter 31All the finger bounds at once

Part IV has produced two online BSTs whose guarantees do not compare. GreedyASS (Section 25.3) is within a constant factor of the best weighted dynamic finger bound, with a linear startup term, but no competitive ratio better than O(log⁡n)O(\log n) is known for it. Tango (Section 26.2) is O(log⁡log⁡n)O(\log\log n)-competitive with the offline optimum, but its bound is relative to the optimum only, and it is not known to have the finger bounds. Neither guarantee implies the other. Iacono and Langerman (2016) end their paper with Theorem 4.3, which takes the best of both. They combine the two algorithms with the ComboBST construction of Demaine, Iacono, Langerman and Özkan (Section 29.1), so that one BST costs at most a constant times the minimum of the two bounds, plus O(n)O(n). They then apply the deamortization of Bose, Collette, Fagerberg and Langerman (Chapter 30), so that every search also costs O(log⁡n)O(\log n) in the worst case.

The paper gives this theorem in two lines, citing the other two papers. The library proves it. This chapter assembles the proof from the pieces built in the preceding chapters, and states the result with its explicit constants.

Key result · Iacono and Langerman 2016
One BST has the weighted dynamic finger bound, is O(log⁡log⁡n)O(\log\log n)-competitive, and costs O(log⁡n)O(\log n) per search

This is the abstract BST-operation counterpart of Theorem 4.3 of the paper, in a normalized form. Let saved be any nonempty initial tree on nn keys. There is one program, fixed before the requests, the start finger, the weights and the offline comparator are chosen, with the following properties.

  • Setup. Before the first request, a legal pointer trace of cost S≤16 nS \le 16\,n turns saved into the program’s prepared tree.
  • Serving. For every sequence X=x1,…,xmX = x_1, \dots, x_m of keys less than nn, the empty sequence included, the program’s instructions form a legal single-finger pointer execution from the prepared tree. They split into one contiguous segment per request, and the segment of xjx_j visits xjx_j. The response cost cjc_j is 11 plus the length of that segment, so ∑jcj=m+\sum_j c_j = m + {}(number of instructions).
  • Online. The instructions and response costs for x1,…,xjx_1, \dots, x_j do not depend on the later requests.
  • Worst case. Every response costs cj<251+195log⁡2nc_j < 251 + 195 \log_2 n.
  • Total. For every start key p<np < n, every initial tree on nn keys and every offline rotation-model execution that serves XX from it with RR rotations,
S+∑j=1mcj  ≤  16 n+2480(1307904min⁡(184903680 WF∗(p,X),  8 ⌈64 (14 L+6)⌉ (m+R))+3839872⋅46225920 n),S + \sum_{j=1}^m c_j \;\le\; 16\,n + 2480\Bigl(1307904 \min\bigl(184903680\,\mathrm{WF}^*(p, X),\; 8\,\lceil 64\,(14\,L + 6)\rceil\,(m + R)\bigr) + 3839872 \cdot 46225920\, n\Bigr),

where L=log⁡2(1+⌊log⁡2n⌋)L = \log_2(1 + \lfloor\log_2 n\rfloor). So the total cost is

O(n+min⁡(WF∗(p,X),  (m+R)(1+log⁡2(1+⌊log⁡2n⌋)))).O\bigl(n + \min\bigl(\mathrm{WF}^*(p, X),\; (m + R)(1 + \log_2(1 + \lfloor\log_2 n\rfloor))\bigr)\bigr).

Here WF∗(p,X)\mathrm{WF}^*(p, X) is WeightedFinger.optimalCostFrom, the infimum over all weightings positive on the keys of the weighted dynamic finger cost with x0=px_0 = p and one unit per request (Section 25.3). It is not assumed to be attained. The comparator is any Execution, so the bound holds in particular for the optimal one. The program is a Combination.Deamortized structure: its fields give the setup trace and the causality, and the theorem gives the rest.

The Lean statement
theoremGeometric.GreedyASS.Combination.Deamortized.Results.combinedpropext · Classical.choice · Quot.soundAlgorithms/GreedyASS/Combination/Deamortized/Abstract.lean:55
theorem combined (saved : Tree) (nonempty : saved ≠ .nil)    (fields : Nat → IntervalMetadata.Bounds) (oldData : Nat → Nat) :    ∃ p : Policy saved fields oldData, ∃ d : Deamortized p,      ∀ xs : List Nat, (∀ x ∈ xs, x < saved.size) →        ∃ out, d.program xs = some out ∧          Deamortization.Scheduler.ServedStream ⟨d.initial, []⟩ xs out.state.cursor out.instructions out.costs ∧          out.costs.length = xs.length ∧ out.costs.sum = xs.length + out.instructions.length ∧          (∀ cost ∈ out.costs, (cost : ℝ) < 251 + 195 * Real.logb 2 saved.size) ∧          ∀ (start : Nat), start < saved.size → ∀ (s t : Tree) (k : Nat), s.size = saved.size →            RotationBST.Execution s xs t k →              (d.startup + out.costs.sum : ℝ) ≤ 16 * saved.size + 2480 *                (1307904 * min (184903680 * WeightedFinger.optimalCostFrom saved.size start xs)                  ((8 * ⌈64 * (14 * Real.logb 2 (Nat.log2 saved.size + 1) + 6)⌉₊ : Nat) * (xs.length + k : Nat)) +                  3839872 * (46225920 * saved.size : Nat)) := …  RotationBST.Geometric.GreedyASS.Combination.combined saved nonempty fields oldData
Statement reads only Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Models.Rotation, Models.Online, Models.Pointer.Lazy.Online.Definitions, Algorithms.Combination.Analysis.Definitions, Models.Pointer.Machine, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Shared.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Refinement.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Charges.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Snapshot.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, Algorithms.Combination.Rounds.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.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.Online.Replay.Definitions, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.State.Defs, Algorithms.Tango.State.Nesting.Defs, Algorithms.Tango.State, Algorithms.Tango.Preferences.Updates, Bounds.Interleave.Definitions, Algorithms.Tango.Definitions, Algorithms.Tango.Paths, Bounds.Interleave.Wilber, Bounds.Interleave.Transition.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Traces, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Combination.Definitions, Algorithms.GreedyASS.Combination.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Bounds.WeightedFinger.Definitions, Models.Pointer.Mirror.Definitions, Models.Labelled.Ordering.Definitions, Structures.PopTart.Definitions, Structures.PopTart.Mirror.Definitions, Structures.PopTart.Chocolate.Definitions, Structures.PopTart.Located.Definitions, Structures.HeavyPath.Definitions, Structures.HeavyPath.Paired.Definitions, Structures.HeavyPath.Paired.Substitution.Definitions, Structures.HeavyPath.Recursive.Definitions, Structures.HeavyPath.Finger.Definitions, Structures.PopTart.Chocolate.Top.Definitions, Structures.HeavyPath.Paired.Exposure.Definitions, Structures.HeavyPath.Recursive.History.Definitions, Structures.HeavyPath.Finger.Transfer.Definitions, Structures.HeavyPath.Finger.History.Definitions, Structures.HeavyPath.Finger.History.Simulation.Definitions, Structures.HeavyPath.Finger.History.Simulation.Requests.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Finger.Definitions, Structures.HeavyPath.Finger.History.Simulation.Minimum.Definitions, Algorithms.GreedyASS.Combination.Deamortized.Definitions
32 definitions in 9 chapters · reading list
The same program, against every weighting

The form of Theorem 4.3 for a single weighting. For every nonempty tree on nn keys there is a combined policy p and a deamortized program d for it. For every weighting ww positive on the keys, every p<np < n, and every rotation-model execution with RR rotations that serves XX from a tree on nn keys, if the program serves XX then its setup plus response costs is at most

16 n+2480(1307904min⁡(184903680 WFw(p,X),  4 linearChargeFactor(balanced n) (m+R))+3839872⋅46225920 n).16\,n + 2480\Bigl(1307904 \min\bigl(184903680\,\mathrm{WF}_w(p, X),\; 4\,\mathtt{linearChargeFactor}(\mathtt{balanced}\ n)\,(m + R)\bigr) + 3839872 \cdot 46225920\, n\Bigr).

The weights are chosen after the program, which never sees them.

The Lean statements
theoremGeometric.GreedyASS.Combination.Results.policy_existspropext · Classical.choice · Quot.soundAlgorithms/GreedyASS/Combination/Abstract.lean:25
theorem policy_exists (saved : Tree) (nonempty : saved ≠ .nil)    (fields : Nat → IntervalMetadata.Bounds) (oldData : Nat → Nat) :    Nonempty (Policy saved fields oldData) := …  RotationBST.Geometric.GreedyASS.Combination.policy_exists saved nonempty fields oldData
Statement reads only Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Models.Rotation, Models.Online, Models.Pointer.Lazy.Online.Definitions, Algorithms.Combination.Analysis.Definitions, Models.Pointer.Machine, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Shared.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Refinement.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Charges.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Snapshot.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, Algorithms.Combination.Rounds.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.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.Online.Replay.Definitions, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.State.Defs, Algorithms.Tango.State.Nesting.Defs, Algorithms.Tango.State, Algorithms.Tango.Preferences.Updates, Bounds.Interleave.Definitions, Algorithms.Tango.Definitions, Algorithms.Tango.Paths, Bounds.Interleave.Wilber, Bounds.Interleave.Transition.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Traces, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Combination.Definitions, Algorithms.GreedyASS.Combination.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Bounds.WeightedFinger.Definitions
theoremGeometric.GreedyASS.Combination.Deamortized.Results.policy_existspropext · Classical.choice · Quot.soundAlgorithms/GreedyASS/Combination/Deamortized/Abstract.lean:9
theorem policy_exists {saved : Tree} {fields : Nat → IntervalMetadata.Bounds} {oldData : Nat → Nat}    (p : Policy saved fields oldData) (nonempty : saved ≠ .nil) : Nonempty (Deamortized p) := …  RotationBST.Geometric.GreedyASS.Combination.deamortized_exists p nonempty
Statement reads only Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Models.Rotation, Models.Online, Models.Pointer.Lazy.Online.Definitions, Algorithms.Combination.Analysis.Definitions, Models.Pointer.Machine, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Shared.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Refinement.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Charges.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Snapshot.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, Algorithms.Combination.Rounds.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.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.Online.Replay.Definitions, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.State.Defs, Algorithms.Tango.State.Nesting.Defs, Algorithms.Tango.State, Algorithms.Tango.Preferences.Updates, Bounds.Interleave.Definitions, Algorithms.Tango.Definitions, Algorithms.Tango.Paths, Bounds.Interleave.Wilber, Bounds.Interleave.Transition.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Traces, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Combination.Definitions, Algorithms.GreedyASS.Combination.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Bounds.WeightedFinger.Definitions, Models.Pointer.Mirror.Definitions, Models.Labelled.Ordering.Definitions, Structures.PopTart.Definitions, Structures.PopTart.Mirror.Definitions, Structures.PopTart.Chocolate.Definitions, Structures.PopTart.Located.Definitions, Structures.HeavyPath.Definitions, Structures.HeavyPath.Paired.Definitions, Structures.HeavyPath.Paired.Substitution.Definitions, Structures.HeavyPath.Recursive.Definitions, Structures.HeavyPath.Finger.Definitions, Structures.PopTart.Chocolate.Top.Definitions, Structures.HeavyPath.Paired.Exposure.Definitions, Structures.HeavyPath.Recursive.History.Definitions, Structures.HeavyPath.Finger.Transfer.Definitions, Structures.HeavyPath.Finger.History.Definitions, Structures.HeavyPath.Finger.History.Simulation.Definitions, Structures.HeavyPath.Finger.History.Simulation.Requests.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Finger.Definitions, Structures.HeavyPath.Finger.History.Simulation.Minimum.Definitions, Algorithms.GreedyASS.Combination.Deamortized.Definitions
theoremGeometric.GreedyASS.Combination.Deamortized.Results.weights_competitivepropext · Classical.choice · Quot.soundAlgorithms/GreedyASS/Combination/Deamortized/Abstract.lean:31
theorem weights_competitive {saved : Tree} {fields : Nat → IntervalMetadata.Bounds} {oldData : Nat → Nat}    {p : Policy saved fields oldData} (d : Deamortized p) (start : Nat) (key : start < saved.size)    (w : Nat → ℝ) (positive : ∀ x < saved.size, 0 < w x)    {s t : Tree} {xs : List Nat} {k : Nat} (size : s.size = saved.size)    (execution : RotationBST.Execution s xs t k) {out : Deamortization.Scheduler.Output}    (completed : d.program xs = some out) :    (d.startup + out.costs.sum : ℝ) ≤ 16 * saved.size + 2480 *      (1307904 * min (184903680 * WeightedFinger.costFrom w start xs)        ((4 * Tango.Combination.linearChargeFactor (Tango.balanced saved.size) : Nat) * (xs.length + k : Nat)) +        3839872 * overhead saved) := …  RotationBST.Geometric.GreedyASS.Combination.Deamortized.weights_competitive d start key w positive size execution completed
Statement reads only Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Models.Rotation, Models.Online, Models.Pointer.Lazy.Online.Definitions, Algorithms.Combination.Analysis.Definitions, Models.Pointer.Machine, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Shared.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Refinement.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Charges.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Snapshot.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, Algorithms.Combination.Rounds.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.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.Online.Replay.Definitions, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.State.Defs, Algorithms.Tango.State.Nesting.Defs, Algorithms.Tango.State, Algorithms.Tango.Preferences.Updates, Bounds.Interleave.Definitions, Algorithms.Tango.Definitions, Algorithms.Tango.Paths, Bounds.Interleave.Wilber, Bounds.Interleave.Transition.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Traces, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Combination.Definitions, Algorithms.GreedyASS.Combination.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Bounds.WeightedFinger.Definitions, Models.Pointer.Mirror.Definitions, Models.Labelled.Ordering.Definitions, Structures.PopTart.Definitions, Structures.PopTart.Mirror.Definitions, Structures.PopTart.Chocolate.Definitions, Structures.PopTart.Located.Definitions, Structures.HeavyPath.Definitions, Structures.HeavyPath.Paired.Definitions, Structures.HeavyPath.Paired.Substitution.Definitions, Structures.HeavyPath.Recursive.Definitions, Structures.HeavyPath.Finger.Definitions, Structures.PopTart.Chocolate.Top.Definitions, Structures.HeavyPath.Paired.Exposure.Definitions, Structures.HeavyPath.Recursive.History.Definitions, Structures.HeavyPath.Finger.Transfer.Definitions, Structures.HeavyPath.Finger.History.Definitions, Structures.HeavyPath.Finger.History.Simulation.Definitions, Structures.HeavyPath.Finger.History.Simulation.Requests.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Finger.Definitions, Structures.HeavyPath.Finger.History.Simulation.Minimum.Definitions, Algorithms.GreedyASS.Combination.Deamortized.Definitions
36 definitions in 10 chapters · reading list

The first box is all that a reader who wants to confirm the result needs; the second restates its weighted form for a single weighting. The rest of the chapter has two parts. Section 31.1 explains the conventions of the statement, and compares it line by line with the paper’s Theorem 4.3. Section 31.2 gives a map of the proof. The later sections state every theorem of the four interface files Algorithms/Tango/Combination/Abstract.lean, Algorithms/GreedyASS/Combination/Abstract.lean, Algorithms/GreedyASS/Combination/Deamortized/Abstract.lean and their definitions, in the order of the proof: the two source workers (Section 31.3 and Section 31.4), the combined policy (Section 31.5), and its deamortization (Section 31.6).

This chapter needs almost nothing from the construction behind ComboBST and the deamortization. It uses their main theorems, as black boxes with explicit constants, and their interfaces. The reader who wants to know how a combined BST can switch between two algorithms without losing their bounds should read Section 29.1 to Section 29.4, and the reader who wants to know how amortized costs become worst-case costs should read Chapter 30.

31.1 Reading the statement

31.1.1 One program, chosen first

The quantifiers of Results.combined come in this order:

∀ saved  ∃ policy  ∃ program  ∀ X  ∀ p  ∀ offline.\forall\, \mathit{saved}\ \ \exists\, \mathit{policy}\ \ \exists\, \mathit{program}\ \ \forall\, X\ \ \forall\, p\ \ \forall\, \mathit{offline}.

The program is fixed before the requests, before the start key pp of the finger benchmark, and before the offline execution it is compared with. Like GreedyASS with respect to its weights, it never sees pp, the weights or the offline execution: they appear only in the bound. It is fixed after the initial tree saved, as an online algorithm knows its own tree, and after fields and oldData, the arbitrary initial contents of the per-node fields that the ComboBST snapshots use. The combined policy’s startup initializes those fields, and the proof builds the same two source workers whatever their initial contents.

The program is a function from whole request sequences to outputs (a Scheduler.Output: final state, instruction list, and one response cost per request). What makes it online is its causal field: the output on a prefix of a sequence is a prefix of the output on the whole sequence, both for the instruction list and for the cost list. Since every request has its own contiguous segment of instructions (Scheduler.ServedStream), the response to xjx_j is fixed once x1,…,xjx_1, \dots, x_j are known.

31.1.2 Conventions

  • What is counted. The program runs on the single-finger pointer machine of Chapter 7 and Chapter 10: every finger move and every rotation is one instruction. The response cost of a request is 11 plus the number of instructions in its segment, so every request costs at least 11, and the costs sum to mm plus the number of instructions. The computation that decides the instructions is not counted (see What is not claimed below).
  • Setup. The setup trace S≤16 nS \le 16\,n is paid once, before the first request, and belongs to no response. It is included in the total. The startup of ComboBST (initializing the node fields and saving the first snapshot) is not part of SS: it is paid inside the response costs, so it is subject to the worst-case bound, and it is included in the additive term 3839872⋅46225920 n3839872 \cdot 46225920\, n.
  • A unit per request. The weighted charge is 1+log⁡2(W[xj−1,xj]/min⁡(wxj−1,wxj))1 + \log_2(W[x_{j-1}, x_j] / \min(w_{x_{j-1}}, w_{x_j})), as in Section 25.3, and the competitive term charges m+Rm + R, not RR. Without the unit, a sequence that repeats one key would have benchmark 00 and no BST could meet it.
  • The finger benchmark. WF∗(p,X)\mathrm{WF}^*(p, X) starts from an explicit predecessor x0=px_0 = p, and the bound holds for every valid pp. It is an infimum of real numbers over the weightings positive on {0,…,n−1}\{0, \dots, n-1\}. A bound by the infimum implies the bound for every weighting; Results.weights_competitive states that form.
  • The competitive benchmark. RR is the number of rotations of any Execution serving XX: the rotate-to-root model of Chapter 3, where each access rotates the requested key to the root. Its initial tree is any tree on nn keys, not necessarily saved.
  • The doubly logarithmic factor. The paper’s log⁡log⁡n\log\log n appears as ⌈64(14L+6)⌉\lceil 64(14L + 6)\rceil with L=log⁡2(1+⌊log⁡2n⌋)L = \log_2(1 + \lfloor\log_2 n\rfloor), coming from Tango on the balanced reference tree Tree.balanced of height at most 1+⌊log⁡2n⌋1 + \lfloor\log_2 n\rfloor. Since ⌈64(14L+6)⌉≤896 L+385\lceil 64(14L + 6)\rceil \le 896\,L + 385, the factor is O(1+L)O(1 + L), and it is positive even when n=1n = 1, where L=0L = 0.
  • Constants. They are explicit witnesses, products of the constants of the ingredients, and nowhere near optimal: the coefficient of WF∗\mathrm{WF}^* in the total is about 6.0⋅10176.0 \cdot 10^{17}, and that of nn is about 4.4⋅10174.4 \cdot 10^{17}. Section 31.2 shows where each comes from.
  • Valid inputs. Requests and the start key must be less than nn, and saved must be nonempty. The empty sequence is allowed: its total is the setup alone.

31.1.3 Compared with Theorem 4.3

Theorem 4.3 of the paper combined
“There is a BST algorithm” For each nonempty initial tree, one combined policy and one causal deamortized program, on the single-finger pointer machine
WW ranges over positive weights, minimum over WW Infimum over weightings positive on the keys, not assumed attained
∑i=1mlog⁡(⋯ )\sum_{i=1}^m \log(\cdots), with s0s_0 unspecified ∑j=1m(1+log⁡2(⋯ ))\sum_{j=1}^m (1 + \log_2(\cdots)), with x0=px_0 = p for every p<np < n
OPT(S)\mathrm{OPT}(S) m+Rm + R for every rotation-model execution from every tree on nn keys
log⁡log⁡n\log\log n ⌈64(14L+6)⌉\lceil 64(14L + 6)\rceil, L=log⁡2(1+⌊log⁡2n⌋)L = \log_2(1 + \lfloor\log_2 n\rfloor)
O(n+min⁡(⋅,⋅))O(n + \min(\cdot, \cdot)) Explicit constants, setup included
Each search O(log⁡n)O(\log n) worst-case Each response <251+195log⁡2n< 251 + 195\log_2 n; setup ≤16 n\le 16\,n before the first request
Exactly one response per request, each visiting its key; the empty sequence included

The paper’s proof is the sentence before the theorem: deamortize and combine GreedyASS with Tango. Two remarks about how the library carries it out.

  • The source contracts are proved. ComboBST does not combine arbitrary algorithms. Its Theorem 3 assumes that each source has well-behaved amortized charges: bounded single accesses, an upper bound that holds on every contiguous piece of the sequence, and a linear restart allowance (Analysis.WellBehaved, Section 29.1). In the library’s ComboBST theorems these are hypotheses. Here they are theorems: Results.greedy_worker for GreedyASS and Results.linear_balanced_worker for Tango. So combined has no hypothesis beyond a nonempty initial tree.
  • Tango needed a new proof. The Tango analysis of Section 26.2 has a startup term (14L+6) n(14L + 6)\,n, of order nlog⁡log⁡nn\log\log n, because it charges each first setting of a preference like a preference change. Combined directly, it would give O(nlog⁡log⁡n+min⁡(⋅,⋅))O(n\log\log n + \min(\cdot, \cdot)), which is weaker than Theorem 4.3. The bottom-up preference updates of Section 26.3 bring Tango’s startup term down to O(n)O(n). The paper’s one-sentence proof does not address this point.

The sentence before Theorem 4.3 also mentions the working-set bound. Theorem 4.3 does not state it, and neither does the library.

31.1.4 What is not claimed

Not claimed
  • Private computation and storage. All bounds count BST instructions. The program decides its instructions by simulating the two sources, replaying their logs, and scheduling their work, and none of this computation is charged or bounded. Planning, instruction logs and snapshots are abstract resources of the model. The library does not claim the clauses of the source papers about auxiliary storage and execution on a finite-word machine: Theorem 7 of the deamortization paper, and the storage parts of Theorems 3 and 5 of the ComboBST paper.
  • Dynamic optimality. The competitive factor is O(log⁡log⁡n)O(\log\log n), as for Tango. Nothing here says that the program, GreedyASS or Tango is dynamically optimal.
  • Optimal constants. The constants witness the asymptotic statement; no effort was made to reduce them.

31.2 How the pieces fit

The proof has five steps, each a theorem of an earlier chapter, or a short theorem of this chapter.

 GreedyASS as a BST (Ch. 24)              bottom-up Tango on balanced n (Ch. 30)
 Performance.Results.bst                   BottomUp.policy, linear_run_bound
          │  replay adapter (x 64)                  │  replay adapter (x 64)
          ▼                                         ▼
 greedy_worker                             linear_balanced_worker
   allowance 46225920 n                      allowance 2816 n
   charges: lazy finger on any tree t        charges: interleave on balanced n
          └───────────────┬─────────────────────────┘
                          │  Worker.Pair, common allowance F = 46225920 n
                          ▼  ComboBST: Online.Replay.Results.combine (Ch. 33–36)
                  Policy   (Combination.Results.policy_exists)
                    cost ≤ 1307904 · min(...) + 2531968 F
                          │  lazy finger → weights (Ch. 15), interleave → OPT (Ch. 14)
                          ▼
                  weighted_competitive: 184903680 WF*, 4 c (m + R), 3839872 F
                          │  deamortization: Deamortization.Replay.Results.deamortize (Ch. 37)
                          ▼
                  Deamortized   (Deamortized.Results.policy_exists)
                    S ≤ 16 n,  Σ c ≤ 2480 · cost,  each c < 251 + 195 log₂ n
                          │
                          ▼
                  combined
  1. Two workers. ComboBST runs its sources as interruptible workers (Section 29.2): it executes them a bounded number of instructions at a time, and restores their trees from snapshots when it switches. Any online rotation-model algorithm becomes such a worker by the replay adapter Results.algorithms_well_behaved, which costs at most 6464 times the algorithm’s total cost. GreedyASS as a BST (Results.bst) costs at most 722280 LF∗(X)+96303 n722280\,\mathrm{LF}^*(X) + 96303\,n, and 64⋅722280=4622592064 \cdot 722280 = 46225920. This gives Results.greedy_worker, with allowance 46225920 n46225920\,n. The bottom-up Tango policy on the balanced reference (Results.balanced_policy) gives Results.linear_balanced_worker, with allowance 2816 n2816\,n.
  2. One policy. The two workers are paired (Results.well_behaved), with the larger allowance F=46225920 nF = 46225920\,n for both (Combination.overhead). ComboBST’s replay theorem Results.combine turns the pair into one prepared online policy, which Results.policy_exists packages as a Combination.Policy. Its cost bound comes from Results.minimum_bound with C0=1C_0 = 1, C1=20C_1 = 20 and restore factor 5757: the factor is 8384⋅(20+1+57)⋅2=13079048384 \cdot (20 + 1 + 57) \cdot 2 = 1307904, and the additive term is 8384⋅78⋅3 F+524⋅1088 n≤2531968 F8384 \cdot 78 \cdot 3\,F + 524 \cdot 1088\, n \le 2531968\,F.
  3. From fixed trees to the benchmarks. The GreedyASS charges are those of a lazy finger on a fixed reference tree, and hold for every tree; at the best tree they give LF∗(X)\mathrm{LF}^*(X), and the characterization of Chapter 15, LF∗(X)≤n+4 WF∗(p,X)\mathrm{LF}^*(X) \le n + 4\,\mathrm{WF}^*(p, X) (Results.characterization_root), gives the coefficient 4⋅46225920=1849036804 \cdot 46225920 = 184903680. The Tango charges are Wilber’s interleave bound on the balanced reference, and m+IB(X)≤4(m+R)m + \mathrm{IB}(X) \le 4(m + R) by Results.rotation_lower_bound (Chapter 17). The additive term becomes (2531968+1307904) F=3839872 F(2531968 + 1307904)\,F = 3839872\,F.
  4. Deamortization. The combined policy is again a replay planner. The deamortization theorem for planners Results.deamortize turns it into a program with setup at most 16 n16\,n, worst-case responses below 251+195log⁡2n251 + 195\log_2 n, and total response cost at most 12401240 times the planner’s run, which is at most twice the policy’s cost (Results.run_bound); hence 24802480.
  5. Closed form. The Tango coefficient is 4⋅linearChargeFactor(balanced n)≤8 ⌈64(14L+6)⌉4 \cdot \mathtt{linearChargeFactor}(\mathtt{balanced}\ n) \le 8\,\lceil 64(14L+6)\rceil (Results.balanced_linear_factor), which gives combined.

Only step 1 for Tango contains new mathematics: the linear startup of Section 26.3. The rest is arithmetic on the theorems of other chapters.

31.3 The GreedyASS worker

A worker for ComboBST is a Replay.Planner: a causal function that, from its current state and the current request, produces the pointer instructions that serve the request, certified legal and visiting the request (Section 29.2). Its state type here is List Nat × Pointer.Lazy.Online.State: the past requests and the state of the lazy pointer simulation Online.run of an online algorithm. A worker is well-behaved with allowance FF, constants C0,C1C_0, C_1 and charges ϕ\phi if, for every valid sequence (Analysis.WellBehaved):

  • every single access, from any reachable state, costs at most C1FC_1 F;
  • the whole sequence costs at most its total charge plus FF;
  • for every contiguous piece X[lo,hi)X[lo, hi), the total charge of the piece as a sequence of its own, plus FF, is at most C0C_0 times the charges of the same positions in the original sequence, plus C1FC_1 F.

The last condition is what lets ComboBST restart a source in the middle of a sequence. For the lazy-finger charges it holds because restarting a lazy finger at the root, instead of at the previous request, costs at most nn more, which the allowance pays (Results.lazyFinger_stable, Section 29.1).

Theorem (the GreedyASS worker). For every tree saved on nn keys there is one replay planner starting from saved that is well-behaved, with allowance 46225920 n46225920\,n, C0=1C_0 = 1 and C1=20C_1 = 20, for the lazy-finger charges 46225920⋅(LFt(x1…xi+1)−LFt(x1…xi))46225920 \cdot \bigl(\mathrm{LF}_t(x_1 \dots x_{i+1}) - \mathrm{LF}_t(x_1 \dots x_i)\bigr) of every tree tt on nn keys.

theoremGeometric.GreedyASS.Combination.Results.greedy_workerpropext · Classical.choice · Quot.soundAlgorithms/GreedyASS/Combination/Abstract.lean:14
/-- One fixed GreedyASS replay worker has the full combination contract forevery same-size lazy-finger reference tree. This is the GreedyASS input toTheorem 4.3; the Tango input and final deamortized combination are separate.Planning and instruction-log storage are abstract BST resources. -/theorem greedy_worker (saved : Tree) :    ∃ planner : Worker.Replay.Planner (List Nat × Pointer.Lazy.Online.State) saved,      ∀ t : Tree, t.size = saved.size →        Analysis.WellBehaved (Worker.Replay.worker planner) saved.size          (46225920 * saved.size) 1 20 (fun _ => Charges.lazyFinger 46225920 t) :=  RotationBST.Geometric.GreedyASS.Combination.greedy_worker saved
Statement reads only Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Models.Rotation, Models.Online, Models.Pointer.Lazy.Online.Definitions, Algorithms.Combination.Analysis.Definitions, Models.Pointer.Machine, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Shared.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Refinement.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Charges.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Snapshot.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, Algorithms.Combination.Rounds.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.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.Online.Replay.Definitions, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.State.Defs, Algorithms.Tango.State.Nesting.Defs, Algorithms.Tango.State, Algorithms.Tango.Preferences.Updates, Bounds.Interleave.Definitions, Algorithms.Tango.Definitions, Algorithms.Tango.Paths, Bounds.Interleave.Wilber, Bounds.Interleave.Transition.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Traces, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Combination.Definitions, Algorithms.GreedyASS.Combination.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Bounds.WeightedFinger.Definitions

The planner is chosen before the reference tree tt: one GreedyASS worker satisfies the contract for all trees at once. This is what lets the combined policy be chosen before the benchmark. The charges are Charges.lazyFinger, the increments of the root-start lazy-finger cost LazyFinger.cost, scaled by the constant of the GreedyASS simulation; they sum to 46225920 LFt(X)46225920\,\mathrm{LF}_t(X). The planner is the replay adapter applied to the GreedyASS algorithm of Results.bst, whose bound 722280 LF∗(X)+96303 n722280\,\mathrm{LF}^*(X) + 96303\,n multiplied by the adapter’s 6464 is below 46225920 LFt(X)+46225920 n46225920\,\mathrm{LF}_t(X) + 46225920\,n.

31.4 The Tango worker

31.4.1 The charge factors

Tango’s charges are Wilber’s interleave bound on a fixed reference tree, one unit per request plus one per preference change (Charges.interleave), scaled by a factor that pays for the work per change. The factor depends on the height hh of the reference.

defTango.Combination.chargeFactorpropext · Classical.choice · Quot.soundAlgorithms/Tango/Combination/Definitions/Abstract.lean:9
/-- Uniform simulation coefficient for the existing Tango upper bound.For a balanced reference it grows doubly logarithmically in its size.The corresponding initialization allowance is `chargeFactor reference * n`;the sharper bottom-up adapter below instead has a separate linear allowance. -/noncomputable def chargeFactor (reference : Tree) : Nat :=  ⌈64 * (14 * Real.logb 2 (height reference) + 6)⌉₊
defTango.Combination.linearChargeFactorpropext · Classical.choice · Quot.soundAlgorithms/Tango/Combination/Definitions/Abstract.lean:16
/-- Simulation coefficient for the bottom-up policy. Startup is accountedseparately by a constant times n, rather than by this coefficient times n. -/noncomputable def linearChargeFactor (reference : Tree) : Nat := 2 * chargeFactor reference

chargeFactor reference is ⌈64 (14log⁡2h+6)⌉\lceil 64\,(14 \log_2 h + 6)\rceil: the replay adapter’s factor 6464, times a coefficient that covers the O(log⁡h)O(\log h) cost of Tango per preference change, per first setting of a preference and per request in the analysis of Section 26.2. linearChargeFactor is twice that, for the bottom-up policy of Section 26.3, whose per-request coefficient 17log⁡2h+517\log_2 h + 5 is larger and whose startup is accounted separately.

The following five lemmas are the arithmetic facts about these factors that the proofs need: lower bounds by the real expressions, positivity, and the bounds for the balanced reference on nn keys, whose height is at most 1+⌊log⁡2n⌋1 + \lfloor\log_2 n\rfloor.

theoremTango.Combination.Results.factor_lowerpropext · Classical.choice · Quot.soundAlgorithms/Tango/Combination/Abstract.lean:13
theorem factor_lower (reference : Tree) :    64 * (14 * Real.logb 2 (height reference) + 6) ≤ (chargeFactor reference : ℝ) :=  RotationBST.Tango.Combination.factor_lower reference
theoremTango.Combination.Results.factor_pospropext · Classical.choice · Quot.soundAlgorithms/Tango/Combination/Abstract.lean:17
theorem factor_pos (reference : Tree) : 0 < chargeFactor reference :=  RotationBST.Tango.Combination.factor_pos reference
theoremTango.Combination.Results.balanced_factorpropext · Classical.choice · Quot.soundAlgorithms/Tango/Combination/Abstract.lean:20
theorem balanced_factor (n : Nat) : chargeFactor (balanced n) ≤    ⌈64 * (14 * Real.logb 2 (Nat.log2 n + 1) + 6)⌉₊ :=  RotationBST.Tango.Combination.balanced_factor n
theoremTango.Combination.Results.linear_factor_lowerpropext · Classical.choice · Quot.soundAlgorithms/Tango/Combination/Abstract.lean:49
theorem linear_factor_lower (reference : Tree) :    64 * (17 * Real.logb 2 (height reference) + 6) ≤ (linearChargeFactor reference : ℝ) :=  RotationBST.Tango.Combination.linear_factor_lower reference
theoremTango.Combination.Results.balanced_linear_factorpropext · Classical.choice · Quot.soundAlgorithms/Tango/Combination/Abstract.lean:53
theorem balanced_linear_factor (n : Nat) : linearChargeFactor (balanced n) ≤    2 * ⌈64 * (14 * Real.logb 2 (Nat.log2 n + 1) + 6)⌉₊ :=  RotationBST.Tango.Combination.balanced_linear_factor n

31.4.2 Workers with an nlog⁡log⁡nn \log\log n startup

The first adapter takes the top-down Tango policy of Section 26.2 as it is.

Theorem (Tango workers). For every Tango policy on a reference tree, and every tree saved of the same size nn, there is a replay planner starting from saved that is well-behaved, with allowance chargeFactor⋅n\mathtt{chargeFactor} \cdot n, C0=1C_0 = 1, C1=20C_1 = 20, and the interleave charges of the reference scaled by chargeFactor. The second version adds that the worker, restarted on any sequence XX, costs at most 4 chargeFactor (m+R)+chargeFactor⋅n4\,\mathtt{chargeFactor}\,(m + R) + \mathtt{chargeFactor} \cdot n for every offline execution with RR rotations. The third is the case of the balanced reference.

theoremTango.Combination.Results.workerpropext · Classical.choice · Quot.soundAlgorithms/Tango/Combination/Abstract.lean:24
theorem worker {reference : Tree} (p : Policy reference) (saved : Tree) (same : saved.size = reference.size) :    ∃ planner : Worker.Replay.Planner (List Nat × Pointer.Lazy.Online.State) saved,      Analysis.WellBehaved (Worker.Replay.worker planner) saved.size        (chargeFactor reference * saved.size) 1 20 (fun _ => Charges.interleave (chargeFactor reference) reference) :=  RotationBST.Tango.Combination.worker p saved same
theoremTango.Combination.Results.competitive_workerpropext · Classical.choice · Quot.soundAlgorithms/Tango/Combination/Abstract.lean:30
theorem competitive_worker {reference : Tree} (p : Policy reference) (saved : Tree) (same : saved.size = reference.size) :    ∃ planner : Worker.Replay.Planner (List Nat × Pointer.Lazy.Online.State) saved,      Analysis.WellBehaved (Worker.Replay.worker planner) saved.size        (chargeFactor reference * saved.size) 1 20 (fun _ => Charges.interleave (chargeFactor reference) reference) ∧      ∀ (s t : Tree) (xs : List Nat) (k : Nat), s.size = reference.size →        RotationBST.Execution s xs t k → ∀ side,          ∃ final cost, Worker.Requests (Worker.Replay.worker planner) side            ((Worker.Replay.worker planner).restart side) xs final cost ∧            (cost : ℝ) ≤ (4 * chargeFactor reference : Nat) * (xs.length + k : Nat) +              (chargeFactor reference * saved.size : Nat) :=  RotationBST.Tango.Combination.competitive_worker p saved same
theoremTango.Combination.Results.balanced_workerpropext · Classical.choice · Quot.soundAlgorithms/Tango/Combination/Abstract.lean:42
theorem balanced_worker (saved : Tree) :    ∃ planner : Worker.Replay.Planner (List Nat × Pointer.Lazy.Online.State) saved,      Analysis.WellBehaved (Worker.Replay.worker planner) saved.size        (chargeFactor (balanced saved.size) * saved.size) 1 20        (fun _ => Charges.interleave (chargeFactor (balanced saved.size)) (balanced saved.size)) :=  RotationBST.Tango.Combination.balanced_worker saved

These workers are not used for Theorem 4.3. Their allowance, chargeFactor⋅n\mathtt{chargeFactor} \cdot n, is Θ(nlog⁡log⁡n)\Theta(n\log\log n) for a balanced reference. The combination charges the common allowance FF a constant number of times (the term 3839872 F3839872\,F), so a superlinear FF would leave a superlinear additive term in the final bound.

31.4.3 The linear-startup worker

Theorem (the Tango worker with linear startup). For every tree saved on nn keys there is a replay planner starting from saved that is well-behaved, with allowance 2816 n2816\,n, C0=1C_0 = 1, C1=20C_1 = 20, and the interleave charges of Tree.balanced n scaled by linearChargeFactor.

theoremTango.Combination.Results.linear_balanced_workerpropext · Classical.choice · Quot.soundAlgorithms/Tango/Combination/Abstract.lean:57
theorem linear_balanced_worker (saved : Tree) :    ∃ planner : Worker.Replay.Planner (List Nat × Pointer.Lazy.Online.State) saved,      Analysis.WellBehaved (Worker.Replay.worker planner) saved.size        (2816 * saved.size) 1 20        (fun _ => Charges.interleave (linearChargeFactor (balanced saved.size)) (balanced saved.size)) :=  RotationBST.Tango.Combination.linear_balanced_worker saved

The planner is the replay adapter applied to the bottom-up Tango policy Tango.BottomUp.policy on the balanced reference. Its run costs at most the reference’s local initialization credit, plus 14log⁡2h+414\log_2 h + 4 per preference change, plus 17log⁡2h+517\log_2 h + 5 per request (Results.linear_run_bound). For the balanced reference the local credit is at most 42 n42\,n (Results.balanced_localAllowance), and the conversion to an online algorithm adds 2 n2\,n; the adapter’s factor 6464 turns 44 n44\,n into 2816 n2816\,n. Segment stability holds for interleave charges because a contiguous piece keeps every preference change internal to it (Results.interleave_stable).

31.5 The combined policy

31.5.1 The definitions

Both sources use the same state type, and one common allowance:

defGeometric.GreedyASS.Combination.SourceStateno axiomsAlgorithms/GreedyASS/Combination/Definitions/Abstract.lean:14
abbrev SourceState := List Nat × Pointer.Lazy.Online.State
defGeometric.GreedyASS.Combination.overheadno axiomsAlgorithms/GreedyASS/Combination/Definitions/Abstract.lean:16
/-- One linear restart allowance covers both the GreedyASS and bottom-upTango sources, independently of the doubly logarithmic competitive factor. -/noncomputable def overhead (saved : Tree) : Nat :=  46225920 * saved.size

F=46225920 nF = 46225920\,n is the larger of the two allowances. A well-behaved worker stays well-behaved when its allowance grows, so both sources can use FF.

defGeometric.GreedyASS.Combination.chargespropext · Classical.choice · Quot.soundAlgorithms/GreedyASS/Combination/Definitions/Abstract.lean:21
/-- The reference tree is an analysis parameter, not an algorithm input. -/noncomputable def charges (saved reference : Tree) : Analysis.Charges :=  fun side => if side then    Charges.interleave (Tango.Combination.linearChargeFactor (Tango.balanced saved.size)) (Tango.balanced saved.size)  else Charges.lazyFinger 46225920 reference
defGeometric.GreedyASS.Combination.pairModelpropext · Quot.soundAlgorithms/GreedyASS/Combination/Definitions/Abstract.lean:27
abbrev pairModel {saved : Tree} (left right : Worker.Replay.Planner SourceState saved) :=  Worker.Pair.model (Worker.Replay.model left) (Worker.Replay.model right) false false

charges saved reference assigns the GreedyASS lazy-finger charges on reference to side false and the Tango interleave charges on the balanced tree to side true. The reference tree is a parameter of the analysis only: the algorithm never sees it. pairModel is the pointer model of the paired worker Pair.worker: GreedyASS on side false, Tango on side true, each running its own side false.

Definition (the combined policy). A Policy saved fields oldData consists of the two source planners, the proof that their pair is well-behaved for every reference tree of size nn, a prepared ComboBST execution (Online.Prepared, Section 29.4) with round budget 21 F21\,F and restore allowance 57 F57\,F, and a replay implementation of it (Replay.Implementation).

structureGeometric.GreedyASS.Combination.Policypropext · Classical.choice · Quot.soundAlgorithms/GreedyASS/Combination/Definitions/Abstract.lean:30
/-- One certified combined policy. Both sources, their shared snapshot, andits interruptible replay implementation are fixed before choosing a benchmarkor request sequence. The source contract holds for every reference shape. -/structure Policy (saved : Tree) (fields : Nat → IntervalMetadata.Bounds) (oldData : Nat → Nat) where  left : Worker.Replay.Planner SourceState saved  right : Worker.Replay.Planner SourceState saved  supported : ∀ reference : Tree, reference.size = saved.size →    Analysis.WellBehaved (Worker.Pair.worker (Worker.Replay.worker left) (Worker.Replay.worker right) false false)      saved.size (overhead saved) 1 20 (charges saved reference)  prepared : Online.Prepared (pairModel left right) (Analysis.budget (overhead saved) 20)    (57 * overhead saved) fields oldData  implementation : Online.Replay.Implementation prepared

The field supported quantifies over the reference inside the structure, after the planners: once a policy is chosen, all the reference trees are compared with the same execution. fields and oldData are the initial contents of the node fields, which the prepared startup initializes (Section 39.1 and Section 39.2).

defGeometric.GreedyASS.Combination.Policy.costpropext · Classical.choice · Quot.soundAlgorithms/GreedyASS/Combination/Definitions/Abstract.lean:43
/-- The actual physical execution of the prepared policy, including startup. -/noncomputable def Policy.cost {saved : Tree} {fields : Nat → IntervalMetadata.Bounds} {oldData : Nat → Nat}    (p : Policy saved fields oldData) (xs : List Nat) : Nat :=  (Online.execute p.prepared none xs).2
defGeometric.GreedyASS.Combination.Policy.finalTreepropext · Classical.choice · Quot.soundAlgorithms/GreedyASS/Combination/Definitions/Abstract.lean:48
noncomputable def Policy.finalTree {saved : Tree} {fields : Nat → IntervalMetadata.Bounds} {oldData : Nat → Nat}    (p : Policy saved fields oldData) (xs : List Nat) : Tree :=  p.prepared.current (Online.execute p.prepared none xs).1

p.cost xs is the cost of the actual pointer execution Online.execute of the prepared policy on xs, started in its unprepared state none. It includes the preparation, which the first request triggers, and is 00 on the empty sequence. p.finalTree xs is the tree it ends in.

Theorem (one combined policy). For every nonempty tree saved and all initial node contents, a combined policy exists.

theoremGeometric.GreedyASS.Combination.Results.policy_existspropext · Classical.choice · Quot.soundAlgorithms/GreedyASS/Combination/Abstract.lean:25
theorem policy_exists (saved : Tree) (nonempty : saved ≠ .nil)    (fields : Nat → IntervalMetadata.Bounds) (oldData : Nat → Nat) :    Nonempty (Policy saved fields oldData) :=  RotationBST.Geometric.GreedyASS.Combination.policy_exists saved nonempty fields oldData
Statement reads only Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Models.Rotation, Models.Online, Models.Pointer.Lazy.Online.Definitions, Algorithms.Combination.Analysis.Definitions, Models.Pointer.Machine, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Shared.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Refinement.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Charges.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Snapshot.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, Algorithms.Combination.Rounds.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.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.Online.Replay.Definitions, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.State.Defs, Algorithms.Tango.State.Nesting.Defs, Algorithms.Tango.State, Algorithms.Tango.Preferences.Updates, Bounds.Interleave.Definitions, Algorithms.Tango.Definitions, Algorithms.Tango.Paths, Bounds.Interleave.Wilber, Bounds.Interleave.Transition.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Traces, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Combination.Definitions, Algorithms.GreedyASS.Combination.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Bounds.WeightedFinger.Definitions

31.5.2 Bounds for the policy

All the bounds below hold for one policy p, fixed before the reference tree, the start key, the weights and the offline execution.

Theorem (every fixed reference). For every tree tt on nn keys and every valid XX, the policy’s execution is a legal Pointer.Execution that serves XX from saved and ends in p.finalTree X, and its cost is at most

1307904min⁡(46225920 LFt(X),  linearChargeFactor (m+IB(X)))+2531968 F,1307904 \min\bigl(46225920\,\mathrm{LF}_t(X),\; \mathtt{linearChargeFactor}\,(m + \mathrm{IB}(X))\bigr) + 2531968\,F,

where LFt\mathrm{LF}_t is the root-start lazy-finger cost on tt and IB\mathrm{IB} is Wilber.interleave on the balanced reference. The second version replaces LFt(X)\mathrm{LF}_t(X) by its minimum LF∗(X)\mathrm{LF}^*(X) over all trees on nn keys.

theoremGeometric.GreedyASS.Combination.Results.tree_boundpropext · Classical.choice · Quot.soundAlgorithms/GreedyASS/Combination/Abstract.lean:30
theorem tree_bound {saved : Tree} {fields : Nat → IntervalMetadata.Bounds} {oldData : Nat → Nat}    (p : Policy saved fields oldData) (reference : Tree) (same : reference.size = saved.size)    (xs : List Nat) (valid : ∀ x ∈ xs, x < saved.size) :    Pointer.Execution saved xs (p.finalTree xs) (p.cost xs) ∧      (p.cost xs : ℝ) ≤ 1307904 * min (46225920 * (LazyFinger.cost reference xs : ℝ))        (Tango.Combination.linearChargeFactor (Tango.balanced saved.size) *          (xs.length + Wilber.interleave (Tango.balanced saved.size) xs : Nat)) +        2531968 * overhead saved :=  RotationBST.Geometric.GreedyASS.Combination.Policy.tree_bound p reference same xs valid
Statement reads only Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Models.Rotation, Models.Online, Models.Pointer.Lazy.Online.Definitions, Algorithms.Combination.Analysis.Definitions, Models.Pointer.Machine, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Shared.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Refinement.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Charges.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Snapshot.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, Algorithms.Combination.Rounds.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.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.Online.Replay.Definitions, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.State.Defs, Algorithms.Tango.State.Nesting.Defs, Algorithms.Tango.State, Algorithms.Tango.Preferences.Updates, Bounds.Interleave.Definitions, Algorithms.Tango.Definitions, Algorithms.Tango.Paths, Bounds.Interleave.Wilber, Bounds.Interleave.Transition.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Traces, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Combination.Definitions, Algorithms.GreedyASS.Combination.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Bounds.WeightedFinger.Definitions
theoremGeometric.GreedyASS.Combination.Results.optimal_boundpropext · Classical.choice · Quot.soundAlgorithms/GreedyASS/Combination/Abstract.lean:40
theorem optimal_bound {saved : Tree} {fields : Nat → IntervalMetadata.Bounds} {oldData : Nat → Nat}    (p : Policy saved fields oldData) (xs : List Nat) (valid : ∀ x ∈ xs, x < saved.size) :    Pointer.Execution saved xs (p.finalTree xs) (p.cost xs) ∧      (p.cost xs : ℝ) ≤ 1307904 * min (46225920 * (LazyFinger.optimalCost saved.size xs : ℝ))        (Tango.Combination.linearChargeFactor (Tango.balanced saved.size) *          (xs.length + Wilber.interleave (Tango.balanced saved.size) xs : Nat)) +        2531968 * overhead saved :=  RotationBST.Geometric.GreedyASS.Combination.Policy.optimal_bound p xs valid
Statement reads only Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Models.Rotation, Models.Online, Models.Pointer.Lazy.Online.Definitions, Algorithms.Combination.Analysis.Definitions, Models.Pointer.Machine, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Shared.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Refinement.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Charges.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Snapshot.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, Algorithms.Combination.Rounds.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.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.Online.Replay.Definitions, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.State.Defs, Algorithms.Tango.State.Nesting.Defs, Algorithms.Tango.State, Algorithms.Tango.Preferences.Updates, Bounds.Interleave.Definitions, Algorithms.Tango.Definitions, Algorithms.Tango.Paths, Bounds.Interleave.Wilber, Bounds.Interleave.Transition.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Traces, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Combination.Definitions, Algorithms.GreedyASS.Combination.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Bounds.WeightedFinger.Definitions

The minimum is attained (Results.optimal_attained), so optimal_bound is tree_bound at a minimizing tree.

Theorem (weighted and competitive). For every p<np < n, and every rotation-model execution with RR rotations that serves XX from a tree on nn keys, the policy’s cost is at most

1307904min⁡(184903680 WF∗(p,X),  4 linearChargeFactor (m+R))+3839872 F.1307904 \min\bigl(184903680\,\mathrm{WF}^*(p, X),\; 4\,\mathtt{linearChargeFactor}\,(m + R)\bigr) + 3839872\,F.

The second version has WFw(p,X)\mathrm{WF}_w(p, X), for every weighting ww positive on the keys, in place of the infimum.

theoremGeometric.GreedyASS.Combination.Results.weighted_competitivepropext · Classical.choice · Quot.soundAlgorithms/GreedyASS/Combination/Abstract.lean:58
theorem weighted_competitive {saved : Tree} {fields : Nat → IntervalMetadata.Bounds} {oldData : Nat → Nat}    (p : Policy saved fields oldData) (start : Nat) (key : start < saved.size)    {s t : Tree} {xs : List Nat} {k : Nat} (size : s.size = saved.size)    (execution : RotationBST.Execution s xs t k) :    (p.cost xs : ℝ) ≤ 1307904 * min        (184903680 * WeightedFinger.optimalCostFrom saved.size start xs)        ((4 * Tango.Combination.linearChargeFactor (Tango.balanced saved.size) : Nat) * (xs.length + k : Nat)) +      3839872 * overhead saved :=  RotationBST.Geometric.GreedyASS.Combination.Policy.weighted_competitive p start key size execution
Statement reads only Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Models.Rotation, Models.Online, Models.Pointer.Lazy.Online.Definitions, Algorithms.Combination.Analysis.Definitions, Models.Pointer.Machine, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Shared.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Refinement.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Charges.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Snapshot.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, Algorithms.Combination.Rounds.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.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.Online.Replay.Definitions, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.State.Defs, Algorithms.Tango.State.Nesting.Defs, Algorithms.Tango.State, Algorithms.Tango.Preferences.Updates, Bounds.Interleave.Definitions, Algorithms.Tango.Definitions, Algorithms.Tango.Paths, Bounds.Interleave.Wilber, Bounds.Interleave.Transition.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Traces, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Combination.Definitions, Algorithms.GreedyASS.Combination.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Bounds.WeightedFinger.Definitions
theoremGeometric.GreedyASS.Combination.Results.weights_competitivepropext · Classical.choice · Quot.soundAlgorithms/GreedyASS/Combination/Abstract.lean:68
theorem weights_competitive {saved : Tree} {fields : Nat → IntervalMetadata.Bounds} {oldData : Nat → Nat}    (p : Policy saved fields oldData) (start : Nat) (key : start < saved.size)    (w : Nat → ℝ) (positive : ∀ x < saved.size, 0 < w x)    {s t : Tree} {xs : List Nat} {k : Nat} (size : s.size = saved.size)    (execution : RotationBST.Execution s xs t k) :    (p.cost xs : ℝ) ≤ 1307904 * min        (184903680 * WeightedFinger.costFrom w start xs)        ((4 * Tango.Combination.linearChargeFactor (Tango.balanced saved.size) : Nat) * (xs.length + k : Nat)) +      3839872 * overhead saved :=  RotationBST.Geometric.GreedyASS.Combination.Policy.weights_competitive p start key w positive size execution
Statement reads only Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Models.Rotation, Models.Online, Models.Pointer.Lazy.Online.Definitions, Algorithms.Combination.Analysis.Definitions, Models.Pointer.Machine, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Shared.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Refinement.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Charges.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Snapshot.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, Algorithms.Combination.Rounds.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.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.Online.Replay.Definitions, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.State.Defs, Algorithms.Tango.State.Nesting.Defs, Algorithms.Tango.State, Algorithms.Tango.Preferences.Updates, Bounds.Interleave.Definitions, Algorithms.Tango.Definitions, Algorithms.Tango.Paths, Bounds.Interleave.Wilber, Bounds.Interleave.Transition.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Traces, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Combination.Definitions, Algorithms.GreedyASS.Combination.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Bounds.WeightedFinger.Definitions

The validity of XX is not a hypothesis here: it follows from the offline execution. This is the combined bound of Theorem 4.3, with linear startup but with amortized costs.

Theorem (the policy is again a worker). For every reference tree and every choice select of which source’s charges to put on each side, the replay worker of the combined policy is well-behaved with C0=1C_0 = 1, C1=21C_1 = 21, allowance overheadFactor 1 20 57 ⋅ F\cdot\,F, and the selected charges scaled by chargeFactor 1 20 57 (Replay.overheadFactor, Replay.chargeFactor).

theoremGeometric.GreedyASS.Combination.Results.worker_boundpropext · Classical.choice · Quot.soundAlgorithms/GreedyASS/Combination/Abstract.lean:49
theorem worker_bound {saved : Tree} {fields : Nat → IntervalMetadata.Bounds} {oldData : Nat → Nat}    (p : Policy saved fields oldData) (reference : Tree) (same : reference.size = saved.size)    (select : Bool → Bool) :    Analysis.WellBehaved (Worker.Replay.worker p.implementation.planner) saved.size      (Online.Replay.overheadFactor 1 20 57 * overhead saved) 1 21      (Online.Replay.scaledCharges (Online.Replay.chargeFactor 1 20 57)        (fun side => charges saved reference (select side))) :=  RotationBST.Geometric.GreedyASS.Combination.Policy.worker_bound p reference same select
Statement reads only Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Models.Rotation, Models.Online, Models.Pointer.Lazy.Online.Definitions, Algorithms.Combination.Analysis.Definitions, Models.Pointer.Machine, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Shared.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Refinement.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Charges.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Snapshot.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, Algorithms.Combination.Rounds.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.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.Online.Replay.Definitions, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.State.Defs, Algorithms.Tango.State.Nesting.Defs, Algorithms.Tango.State, Algorithms.Tango.Preferences.Updates, Bounds.Interleave.Definitions, Algorithms.Tango.Definitions, Algorithms.Tango.Paths, Bounds.Interleave.Wilber, Bounds.Interleave.Transition.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Traces, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Combination.Definitions, Algorithms.GreedyASS.Combination.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Bounds.WeightedFinger.Definitions

So the combined policy can itself enter a further combination, with either source’s guarantee. Theorem 4.3 does not need this.

31.6 Deamortizing the policy

31.6.1 The deamortized program

Definition (the deamortized program). For a combined policy p, a Deamortized p consists of a prepared tree initial, a setup cost startup and a program from request sequences to scheduler outputs, with:

  • setup, a legal Pointer.Trace of cost startup from saved to initial, both with the finger at the root, and setup_bound, startup≤16 n\mathtt{startup} \le 16\,n;
  • correct: on every valid sequence the program returns an output whose instructions replay legally from initial (Multifinger.replay); they form a Scheduler.ServedStream, one contiguous segment per request visiting it, with response cost 1+1 + {}segment length; they form a single-finger Multifinger.Execution serving the sequence at cost m+m + {}(number of instructions); there is one cost per request, summing to m+m + {}(number of instructions) and to at most 24802480 times p.cost; and each cost is below 251+195log⁡2n251 + 195\log_2 n;
  • causal: the output on a prefix has a prefix of the instructions and a prefix of the costs.
structureGeometric.GreedyASS.Combination.Deamortizedpropext · Classical.choice · Quot.soundAlgorithms/GreedyASS/Combination/Deamortized/Definitions/Abstract.lean:9
/-- A fixed physical program with exact per-request costs. Setup is paid once,before the sequence. Its choices precede all weights and offline comparators.The simulation bounds abstract BST instructions, not private computation. -/structure Deamortized {saved : Tree} {fields : Nat → IntervalMetadata.Bounds} {oldData : Nat → Nat}    (p : Policy saved fields oldData) where  initial : Tree  startup : Nat  program : List Nat → Option Deamortization.Scheduler.Output  setup : Pointer.Trace ⟨saved, []⟩ ⟨initial, []⟩ startup  setup_bound : startup ≤ 16 * saved.size  correct : ∀ keys, (∀ x ∈ keys, x < saved.size) →    ∃ out, program keys = some out ∧      Multifinger.replay out.instructions ⟨initial, []⟩ = some out.state.cursor ∧      Deamortization.Scheduler.ServedStream ⟨initial, []⟩ keys out.state.cursor out.instructions out.costs ∧      Multifinger.Execution (Deamortization.Scheduler.cursorState ⟨initial, []⟩) keys        (Deamortization.Scheduler.cursorState out.state.cursor) (keys.length + out.instructions.length) ∧      out.costs.length = keys.length ∧ out.costs.sum = keys.length + out.instructions.length ∧      out.costs.sum ≤ 2480 * p.cost keys ∧      ∀ cost ∈ out.costs, (cost : ℝ) < 251 + 195 * Real.logb 2 saved.size  causal : ∀ xs ys out, program (xs ++ ys) = some out →    ∃ first, program xs = some first ∧ first.instructions <+: out.instructions ∧      first.costs <+: out.costs

The structure records the guarantees of the deamortization theorem of Chapter 30 for this one source. The comparison with p.cost is the only field that mentions the policy. The worst-case bound depends only on nn, not on the policy.

Theorem (the deamortized program exists). Every combined policy on a nonempty tree has a deamortized program.

theoremGeometric.GreedyASS.Combination.Deamortized.Results.policy_existspropext · Classical.choice · Quot.soundAlgorithms/GreedyASS/Combination/Deamortized/Abstract.lean:9
theorem policy_exists {saved : Tree} {fields : Nat → IntervalMetadata.Bounds} {oldData : Nat → Nat}    (p : Policy saved fields oldData) (nonempty : saved ≠ .nil) : Nonempty (Deamortized p) :=  RotationBST.Geometric.GreedyASS.Combination.deamortized_exists p nonempty
Statement reads only Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Models.Rotation, Models.Online, Models.Pointer.Lazy.Online.Definitions, Algorithms.Combination.Analysis.Definitions, Models.Pointer.Machine, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Shared.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Refinement.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Charges.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Snapshot.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, Algorithms.Combination.Rounds.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.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.Online.Replay.Definitions, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.State.Defs, Algorithms.Tango.State.Nesting.Defs, Algorithms.Tango.State, Algorithms.Tango.Preferences.Updates, Bounds.Interleave.Definitions, Algorithms.Tango.Definitions, Algorithms.Tango.Paths, Bounds.Interleave.Wilber, Bounds.Interleave.Transition.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Traces, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Combination.Definitions, Algorithms.GreedyASS.Combination.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Bounds.WeightedFinger.Definitions, Models.Pointer.Mirror.Definitions, Models.Labelled.Ordering.Definitions, Structures.PopTart.Definitions, Structures.PopTart.Mirror.Definitions, Structures.PopTart.Chocolate.Definitions, Structures.PopTart.Located.Definitions, Structures.HeavyPath.Definitions, Structures.HeavyPath.Paired.Definitions, Structures.HeavyPath.Paired.Substitution.Definitions, Structures.HeavyPath.Recursive.Definitions, Structures.HeavyPath.Finger.Definitions, Structures.PopTart.Chocolate.Top.Definitions, Structures.HeavyPath.Paired.Exposure.Definitions, Structures.HeavyPath.Recursive.History.Definitions, Structures.HeavyPath.Finger.Transfer.Definitions, Structures.HeavyPath.Finger.History.Definitions, Structures.HeavyPath.Finger.History.Simulation.Definitions, Structures.HeavyPath.Finger.History.Simulation.Requests.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Finger.Definitions, Structures.HeavyPath.Finger.History.Simulation.Minimum.Definitions, Algorithms.GreedyASS.Combination.Deamortized.Definitions

The proof applies Results.deamortize to the policy’s replay planner. Its total is at most 12401240 times the planner’s run, and the planner’s run costs at most twice the policy’s execution (Results.run_bound).

31.6.2 Bounds for the program

Theorem (setup included). On every valid sequence, the setup plus all response costs is at most 16 n+2480 p.cost(X)16\,n + 2480\,\mathtt{p.cost}(X).

theoremGeometric.GreedyASS.Combination.Deamortized.Results.total_boundpropext · Classical.choice · Quot.soundAlgorithms/GreedyASS/Combination/Deamortized/Abstract.lean:13
theorem total_bound {saved : Tree} {fields : Nat → IntervalMetadata.Bounds} {oldData : Nat → Nat}    {p : Policy saved fields oldData} (d : Deamortized p) {keys : List Nat}    (valid : ∀ x ∈ keys, x < saved.size) {out : Deamortization.Scheduler.Output}    (completed : d.program keys = some out) :    d.startup + out.costs.sum ≤ 16 * saved.size + 2480 * p.cost keys :=  RotationBST.Geometric.GreedyASS.Combination.Deamortized.total_bound d valid completed
Statement reads only Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Models.Rotation, Models.Online, Models.Pointer.Lazy.Online.Definitions, Algorithms.Combination.Analysis.Definitions, Models.Pointer.Machine, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Shared.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Refinement.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Charges.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Snapshot.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, Algorithms.Combination.Rounds.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.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.Online.Replay.Definitions, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.State.Defs, Algorithms.Tango.State.Nesting.Defs, Algorithms.Tango.State, Algorithms.Tango.Preferences.Updates, Bounds.Interleave.Definitions, Algorithms.Tango.Definitions, Algorithms.Tango.Paths, Bounds.Interleave.Wilber, Bounds.Interleave.Transition.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Traces, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Combination.Definitions, Algorithms.GreedyASS.Combination.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Bounds.WeightedFinger.Definitions, Models.Pointer.Mirror.Definitions, Models.Labelled.Ordering.Definitions, Structures.PopTart.Definitions, Structures.PopTart.Mirror.Definitions, Structures.PopTart.Chocolate.Definitions, Structures.PopTart.Located.Definitions, Structures.HeavyPath.Definitions, Structures.HeavyPath.Paired.Definitions, Structures.HeavyPath.Paired.Substitution.Definitions, Structures.HeavyPath.Recursive.Definitions, Structures.HeavyPath.Finger.Definitions, Structures.PopTart.Chocolate.Top.Definitions, Structures.HeavyPath.Paired.Exposure.Definitions, Structures.HeavyPath.Recursive.History.Definitions, Structures.HeavyPath.Finger.Transfer.Definitions, Structures.HeavyPath.Finger.History.Definitions, Structures.HeavyPath.Finger.History.Simulation.Definitions, Structures.HeavyPath.Finger.History.Simulation.Requests.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Finger.Definitions, Structures.HeavyPath.Finger.History.Simulation.Minimum.Definitions, Algorithms.GreedyASS.Combination.Deamortized.Definitions

Theorem (weighted and competitive, deamortized). For every p<np < n and every rotation-model execution with RR rotations that serves XX from a tree on nn keys, the setup plus all response costs is at most

16 n+2480(1307904min⁡(184903680 WF∗(p,X),  4 linearChargeFactor (m+R))+3839872 F).16\,n + 2480\Bigl(1307904 \min\bigl(184903680\,\mathrm{WF}^*(p, X),\; 4\,\mathtt{linearChargeFactor}\,(m + R)\bigr) + 3839872\,F\Bigr).

The second version has WFw(p,X)\mathrm{WF}_w(p, X), for every weighting ww positive on the keys, in place of the infimum.

theoremGeometric.GreedyASS.Combination.Deamortized.Results.weighted_competitivepropext · Classical.choice · Quot.soundAlgorithms/GreedyASS/Combination/Deamortized/Abstract.lean:20
theorem weighted_competitive {saved : Tree} {fields : Nat → IntervalMetadata.Bounds} {oldData : Nat → Nat}    {p : Policy saved fields oldData} (d : Deamortized p) (start : Nat) (key : start < saved.size)    {s t : Tree} {xs : List Nat} {k : Nat} (size : s.size = saved.size)    (execution : RotationBST.Execution s xs t k) {out : Deamortization.Scheduler.Output}    (completed : d.program xs = some out) :    (d.startup + out.costs.sum : ℝ) ≤ 16 * saved.size + 2480 *      (1307904 * min (184903680 * WeightedFinger.optimalCostFrom saved.size start xs)        ((4 * Tango.Combination.linearChargeFactor (Tango.balanced saved.size) : Nat) * (xs.length + k : Nat)) +        3839872 * overhead saved) :=  RotationBST.Geometric.GreedyASS.Combination.Deamortized.weighted_competitive d start key size execution completed
Statement reads only Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Models.Rotation, Models.Online, Models.Pointer.Lazy.Online.Definitions, Algorithms.Combination.Analysis.Definitions, Models.Pointer.Machine, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Shared.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Refinement.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Charges.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Snapshot.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, Algorithms.Combination.Rounds.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.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.Online.Replay.Definitions, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.State.Defs, Algorithms.Tango.State.Nesting.Defs, Algorithms.Tango.State, Algorithms.Tango.Preferences.Updates, Bounds.Interleave.Definitions, Algorithms.Tango.Definitions, Algorithms.Tango.Paths, Bounds.Interleave.Wilber, Bounds.Interleave.Transition.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Traces, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Combination.Definitions, Algorithms.GreedyASS.Combination.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Bounds.WeightedFinger.Definitions, Models.Pointer.Mirror.Definitions, Models.Labelled.Ordering.Definitions, Structures.PopTart.Definitions, Structures.PopTart.Mirror.Definitions, Structures.PopTart.Chocolate.Definitions, Structures.PopTart.Located.Definitions, Structures.HeavyPath.Definitions, Structures.HeavyPath.Paired.Definitions, Structures.HeavyPath.Paired.Substitution.Definitions, Structures.HeavyPath.Recursive.Definitions, Structures.HeavyPath.Finger.Definitions, Structures.PopTart.Chocolate.Top.Definitions, Structures.HeavyPath.Paired.Exposure.Definitions, Structures.HeavyPath.Recursive.History.Definitions, Structures.HeavyPath.Finger.Transfer.Definitions, Structures.HeavyPath.Finger.History.Definitions, Structures.HeavyPath.Finger.History.Simulation.Definitions, Structures.HeavyPath.Finger.History.Simulation.Requests.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Finger.Definitions, Structures.HeavyPath.Finger.History.Simulation.Minimum.Definitions, Algorithms.GreedyASS.Combination.Deamortized.Definitions
theoremGeometric.GreedyASS.Combination.Deamortized.Results.weights_competitivepropext · Classical.choice · Quot.soundAlgorithms/GreedyASS/Combination/Deamortized/Abstract.lean:31
theorem weights_competitive {saved : Tree} {fields : Nat → IntervalMetadata.Bounds} {oldData : Nat → Nat}    {p : Policy saved fields oldData} (d : Deamortized p) (start : Nat) (key : start < saved.size)    (w : Nat → ℝ) (positive : ∀ x < saved.size, 0 < w x)    {s t : Tree} {xs : List Nat} {k : Nat} (size : s.size = saved.size)    (execution : RotationBST.Execution s xs t k) {out : Deamortization.Scheduler.Output}    (completed : d.program xs = some out) :    (d.startup + out.costs.sum : ℝ) ≤ 16 * saved.size + 2480 *      (1307904 * min (184903680 * WeightedFinger.costFrom w start xs)        ((4 * Tango.Combination.linearChargeFactor (Tango.balanced saved.size) : Nat) * (xs.length + k : Nat)) +        3839872 * overhead saved) :=  RotationBST.Geometric.GreedyASS.Combination.Deamortized.weights_competitive d start key w positive size execution completed
Statement reads only Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Models.Rotation, Models.Online, Models.Pointer.Lazy.Online.Definitions, Algorithms.Combination.Analysis.Definitions, Models.Pointer.Machine, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Shared.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Refinement.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Charges.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Snapshot.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, Algorithms.Combination.Rounds.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.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.Online.Replay.Definitions, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.State.Defs, Algorithms.Tango.State.Nesting.Defs, Algorithms.Tango.State, Algorithms.Tango.Preferences.Updates, Bounds.Interleave.Definitions, Algorithms.Tango.Definitions, Algorithms.Tango.Paths, Bounds.Interleave.Wilber, Bounds.Interleave.Transition.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Traces, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Combination.Definitions, Algorithms.GreedyASS.Combination.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Bounds.WeightedFinger.Definitions, Models.Pointer.Mirror.Definitions, Models.Labelled.Ordering.Definitions, Structures.PopTart.Definitions, Structures.PopTart.Mirror.Definitions, Structures.PopTart.Chocolate.Definitions, Structures.PopTart.Located.Definitions, Structures.HeavyPath.Definitions, Structures.HeavyPath.Paired.Definitions, Structures.HeavyPath.Paired.Substitution.Definitions, Structures.HeavyPath.Recursive.Definitions, Structures.HeavyPath.Finger.Definitions, Structures.PopTart.Chocolate.Top.Definitions, Structures.HeavyPath.Paired.Exposure.Definitions, Structures.HeavyPath.Recursive.History.Definitions, Structures.HeavyPath.Finger.Transfer.Definitions, Structures.HeavyPath.Finger.History.Definitions, Structures.HeavyPath.Finger.History.Simulation.Definitions, Structures.HeavyPath.Finger.History.Simulation.Requests.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Finger.Definitions, Structures.HeavyPath.Finger.History.Simulation.Minimum.Definitions, Algorithms.GreedyASS.Combination.Deamortized.Definitions

Theorem (closed form). The same, with 4 linearChargeFactor4\,\mathtt{linearChargeFactor} replaced by 8 ⌈64(14L+6)⌉8\,\lceil 64(14L + 6)\rceil, L=log⁡2(1+⌊log⁡2n⌋)L = \log_2(1 + \lfloor\log_2 n\rfloor), and FF by 46225920 n46225920\,n.

theoremGeometric.GreedyASS.Combination.Deamortized.Results.linear_weighted_competitivepropext · Classical.choice · Quot.soundAlgorithms/GreedyASS/Combination/Deamortized/Abstract.lean:43
theorem linear_weighted_competitive {saved : Tree} {fields : Nat → IntervalMetadata.Bounds}    {oldData : Nat → Nat} {p : Policy saved fields oldData} (d : Deamortized p)    (start : Nat) (key : start < saved.size)    {s t : Tree} {xs : List Nat} {k : Nat} (size : s.size = saved.size)    (execution : RotationBST.Execution s xs t k) {out : Deamortization.Scheduler.Output}    (completed : d.program xs = some out) :    (d.startup + out.costs.sum : ℝ) ≤ 16 * saved.size + 2480 *      (1307904 * min (184903680 * WeightedFinger.optimalCostFrom saved.size start xs)        ((8 * ⌈64 * (14 * Real.logb 2 (Nat.log2 saved.size + 1) + 6)⌉₊ : Nat) * (xs.length + k : Nat)) +        3839872 * (46225920 * saved.size : Nat)) :=  RotationBST.Geometric.GreedyASS.Combination.Deamortized.linear_weighted_competitive d start key size execution completed
Statement reads only Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Models.Rotation, Models.Online, Models.Pointer.Lazy.Online.Definitions, Algorithms.Combination.Analysis.Definitions, Models.Pointer.Machine, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Shared.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Refinement.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Charges.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Snapshot.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, Algorithms.Combination.Rounds.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.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.Online.Replay.Definitions, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.State.Defs, Algorithms.Tango.State.Nesting.Defs, Algorithms.Tango.State, Algorithms.Tango.Preferences.Updates, Bounds.Interleave.Definitions, Algorithms.Tango.Definitions, Algorithms.Tango.Paths, Bounds.Interleave.Wilber, Bounds.Interleave.Transition.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Traces, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Combination.Definitions, Algorithms.GreedyASS.Combination.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Bounds.WeightedFinger.Definitions, Models.Pointer.Mirror.Definitions, Models.Labelled.Ordering.Definitions, Structures.PopTart.Definitions, Structures.PopTart.Mirror.Definitions, Structures.PopTart.Chocolate.Definitions, Structures.PopTart.Located.Definitions, Structures.HeavyPath.Definitions, Structures.HeavyPath.Paired.Definitions, Structures.HeavyPath.Paired.Substitution.Definitions, Structures.HeavyPath.Recursive.Definitions, Structures.HeavyPath.Finger.Definitions, Structures.PopTart.Chocolate.Top.Definitions, Structures.HeavyPath.Paired.Exposure.Definitions, Structures.HeavyPath.Recursive.History.Definitions, Structures.HeavyPath.Finger.Transfer.Definitions, Structures.HeavyPath.Finger.History.Definitions, Structures.HeavyPath.Finger.History.Simulation.Definitions, Structures.HeavyPath.Finger.History.Simulation.Requests.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Finger.Definitions, Structures.HeavyPath.Finger.History.Simulation.Minimum.Definitions, Algorithms.GreedyASS.Combination.Deamortized.Definitions

Finally, the theorem of the headline puts the pieces together: a policy and a program exist, and for every valid sequence the program’s output serves it with one response per request, each below 251+195log⁡2n251 + 195\log_2 n, and the closed-form bound holds for every start key and every offline execution.

theoremGeometric.GreedyASS.Combination.Deamortized.Results.combinedpropext · Classical.choice · Quot.soundAlgorithms/GreedyASS/Combination/Deamortized/Abstract.lean:55
theorem combined (saved : Tree) (nonempty : saved ≠ .nil)    (fields : Nat → IntervalMetadata.Bounds) (oldData : Nat → Nat) :    ∃ p : Policy saved fields oldData, ∃ d : Deamortized p,      ∀ xs : List Nat, (∀ x ∈ xs, x < saved.size) →        ∃ out, d.program xs = some out ∧          Deamortization.Scheduler.ServedStream ⟨d.initial, []⟩ xs out.state.cursor out.instructions out.costs ∧          out.costs.length = xs.length ∧ out.costs.sum = xs.length + out.instructions.length ∧          (∀ cost ∈ out.costs, (cost : ℝ) < 251 + 195 * Real.logb 2 saved.size) ∧          ∀ (start : Nat), start < saved.size → ∀ (s t : Tree) (k : Nat), s.size = saved.size →            RotationBST.Execution s xs t k →              (d.startup + out.costs.sum : ℝ) ≤ 16 * saved.size + 2480 *                (1307904 * min (184903680 * WeightedFinger.optimalCostFrom saved.size start xs)                  ((8 * ⌈64 * (14 * Real.logb 2 (Nat.log2 saved.size + 1) + 6)⌉₊ : Nat) * (xs.length + k : Nat)) +                  3839872 * (46225920 * saved.size : Nat)) :=  RotationBST.Geometric.GreedyASS.Combination.combined saved nonempty fields oldData
Statement reads only Bounds.StaticTree.Definitions, Bounds.LazyFinger.Definitions, Models.Rotation, Models.Online, Models.Pointer.Lazy.Online.Definitions, Algorithms.Combination.Analysis.Definitions, Models.Pointer.Machine, Models.Multifinger.Program.Definitions, Models.Multifinger.Program.Replay.Definitions, Models.Labelled.Cursor.Definitions, Models.Labelled.Cursor.Map.Definitions, Models.Labelled.Metadata.Definitions, Models.Labelled.Intervals.Definitions, Structures.TreeBuffer.Nodes.Definitions, Structures.TreeBuffer.Shared.Definitions, Algorithms.Combination.Controller.Definitions, Algorithms.Combination.Worker.Definitions, Algorithms.Combination.Refinement.Definitions, Algorithms.Combination.Refinement.Visits.Definitions, Algorithms.Combination.Worker.Replay.Definitions, Algorithms.Combination.Worker.Replay.Model, Algorithms.Combination.Charges.Definitions, Models.Labelled.Intervals.Initialization.Definitions, Structures.TreeBuffer.Nodes.Initialization.Definitions, Structures.TreeBuffer.Cells.Definitions, Structures.TreeBuffer.Snapshot.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, Algorithms.Combination.Rounds.Definitions, Models.Multifinger.Definitions, Structures.TreeBuffer.Shared.Requests.Definitions, Structures.TreeBuffer.Shared.Erasure.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.Online.Replay.Definitions, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.State.Defs, Algorithms.Tango.State.Nesting.Defs, Algorithms.Tango.State, Algorithms.Tango.Preferences.Updates, Bounds.Interleave.Definitions, Algorithms.Tango.Definitions, Algorithms.Tango.Paths, Bounds.Interleave.Wilber, Bounds.Interleave.Transition.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Traces, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Combination.Definitions, Algorithms.GreedyASS.Combination.Definitions, Algorithms.Combination.Worker.Pair.Definitions, Bounds.WeightedFinger.Definitions, Models.Pointer.Mirror.Definitions, Models.Labelled.Ordering.Definitions, Structures.PopTart.Definitions, Structures.PopTart.Mirror.Definitions, Structures.PopTart.Chocolate.Definitions, Structures.PopTart.Located.Definitions, Structures.HeavyPath.Definitions, Structures.HeavyPath.Paired.Definitions, Structures.HeavyPath.Paired.Substitution.Definitions, Structures.HeavyPath.Recursive.Definitions, Structures.HeavyPath.Finger.Definitions, Structures.PopTart.Chocolate.Top.Definitions, Structures.HeavyPath.Paired.Exposure.Definitions, Structures.HeavyPath.Recursive.History.Definitions, Structures.HeavyPath.Finger.Transfer.Definitions, Structures.HeavyPath.Finger.History.Definitions, Structures.HeavyPath.Finger.History.Simulation.Definitions, Structures.HeavyPath.Finger.History.Simulation.Requests.Definitions, Algorithms.Deamortization.Scheduler.Definitions, Algorithms.Deamortization.Finger.Definitions, Structures.HeavyPath.Finger.History.Simulation.Minimum.Definitions, Algorithms.GreedyASS.Combination.Deamortized.Definitions

The statement omits the replay and single-finger execution clauses of correct, and the causality, which are fields of the program d. Since d is the existential witness, those fields hold for the same program.