def well_formed
import mylsm-lsm-store@0.6.0.1/src/BitTree.bend as BitTreeimport Base
254# Checks zero canonicality, logical bounds, power-of-two capacity, height, and
255# exact tree shape. It does not require padding words to remain zero.
256def well_formed(tree: BitTree) -> Bool:
257 match tree:
258 case BT{Empty{}, words, capacity, height}:
259 empty_metadata_ok(words, capacity, height)
260 case BT{root, words, capacity, height}:
261 nonempty_metadata_ok(root, words, capacity, height)