Splay-tree potential #
Ranks are binary logarithms of leaf counts, equivalently internal-node counts plus one. The potential sums these ranks over internal nodes. Both quantities are proof-only observations of mathlib trees: the implementation does not maintain subtree sizes or compute logarithms.
The local inequalities below count one or two rotations, not RAM instructions. An implementation's measured execution must separately justify the cost of those rotations and all surrounding work before using a scaled potential for runtime.
A proof-only rank with a well-defined zero value at the empty tree.
Equations
Instances For
Sum the ranks of the internal nodes.
Equations
- One or more equations did not get rendered due to their size.
- Complexity.Language.Examples.Splay.potential Tree.nil = 0
Instances For
A final left-child single rotation has one additive unit of amortized cost.
A final right-child single rotation has one additive unit of amortized cost.
Two left-child rotations are paid for by three times the accessed rank gain.
Two right-child rotations are paid for by three times the accessed rank gain.
A left-right double rotation satisfies the stronger two-rank-gain bound.
A right-left double rotation satisfies the stronger two-rank-gain bound.