spec/math/hash.bend
bend-collections-laws-math@1.0.0.0 · 17 lines · 2 definitions
1import Base
2import bend-collections-laws-math@1.0.0.0/spec/lib/numeric.bend as N
3import bend-collections-laws-math@1.0.0.0/src/math/hash.bend as H
4
5
6
7
8
9
10
11
12def Bucket.le(+w: U32, +mask: U32) -> Type:
13 {Nat.is_le(U32.to_nat(H.bucket(w, mask)), U32.to_nat(mask)) == True{} : Bool}
14
15
16def Bucket.lt(+w: U32, +k: Nat, +mask: U32, +hm: {mask == U32{N.mask(32n, k)} : U32}) -> Type:
17 {Nat.is_lt(U32.to_nat(H.bucket(w, mask)), N.scale_binary(k, 1n)) == True{} : Bool}