B-trees under a key function #
The monadic lookup programs commute with mapping keys (BTree.mapKeys): looking up g k in the
tree with keys g x under a comparison le is the same program as looking up k in the original
tree under the comparison fun a b => le (g a) (g b). This lets a lookup be evaluated under an
oracle that compares keys through a key function.
Main results #
BTree.lookupM_mapKeys,BTree.lookupBinM_mapKeys: lookup commutes withmapKeys.BTree.eval_lookupQ_keyOracle,BTree.eval_lookupBinQ_keyOracle: the query programs, evaluated at the comparison oracle of a key function, are the pure lookups in the tree with mapped keys.
Lookup in a tree with mapped keys, compared through the key function, is lookup in the original tree under the pulled-back comparison.
Lookup with binary in-node search in a tree with mapped keys, compared through the key function, is lookup in the original tree under the pulled-back comparison.
Under the comparison oracle of a key function, lookupQ evaluates to the pure lookup of the
mapped key in the tree with mapped keys.
Under the comparison oracle of a key function, lookupBinQ evaluates to the pure lookupBin
of the mapped key in the tree with mapped keys.