(* This program is free software; you can redistribute it and/or      *)
(* modify it under the terms of the GNU Lesser General Public License *)
(* as published by the Free Software Foundation; either version 2.1   *)
(* of the License, or (at your option) any later version.             *)
(*                                                                    *)
(* This program is distributed in the hope that it will be useful,    *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of     *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *)
(* GNU General Public License for more details.                       *)
(*                                                                    *)
(* You should have received a copy of the GNU Lesser General Public   *)
(* License along with this program; if not, write to the Free         *)
(* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *)
(* 02110-1301 USA                                                     *)
Section BDDmisc.
Definition BDDvar := ad.
Definition BDDcompare (x y : BDDvar) :=
match x, y with
| N0, N0 => Datatypes.Eq
| N0, Npos _ => Datatypes.Lt
| Npos _, N0 => Datatypes.Gt
| Npos p1, Npos p2 => Pcompare p1 p2 Datatypes.Eq
end.
Definition ad_S (a : ad) :=
match a with
| N0 => Npos 1
| Npos p => Npos (Psucc p)
end.
Definition max (m n : nat) := if leb m n then n else m.
Definition BDDvar_max (x y : BDDvar) := if Nleb x y then y else x.
Inductive no_dup_list (A : Set) : list A -> Prop :=
| no_dup_nil : no_dup_list A nil
| no_dup_cons :
forall (a : A) (l : list A),
~ In a l -> no_dup_list _ l -> no_dup_list _ (a :: l).

Lemma ad_S_le_then_neq :
forall x y : ad, Nleb (ad_S x) y = true -> Neqb x y = false.