End BDDreplacel_results.
End BDDquant.
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.

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.