Least and greatest entries of B+-trees #
The least entry of a B+-tree is the first entry of its leftmost leaf, and the greatest is the
last entry of its rightmost leaf. minM and maxM walk to that leaf through first, respectively
last, children. They compare no keys, so they take only the node-visit action visit, which
fires once at each node on the path, the leaf included. The pure operations are the Id
instantiations with visit := pure ().
The model equations need the leaf that the walk reaches to be non-empty unless it is the root.
They are stated for occupied subtrees at 2 ≤ t, which is what the sibling fallback of
pred? and succ? uses, and for well-formed trees.
Main definitions #
Main results #
map_minM,map_maxM: a monad morphism commutes with the walks.min?_eq,max?_eq: on a well-formed tree,min?andmax?are the first and the last entry oftoList.Occupied.min?_eq,Occupied.max?_eq: the same for an occupied subtree at2 ≤ t.
Greatest entry: walk along the separators of each node, which is free, descend through last
children to the rightmost leaf and return its last entry. visit fires once at each node on the
path.