Dyadic

Dyadic intervals

This module is mostly internal to MerkleTree. It is a separate module mainly to expose its code for the test suite without polluting the MerkleTree interface.

type Prefix = [Nat8]

type IntervalLength = Nat

type Interval = { prefix : Prefix; len : IntervalLength }

A diadic interval, identified by a common prefix and its length in bits

public func singleton(p : Prefix) : Interval

public func mk(p : Prefix, i : IntervalLength) : Interval

Smart constructor. Normalizes the prefix by setting all bits beyond len to zero.

type FindResult = {#before : IntervalLength; #needle_is_prefix; #equal; #in_left_half; #in_right_half; #after : IntervalLength}

public func find(needle : Prefix, i : Interval) : FindResult