Definition BDDiff :=
  match BDDor cfg ul node1 node2 with
  | (cfg1, node3) =>
      match BDDand cfg1 (node3 :: ul) node1 node2 with
      | (cfg2, node4) => BDDimpl cfg2 (node4 :: node3 :: ul) node3 node4
      end
  end.

(* Specifications: *)
Lemma BDDiff_config_OK : BDDconfig_OK (fst BDDiff).
Lemma BDDiff_node_OK : config_node_OK (fst BDDiff) (snd BDDiff).
Lemma BDDiff_used_nodes_preserved : used_nodes_preserved cfg (fst BDDiff) ul.
Lemma BDDiff_is_iff : bool_fun_eq (bool_fun_of_BDD (fst BDDiff) (snd BDDiff)) (bool_fun_iff (bool_fun_of_BDD cfg node1) (bool_fun_of_BDD cfg node2)).
Lemma BDDiff_list_OK : used_list_OK (fst BDDiff) ul.
Lemma BDDiff_list_OK_cons : used_list_OK (fst BDDiff) (snd BDDiff :: ul).