Fixpoint be_x_free (x : BDDvar) (be : bool_expr) {struct be} : bool :=
  match be with
  | Zero => false
  | One => false
  | Var y => Neqb x y
  | Neg be1 => be_x_free x be1
  | Or be1 be2 => be_x_free x be1 || be_x_free x be2
  | ANd be1 be2 => be_x_free x be1 || be_x_free x be2
  | Impl be1 be2 => be_x_free x be1 || be_x_free x be2
  | Iff be1 be2 => be_x_free x be1 || be_x_free x be2
  end.

(* Specifications: *)
Lemma subst_x_free : forall (be bex : bool_expr) (x y : BDDvar), be_x_free y (subst x bex be) = true -> be_x_free y be = true /\ Neqb x y = false \/ be_x_free y bex = true.
Lemma restrict_x_free : forall (be : bool_expr) (x y : BDDvar) (b : bool), be_x_free y (restrict x b be) = true -> be_x_free y be = true /\ Neqb x y = false.
Lemma replace_x_free : forall (be : bool_expr) (x y z : BDDvar), be_x_free z (replace x y be) = true -> be_x_free z be = true /\ Neqb x z = false \/ Neqb y z = true.
Lemma replacel_x_free : forall (lx ly : list ad) (be : bool_expr) (x : BDDvar), length lx = length ly -> be_x_free x (replacel be lx ly) = true -> be_x_free x be = true /\ ~ In x lx \/ In x ly.
Lemma impl_x_free : forall (be1 be2 : bool_expr) (x : BDDvar), be_x_free x (Impl be1 be2) = true -> be_x_free x be1 = true \/ be_x_free x be2 = true.
Lemma and_x_free : forall (be1 be2 : bool_expr) (x : BDDvar), be_x_free x (ANd be1 be2) = true -> be_x_free x be1 = true \/ be_x_free x be2 = true.
Lemma univ_x_free : forall (be : bool_expr) (x y : BDDvar), be_x_free y (forall_ x be) = true -> be_x_free y be = true /\ Neqb x y = false.
Lemma ex_x_free : forall (be : bool_expr) (x y : BDDvar), be_x_free y (be_ex x be) = true -> be_x_free y be = true /\ Neqb x y = false.
Lemma univl_x_free : forall (lx : list ad) (be : bool_expr) (x : BDDvar), be_x_free x (univl be lx) = true -> be_x_free x be = true /\ ~ In x lx.
Lemma exl_x_free : forall (lx : list ad) (be : bool_expr) (x : BDDvar), be_x_free x (exl be lx) = true -> be_x_free x be = true /\ ~ In x lx.