Fixpoint tree_of_ptree (t : PositiveMap.t A) : tree (option A) :=
    match t with
    | PositiveMap.Leaf _ => atom None
    | PositiveMap.Node t1 v t2 =>
      node [tree_of_ptree t1; atom v; tree_of_ptree t2]
    end.Fixpoint ptree_of_tree (t : tree (option A)) : option (PositiveMap.t A) :=
    match t with
    | atom None => Some (PositiveMap.Leaf A)
    | node [t1; atom v; t2] =>
      match ptree_of_tree t1, ptree_of_tree t2 with
      | Some pt1, Some pt2 =>
        Some (PositiveMap.Node pt1 v pt2)
      | _, _ => None
      end
    | _ => None
    end.

(* Specifications: *)
Lemma tree_of_ptree_ptree_of_tree : forall t, ptree_of_tree (tree_of_ptree t) = Some t.