LAWS.hmap_wf.go: def of bend-kit-collections@0.1.4.1 Import: import bend-kit-collections@0.1.4.1/LAWS.bend as LAWS Lines 513-534 of bend-kit-collections@0.1.4.1/LAWS.bend: https://jend.leeeet.dev/read.txt?path=bend-kit-collections@0.1.4.1/LAWS.bend&start_line=513&end_line=534 import Base import bend-kit-collections@0.1.4.1/hmap.bend as M # A trie with n levels left: buckets hold distinct keys; above the last level, # a bucket's keys hash to its hash; the last level has no branches. def hmap_wf.go( ~K: Data, ~V: Data, ~hash: K -> U32, ~eq: K -> K -> Bool, +n: Nat, m: M.HMap ) -> Bool: match n: case 0n: match m: case M.HNil{}: True{} case M.HLeaf{h, es}: hmap_distinct(~K, ~V, ~eq, es) case M.HBranch{lo, hi}: False{} case 1n+p: match m: case M.HNil{}: True{} case M.HLeaf{h, +es}: hmap_hashed(~K, ~V, ~hash, es, h) && hmap_distinct(~K, ~V, ~eq, es) case M.HBranch{lo, hi}: hmap_wf.go(~K, ~V, ~hash, ~eq, p, lo) && hmap_wf.go(~K, ~V, ~hash, ~eq, p, hi) Uses (7): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=bend-kit-collections@0.1.4.1/LAWS.bend&name=hmap_distinct https://jend.leeeet.dev/definition.txt?path=bend-kit-collections@0.1.4.1/LAWS.bend&name=hmap_hashed https://jend.leeeet.dev/definition.txt?path=bend-kit-collections@0.1.4.1/hmap.bend&name=HMap