def hmap_wf.go
bend-kit-collections@0.1.4.1 · LAWS.bend:513
import bend-kit-collections@0.1.4.1/LAWS.bend as LAWS
import Base
import bend-kit-collections@0.1.4.1/hmap.bend as M
513
514
515def hmap_wf.go(
516 ~K: Data, ~V: Data, ~hash: K -> U32, ~eq: K -> K -> Bool, +n: Nat, m: M.HMap<K, V>
517) -> Bool:
518 match n:
519 case 0n:
520 match m:
521 case M.HNil{}:
522 True{}
523 case M.HLeaf{h, es}:
524 hmap_distinct(~K, ~V, ~eq, es)
525 case M.HBranch{lo, hi}:
526 False{}
527 case 1n+p:
528 match m:
529 case M.HNil{}:
530 True{}
531 case M.HLeaf{h, +es}:
532 hmap_hashed(~K, ~V, ~hash, es, h) && hmap_distinct(~K, ~V, ~eq, es)
533 case M.HBranch{lo, hi}:
534 hmap_wf.go(~K, ~V, ~hash, ~eq, p, lo) && hmap_wf.go(~K, ~V, ~hash, ~eq, p, hi)