def h.distinct_put.c

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

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

2412def h.distinct_put.c(
2413  ~K: Data, ~V: Data, ~eq: K -> K -> Bool, ~refl: @x: K -> {eq(x, x) == True{} : Bool},
2414  ~sound: @x: K -> @y: K -> {eq(x, y) == True{} : Bool} -> {x == y : K},
2415  +key: K, +val: V, +rest: List<&2, M.Entry<K, V>>, +k: K, +v: V, b: Bool, eb: {b == eq(k, key) : Bool},
2416  +ds: {Laws.hmap_distinct(~K, ~V, ~eq, M.Entry{key, val} <> rest) == True{} : Bool},
2417  ih: {Laws.hmap_distinct(~K, ~V, ~eq, M.HMap.entries.put(~K, ~V, ~eq, rest, k, v)) == True{} : Bool}
2418) -> {Laws.hmap_distinct(~K, ~V, ~eq, h.epc(~K, ~V, ~eq, b, key, val, rest, k, v)) == True{} : Bool}:
2419  match b:
2420    case True{}:
2421      ds
2422    case False{}:
2423      MBool.and_eq_true(Laws.hmap_absent(~K, ~V, ~eq, M.HMap.entries.put(~K, ~V, ~eq, rest, k, v), key), Laws.hmap_distinct(~K, ~V, ~eq, M.HMap.entries.put(~K, ~V, ~eq, rest, k, v)), h.absent_put(~K, ~V, ~eq, ~refl, ~sound, rest, key, k, v,
2424          MBool.eq_true_of_and_left(Laws.hmap_absent(~K, ~V, ~eq, rest, key), Laws.hmap_distinct(~K, ~V, ~eq, rest), ds),
2425          h.sb(False{}, eq(k, key), eb)), ih)

Uses (11)

Used by (1)