def h.distinct_put

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

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

2427def h.distinct_put(
2428  ~K: Data, ~V: Data, ~eq: K -> K -> Bool, ~refl: @x: K -> {eq(x, x) == True{} : Bool},
2429  ~sound: @x: K -> @y: K -> {eq(x, y) == True{} : Bool} -> {x == y : K},
2430  xs: List<&2, M.Entry<K, V>>, +k: K, +v: V,
2431  ds: {Laws.hmap_distinct(~K, ~V, ~eq, xs) == True{} : Bool}
2432) -> {Laws.hmap_distinct(~K, ~V, ~eq, M.HMap.entries.put(~K, ~V, ~eq, xs, k, v)) == True{} : Bool}:
2433  match xs:
2434    case Nil{}:
2435      {==}
2436    case Con{M.Entry{+key, +val}, +rest}:
2437      +ds = ds
2438      h.distinct_put.c(~K, ~V, ~eq, ~refl, ~sound, key, val, rest, k, v, eq(k, key), {==}, ds,
2439        h.distinct_put(~K, ~V, ~eq, ~refl, ~sound, rest, k, v,
2440          MBool.eq_true_of_and_right(Laws.hmap_absent(~K, ~V, ~eq, rest, key), Laws.hmap_distinct(~K, ~V, ~eq, rest), ds)))

Uses (8)

Used by (3)