Definition restrict (x : BDDvar) (b : bool) (be : bool_expr) :=
  subst x (bool_to_be b) be.

Lemma restrict_OK : forall (x : BDDvar) (b : bool) (be : bool_expr), bool_fun_eq (bool_fun_of_bool_expr (restrict x b be)) (bool_fun_restrict (bool_fun_of_bool_expr be) x b).