Chapter 26 · Tango trees · Section 26.3Tango with linear startup
The Tango bound of Section 26.2 has two terms: a factor on the cost of the best offline execution, and an additive startup term , where . The startup term pays for the first time each reference node receives a preference, so it is . That is harmless for competitiveness, but not when Tango is used as one ingredient of a larger bound. Theorem 4.3 of Iacono and Langerman combines GreedyASS with Tango and claims a total cost of
with an additive , not . When the optimum is small, an startup on the Tango side would dominate. So the combination needs a Tango whose startup is linear.
This section proves that bound. The algorithm is the Tango of Section 26.2 with one change: within each request, the preference updates are applied from the bottom of the search path upward instead of from the top down. With that order, almost every first setting is paid by a credit local to the node’s reference subtree, and the credits of a balanced reference tree sum to at most .
For every there is a Tango policy for the balanced reference tree on keys, fixed before any request is known, whose step applies each request’s preference updates bottom-up, with the following property. Let be any sequence of requests, and take any offline execution that serves with rotations from any tree on keys. Then the policy, run from its reference tree, serves with total cost (rotations plus one per request) at most
Compared with Section 26.2, the startup term of the policy becomes , and the factor becomes .
A policy starts from its own reference tree. The second theorem turns any policy into an online algorithm in the sense of Chapter 5 that performs exactly the policy’s rotations when it starts from the reference tree. From any other tree of the same size it costs at most , plus the policy’s rotations, plus . Combining the two gives an online BST, chosen before the initial tree and the requests, of total cost at most from every initial tree on keys, against every offline execution from that tree. The library states this combination as one theorem, exists_competitive_linear.
In Lean, the policy is a Tango.Policy whose step is BottomUp.serve, its cost is that of Policy.run, the comparator is any Execution, and the online algorithm is an Algorithm with cost Algorithm.totalCost.
The Lean statements
theorem balanced_policy (n : Nat) : ∃ p : Policy (balanced n), (∀ past s x, p.step past s x = serve s (balanced n) past x) ∧ ∀ (start finish : Tree) (xs : List Nat) (offline : Nat), start.size = n → RotationBST.Execution start xs finish offline → ((p.run xs).2 : ℝ) + xs.length ≤ 42 * n + (70 * Real.logb 2 (Nat.log2 n + 1) + 20) * (offline + xs.length : Nat) := … RotationBST.Tango.BottomUp.balanced_policy nModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.Definitions, Algorithms.Tango.Algorithm.BottomUp.Definitions/-- A causal rotation algorithm follows the marked policy exactly from itsreference tree. Any other same-size initial tree pays at most one 2n reset.Reconstructing private marks from history has uncharged abstract planning cost. -/theorem rotation_algorithm {reference : Tree} (p : Policy reference) : ∃ a : RotationBST.Algorithm, (∀ xs, (∀ x ∈ xs, x < reference.size) → a.runFrom [] reference xs = ((p.run xs).1.tree, (p.run xs).2)) ∧ ∀ saved : Tree, saved.size = reference.size → ∀ xs, (∀ x ∈ xs, x < reference.size) → a.totalCost saved xs ≤ xs.length + (p.run xs).2 + 2 * saved.size := … p.rotation_algorithmModels.Rotation, 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.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Models.Online/-- **Tango with linear startup.** The same statement with startup `44n`instead of `O(n log log n)`, at a larger coefficient. The algorithm runs thebottom-up policy (`Tango.BottomUp`), which pays for first preference settingsfrom local credit, at most `42n` on the balanced reference; reaching thereference from another initial tree costs at most `2n` more. -/theorem exists_competitive_linear (n : Nat) : ∃ A : Algorithm, ∀ {start finish : Tree} {xs : List Nat} {offline : Nat}, start.size = n → Execution start xs finish offline → (A.totalCost start xs : ℝ) ≤ (70 * Real.logb 2 (Nat.log2 n + 1) + 20) * (offline + xs.length : Nat) + 44 * n := … Tango.exists_online_linear_bound nModels.Rotation, Models.Online, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.State, Algorithms.Tango.Preferences.Updates, Bounds.Interleave.Definitions, Algorithms.Tango.Definitions, Algorithms.Tango.Paths, Bounds.Interleave.Wilber, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.PotentialLet be any reference tree of height , and serve a sequence of keys of with bottom-up preference updates, starting from the all-singleton marking. Each preference update gets an amortized charge from its actual position in the evolving auxiliary trees. The charges of all first settings together are at most
where is the height of ’s subtree in . The first term is a one-time credit per node; the second is one ancestor-attachment charge per request. For the balanced reference tree on keys, the credit sum is at most .
In Lean, the first-setting charge is Initialization.firstLogCharge of the bottom-up log BottomUp.log, and the credit sum is Initialization.localAllowance.
The Lean statements
theorem startup_bound (reference : Tree) (xs : List Nat) (valid : ∀ x ∈ xs, x < reference.size) : firstLogCharge (initial reference) (log reference [] xs) ≤ localAllowance reference + xs.length * (14 * Real.logb 2 (height reference) + 4) := … RotationBST.Tango.BottomUp.startup_bound reference xs validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.Definitions, Algorithms.Tango.Algorithm.BottomUp.Definitionstheorem balanced_localAllowance (n : Nat) : localAllowance (balanced n) ≤ 42 * n := … RotationBST.Tango.Initialization.balanced_localAllowance nModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.DefinitionsIf you only want to confirm the result, the first box is enough. Its statements use the rotation model, the online algorithms of Part I, and the Policy interface and marked trees of Section 26.2, and the checking page lists those definitions. The rest of the section explains where the came from and how the bottom-up order removes it. Section 26.3.1 is an overview with a small example. Section 26.3.2 and Section 26.3.3 set up the accounting: a credit per reference node, and an exact charge per preference update, which also refines the top-down analysis of Section 26.2. Section 26.3.4 defines the bottom-up policy and Section 26.3.5 proves the linear startup. Section 26.3.6 packages a policy as an online algorithm and points to the combination of Chapter 31, which uses this section.
The definitions are in Algorithms/Tango/Preferences/Initialization/, Algorithms/Tango/Algorithm/Initialization/ and Algorithms/Tango/Algorithm/BottomUp/, each with a Definitions/Abstract.lean; the online packaging is in Algorithms/Tango/Algorithm/Rotation/Abstract.lean.
26.3.1 Overview
26.3.1.1 Where the startup term comes from
Recall the accounting of Section 26.2. A request for produces an update log: one entry for each node on the reference search path to whose preference changes (Tango.preferenceUpdates). An entry is either a switch, where a node’s preferred child changes sides, or a first setting, where a node that has never been observed receives a preference. The policy contract charges every entry , and every request for the final splay. Switches total Wilber’s interleave quantity, which is . First settings number at most , once per node, so they cost . That is the startup term.
The flat charge for a first setting is pessimistic. A first setting at only joins: it merges the auxiliary tree of ’s newly preferred child into the auxiliary tree that contains . In the library’s analysis a join costs at most amortized, where is the size of the merged auxiliary tree. The question is how large is.
In the original top-down order, the updates of a request run from the reference root toward . When the update reaches , every ancestor of on the search path already prefers the side toward , so already lies in the root’s auxiliary tree. The merged tree contains all of ’s ancestors, so . Most nodes of a balanced tree are deep, so most first settings really cost .
26.3.1.2 Bottom-up order
Apply the same updates in reverse, from up to the reference root. When the update reaches a node that is set for the first time, consider its parent on the path.
- is new as well. Then ’s update comes later, and has no preference yet, so the edge from to still leaves the auxiliary tree. The tree containing is a downward path that starts at , so the merged tree lies inside ’s reference subtree: , the height of that subtree. The join costs at most , a credit that depends only on .
- was observed before. Nothing on the search path below was ever requested, since is unobserved. So is the topmost new node of this request, and there is at most one such node per request. If prefers some other child, is again at the top of its auxiliary tree and the local bound applies. If already prefers , then hangs in an existing auxiliary tree of ancestors. That happens only when is the left child of and the last request in ’s subtree was itself. This join is the ancestor attachment, charged the flat .
Switches are unchanged: each still costs and is counted by the interleave quantity. Over a run, each node’s local credit is spent at most once, and there is at most one attachment per request:
The credit sum is linear for a balanced tree, because and the subtree heights of a balanced tree sum to at most :
The attachment charge goes into the per-request term, which is why the factor grows from to .
Two facts make the reordering safe. The updates of one request concern distinct nodes, and setting the preference of one node does not affect another, so the reversed log produces exactly the same final marking (Results.preferenceUpdates_reverse_canonical). And every intermediate marking is still a valid path marking, which is all that the edits of Section 26.2 need.
26.3.1.3 An example
Take the reference tree balanced 7 (root , children and , leaves ) and the first request . All three nodes on the path are set for the first time, each toward its left child. The library’s regression tests compute the size of the merged auxiliary tree at node :
| order | updates | merged tree at | charge at | local credit of |
|---|---|---|---|---|
| top-down | , size | |||
| bottom-up | , size |
Top-down, node joins after its ancestor , and its charge exceeds its credit. Bottom-up, it joins before, and the charge fits. Node is a leaf, and its first setting points toward an empty child. There is nothing to join, and the implementation now performs no rotation at all (see the section on exact charges).
The attachment case is real. In the tree below, with past requests and then , both prefer their left child. Node has never been observed, but it already hangs in the auxiliary tree .
4 past requests: 4, 3
/ auxiliary tree {4, 3, 1}
3
/
1 request 0: 1 is set for the first time,
/ \ and joins 0 into {4, 3, 1}
0 2
The request sets and then for the first time. The join at produces a tree of size and is charged , while the local credits of and are only . The regression module checks both numbers. This is why a per-request attachment allowance is needed: local credit alone does not suffice.
- Demaine, Harmon, Iacono and Pătraşcu (2007) bound Tango’s running time by , with the coming from first settings, as in Section 26.2. The bottom-up order and the local-credit argument are the library’s. They change neither the data structure nor the order of magnitude of the competitive ratio.
- The combination paper (Demaine et al. 2013) treats -competitiveness as a well-behaved bound with overhead , in its Corollary 4. The additive of Iacono and Langerman’s Theorem 4.3 needs the Tango side to have overhead ; the paper does not spell this step out. This section supplies it, and Chapter 31 uses it.
26.3.2 Credit on the reference side
The first layer of accounting lives entirely in the reference tree, like Section 26.1: a weight per reference node, spent when the node is observed for the first time.
/-- Total available initialization credit, one weight per reference node. -/def allowance : Tree → Nat → (Nat → ℝ) → ℝ | .nil, _, _ => 0 | .node l r, lo, w => w (lo + l.size) + allowance l lo w + allowance r (lo + l.size + 1) w/-- The accumulated charge of reference nodes observed by the history. Theweight belongs to the reference key, independently of when it is first seen. -/def observedCharge : Tree → Nat → List Nat → (Nat → ℝ) → ℝ | .nil, _, _, _ => 0 | .node l r, lo, past, w => (if regions l.size (l.size + 1 + r.size) past = [] then 0 else w (lo + l.size)) + observedCharge l lo (leftRequests l.size past) w + observedCharge r (lo + l.size + 1) (rightRequests l.size past) w/-- Charge only actual first-setting events in the executable update log. -/def firstCharge (updates : List PreferenceUpdate) (w : Nat → ℝ) : ℝ := ((updates.filter fun e => e.previous.isNone).map fun e => w e.key).sumFor a weight function on absolute ranks:
allowance t lo wis the total weight of the nodes oft, a subtree at offsetlo.observedCharge t lo past wis the total weight of the nodes thatpasthas observed, meaning the nodes whose subtree contains at least one past request. It has the recursive shape ofTango.initializations, which counts the same nodes.firstCharge updates wsums the weights of the first-setting entries of an update log, the entries whosepreviousisnone.
The weight belongs to the node, whenever it happens to be observed. The following theorems say that first settings are exactly the newly observed nodes, so every node pays its weight at most once.
theorem allowance_eq_sum (t : Tree) (lo : Nat) (w : Nat → ℝ) : allowance t lo w = ((List.range' lo t.size).map w).sum := RotationBST.Tango.Initialization.allowance_eq_sum t lo wModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitionstheorem observed_step (t : Tree) (lo : Nat) (past : List Nat) (x : Nat) (w : Nat → ℝ) (valid : x < t.size) : observedCharge t lo (past ++ [x]) w = observedCharge t lo past w + firstCharge (preferenceUpdates t lo past x) w := RotationBST.Tango.Initialization.observed_step t lo past x w validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitionstheorem observed_log (t : Tree) (past xs : List Nat) (w : Nat → ℝ) (valid : ∀ x ∈ xs, x < t.size) : observedCharge t 0 (past ++ xs) w = observedCharge t 0 past w + firstCharge (preferenceLog t past xs) w := RotationBST.Tango.Initialization.observed_log t past xs w validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitionsallowance_eq_sum writes the allowance as a plain sum over the ranks lo, …, lo + size - 1. observed_step says that serving a valid request increases the observed charge by exactly the first-setting charge of ’s update log, and observed_log sums this over a sequence served online, with the log Tango.preferenceLog of Section 26.1.
Theorem (one payment per node). For nonnegative weights and any valid sequence following a history past, the first settings of cost at most the weight not yet observed: . In particular, from the empty history, they cost at most the whole allowance.
theorem remaining_budget (t : Tree) (past xs : List Nat) (w : Nat → ℝ) (valid : ∀ x ∈ xs, x < t.size) (nonneg : ∀ key < t.size, 0 ≤ w key) : firstCharge (preferenceLog t past xs) w ≤ allowance t 0 w - observedCharge t 0 past w := RotationBST.Tango.Initialization.remaining_budget t past xs w valid nonnegModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitionstheorem first_budget (t : Tree) (xs : List Nat) (w : Nat → ℝ) (valid : ∀ x ∈ xs, x < t.size) (nonneg : ∀ key < t.size, 0 ≤ w key) : firstCharge (preferenceLog t [] xs) w ≤ allowance t 0 w := RotationBST.Tango.Initialization.first_budget t xs w valid nonnegModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.DefinitionsThe two counting identities behind Results.preference_settings also hold exactly for a continued history:
theorem first_count (t : Tree) (past xs : List Nat) (valid : ∀ x ∈ xs, x < t.size) : (preferenceLog t past xs |>.filter fun e => e.previous.isNone).length + initializations t past = initializations t (past ++ xs) := RotationBST.Tango.Initialization.first_count t past xs validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitionstheorem switch_count (t : Tree) (past xs : List Nat) (valid : ∀ x ∈ xs, x < t.size) : (preferenceLog t past xs |>.filter fun e => e.previous.isSome).length + interleave t past = interleave t (past ++ xs) := RotationBST.Tango.Initialization.switch_count t past xs validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitionsfirst_count says that the first-setting entries of the log of , added to the nodes observed by past, give the nodes observed by past ++ X. switch_count says the same for switches and Wilber’s Wilber.interleave. Together they say that the log of consists of exactly switches and as many first settings as newly observed nodes.
26.3.2.1 Local credit
The weight used for the linear startup is the local join bound: for each node , where is the height of ’s subtree.
/-- Height of the reference subtree rooted at an inorder key; zero off-tree. -/def heightAt : Tree → Nat → Nat | .nil, _ => 0 | .node l r, key => if key < l.size then heightAt l key else if key = l.size then height (.node l r) else heightAt r (key - l.size - 1)/-- Sum of subtree heights, used only to bound available initialization credit. -/def heightSum : Tree → Nat | .nil => 0 | .node l r => height (.node l r) + heightSum l + heightSum r/-- Local reference-height credit. This is not the evolving component charge. -/noncomputable def localCredit (t : Tree) (key : Nat) : ℝ := 8 * Real.logb 2 (heightAt t key) + 2/-- One local logarithmic allowance at each node of the reference tree. -/noncomputable def localAllowance : Tree → ℝ | .nil => 0 | .node l r => 8 * Real.logb 2 (height (.node l r)) + 2 + localAllowance l + localAllowance rheightAt t key is the height, in nodes as in Tree.height, of the subtree of t rooted at the node of inorder rank key, and for ranks outside t. heightSum t is the sum of all subtree heights. localCredit t key is , a function of the fixed reference tree only. Its docstring stresses that it is not the charge of the evolving components; the bounds below relate the two. localAllowance t sums the credits structurally, and allowance_localCredit identifies it with the allowance of the weight localCredit.
Theorem (the credit of a balanced tree is linear). The subtree heights of balanced n sum to at most , and its local credits sum to at most .
theorem heightSum_cap (t : Tree) (h : Nat) (cap : height t ≤ h) : heightSum t + h + 2 ≤ 2 ^ (h + 1) := RotationBST.Tango.Initialization.heightSum_cap t h capModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.Definitionstheorem balanced_heightSum (n : Nat) : heightSum (balanced n) ≤ 4 * n := RotationBST.Tango.Initialization.balanced_heightSum nModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.Definitionstheorem allowance_localCredit (t : Tree) (lo : Nat) : allowance t lo (fun key => localCredit t (key - lo)) = localAllowance t := RotationBST.Tango.Initialization.allowance_localCredit t loModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.Definitionstheorem balanced_localAllowance (n : Nat) : localAllowance (balanced n) ≤ 42 * n := RotationBST.Tango.Initialization.balanced_localAllowance nModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.DefinitionsheightSum_cap is the general fact behind it. A tree of height at most has no more total subtree height than the complete tree of height , whose height sum is . Since balanced n has height and , this gives , including incomplete last levels and . The proof of balanced_localAllowance then uses to get , hence . The constant is not optimized.
theorem balanced_firstCharge (n : Nat) (xs : List Nat) (valid : ∀ key ∈ xs, key < n) : firstCharge (preferenceLog (balanced n) [] xs) (localCredit (balanced n)) ≤ 42 * n := RotationBST.Tango.Initialization.balanced_firstCharge n xs validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.Definitionstheorem balanced_remainingCharge (n : Nat) (past xs : List Nat) (valid : ∀ key ∈ xs, key < n) : firstCharge (preferenceLog (balanced n) past xs) (localCredit (balanced n)) ≤ 42 * n - observedCharge (balanced n) 0 past (localCredit (balanced n)) := RotationBST.Tango.Initialization.balanced_remainingCharge n past xs validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.DefinitionsSpecialized to the local credit of balanced n, the budget theorems read: the first settings of any valid sequence from the empty history are charged at most , and after a history past, at most minus the credit that past has already spent. The second form applies to a run resumed after an arbitrary valid history.
26.3.3 Exact charges for preference updates
The second layer charges each update for what it really costs in the BST. Section 26.2 used the flat bound for every update. The library now has a refined charge that distinguishes first settings and records the actual size of the merged auxiliary tree.
/-- First joins retain their actual target component size; empty childrenrequire no rotations and make no potential change. -/noncomputable def componentCharge (fs : List Frame) (l r : MarkedTree) (next : Bool) : ℝ := if (if next then l else r) = .nil then 0 else 8 * Real.logb 2 (plug fs (.node l r (!next) next)).region.size + 2/-- Charge the compiled reference update according to its current marks.This inspects the reference state, not a potentially inconsistent log label. -/noncomputable def updateCharge (reference : MarkedTree) (key : Nat) (next : Bool) : ℝ := match reference.locateKey key with | some (.node l r cl cr, fs) => if cl && cr then componentCharge (componentAddress fs).2 l r next else 14 * Real.logb 2 (height reference.tree) + 4 | _ => 0/-- Advance the actual reference marks between charged updates. -/noncomputable def logCharge : MarkedTree → List PreferenceUpdate → ℝ | _, [] => 0 | reference, u :: us => updateCharge reference u.key u.next + logCharge (reference.setPreference u.key u.next) usThe charges are computed on the reference marking, the marked reference tree whose unmarked edges are the current preferred edges, like MarkedTree.canonical. The actual BST is a different marked tree with the same component nesting.
updateCharge reference key nextlocates the reference node of rankkey(with the internallocateKey, which returns the node and the list of frames on the path to it). If both child edges of the node are marked, the node has no preference yet and this is a first setting, charged bycomponentCharge. Otherwise it is a switch, charged with the reference height. An out-of-range key is charged ; such keys do not occur in generated logs.componentCharge fs l r nextis the join bound , where is the size of the auxiliary tree that contains the node after the update. That tree is computed by plugging the node, with its new marks, into the unmarked frames above it (componentAddress), so it includes every ancestor already in the node’s component. If the newly preferred child is empty, the charge is .logCharge reference updatesadds the charges of a log, and advances the reference marking after each entry with the internalsetPreference. Each entry is therefore classified and measured on the marking it actually meets, not by thepreviouslabel recorded in the log. This matters once logs are reordered.
The zero for empty children reflects a change of the implementation, the redundant-splay skip. When a first setting points toward an empty child, there is no auxiliary tree to join, and the auxiliary trees do not change. Only the mark changes. The executable edit (the internal unmarkKnownInPath, used by both the top-down and the bottom-up policy) now returns the tree unchanged with cost in that case, instead of performing the merge at the component boundary. For instance, the first time a leaf is requested, its first setting points toward its empty left child. The following theorems state the effect of a first-setting edit, with or without an empty target:
theorem empty_component (s : MarkedTree) (fs : List Frame) (l r : MarkedTree) (next : Bool) (empty : (if next then l else r) = .nil) : s.setMarksInPath fs l r true true next = (s, 0) := RotationBST.Tango.MarkedTree.setMarksInPath_initial_empty s fs l r next emptyModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitionstheorem empty_update_cost (s reference : MarkedTree) (key : Nat) (next : Bool) (l r : MarkedTree) (fs : List Frame) (located : reference.locateKey key = some (.node l r true true, fs)) (empty : (if next then l else r) = .nil) : (s.updatePreference reference key next).2 = 0 := RotationBST.Tango.MarkedTree.updatePreference_initial_empty_cost s reference key next l r fs located emptyModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitionstheorem component_charge (s : MarkedTree) (fs : List Frame) (unmarked : ∀ f ∈ fs, f.marked = false) (l r : MarkedTree) (next : Bool) (same : s.nesting = (plug fs (.node l r true true)).nesting) : (s.setMarksInPath fs l r true true next).1.nesting = (plug fs (.node l r (!next) next)).nesting ∧ Rotations s.tree (s.setMarksInPath fs l r true true next).1.tree (s.setMarksInPath fs l r true true next).2 ∧ ((s.setMarksInPath fs l r true true next).2 : ℝ) + (s.setMarksInPath fs l r true true next).1.potential - s.potential ≤ if (if next then l else r) = .nil then 0 else 8 * Real.logb 2 (plug fs (.node l r (!next) next)).region.size + 2 := RotationBST.Tango.MarkedTree.setMarksInPath_initial_charge s fs unmarked l r next sameModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitionstheorem initial_component (s : MarkedTree) (fs : List Frame) (unmarked : ∀ f ∈ fs, f.marked = false) (l r : MarkedTree) (next : Bool) (same : s.nesting = (plug fs (.node l r true true)).nesting) : (s.setMarksInPath fs l r true true next).1.nesting = (plug fs (.node l r (!next) next)).nesting ∧ Rotations s.tree (s.setMarksInPath fs l r true true next).1.tree (s.setMarksInPath fs l r true true next).2 ∧ ((s.setMarksInPath fs l r true true next).2 : ℝ) + (s.setMarksInPath fs l r true true next).1.potential - s.potential ≤ 8 * Real.logb 2 (plug fs (.node l r (!next) next)).region.size + 2 := RotationBST.Tango.MarkedTree.setMarksInPath_initial_spec s fs unmarked l r next sameModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitionstheorem initial_update (s reference : MarkedTree) (key : Nat) (next : Bool) (same : s.nesting = reference.nesting) (paths : reference.PathMarked) (valid : key < reference.tree.size) (first : ∃ l r fs, reference.locateKey key = some (.node l r true true, fs)) : ∃ size : Nat, size ≤ height reference.tree ∧ (s.updatePreference reference key next).1.nesting = (reference.setPreference key next).nesting ∧ Rotations s.tree (s.updatePreference reference key next).1.tree (s.updatePreference reference key next).2 ∧ ((s.updatePreference reference key next).2 : ℝ) + (s.updatePreference reference key next).1.potential - s.potential ≤ 8 * Real.logb 2 size + 2 := RotationBST.Tango.MarkedTree.updatePreference_initial_spec s reference key next same paths valid firstModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.DefinitionsThese are statements about the internal edit setMarksInPath, which changes the marks of one node inside the auxiliary tree described by the frames fs, and about updatePreference, which locates the node from the reference marking and calls it.
empty_componentandempty_update_cost: a first setting toward an empty child returns the same tree and rotations, even when the node’s component is nested below other components.component_charge: for a first setting, the edit produces the nesting of the updated marking, is a legal sequence ofRotations, and has amortized cost (rotations plus the change ofMarkedTree.potential) at mostcomponentCharge: toward an empty child, otherwise.initial_componentis the same bound without the empty case, .initial_updateis the version throughupdatePreference, with bounded by the reference height. Summed over first settings, this is the old bound.
theorem root_component_charge (s l r : MarkedTree) (next : Bool) (paths : (MarkedTree.node l r true true).PathMarked) (same : s.nesting = (MarkedTree.node l r true true).nesting) : (s.setMarksInPath [] l r true true next).1.nesting = (MarkedTree.node l r (!next) next).nesting ∧ Rotations s.tree (s.setMarksInPath [] l r true true next).1.tree (s.setMarksInPath [] l r true true next).2 ∧ ((s.setMarksInPath [] l r true true next).2 : ℝ) + (s.setMarksInPath [] l r true true next).1.potential - s.potential ≤ localCredit (.node l.tree r.tree) l.tree.size := RotationBST.Tango.Initialization.root_component_charge s l r next paths sameModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.Definitionsroot_component_charge is the local case in its simplest form. When the node is the root of the reference marking, with no frames above it, the amortized cost of its first setting is at most its own local credit. The bottom-up proof applies this at every component boundary, a node whose parent edge is marked.
26.3.3.1 The charge of a single update and of a log
With the charges defined, the per-update contract reads as follows.
Theorem (one update). Let be a marked BST with the same component nesting as the reference marking, and let the reference marking give each node at most one preferred child (the internal predicate PathMarked). Updating the preference of a valid node produces the nesting of the updated marking, by legal rotations, at amortized cost at most updateCharge. The same holds for a whole log, with logCharge.
theorem update_spec (s reference : MarkedTree) (key : Nat) (next : Bool) (same : s.nesting = reference.nesting) (paths : reference.PathMarked) (valid : key < reference.tree.size) : (s.updatePreference reference key next).1.nesting = (reference.setPreference key next).nesting ∧ Rotations s.tree (s.updatePreference reference key next).1.tree (s.updatePreference reference key next).2 ∧ ((s.updatePreference reference key next).2 : ℝ) + (s.updatePreference reference key next).1.potential - s.potential ≤ updateCharge reference key next := RotationBST.Tango.Initialization.update_spec s reference key next same paths validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitionstheorem log_spec (s reference : MarkedTree) (updates : List PreferenceUpdate) (same : s.nesting = reference.nesting) (paths : reference.PathMarked) (valid : ∀ update ∈ updates, update.key < reference.tree.size) : (s.updatePreferences reference updates).1.nesting = (reference.applyPreferences updates).nesting ∧ Rotations s.tree (s.updatePreferences reference updates).1.tree (s.updatePreferences reference updates).2 ∧ ((s.updatePreferences reference updates).2 : ℝ) + (s.updatePreferences reference updates).1.potential - s.potential ≤ logCharge reference updates := RotationBST.Tango.Initialization.log_spec s reference updates same paths validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitionstheorem logCharge_append (reference : MarkedTree) (xs ys : List PreferenceUpdate) : logCharge reference (xs ++ ys) = logCharge reference xs + logCharge (reference.applyPreferences xs) ys := RotationBST.Tango.Initialization.logCharge_append reference xs ysModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.DefinitionsThe hypothesis is only that and the reference marking agree on the nesting, not that the marking is canonical for some history. This is what allows applying the updates in any order: every intermediate marking of a reordered log still satisfies PathMarked. logCharge_append splits the charge of a concatenated log at the intermediate marking.
The refined charge is never worse than the flat one of Section 26.2:
theorem updateCharge_le (reference : MarkedTree) (key : Nat) (next : Bool) (paths : reference.PathMarked) (valid : key < reference.tree.size) : updateCharge reference key next ≤ 14 * Real.logb 2 (height reference.tree) + 4 := RotationBST.Tango.Initialization.updateCharge_le reference key next paths validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitionstheorem logCharge_le (reference : MarkedTree) (updates : List PreferenceUpdate) (paths : reference.PathMarked) (valid : ∀ u ∈ updates, u.key < reference.tree.size) : logCharge reference updates ≤ updates.length * (14 * Real.logb 2 (height reference.tree) + 4) := RotationBST.Tango.Initialization.logCharge_le reference updates paths validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitions26.3.3.2 First settings and switches, from the marks
To separate the two kinds of updates, the library classifies each entry by the marks it meets.
/-- Reference nodes with no preference set yet, including empty-child marks. -/def virginCount : MarkedTree → Nat | .nil => 0 | .node l r cl cr => (if cl && cr then 1 else 0) + virginCount l + virginCount rdef firstAt (reference : MarkedTree) (key : Nat) : Bool := match reference.locateKey key with | some (.node _ _ cl cr, _) => cl && cr | _ => falsedef firstCount : MarkedTree → List PreferenceUpdate → Nat | _, [] => 0 | reference, u :: us => (if firstAt reference u.key then 1 else 0) + firstCount (reference.setPreference u.key u.next) usdef laterCount : MarkedTree → List PreferenceUpdate → Nat | _, [] => 0 | reference, u :: us => (if firstAt reference u.key then 0 else 1) + laterCount (reference.setPreference u.key u.next) us/-- Keep only initialization charges, classified from the evolving marks. -/noncomputable def firstLogCharge : MarkedTree → List PreferenceUpdate → ℝ | _, [] => 0 | reference, u :: us => (if firstAt reference u.key then updateCharge reference u.key u.next else 0) + firstLogCharge (reference.setPreference u.key u.next) usvirginCount counts the nodes with both child edges marked, the nodes without a preference. Its docstring says it includes “empty-child marks”: a leaf counts until it is first set, even though its preferred child is empty. firstAt reference key says that the node of rank key has no preference yet. Along a log, with the marking advanced after each entry, firstCount counts the entries that meet an unset node, laterCount the others, and firstLogCharge keeps only the charges of the first ones.
theorem virgin_step (reference : MarkedTree) (key : Nat) (next : Bool) (valid : key < reference.tree.size) : virginCount (reference.setPreference key next) + (if firstAt reference key then 1 else 0) = virginCount reference := RotationBST.Tango.Initialization.virgin_step reference key next validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitionstheorem virgin_log (reference : MarkedTree) (updates : List PreferenceUpdate) (valid : ∀ u ∈ updates, u.key < reference.tree.size) : firstCount reference updates + virginCount (reference.applyPreferences updates) = virginCount reference := RotationBST.Tango.Initialization.virgin_log reference updates validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitionstheorem virgin_canonical (t : Tree) (past : List Nat) (history : ∀ x ∈ past, x < t.size) : virginCount (canonical t 0 past) + initializations t past = t.size := RotationBST.Tango.Initialization.virgin_canonical t past historyModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.DefinitionsEach first setting removes exactly one unset node (virgin_step, virgin_log), and the canonical marking of a history has exactly unset nodes (virgin_canonical). So the classification by marks agrees with the reference-side counts:
theorem firstCount_generated (t : Tree) (past xs : List Nat) (history : ∀ x ∈ past, x < t.size) (valid : ∀ x ∈ xs, x < t.size) : firstCount (canonical t 0 past) (preferenceLog t past xs) + initializations t past = initializations t (past ++ xs) := RotationBST.Tango.Initialization.firstCount_generated t past xs history validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitionstheorem laterCount_generated (t : Tree) (past xs : List Nat) (history : ∀ x ∈ past, x < t.size) (valid : ∀ x ∈ xs, x < t.size) : laterCount (canonical t 0 past) (preferenceLog t past xs) + interleave t past = interleave t (past ++ xs) := RotationBST.Tango.Initialization.laterCount_generated t past xs history validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitionstheorem logCharge_split (reference : MarkedTree) (updates : List PreferenceUpdate) (valid : ∀ u ∈ updates, u.key < reference.tree.size) : logCharge reference updates = firstLogCharge reference updates + laterCount reference updates * (14 * Real.logb 2 (height reference.tree) + 4) := RotationBST.Tango.Initialization.logCharge_split reference updates validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitionstheorem firstLogCharge_le (reference : MarkedTree) (updates : List PreferenceUpdate) (paths : reference.PathMarked) (valid : ∀ u ∈ updates, u.key < reference.tree.size) : firstLogCharge reference updates ≤ firstCount reference updates * (14 * Real.logb 2 (height reference.tree) + 4) := RotationBST.Tango.Initialization.firstLogCharge_le reference updates paths validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitionstheorem generated_split (reference : Tree) (xs : List Nat) (valid : ∀ x ∈ xs, x < reference.size) : logCharge (initial reference) (preferenceLog reference [] xs) = firstLogCharge (initial reference) (preferenceLog reference [] xs) + interleave reference xs * (14 * Real.logb 2 (height reference) + 4) := RotationBST.Tango.Initialization.generated_split reference xs validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.DefinitionsOn the top-down log of a continued history, firstCount is the number of newly observed nodes and laterCount is the increase of the interleave quantity. logCharge_split splits any log’s charge into its first-setting part and per later entry. firstLogCharge_le bounds the first part by per first setting, which is the old bound again. generated_split combines them for a run from the initial marking: the total charge is the first-setting charge plus .
26.3.3.3 The top-down policy with exact charges
These charges sharpen the analysis of the existing top-down step MarkedTree.serve of Section 26.2. The request charge is the refined log charge of the request’s update log, plus for the final splay.
/-- Preference maintenance followed by the final root-component access. -/noncomputable def requestCharge (reference : Tree) (past : List Nat) (x : Nat) : ℝ := logCharge (canonical reference 0 past) (preferenceUpdates reference 0 past x) + (3 * Real.logb 2 (height reference) + 1)noncomputable def sequenceCharge (reference : Tree) : List Nat → List Nat → ℝ | _, [] => 0 | past, x :: xs => requestCharge reference past x + sequenceCharge reference (past ++ [x]) xsTheorem (top-down Tango with exact charges). Under the invariant MarkedTree.Maintains of Section 26.2, the top-down step is a legal access, preserves the invariant, and has amortized cost at most the refined request charge. Over a run from the reference tree, the rotations are at most the first-setting charge plus , and the total cost is at most the first-setting charge plus against any offline execution.
theorem request_spec (s : MarkedTree) (reference : Tree) (past : List Nat) (x : Nat) (maintained : Maintains s reference past) (history : ∀ y ∈ past, y < reference.size) (valid : x < reference.size) : Access s.tree (s.serve reference past x).1.tree x (s.serve reference past x).2 ∧ Maintains (s.serve reference past x).1 reference (past ++ [x]) ∧ ((s.serve reference past x).2 : ℝ) + (s.serve reference past x).1.potential - s.potential ≤ requestCharge reference past x := RotationBST.Tango.Initialization.request_spec s reference past x maintained history validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitionstheorem sequenceCharge_eq (reference : Tree) (past xs : List Nat) (history : ∀ y ∈ past, y < reference.size) (valid : ∀ x ∈ xs, x < reference.size) : sequenceCharge reference past xs = logCharge (canonical reference 0 past) (preferenceLog reference past xs) + xs.length * (3 * Real.logb 2 (height reference) + 1) := RotationBST.Tango.Initialization.sequenceCharge_eq reference past xs history validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitionstheorem runFrom_bound {reference : Tree} (p : Policy reference) (steps : ∀ past s x, p.step past s x = s.serve reference past x) (s : MarkedTree) (past xs : List Nat) (maintained : Maintains s reference past) (history : ∀ y ∈ past, y < reference.size) (valid : ∀ x ∈ xs, x < reference.size) : ((p.runFrom past s xs).2 : ℝ) + (p.runFrom past s xs).1.potential - s.potential ≤ sequenceCharge reference past xs := RotationBST.Tango.Initialization.runFrom_bound p steps s past xs maintained history validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitionstheorem run_bound {reference : Tree} (p : Policy reference) (steps : ∀ past s x, p.step past s x = s.serve reference past x) (xs : List Nat) (valid : ∀ x ∈ xs, x < reference.size) : ((p.run xs).2 : ℝ) ≤ logCharge (initial reference) (preferenceLog reference [] xs) + xs.length * (3 * Real.logb 2 (height reference) + 1) := RotationBST.Tango.Initialization.run_bound p steps xs validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitionstheorem policy_exists (reference : Tree) : ∃ p : Policy reference, (∀ past s x, p.step past s x = s.serve reference past x) ∧ ∀ xs, (∀ x ∈ xs, x < reference.size) → ((p.run xs).2 : ℝ) ≤ logCharge (initial reference) (preferenceLog reference [] xs) + xs.length * (3 * Real.logb 2 (height reference) + 1) := RotationBST.Tango.Initialization.policy_exists referenceModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitionstheorem separated_run_bound {reference : Tree} (p : Policy reference) (steps : ∀ past s x, p.step past s x = s.serve reference past x) (xs : List Nat) (valid : ∀ x ∈ xs, x < reference.size) : ((p.run xs).2 : ℝ) ≤ firstLogCharge (initial reference) (preferenceLog reference [] xs) + interleave reference xs * (14 * Real.logb 2 (height reference) + 4) + xs.length * (3 * Real.logb 2 (height reference) + 1) := RotationBST.Tango.Initialization.separated_run_bound p steps xs validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitionstheorem separated_competitive {reference : Tree} (p : Policy reference) (steps : ∀ past s x, p.step past s x = s.serve reference past x) {start finish : Tree} {xs : List Nat} {offline : Nat} (size : reference.size = start.size) (execution : RotationBST.Execution start xs finish offline) : ((p.run xs).2 : ℝ) + xs.length ≤ firstLogCharge (initial reference) (preferenceLog reference [] xs) + (56 * Real.logb 2 (height reference) + 16) * (offline + xs.length : Nat) := RotationBST.Tango.Initialization.separated_competitive p steps size executionModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.DefinitionsrunFrom_bound and run_bound hold for every policy p whose step is MarkedTree.serve (the hypothesis steps), and policy_exists provides one. separated_competitive separates the startup from the competitive part. In the top-down order, the only bound available for the first-setting charge is firstLogCharge_le, per node. So this is where the top-down analysis stops: with an unresolved .
26.3.4 The bottom-up policy
The new step differs from MarkedTree.serve in a single word: it applies the reversed update log.
/-- Compile one request's distinct reference changes from the deepest nodeupward, then access the key in the resulting root component. -/def serve (s : MarkedTree) (reference : Tree) (past : List Nat) (x : Nat) : MarkedTree × Nat := let updated := s.updatePreferences (canonical reference 0 past) (preferenceUpdates reference 0 past x).reverse let accessed := updated.1.splayRoot (Region.index updated.1.region 0 x) (accessed.1, updated.2 + accessed.2)/-- Reverse within each request only; the request sequence remains causal. -/def log (reference : Tree) : List Nat → List Nat → List PreferenceUpdate | _, [] => [] | past, x :: xs => (preferenceUpdates reference 0 past x).reverse ++ log reference (past ++ [x]) xsserve s reference past x computes the update log of from the history, reverses it, and replays it on the actual marked BST s with the internal updatePreferences, advancing the canonical reference marking canonical reference 0 past after each entry. Then it splays to the root within the root component, exactly as before. The cost is the sum of the two rotation counts. log reference past xs is the log that a run actually replays: the update log of each request, reversed, concatenated in request order. Only the updates within a request are reordered, so the run remains online.
26.3.4.1 Reordering is harmless
theorem setPreference_commute (s : MarkedTree) (x y : Nat) (a b : Bool) (different : x ≠ y) : (s.setPreference x a).setPreference y b = (s.setPreference y b).setPreference x a := RotationBST.Tango.MarkedTree.setPreference_commute s x y a b differentModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.Definitions, Algorithms.Tango.Algorithm.BottomUp.Definitionstheorem applyPreferences_reverse (s : MarkedTree) (updates : List PreferenceUpdate) (distinct : updates.Pairwise (fun u v => u.key ≠ v.key)) : s.applyPreferences updates.reverse = s.applyPreferences updates := RotationBST.Tango.MarkedTree.applyPreferences_reverse s updates distinctModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.Definitions, Algorithms.Tango.Algorithm.BottomUp.Definitionstheorem preferenceUpdates_reverse_canonical (t : Tree) (past : List Nat) (x : Nat) (history : ∀ y ∈ past, y < t.size) (valid : x < t.size) : (canonical t 0 past).applyPreferences (preferenceUpdates t 0 past x).reverse = canonical t 0 (past ++ [x]) := RotationBST.Tango.MarkedTree.preferenceUpdates_reverse_canonical t past x history validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.Definitions, Algorithms.Tango.Algorithm.BottomUp.Definitionstheorem log_canonical (reference : Tree) (past xs : List Nat) (history : ∀ y ∈ past, y < reference.size) (valid : ∀ x ∈ xs, x < reference.size) : (canonical reference 0 past).applyPreferences (log reference past xs) = canonical reference 0 (past ++ xs) := RotationBST.Tango.BottomUp.log_canonical reference past xs history validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.Definitions, Algorithms.Tango.Algorithm.BottomUp.Definitionstheorem log_append (reference : Tree) (past xs ys : List Nat) : log reference past (xs ++ ys) = log reference past xs ++ log reference (past ++ xs) ys := RotationBST.Tango.BottomUp.log_append reference past xs ysModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.Definitions, Algorithms.Tango.Algorithm.BottomUp.DefinitionsSetting the preferences of two different nodes commutes (setPreference_commute), so a log with pairwise distinct keys gives the same marking in either order (applyPreferences_reverse). The update log of one request has distinct keys, one per node on the search path. Hence the reversed log turns the canonical marking of past into the canonical marking of past ++ [x] (preferenceUpdates_reverse_canonical), and the whole bottom-up log does the same for a sequence (log_canonical). log_append splits the log of a concatenated sequence.
26.3.4.2 The contract
The bottom-up request charge is the refined log charge of the reversed log, measured on the marking each entry actually meets, plus the final splay:
/-- The refined charge uses the actual intermediate reference components inbottom-up order, not the components of the top-down execution. -/noncomputable def requestCharge (reference : Tree) (past : List Nat) (x : Nat) : ℝ := Initialization.logCharge (canonical reference 0 past) (preferenceUpdates reference 0 past x).reverse + (3 * Real.logb 2 (height reference) + 1)noncomputable def sequenceCharge (reference : Tree) : List Nat → List Nat → ℝ | _, [] => 0 | past, x :: xs => requestCharge reference past x + sequenceCharge reference (past ++ [x]) xsIts docstring makes the point explicit: the charge uses the intermediate reference markings in bottom-up order, not those of the top-down execution.
Theorem (serving a request bottom-up). Under the invariant of Section 26.2, the bottom-up step performs a legal access of , preserves the invariant for past ++ [x], and has amortized cost at most the bottom-up request charge.
theorem request_spec (s : MarkedTree) (reference : Tree) (past : List Nat) (x : Nat) (maintained : Maintains s reference past) (history : ∀ y ∈ past, y < reference.size) (valid : x < reference.size) : Access s.tree (serve s reference past x).1.tree x (serve s reference past x).2 ∧ Maintains (serve s reference past x).1 reference (past ++ [x]) ∧ ((serve s reference past x).2 : ℝ) + (serve s reference past x).1.potential - s.potential ≤ requestCharge reference past x := RotationBST.Tango.BottomUp.request_spec s reference past x maintained history validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.Definitions, Algorithms.Tango.Algorithm.BottomUp.DefinitionsThis is the analogue of the internal contract of Section 26.2, stated here with the refined charge. Since the refined charge is at most the flat one, the step also satisfies the Policy contract, so it is a Tango.Policy (the internal BottomUp.policy).
theorem sequenceCharge_eq (reference : Tree) (past xs : List Nat) (history : ∀ y ∈ past, y < reference.size) (valid : ∀ x ∈ xs, x < reference.size) : sequenceCharge reference past xs = logCharge (canonical reference 0 past) (log reference past xs) + xs.length * (3 * Real.logb 2 (height reference) + 1) := RotationBST.Tango.BottomUp.sequenceCharge_eq reference past xs history validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.Definitions, Algorithms.Tango.Algorithm.BottomUp.Definitionstheorem runFrom_bound {reference : Tree} (p : Policy reference) (steps : ∀ past s x, p.step past s x = serve s reference past x) (s : MarkedTree) (past xs : List Nat) (maintained : Maintains s reference past) (history : ∀ y ∈ past, y < reference.size) (valid : ∀ x ∈ xs, x < reference.size) : ((p.runFrom past s xs).2 : ℝ) + (p.runFrom past s xs).1.potential - s.potential ≤ sequenceCharge reference past xs := RotationBST.Tango.BottomUp.runFrom_bound p steps s past xs maintained history validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.Definitions, Algorithms.Tango.Algorithm.BottomUp.Definitionstheorem run_bound {reference : Tree} (p : Policy reference) (steps : ∀ past s x, p.step past s x = serve s reference past x) (xs : List Nat) (valid : ∀ x ∈ xs, x < reference.size) : ((p.run xs).2 : ℝ) ≤ logCharge (initial reference) (log reference [] xs) + xs.length * (3 * Real.logb 2 (height reference) + 1) := RotationBST.Tango.BottomUp.run_bound p steps xs validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.Definitions, Algorithms.Tango.Algorithm.BottomUp.Definitionstheorem policy_exists (reference : Tree) : ∃ p : Policy reference, (∀ past s x, p.step past s x = serve s reference past x) ∧ ∀ xs, (∀ x ∈ xs, x < reference.size) → ((p.run xs).2 : ℝ) ≤ logCharge (initial reference) (log reference [] xs) + xs.length * (3 * Real.logb 2 (height reference) + 1) := RotationBST.Tango.BottomUp.policy_exists referenceModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.Definitions, Algorithms.Tango.Algorithm.BottomUp.Definitionstheorem runFrom_append {reference : Tree} (p : Policy reference) (past : List Nat) (s : MarkedTree) (xs ys : List Nat) : p.runFrom past s (xs ++ ys) = let first := p.runFrom past s xs let rest := p.runFrom (past ++ xs) first.1 ys (rest.1, first.2 + rest.2) := RotationBST.Tango.Policy.runFrom_append p past s xs ysModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.Definitions, Algorithms.Tango.Algorithm.BottomUp.DefinitionsThese are the run-level forms. sequenceCharge_eq rewrites the summed request charges as one log charge of log reference past xs plus . runFrom_bound and run_bound telescope the potential, for every policy whose step is BottomUp.serve. policy_exists provides such a policy, with the run bound. runFrom_append is a general fact about policies: running on xs ++ ys is running on xs and then resuming on ys from the returned marked tree, with the counts added. A worker that is paused and resumed relies on it.
26.3.4.3 The same counts in a different order
Reordering must not change how many first settings and switches there are. The bottom-up log is a permutation of the top-down log within each request, and the classification by marks still agrees with the reference-side counts:
theorem firstCharge_log (reference : Tree) (past xs : List Nat) (w : Nat → ℝ) : firstCharge (log reference past xs) w = firstCharge (preferenceLog reference past xs) w := RotationBST.Tango.BottomUp.firstCharge_log reference past xs wModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.Definitions, Algorithms.Tango.Algorithm.BottomUp.Definitionstheorem firstCount_generated (t : Tree) (past xs : List Nat) (history : ∀ x ∈ past, x < t.size) (valid : ∀ x ∈ xs, x < t.size) : firstCount (canonical t 0 past) (log t past xs) + initializations t past = initializations t (past ++ xs) := RotationBST.Tango.BottomUp.firstCount_generated t past xs history validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.Definitions, Algorithms.Tango.Algorithm.BottomUp.Definitionstheorem laterCount_generated (t : Tree) (past xs : List Nat) (history : ∀ x ∈ past, x < t.size) (valid : ∀ x ∈ xs, x < t.size) : laterCount (canonical t 0 past) (log t past xs) + interleave t past = interleave t (past ++ xs) := RotationBST.Tango.BottomUp.laterCount_generated t past xs history validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.Definitions, Algorithms.Tango.Algorithm.BottomUp.Definitionstheorem generated_split (reference : Tree) (xs : List Nat) (valid : ∀ x ∈ xs, x < reference.size) : logCharge (initial reference) (log reference [] xs) = firstLogCharge (initial reference) (log reference [] xs) + interleave reference xs * (14 * Real.logb 2 (height reference) + 4) := RotationBST.Tango.BottomUp.generated_split reference xs validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.Definitions, Algorithms.Tango.Algorithm.BottomUp.Definitionstheorem separated_competitive {reference : Tree} (p : Policy reference) (steps : ∀ past s x, p.step past s x = serve s reference past x) {start finish : Tree} {xs : List Nat} {offline : Nat} (size : reference.size = start.size) (execution : RotationBST.Execution start xs finish offline) : ((p.run xs).2 : ℝ) + xs.length ≤ firstLogCharge (initial reference) (log reference [] xs) + (56 * Real.logb 2 (height reference) + 16) * (offline + xs.length : Nat) := RotationBST.Tango.BottomUp.separated_competitive p steps size executionModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.Definitions, Algorithms.Tango.Algorithm.BottomUp.DefinitionsfirstCharge_log says that the bottom-up and the top-down log have the same first-setting charge for every weight function. firstCount_generated and laterCount_generated say that, measured on the marks, the bottom-up log of a continued history still has one first setting per newly observed node and one later entry per new unit of interleave. A regression test checks that reversing does not turn switches into first settings. generated_split and separated_competitive are the bottom-up versions of the top-down statements above: the run’s total cost is at most the first-setting charge plus .
26.3.5 The linear startup
All that remains is the bound on the first-setting charge in bottom-up order.
Theorem (local credit plus one attachment per request). For any reference tree of height and any valid history and continuation of requests, the first-setting charge of the bottom-up log of , measured on the evolving marking, is at most the local credit of the first-set nodes plus . From the empty history, it is at most localAllowance plus .
theorem first_log_bound (reference : Tree) (past xs : List Nat) (history : ∀ y ∈ past, y < reference.size) (valid : ∀ x ∈ xs, x < reference.size) : firstLogCharge (canonical reference 0 past) (log reference past xs) ≤ firstCharge (log reference past xs) (localCredit reference) + xs.length * (14 * Real.logb 2 (height reference) + 4) := RotationBST.Tango.BottomUp.first_log_bound reference past xs history validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.Definitions, Algorithms.Tango.Algorithm.BottomUp.Definitionstheorem startup_bound (reference : Tree) (xs : List Nat) (valid : ∀ x ∈ xs, x < reference.size) : firstLogCharge (initial reference) (log reference [] xs) ≤ localAllowance reference + xs.length * (14 * Real.logb 2 (height reference) + 4) := RotationBST.Tango.BottomUp.startup_bound reference xs validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.Definitions, Algorithms.Tango.Algorithm.BottomUp.DefinitionsThe proof is the argument of the overview, by induction on the reference tree for one request. Inside a newly observed subtree, every first setting meets a component boundary, so root_component_charge, in an internal form plugged into the surrounding frames, bounds it by the node’s local credit. Only the topmost first setting of the request may join an existing ancestor component, and that one is bounded by updateCharge_le. startup_bound then sums the local credits with first_budget: each node’s credit is spent once.
theorem balanced_remainingCharge (n : Nat) (past xs : List Nat) (valid : ∀ key ∈ xs, key < n) : firstCharge (log (balanced n) past xs) (localCredit (balanced n)) ≤ 42 * n - observedCharge (balanced n) 0 past (localCredit (balanced n)) := RotationBST.Tango.BottomUp.balanced_remainingCharge n past xs validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.Definitions, Algorithms.Tango.Algorithm.BottomUp.Definitionstheorem balanced_startup_remaining (n : Nat) (past xs : List Nat) (history : ∀ y ∈ past, y < n) (valid : ∀ x ∈ xs, x < n) : firstLogCharge (canonical (balanced n) 0 past) (log (balanced n) past xs) ≤ 42 * n - observedCharge (balanced n) 0 past (localCredit (balanced n)) + xs.length * (14 * Real.logb 2 (height (balanced n)) + 4) := RotationBST.Tango.BottomUp.balanced_startup_remaining n past xs history validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.Definitions, Algorithms.Tango.Algorithm.BottomUp.DefinitionsFor balanced n, the credit is at most , and a resumed run only has the credit not yet spent by its history: , plus the attachment term.
Theorem (linear-startup Tango). For a policy whose step is the bottom-up step, the rotations of a run on valid requests are at most
and against any offline execution with rotations, from any tree of the same size, the total cost is at most .
theorem linear_run_bound {reference : Tree} (p : Policy reference) (steps : ∀ past s x, p.step past s x = serve s reference past x) (xs : List Nat) (valid : ∀ x ∈ xs, x < reference.size) : ((p.run xs).2 : ℝ) ≤ localAllowance reference + interleave reference xs * (14 * Real.logb 2 (height reference) + 4) + xs.length * (17 * Real.logb 2 (height reference) + 5) := RotationBST.Tango.BottomUp.linear_run_bound p steps xs validModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.Definitions, Algorithms.Tango.Algorithm.BottomUp.Definitionstheorem linear_competitive {reference : Tree} (p : Policy reference) (steps : ∀ past s x, p.step past s x = serve s reference past x) {start finish : Tree} {xs : List Nat} {offline : Nat} (size : reference.size = start.size) (execution : RotationBST.Execution start xs finish offline) : ((p.run xs).2 : ℝ) + xs.length ≤ localAllowance reference + (70 * Real.logb 2 (height reference) + 20) * (offline + xs.length : Nat) := RotationBST.Tango.BottomUp.linear_competitive p steps size executionModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.Definitions, Algorithms.Tango.Algorithm.BottomUp.DefinitionsThe factor is the attachment charge plus the final splay . In linear_competitive, Wilber’s bound (Results.rotation_lower_bound) turns the interleave term into , and the attachment term is absorbed as . Validity of the requests follows from the comparator.
Theorem (balanced reference). With the balanced reference tree on keys, the bound is with , and a policy with this bound exists.
theorem balanced_competitive (n : Nat) (p : Policy (balanced n)) (steps : ∀ past s x, p.step past s x = serve s (balanced n) past x) {start finish : Tree} {xs : List Nat} {offline : Nat} (size : start.size = n) (execution : RotationBST.Execution start xs finish offline) : ((p.run xs).2 : ℝ) + xs.length ≤ 42 * n + (70 * Real.logb 2 (Nat.log2 n + 1) + 20) * (offline + xs.length : Nat) := RotationBST.Tango.BottomUp.balanced_competitive n p steps size executionModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.Definitions, Algorithms.Tango.Algorithm.BottomUp.Definitionstheorem balanced_policy (n : Nat) : ∃ p : Policy (balanced n), (∀ past s x, p.step past s x = serve s (balanced n) past x) ∧ ∀ (start finish : Tree) (xs : List Nat) (offline : Nat), start.size = n → RotationBST.Execution start xs finish offline → ((p.run xs).2 : ℝ) + xs.length ≤ 42 * n + (70 * Real.logb 2 (Nat.log2 n + 1) + 20) * (offline + xs.length : Nat) := RotationBST.Tango.BottomUp.balanced_policy nModels.Rotation, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Algorithm.Request, 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, Algorithms.Tango.State.Preferences.Defs, Algorithms.Tango.State.Preferences.Lookup.Defs, Algorithms.Tango.State.Preferences.Algorithm.Defs, Algorithms.Tango.State.ComponentPath.Defs, Algorithms.Tango.State.ComponentPath.Address.Defs, Algorithms.Tango.State.Context.Defs, Algorithms.Tango.State.Context.Lookup.Defs, Algorithms.Tango.State.Context.Fringe.Defs, Algorithms.Tango.State.Nesting.Edits.Path.Algorithm.Defs, Algorithms.Tango.State.Nesting.Edits.Algorithm.Defs, Algorithms.Tango.State.Rebuild.Defs, Algorithms.Tango.State.Splay.Defs, Algorithms.Tango.State.Cut.Defs, Algorithms.Tango.State.Join.Defs, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Algorithms.Tango.Preferences, Algorithms.Tango.Preferences.Initialization.Definitions, Algorithms.Tango.Algorithm.Initialization.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.Preferences.Initialization.Local.Definitions, Algorithms.Tango.Algorithm.BottomUp.Definitionsbalanced_competitive applies to every policy whose step is BottomUp.serve, and uses . balanced_policy is the headline: one policy, chosen before the requests and the comparator, satisfying the bound for all of them. Its proof is ⟨policy (balanced n), …⟩, the executable bottom-up policy.
- Start tree. As in Section 26.2, the policy’s run starts from its reference tree,
MarkedTree.initial (balanced n), while the comparator starts from any tree of size . The next section removes this asymmetry at the price of rotations. - No hidden inputs. The hypothesis
stepsis discharged by the witness, and none of the bounds assumes anything about the request sequence beyond what the comparator implies. - Constants. , and are explicit, unoptimized witnesses. The attachment term costs a larger multiplicative constant than Section 26.2; only the startup became smaller, from to .
26.3.6 From a policy to an algorithm
A policy becomes an ordinary online algorithm by the construction of Section 26.2: recompute the marks by replaying the policy on the past requests, which is free planning in the rotation model, and reset any other initial tree to the reference tree on the first request, with at most rotations (Geometry.reset). The library states this once, for every policy.
Theorem (a policy as an online algorithm). For every policy with reference tree , there is an online algorithm that, run from on valid requests, produces exactly the policy’s final tree and rotation count, and whose total cost from any tree of the same size is at most .
/-- A causal rotation algorithm follows the marked policy exactly from itsreference tree. Any other same-size initial tree pays at most one 2n reset.Reconstructing private marks from history has uncharged abstract planning cost. -/theorem rotation_algorithm {reference : Tree} (p : Policy reference) : ∃ a : RotationBST.Algorithm, (∀ xs, (∀ x ∈ xs, x < reference.size) → a.runFrom [] reference xs = ((p.run xs).1.tree, (p.run xs).2)) ∧ ∀ saved : Tree, saved.size = reference.size → ∀ xs, (∀ x ∈ xs, x < reference.size) → a.totalCost saved xs ≤ xs.length + (p.run xs).2 + 2 * saved.size := p.rotation_algorithmModels.Rotation, 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.Lazy.Skeleton, Models.Pointer.Traces, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.Potential, Models.OnlineThe first conjunct compares Algorithm.runFrom from the reference tree with the plain tree of the policy’s run. The second bounds Algorithm.totalCost from any saved tree. With balanced_policy, it gives the online algorithm of the headline:
Theorem (Tango with linear startup, as one online algorithm). For every there is an online BST algorithm whose total cost, from every initial tree on keys, is at most against every offline execution from the same initial tree that serves the same requests with rotations.
/-- **Tango with linear startup.** The same statement with startup `44n`instead of `O(n log log n)`, at a larger coefficient. The algorithm runs thebottom-up policy (`Tango.BottomUp`), which pays for first preference settingsfrom local credit, at most `42n` on the balanced reference; reaching thereference from another initial tree costs at most `2n` more. -/theorem exists_competitive_linear (n : Nat) : ∃ A : Algorithm, ∀ {start finish : Tree} {xs : List Nat} {offline : Nat}, start.size = n → Execution start xs finish offline → (A.totalCost start xs : ℝ) ≤ (70 * Real.logb 2 (Nat.log2 n + 1) + 20) * (offline + xs.length : Nat) + 44 * n := Tango.exists_online_linear_bound nModels.Rotation, Models.Online, Algorithms.Tango.Algorithm.Definitions, Algorithms.Tango.Reference, Algorithms.Tango.State, Algorithms.Tango.Preferences.Updates, Bounds.Interleave.Definitions, Algorithms.Tango.Definitions, Algorithms.Tango.Paths, Bounds.Interleave.Wilber, Models.Region, Algorithms.Tango.Auxiliary.Definitions, Models.Pointer.Lazy.Skeleton, Models.Pointer.Machine, Algorithms.Splay.Algorithm, Algorithms.Splay.PotentialIt has the same shape as Results.exists_competitive of Section 26.2, which uses the top-down policy, with a larger factor and a linear additive term.
The real consumer is the combination of Chapter 31. There the bottom-up policy, packaged by rotation_algorithm, becomes an interruptible Tango worker for the ComboBST machinery of Section 29.1, with startup (Results.linear_balanced_worker). Its linear startup is what lets the combined bound of Theorem 4.3, Results.combined, keep an additive .