(* 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).

(* Specifications: *)
Lemma ad_S_is_S : forall a : ad, nat_of_N (ad_S a) = S (nat_of_N a).
Lemma relation_sum :
forall r : Datatypes.comparison,
{r = Datatypes.Eq} + {r = Datatypes.Lt} + {r = Datatypes.Gt}.
Lemma BDD_EGAL_complete :
forall x y : BDDvar, BDDcompare x y = Datatypes.Eq -> x = y.
Lemma BDDcompare_lt :
forall x y : BDDvar,
BDDcompare x y = Datatypes.Lt -> nat_of_N x < nat_of_N y.
Lemma BDDlt_compare :
forall x y : BDDvar,
nat_of_N x < nat_of_N y -> BDDcompare x y = Datatypes.Lt.
Lemma BDDcompare_trans :
forall x y z : BDDvar,
BDDcompare x y = Datatypes.Lt ->
BDDcompare y z = Datatypes.Lt -> BDDcompare x z = Datatypes.Lt.
Lemma BDDcompare_sup_inf :
forall x y : BDDvar,
BDDcompare x y = Datatypes.Gt -> BDDcompare y x = Datatypes.Lt.
Lemma lt_trans_1 : forall x y z : nat, x < y -> y < S z -> x < z.
Lemma BDDcompare_1 :
forall x y : BDDvar,
BDDcompare x y = Datatypes.Lt ->
BDDcompare (ad_S x) y = Datatypes.Lt \/ ad_S x = y.
Lemma andb3_lemma :
forall b1 b2 b3 : bool,
b1 && (b2 && b3) = true -> b1 = true /\ b2 = true /\ b3 = true.
Lemma andb3_lemma_1 :
forall x x0 y y0 z z0 : ad,
(x, (y, z)) <> (x0, (y0, z0)) ->
Neqb x x0 && (Neqb y y0 && Neqb z z0) = false.
Lemma ad_S_le_then_neq :
forall x y : ad, Nleb (ad_S x) y = true -> Neqb x y = false.
Lemma BDD_EGAL_correct : forall x : BDDvar, BDDcompare x x = Datatypes.Eq.
Lemma BDDcompare_inf_sup :
forall x y : BDDvar,
BDDcompare x y = Datatypes.Lt -> BDDcompare y x = Datatypes.Gt.
Lemma ad_S_compare :
forall x y : ad, BDDcompare x y = BDDcompare (ad_S x) (ad_S y).
Lemma prod_sum :
forall (A B : Set) (p : A * B), exists a : A, (exists b : B, p = (a, b)).
Lemma lt_max_1_2 :
forall x1 y1 x2 y2 : nat, x1 < x2 -> y1 < y2 -> max x1 y1 < max x2 y2.
Lemma lt_max_1 :
forall x1 y1 x2 y2 : nat, x1 < x2 -> y1 < x2 -> max x1 y1 < max x2 y2.
Lemma lt_max_2 :
forall x1 y1 x2 y2 : nat, x1 < y2 -> y1 < y2 -> max x1 y1 < max x2 y2.
Lemma max_x_x_eq_x : forall x : nat, max x x = x.
Lemma BDDvar_le_max_2 : forall x y : BDDvar, Nleb x (BDDvar_max y x) = true.
Lemma BDDvar_max_max :
forall x y : BDDvar,
nat_of_N (BDDvar_max x y) = max (nat_of_N x) (nat_of_N y).
Lemma BDDvar_le_max_1 : forall x y : BDDvar, Nleb x (BDDvar_max x y) = true.
Lemma BDDvar_max_inf :
forall x y : BDDvar, BDDcompare x y = Datatypes.Lt -> BDDvar_max x y = y.
Lemma BDDvar_max_comm : forall x y : BDDvar, BDDvar_max x y = BDDvar_max y x.
Lemma nat_gt_1_lemma : forall n : nat, n <> 0 -> n <> 1 -> 2 <= n.
Lemma ad_gt_1_lemma :
forall x : ad, x <> N0 -> x <> Npos 1 -> Nleb (Npos 2) x = true.
Lemma Nltb_lebmma :
forall a b : ad, Nleb a b = false -> Nleb (ad_S b) a = true.
Lemma eq_ad_S_eq :
forall a b : ad, Neqb (ad_S a) (ad_S b) = true -> Neqb a b = true.
Lemma ad_S_neq_N0 : forall a : ad, Neqb (ad_S a) N0 = false.
Lemma list_sum :
forall (A : Set) (l : list A),
l = nil \/ (exists a : A, (exists l' : list A, l = a :: l')).
Lemma no_dup_sum :
forall (A : Set) (l : list A) (H : no_dup_list _ l),
l = nil \/
(exists a : A,
(exists l0 : list A, ~ In a l0 /\ no_dup_list _ l0 /\ l = a :: l0)).
Lemma no_dup_cons_no_dup :
forall (A : Set) (l : list A) (a : A),
no_dup_list _ (a :: l) -> no_dup_list _ l.
Lemma no_dup_cons_no_in :
forall (A : Set) (l : list A) (a : A), no_dup_list _ (a :: l) -> ~ In a l.