fact: Fixpoint updater {A B: Type} (f : A -> B) (g : B -> option A) (acc:B) (i:key) (m:ptrie A) : ptrie A * B := match m with | Empty => (Empty, acc) | Leaf j v => if eqb i j then let r := f v in match g r with | None => (Empty,r) | Some v' => (Leaf i v',r) end else (Leaf j v,acc) | Branch prefix brbit l r => if match_prefix i prefix brbit then if zerobit i brbit then let (u,v) := updater f g acc i l in (branch prefix brbit u r,v) else let (u,v) := updater f g acc i r in (branch prefix brbit l u,v) else (m,acc) end.
imports: List Bool ZArith Lia