def h.hashed_put

bend-kit-collections@0.1.4.1 · PROOF.bend:2454

import bend-kit-collections@0.1.4.1/PROOF.bend as PROOF
import Base
import bend-mathlib@0.7.4.0/bool.bend as MBool
import bend-kit-collections@0.1.4.1/LAWS.bend as Laws
import bend-kit-collections@0.1.4.1/hmap.bend as M

2454def h.hashed_put(
2455  ~K: Data, ~V: Data, ~hash: K -> U32, ~eq: K -> K -> Bool,
2456  xs: List<&2, M.Entry<K, V>>, +o: U32, +k: K, +v: V,
2457  +hk: {U32.is_eq(o, hash(k)) == True{} : Bool},
2458  hs: {Laws.hmap_hashed(~K, ~V, ~hash, xs, o) == True{} : Bool}
2459) -> {Laws.hmap_hashed(~K, ~V, ~hash, M.HMap.entries.put(~K, ~V, ~eq, xs, k, v), o) == True{} : Bool}:
2460  match xs:
2461    case Nil{}:
2462      %h.sb(U32.is_eq(o, hash(k)), True{}, hk) : {Bool.and(_, True{}) == True{} : Bool}
2463      {==}
2464    case Con{M.Entry{+key, +val}, +rest}:
2465      +hs = hs
2466      h.hashed_put.c(~K, ~V, ~hash, ~eq, key, val, rest, o, k, v, eq(k, key), hs,
2467        h.hashed_put(~K, ~V, ~hash, ~eq, rest, o, k, v, hk,
2468          MBool.eq_true_of_and_right(U32.is_eq(o, hash(key)), Laws.hmap_hashed(~K, ~V, ~hash, rest, o), hs)))

Uses (11)

Used by (1)