~/bend-docscommunity

src/Keys.bend checks

raw source on the hub · import mylsm-lsm-store@0.6.0.1/src/Keys.bend as Keys

4 imports
import Base
import bend-mathlib@0.7.5.0/string.bend as MString
import bend-mathlib@0.7.5.0/bool.bend as MBool
import bend-kit-bytes@0.3.2.0/bytes.bend as PackedBytes

Definitions

def Bytes.cmp.order source · line 6 · raw

@pair:Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, Cmp)) -> Cmp

def Bytes.cmp.with_inputs source · line 11 · raw

@left:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @right:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, Pair(0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes, Cmp))

def Bytes.cmp source · line 17 · raw

@left:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @right:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> Cmp

def Bytes.eq source · line 20 · raw

@left:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> @right:0x185ae03c75e3e75be1171471f68b43cb/bytes.Bytes -> Bool

def unpack source · line 26 · raw

@pair:Pair(Pair(String, String), Cmp) -> Cmp

Total-order comparison for keys. Base's String.cmp hands the strings back beside the verdict ((s1, s2), c); we take reusable copies and unpack via a helper (a match cannot scrutinize the computed call directly).

def cmp source · line 32 · raw

@+s1:String -> @+s2:String -> Cmp

Handle cmp in the key ordering and comparison.

def eq source · line 36 · raw

@+s1:String -> @+s2:String -> Bool

Handle eq in the key ordering and comparison.

def cmp_is_lt source · line 40 · raw

@ord:Cmp -> Bool

Small, coherent views of Cmp used by key-order laws and sorted-run code.

def cmp_is_eq source · line 44 · raw

@ord:Cmp -> Bool

Compare whether is eq holds for the key ordering and comparison.

def cmp_is_gt source · line 48 · raw

@ord:Cmp -> Bool

Compare whether is gt holds for the key ordering and comparison.

def cmp_is_le source · line 52 · raw

@ord:Cmp -> Bool

Compare whether is le holds for the key ordering and comparison.

def lt source · line 56 · raw

@+s1:String -> @+s2:String -> Bool

Handle lt in the key ordering and comparison.

def le source · line 60 · raw

@+s1:String -> @+s2:String -> Bool

Handle le in the key ordering and comparison.

def implies source · line 64 · raw

@s1:Bool -> @s2:Bool -> Bool

Handle implies in the key ordering and comparison.

def one_hot3 source · line 72 · raw

@first:Bool -> @second:Bool -> @third:Bool -> Bool

True exactly when one of three arbitrary predicates is true.

def cmp_one_hot source · line 84 · raw

@+ord:Cmp -> Bool

Cmp is intrinsically one-hot; this predicate gives K6 a reusable statement.

def cmp_one_hot_proof source · line 88 · raw

@+ord:Cmp -> {cmp_one_hot(ord) == True{} : Bool}

Compare whether one hot proof holds for the key ordering and comparison.

def cmp_eq_pair source · line 100 · raw

@pair:Pair(Pair(String, String), Cmp) -> {cmp_is_eq(unpack(pair)) == Cmp.is_eq(Pair.snd(Pair(String, String), Cmp, pair)) : Bool}

String.eq is defined by the EQ projection of String.cmp (Cmp.is_eq of Pair.snd since bend 2.0.33); matching the handed-back comparison pair exposes that definitional correspondence.

def cmp_eq_bridge source · line 114 · raw

@+s1:String -> @+s2:String -> {cmp_is_eq(cmp(s1, s2)) == eq(s1, s2) : Bool}

Compare whether eq bridge holds for the key ordering and comparison.

def s_cmp_pair_refl source · line 125 · raw

@+str:String -> {String.cmp(str, str) == ((str, str), EQ{}) : Pair(Pair(String, String), Cmp)}

Handle s cmp pair refl in the key ordering and comparison.

def str_refl source · line 129 · raw

@+str:String -> {cmp(str, str) == EQ{} : Cmp}

Handle str refl in the key ordering and comparison.

def str_eq_refl source · line 134 · raw

@+str:String -> {eq(str, str) == True{} : Bool}

Handle str eq refl in the key ordering and comparison.