Definition map_fmap (A B:Type) (f:A->B) : map A -> map B :=
  fix map_fmap (m:map A) : map B :=
  match m with
  | Leaf => Leaf _
  | Node m1 o m2 =>
       let x := match o with
                | None => None
                | Some x => Some (f x)
                end in
       Node _ (map_fmap m1) x (map_fmap m2)
  end.

Lemma fmap_unset : forall A B (m:map A) (f:A->B) x, (map_fmap A B f (unset A m x)) = unset B (map_fmap A B f m) x.