Chapter 28Multiple trees
A request sequence often has more structure than its key frequencies show. If key is always followed by key , the second request is predictable from the first, however rare is overall. The natural measure of this predictability is the empirical conditional entropy of each request given the previous one, and the natural benchmark is for requests: one unit per request, plus the information it carries given its predecessor. Chapter 18 defines this benchmark and proves, following Lemma 7 of Bose, Douïeb, Iacono and Langerman (2016), that binary search trees cannot reach it: no execution of a BST, even one that rotates and knows the whole sequence in advance, stays within a constant factor of , plus a startup term depending only on , on every sequence. A lazy finger can be simulated by rotations at a constant factor (Chapter 16), so the optimal lazy-finger tree of Chapter 27, which adapts to where the previous search ended, cannot reach it either.
Theorem 9 of the same paper shows that the benchmark is reachable once the structure may hold several trees. Store, for every key , a small search tree holding the keys that most often follow , each with a pointer to its own small tree, and one shared balanced tree as a fallback. With successors per key, the structure has words, and each request costs about when it hits and when it misses. Misses are rare transitions, so the total is within a factor of . With , this is a constant factor in polynomial space, the consequence the paper draws in its Section 7.
Let and . Let be a key and a sequence of keys, all in . Let be the number of indices with , where , let , and let
be the empirical conditional information of , so that . The multiple-tree store built from with capacity uses at most words, and serves , starting from , at total cost at most
Moreover, for every there is a capacity , depending only on and , such that for every and the store built from uses at most words and serves at cost at most .
The cost is that of the linked-search model of Chapter 11: one unit per visited tree node and per pointer link followed. The store is built from the transition counts of the very sequence it serves, and the time to build it is not part of the bound; the counts themselves are not stored. In Lean, the execution is LinkedSearch.Execution, the space Store.words, the counts LazyFinger.frequency, is ConditionalEntropy.cost and is ConditionalEntropy.entropy.
The Lean statements
/-- Theorem 9 of arXiv:1304.6897 in the explicit static linked-pointer model.The empirical matrix is used for preprocessing only. Cost includes one unitper visited node and each fallback/successor link traversal. Request normalizationand `1 + log` factors cover deterministic rows, empty sequences, and capacity one.The initial predecessor is explicit; preprocessing time is not part of the bound. -/theorem sequence (n capacity : Nat) (positive : 0 < n) (nonempty : 0 < capacity) (fits : capacity ≤ n) (p : Fin n) (xs : List (Fin n)) : ∃ q k, LinkedSearch.Execution (build n capacity positive (LazyFinger.frequency p (xs.map Fin.val))) p (xs.map Fin.val) q k ∧ (k : ℝ) ≤ 6 * ConditionalEntropy.cost n p (xs.map Fin.val) * (1 + Real.logb 2 n) / (1 + Real.logb 2 capacity) ∧ (build n capacity positive (LazyFinger.frequency p (xs.map Fin.val))).words ≤ 10 * n * capacity := … sequence_tradeoff n capacity positive nonempty fits p xsModels.Rotation, Models.Labelled.Search.Definitions, Models.LinkedSearch.Definitions, Bounds.StaticTree.Definitions, Bounds.LazyFinger.Frequencies.Definitions, Bounds.LazyFinger.Edges.Definitions, Bounds.LazyFinger.Definitions, Bounds.ConditionalEntropy.Definitions, Structures.WeightedSearch.Definitions, Algorithms.MultipleTrees.Selection.Definitions, Algorithms.MultipleTrees.Cache.Definitions, Algorithms.MultipleTrees.Definitions/-- For each fixed positive exponent, Section 7's structure uses`O(n^(1+ε))` words and `O(m(1+H))` query work. The integer capacity is chosenbefore the sequence; preprocessing the actual trees still uses its empiricalfrequencies. The constants are explicit, including exponents greater than one.Initialization uses the specified predecessor and preprocessing time is excluded. -/theorem polynomial_space (n : Nat) (positive : 0 < n) (ε : ℝ) (exponent : 0 < ε) : ∃ capacity : Nat, 0 < capacity ∧ capacity ≤ n ∧ ∀ (p : Fin n) (xs : List (Fin n)), ∃ q k, LinkedSearch.Execution (build n capacity positive (LazyFinger.frequency p (xs.map Fin.val))) p (xs.map Fin.val) q k ∧ (k : ℝ) ≤ (6 / min ε 1) * (xs.length : ℝ) * (1 + ConditionalEntropy.entropy n p (xs.map Fin.val)) ∧ ((build n capacity positive (LazyFinger.frequency p (xs.map Fin.val))).words : ℝ) ≤ 20 * (n : ℝ) ^ (1 + ε) := … MultipleTrees.polynomial_space n positive ε exponentModels.Rotation, Models.Labelled.Search.Definitions, Models.LinkedSearch.Definitions, Bounds.StaticTree.Definitions, Bounds.LazyFinger.Frequencies.Definitions, Bounds.LazyFinger.Edges.Definitions, Bounds.LazyFinger.Definitions, Bounds.ConditionalEntropy.Definitions, Structures.WeightedSearch.Definitions, Algorithms.MultipleTrees.Selection.Definitions, Algorithms.MultipleTrees.Cache.Definitions, Algorithms.MultipleTrees.DefinitionsThe box is enough to confirm the result; its reading path consists of the linked-search model, the conditional-entropy definitions and the construction of this chapter. The rest of the chapter builds the structure and proves the bound. Section 28.1 explains the setting, Section 28.2 and Section 28.3 build the local trees, Section 28.4 assembles them, Section 28.5 bounds a single request, and Section 28.6 states the paper’s Theorem 9 and its Section 7 consequence in full.
The definitions are in Algorithms/MultipleTrees/Definitions/Abstract.lean, Selection/Definitions/Abstract.lean and Cache/Definitions/Abstract.lean; the theorems are in Algorithms/MultipleTrees/Abstract.lean, Selection/Abstract.lean and Cache/Abstract.lean.
28.1 Offline preprocessing, online queries
The structure is static, like the optimal trees of Chapter 27: it is built once, from the transition counts of the sequence, and then serves the sequence without changing. Three conventions follow, and the theorems state each of them explicitly.
- The counts are used for preprocessing only. The store holds trees and pointers, nothing else: a query compares keys and follows pointers, and never consults a frequency.
Store.wordscounts the store’s words, and the transition matrix is not among them. - Preprocessing time is excluded. The bounds concern the queries. No theorem bounds the time to compute the counts, sort them and build the trees, which is polynomial but not formalized.
- The initial predecessor is explicit. The first request is served from the local tree of a given key , and the pair is a transition like any other.
The cost model is the linked-search model of Chapter 11. A LinkedSearch.Store is a directory of local trees, one per key, and a shared fallback tree. Each node stores a key, two children and a pointer to a local tree. A cursor holds the local tree of the previous request. LinkedSearch.Request serves a key by an ordinary comparison search in the cursor’s local tree. If it finds , it follows ’s stored pointer, at cost . If not, it follows the fallback pointer, at cost , searches the fallback tree, and follows the pointer found there, at cost . Each visited node costs . In both cases the cursor ends at ’s local tree. LinkedSearch.Execution chains requests, adding their costs.
Lazy finger and multiple trees are both ways of exploiting where the previous request was. A lazy finger walks from the previous key inside one tree, so all predecessors share one shape. Multiple trees give each predecessor its own shape, at the price of trees, which is why they can reach the conditional-entropy bound and a single tree cannot.
28.2 Selecting the successors
For a fixed predecessor , the local tree holds the keys that most often follow , where is the capacity.
/-- Rank all keys by decreasing outgoing frequency. Ties retain a validnonincreasing order and do not affect the omission bound. -/def ranking (n : Nat) (frequency : Nat → Nat) : List Nat := (List.range n).mergeSort (fun a b => frequency b ≤ frequency a)/-- The most frequent successors stored for one predecessor. This list is infrequency order; an ordered-key representation is built separately. -/def selected (n capacity : Nat) (frequency : Nat → Nat) : List Nat := (ranking n frequency).take capacityranking n frequency lists the keys by nonincreasing frequency, using a merge sort; how ties are ordered does not matter for the bounds. selected n capacity frequency keeps the first capacity of them. Here frequency is one row of the transition matrix, the counts for a fixed .
Theorem (selection). The selected list has entries, has no repetitions, and contains only keys less than . Every selected key is at least as frequent as every omitted key.
theorem size (n capacity : Nat) (frequency : Nat → Nat) : (selected n capacity frequency).length = min capacity n := selected_length n capacity frequencyAlgorithms.MultipleTrees.Selection.Definitionstheorem distinct (n capacity : Nat) (frequency : Nat → Nat) : (selected n capacity frequency).Nodup := selected_distinct n capacity frequencyAlgorithms.MultipleTrees.Selection.Definitionstheorem valid (n capacity : Nat) (frequency : Nat → Nat) : ∀ x ∈ selected n capacity frequency, x < n := selected_valid n capacity frequencyAlgorithms.MultipleTrees.Selection.Definitionstheorem dominates (n capacity : Nat) (frequency : Nat → Nat) (x y : Nat) (stored : x ∈ selected n capacity frequency) (valid : y < n) (omitted : y ∉ selected n capacity frequency) : frequency y ≤ frequency x := selected_dominates n capacity frequency x y stored valid omittedAlgorithms.MultipleTrees.Selection.DefinitionsThe point of the selection is that an omitted successor is rare. If keys are kept and is not among them, then each of the kept keys is at least as frequent as , so , the row total.
Theorem (misses are rare). If and is not selected, then . If moreover and , then .
theorem miss (n capacity : Nat) (frequency : Nat → Nat) (y : Nat) (fits : capacity ≤ n) (valid : y < n) (omitted : y ∉ selected n capacity frequency) : capacity * frequency y ≤ ((List.range n).map frequency).sum := omitted_frequency n capacity frequency y fits valid omittedAlgorithms.MultipleTrees.Selection.Definitionstheorem miss_information (n capacity : Nat) (frequency : Nat → Nat) (y : Nat) (fits : capacity ≤ n) (nonempty : 0 < capacity) (valid : y < n) (omitted : y ∉ selected n capacity frequency) (positive : 0 < frequency y) : Real.logb 2 capacity ≤ Real.logb 2 ((((List.range n).map frequency).sum : ℝ) / frequency y) := omitted_information n capacity frequency y fits nonempty valid omitted positiveAlgorithms.MultipleTrees.Selection.DefinitionsThe second form is the one the tradeoff uses: a miss costs , but it only happens on a transition whose information is already at least .
28.3 Local trees
/-- The most frequent successors, rearranged into key order for comparisons. -/def cacheKeys (n capacity : Nat) (frequency : Nat → Nat) : List Nat := (selected n capacity frequency).mergeSort (· ≤ ·)/-- A static cache stores actual universe keys. Its shape balances a mixture ofsuccessor frequencies and uniform weight, controlling both hits and misses. -/def cacheTree (n capacity : Nat) (frequency : Nat → Nat) : LabelledTree Nat := (WeightedSearch.balancedBuild ((cacheKeys n capacity frequency).map frequency)).labelWith (cacheKeys n capacity frequency)cacheKeys sorts the selected keys into increasing order, so that they can label a search tree. cacheTree builds a shape for them with WeightedSearch.balancedBuild of Chapter 34, weighted by their frequencies and mixed with a uniform baseline, and labels its nodes with the keys in inorder using Tree.labelWith. The baseline gives every stored key logarithmic depth, and the frequencies give frequent successors small depth.
Theorem (local trees). The local tree has nodes. Its inorder key list is the sorted selection, a permutation of the selected keys, and it is a valid search tree.
theorem size (n capacity : Nat) (frequency : Nat → Nat) : (cacheTree n capacity frequency).erase.size = min capacity n := cacheTree_size n capacity frequencytheorem keys (n capacity : Nat) (frequency : Nat → Nat) : (cacheTree n capacity frequency).inorder = cacheKeys n capacity frequency ∧ (cacheKeys n capacity frequency).Perm (selected n capacity frequency) := ⟨cacheTree_inorder n capacity frequency, cacheKeys_perm n capacity frequency⟩theorem ordered (n capacity : Nat) (frequency : Nat → Nat) : (cacheTree n capacity frequency).Ordered := cacheTree_ordered n capacity frequencyTheorem (search in a local tree). An ordinary comparison search for a key in the local tree finds it exactly when is selected. If , then whether it succeeds or not, it visits at most nodes. If is selected and , it visits at most nodes.
theorem membership (n capacity : Nat) (frequency : Nat → Nat) (x : Nat) : (LabelledTree.lookup (cacheTree n capacity frequency) x).1 = true ↔ x ∈ selected n capacity frequency := cacheTree_lookup n capacity frequency xtheorem uniform (n capacity : Nat) (frequency : Nat → Nat) (x : Nat) (nonempty : 0 < min capacity n) : ((LabelledTree.lookup (cacheTree n capacity frequency) x).2 : ℝ) ≤ Real.logb 2 (2 * ((min capacity n : Nat) : ℝ)) + 1 := cacheTree_uniform n capacity frequency x nonemptytheorem weighted (n capacity : Nat) (frequency : Nat → Nat) (x : Nat) (stored : x ∈ selected n capacity frequency) (positive : 0 < frequency x) : ((LabelledTree.lookup (cacheTree n capacity frequency) x).2 : ℝ) ≤ Real.logb 2 (3 * (((List.range n).map frequency).sum : ℝ) / frequency x) + 1 := cacheTree_weighted n capacity frequency x stored positiveThe search is LabelledTree.lookup, which returns whether the key was found and the number of visited nodes; an unsuccessful search can visit nodes too. In the weighted bound, is the total of the whole row, not only of the selected keys, which is weaker but is the quantity that appears in the conditional information.
28.4 The store
/-- Preprocessing converts a universe key into its local-root address. Themodulus only totalizes out-of-universe inputs; stored and requested keys are valid. -/def rootAddress (n : Nat) (positive : 0 < n) (x : Nat) : Fin n := ⟨x % n, Nat.mod_lt x positive⟩/-- The shared fallback contains every universe key with a uniformly balancedshape. Frequencies are unnecessary for this tree. -/def fallbackTree (n : Nat) : LabelledTree Nat := cacheTree n n (fun _ => 0)/-- Preprocess a frequency matrix into local successor caches and one sharedfallback. Only trees and root pointers are stored; the frequency matrix is nota field of the resulting runtime store. -/def build (n capacity : Nat) (positive : 0 < n) (frequency : Nat → Nat → Nat) : LinkedSearch.Store (Fin n) where roots p := LinkedSearch.attach (rootAddress n positive) (cacheTree n capacity (frequency p)) fallback := LinkedSearch.attach (rootAddress n positive) (fallbackTree n)build n capacity positive frequency is the whole structure, for a universe of keys and a full transition matrix frequency. The local tree of is cacheTree for row . The fallback is a local tree with capacity and all frequencies zero: it holds every key, in a balanced shape. LinkedSearch.attach fills in the successor pointers during preprocessing: a node holding key points to the local tree of . Local trees are addressed by Fin n, and rootAddress converts a key to its address; the reduction modulo only makes the function total, since every stored key is already less than . The matrix is an argument of build, not a field of the store.
Theorem (space). The store has exactly nodes and words. For , that is at most words.
/-- The local trees plus the single shared fallback have this exact node count. -/theorem nodes (n capacity : Nat) (positive : 0 < n) (frequency : Nat → Nat → Nat) : (build n capacity positive frequency).nodes = n * min capacity n + n := build_nodes n capacity positive frequencyModels.Rotation, Models.Labelled.Search.Definitions, Models.LinkedSearch.Definitions, Bounds.StaticTree.Definitions, Bounds.LazyFinger.Frequencies.Definitions, Bounds.LazyFinger.Edges.Definitions, Bounds.LazyFinger.Definitions, Bounds.ConditionalEntropy.Definitions, Structures.WeightedSearch.Definitions, Algorithms.MultipleTrees.Selection.Definitions, Algorithms.MultipleTrees.Cache.Definitions, Algorithms.MultipleTrees.Definitions/-- Four fields per node and one cell per root; no frequency matrix is retained. -/theorem words (n capacity : Nat) (positive : 0 < n) (frequency : Nat → Nat → Nat) : (build n capacity positive frequency).words = 4 * (n * min capacity n + n) + n + 1 := build_words n capacity positive frequencyModels.Rotation, Models.Labelled.Search.Definitions, Models.LinkedSearch.Definitions, Bounds.StaticTree.Definitions, Bounds.LazyFinger.Frequencies.Definitions, Bounds.LazyFinger.Edges.Definitions, Bounds.LazyFinger.Definitions, Bounds.ConditionalEntropy.Definitions, Structures.WeightedSearch.Definitions, Algorithms.MultipleTrees.Selection.Definitions, Algorithms.MultipleTrees.Cache.Definitions, Algorithms.MultipleTrees.Definitionstheorem space (n capacity : Nat) (positive : 0 < n) (frequency : Nat → Nat → Nat) (nonempty : 0 < capacity) : (build n capacity positive frequency).words ≤ 10 * n * capacity := build_space n capacity positive frequency nonemptyModels.Rotation, Models.Labelled.Search.Definitions, Models.LinkedSearch.Definitions, Bounds.StaticTree.Definitions, Bounds.LazyFinger.Frequencies.Definitions, Bounds.LazyFinger.Edges.Definitions, Bounds.LazyFinger.Definitions, Bounds.ConditionalEntropy.Definitions, Structures.WeightedSearch.Definitions, Algorithms.MultipleTrees.Selection.Definitions, Algorithms.MultipleTrees.Cache.Definitions, Algorithms.MultipleTrees.DefinitionsEach node has four words: its key, its successor pointer and two children. The directory has one word per local tree, and one more word points to the fallback.
28.5 Serving one request
Theorem (query semantics). Starting from the local tree of any key , the executable query for any key is a legal request in the linked-search model, ending at ’s local tree, at the cost it reports.
/-- The cursor advances by stored links, ending at the requested key's local root. -/theorem query (n capacity : Nat) (positive : 0 < n) (frequency : Nat → Nat → Nat) (p x : Fin n) : LinkedSearch.Request (build n capacity positive frequency) p x x (LinkedSearch.request (build n capacity positive frequency) p x).2 := request_execution n capacity positive frequency p xModels.Rotation, Models.Labelled.Search.Definitions, Models.LinkedSearch.Definitions, Bounds.StaticTree.Definitions, Bounds.LazyFinger.Frequencies.Definitions, Bounds.LazyFinger.Edges.Definitions, Bounds.LazyFinger.Definitions, Bounds.ConditionalEntropy.Definitions, Structures.WeightedSearch.Definitions, Algorithms.MultipleTrees.Selection.Definitions, Algorithms.MultipleTrees.Cache.Definitions, Algorithms.MultipleTrees.DefinitionsLinkedSearch.request is the executable query and LinkedSearch.Request the relational semantics of Chapter 11; the theorem says they agree on this store, and that the cursor reaches , so the next request can start from there.
Theorem (worst case). For , every request, whatever its frequency, costs at most .
/-- Worst-case query cost includes a possible failed cache search and fallback. -/theorem uniform (n capacity : Nat) (positive : 0 < n) (frequency : Nat → Nat → Nat) (nonempty : 0 < capacity) (p x : Fin n) : ((LinkedSearch.request (build n capacity positive frequency) p x).2 : ℝ) ≤ Real.logb 2 (2 * ((min capacity n : Nat) : ℝ)) + Real.logb 2 (2 * (n : ℝ)) + 4 := request_uniform n capacity positive frequency nonempty p xModels.Rotation, Models.Labelled.Search.Definitions, Models.LinkedSearch.Definitions, Bounds.StaticTree.Definitions, Bounds.LazyFinger.Frequencies.Definitions, Bounds.LazyFinger.Edges.Definitions, Bounds.LazyFinger.Definitions, Bounds.ConditionalEntropy.Definitions, Structures.WeightedSearch.Definitions, Algorithms.MultipleTrees.Selection.Definitions, Algorithms.MultipleTrees.Cache.Definitions, Algorithms.MultipleTrees.DefinitionsThis is the cost of a failed local search, the fallback link, a full search of the balanced fallback and the final successor link. It is the bound for transitions that the preprocessing never saw.
Theorem (one transition). If and the transition has , the request for from costs at most
/-- A normalized per-transition information bound, including capacity one. -/theorem tradeoff (n capacity : Nat) (positive : 0 < n) (frequency : Nat → Nat → Nat) (nonempty : 0 < capacity) (fits : capacity ≤ n) (p x : Fin n) (observed : 0 < frequency p x) : ((LinkedSearch.request (build n capacity positive frequency) p x).2 : ℝ) ≤ 6 * (1 + Real.logb 2 ((ConditionalEntropy.rowTotal n frequency p : ℝ) / frequency p x)) * (1 + Real.logb 2 n) / (1 + Real.logb 2 capacity) := request_tradeoff n capacity positive frequency nonempty fits p x observedModels.Rotation, Models.Labelled.Search.Definitions, Models.LinkedSearch.Definitions, Bounds.StaticTree.Definitions, Bounds.LazyFinger.Frequencies.Definitions, Bounds.LazyFinger.Edges.Definitions, Bounds.LazyFinger.Definitions, Bounds.ConditionalEntropy.Definitions, Structures.WeightedSearch.Definitions, Algorithms.MultipleTrees.Selection.Definitions, Algorithms.MultipleTrees.Cache.Definitions, Algorithms.MultipleTrees.DefinitionsHere is ConditionalEntropy.rowTotal. The proof has two cases. On a hit, the cost is a weighted search in the local tree plus a link, , and the factor is at least . On a miss, the cost is , but by the selection theorem , so . The constant covers both cases. The normalization by instead of keeps the statement meaningful for and for deterministic transitions, where .
28.6 The tradeoff
Summing the one-transition bound over the sequence gives Theorem 9. The store is built from the sequence’s own transition matrix, so every transition actually performed has positive count. And the sum of over all requests is , because the transition occurs times.
Theorem 9 (space/query tradeoff). Let , , , and let be a sequence of keys less than . The store built with capacity from the transition counts of , starting from , serves from at cost at most , and uses at most words.
/-- Theorem 9 of arXiv:1304.6897 in the explicit static linked-pointer model.The empirical matrix is used for preprocessing only. Cost includes one unitper visited node and each fallback/successor link traversal. Request normalizationand `1 + log` factors cover deterministic rows, empty sequences, and capacity one.The initial predecessor is explicit; preprocessing time is not part of the bound. -/theorem sequence (n capacity : Nat) (positive : 0 < n) (nonempty : 0 < capacity) (fits : capacity ≤ n) (p : Fin n) (xs : List (Fin n)) : ∃ q k, LinkedSearch.Execution (build n capacity positive (LazyFinger.frequency p (xs.map Fin.val))) p (xs.map Fin.val) q k ∧ (k : ℝ) ≤ 6 * ConditionalEntropy.cost n p (xs.map Fin.val) * (1 + Real.logb 2 n) / (1 + Real.logb 2 capacity) ∧ (build n capacity positive (LazyFinger.frequency p (xs.map Fin.val))).words ≤ 10 * n * capacity := sequence_tradeoff n capacity positive nonempty fits p xsModels.Rotation, Models.Labelled.Search.Definitions, Models.LinkedSearch.Definitions, Bounds.StaticTree.Definitions, Bounds.LazyFinger.Frequencies.Definitions, Bounds.LazyFinger.Edges.Definitions, Bounds.LazyFinger.Definitions, Bounds.ConditionalEntropy.Definitions, Structures.WeightedSearch.Definitions, Algorithms.MultipleTrees.Selection.Definitions, Algorithms.MultipleTrees.Cache.Definitions, Algorithms.MultipleTrees.DefinitionsThe sequence is a list of Fin n, so its validity is part of its type; xs.map Fin.val is the same list of natural numbers. The theorem asserts an execution of the store, with some final cursor q and cost k, not just a number: every request in it is a legal linked search.
Two capacities are worth spelling out. With , every observed successor is stored, the store has words and the cost is at most , within a constant of the benchmark. With , the store has words and the cost is . In between, the factor is .
Theorem (polynomial space, Section 7 of the paper). Let and . There is a capacity with , depending only on and , such that for every start and every sequence , the store built with capacity from the transition counts of serves from at cost at most , and uses at most words.
/-- For each fixed positive exponent, Section 7's structure uses`O(n^(1+ε))` words and `O(m(1+H))` query work. The integer capacity is chosenbefore the sequence; preprocessing the actual trees still uses its empiricalfrequencies. The constants are explicit, including exponents greater than one.Initialization uses the specified predecessor and preprocessing time is excluded. -/theorem polynomial_space (n : Nat) (positive : 0 < n) (ε : ℝ) (exponent : 0 < ε) : ∃ capacity : Nat, 0 < capacity ∧ capacity ≤ n ∧ ∀ (p : Fin n) (xs : List (Fin n)), ∃ q k, LinkedSearch.Execution (build n capacity positive (LazyFinger.frequency p (xs.map Fin.val))) p (xs.map Fin.val) q k ∧ (k : ℝ) ≤ (6 / min ε 1) * (xs.length : ℝ) * (1 + ConditionalEntropy.entropy n p (xs.map Fin.val)) ∧ ((build n capacity positive (LazyFinger.frequency p (xs.map Fin.val))).words : ℝ) ≤ 20 * (n : ℝ) ^ (1 + ε) := MultipleTrees.polynomial_space n positive ε exponentModels.Rotation, Models.Labelled.Search.Definitions, Models.LinkedSearch.Definitions, Bounds.StaticTree.Definitions, Bounds.LazyFinger.Frequencies.Definitions, Bounds.LazyFinger.Edges.Definitions, Bounds.LazyFinger.Definitions, Bounds.ConditionalEntropy.Definitions, Structures.WeightedSearch.Definitions, Algorithms.MultipleTrees.Selection.Definitions, Algorithms.MultipleTrees.Cache.Definitions, Algorithms.MultipleTrees.DefinitionsThe proof takes the capacity , so and the ratio of logarithms is at most . The cap at reflects that a capacity of already stores every successor: for , the space bound is valid but weaker than the actually used. The cost is written with the average conditional entropy , which ConditionalEntropy.entropy totalizes to for the empty sequence, so .
- The capacity is chosen before the sequence is known, but the trees are not: they are built from the transition counts of itself, as in the paper. Both theorems are offline statements about a structure tuned to the sequence it serves, like the optimal static trees of Chapter 27.
- The cost counts node visits and pointer links in the linked-search model. Building the store is not counted, and the transition matrix is not part of the space.
- The benchmark is normalized as , with one unit per request, so a deterministic sequence, with , still costs .