def h.absent_none

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

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

2284def h.absent_none(
2285  ~K: Data, ~V: Data, ~eq: K -> K -> Bool, xs: List<&2, M.Entry<K, V>>, +k: K,
2286  ab: {Laws.hmap_absent(~K, ~V, ~eq, xs, k) == True{} : Bool}
2287) -> {M.HMap.entries.get(~K, ~V, ~eq, xs, k) == None{} : Maybe<&2, V>}:
2288  match xs:
2289    case Nil{}:
2290      {==}
2291    case Con{M.Entry{+key, +val}, +rest}:
2292      +ab = ab
2293      %h.sb(eq(k, key), False{},
2294        MBool.eq_false_of_not_eq_true(eq(k, key), MBool.eq_true_of_and_left(Bool.not(eq(k, key)), Laws.hmap_absent(~K, ~V, ~eq, rest, k), ab)))
2295        : {h.egc(~K, ~V, ~eq, _, val, rest, k) == None{} : Maybe<&2, V>}
2296      h.absent_none(~K, ~V, ~eq, rest, k,
2297        MBool.eq_true_of_and_right(Bool.not(eq(k, key)), Laws.hmap_absent(~K, ~V, ~eq, rest, k), ab))

Uses (12)

Used by (1)