(* 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 tauto.
Variable gc : BDDconfig -> list ad -> BDDconfig.
Hypothesis gc_is_OK : gc_OK gc.
Fixpoint BDDof_bool_expr (cfg : BDDconfig) (ul : list ad)
(be : bool_expr) {struct be} : BDDconfig * ad :=
match be with
| Zero => (cfg, BDDzero)
| One => (cfg, BDDone)
| Var x => BDDvar_make gc cfg ul x
| Neg be1 =>
match BDDof_bool_expr cfg ul be1 with
| (cfg1, node1) => BDDneg gc cfg1 (node1 :: ul) node1
end
| Or be1 be2 =>
match BDDof_bool_expr cfg ul be1 with
| (cfg1, node1) =>
match BDDof_bool_expr cfg1 (node1 :: ul) be2 with
| (cfg2, node2) => BDDor gc cfg2 (node2 :: node1 :: ul) node1 node2
end
end
| ANd be1 be2 =>
match BDDof_bool_expr cfg ul be1 with
| (cfg1, node1) =>
match BDDof_bool_expr cfg1 (node1 :: ul) be2 with
| (cfg2, node2) =>
BDDand gc cfg2 (node2 :: node1 :: ul) node1 node2
end
end
| Impl be1 be2 =>
match BDDof_bool_expr cfg ul be1 with
| (cfg1, node1) =>
match BDDof_bool_expr cfg1 (node1 :: ul) be2 with
| (cfg2, node2) =>
BDDimpl gc cfg2 (node2 :: node1 :: ul) node1 node2
end
end
| Iff be1 be2 =>
match BDDof_bool_expr cfg ul be1 with
| (cfg1, node1) =>
match BDDof_bool_expr cfg1 (node1 :: ul) be2 with
| (cfg2, node2) =>
BDDiff gc cfg2 (node2 :: node1 :: ul) node1 node2
end
end
end.

Lemma is_tauto_lemma :
forall be : bool_expr,
is_tauto be = true <-> bool_fun_eq bool_fun_one (bool_fun_of_bool_expr be).