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

(* Specifications: *)
Lemma BDDdummy_lemma_4 :
forall bound : nat,
(forall m : nat,
m < bound ->
forall (cfg : BDDconfig) (node1 node2 : ad) (memo : BDDor_memo),
BDDconfig_OK cfg ->
BDDor_memo_OK cfg memo ->
config_node_OK cfg node1 ->
config_node_OK cfg node2 ->
(is_internal_node cfg node1 ->
is_internal_node cfg node2 ->
max (nat_of_N (var cfg node1)) (nat_of_N (var cfg node2)) < m) ->
BDDconfig_OK (fst (BDDor_1 cfg memo node1 node2 m)) /\
BDDor_memo_OK (fst (BDDor_1 cfg memo node1 node2 m))
(snd (snd (BDDor_1 cfg memo node1 node2 m))) /\
config_node_OK (fst (BDDor_1 cfg memo node1 node2 m))
(fst (snd (BDDor_1 cfg memo node1 node2 m))) /\
nodes_preserved cfg (fst (BDDor_1 cfg memo node1 node2 m)) /\
BDDvar_le
(var (fst (BDDor_1 cfg memo node1 node2 m))
(fst (snd (BDDor_1 cfg memo node1 node2 m))))
(BDDvar_max (var cfg node1) (var cfg node2)) = true /\
bool_fun_eq
(bool_fun_of_BDD (fst (BDDor_1 cfg memo node1 node2 m))
(fst (snd (BDDor_1 cfg memo node1 node2 m))))
(bool_fun_or (bool_fun_of_BDD cfg node1) (bool_fun_of_BDD cfg node2))) ->
forall (cfg : BDDconfig) (node1 node2 : ad) (memo : BDDor_memo),
BDDconfig_OK cfg ->
BDDor_memo_OK cfg memo ->
config_node_OK cfg node1 ->
config_node_OK cfg node2 ->
(is_internal_node cfg node1 ->
is_internal_node cfg node2 ->
max (nat_of_N (var cfg node1)) (nat_of_N (var cfg node2)) < bound) ->
BDDor_memo_lookup memo node1 node2 = None ->
in_dom (BDDvar * (ad * ad)) node1 (fst cfg) = true ->
node2 = BDDone \/ in_dom (BDDvar * (ad * ad)) node2 (fst cfg) = true ->
is_internal_node cfg node1 ->
in_dom (BDDvar * (ad * ad)) node2 (fst cfg) = true ->
is_internal_node cfg node2 ->
forall bound' : nat,
bound = S bound' ->
max (nat_of_N (var cfg node1)) (nat_of_N (var cfg node2)) < bound ->
BDDcompare (var cfg node1) (var cfg node2) = Datatypes.Gt ->
BDDconfig_OK (fst (BDDor_1 cfg memo node1 node2 bound)) /\
BDDor_memo_OK (fst (BDDor_1 cfg memo node1 node2 bound))
(snd (snd (BDDor_1 cfg memo node1 node2 bound))) /\
config_node_OK (fst (BDDor_1 cfg memo node1 node2 bound))
(fst (snd (BDDor_1 cfg memo node1 node2 bound))) /\
nodes_preserved cfg (fst (BDDor_1 cfg memo node1 node2 bound)) /\
BDDvar_le
(var (fst (BDDor_1 cfg memo node1 node2 bound))
(fst (snd (BDDor_1 cfg memo node1 node2 bound))))
(BDDvar_max (var cfg node1) (var cfg node2)) = true /\
bool_fun_eq
(bool_fun_of_BDD (fst (BDDor_1 cfg memo node1 node2 bound))
(fst (snd (BDDor_1 cfg memo node1 node2 bound))))
(bool_fun_or (bool_fun_of_BDD cfg node1) (bool_fun_of_BDD cfg node2)).
Lemma nodes_preserved_trans :
forall cfg1 cfg2 cfg3 : BDDconfig,
nodes_preserved cfg1 cfg2 ->
nodes_preserved cfg2 cfg3 -> nodes_preserved cfg1 cfg3.
Lemma nodes_preserved_var :
forall (cfg cfg' : BDDconfig) (node : ad),
nodes_preserved cfg cfg' ->
is_internal_node cfg node -> var cfg' node = var cfg node.
Lemma nodes_preserved_var_1 :
forall (cfg cfg' : BDDconfig) (node : ad),
BDDconfig_OK cfg ->
BDDconfig_OK cfg' ->
nodes_preserved cfg cfg' ->
config_node_OK cfg node -> var cfg' node = var cfg node.
Lemma nodes_preserved_3 :
forall (cfg cfg' : BDDconfig) (node : ad),
BDDconfig_OK cfg ->
BDDconfig_OK cfg' ->
nodes_preserved cfg cfg' ->
config_node_OK cfg node ->
bool_fun_eq (bool_fun_of_BDD cfg' node) (bool_fun_of_BDD cfg node).
Lemma bool_fun_or_preserves_eq :
forall bf1 bf2 bf1' bf2' : bool_fun,
bool_fun_eq bf1 bf1' ->
bool_fun_eq bf2 bf2' ->
bool_fun_eq (bool_fun_or bf1 bf2) (bool_fun_or bf1' bf2').
Lemma BDDneg_memo_OK_1_lemma_2_1' :
forall (cfg : BDDconfig) (memo : BDDneg_memo),
BDDconfig_OK cfg ->
BDDneg_memo_OK_2 cfg memo ->
BDDneg_memo_OK_2 cfg (BDDneg_memo_put memo BDDzero BDDone).
Lemma BDDneg_memo_OK_1_lemma_3_1' :
forall (cfg : BDDconfig) (memo : BDDneg_memo),
BDDconfig_OK cfg ->
BDDneg_memo_OK_2 cfg memo ->
BDDneg_memo_OK_2 cfg (BDDneg_memo_put memo BDDone BDDzero).
Lemma BDDneg_memo_OK_1_lemma_1_2' :
forall (cfg : BDDconfig) (x : BDDvar) (l r node : ad)
(n m : nat) (memo : BDDneg_memo),
BDDconfig_OK cfg ->
MapGet _ (fst cfg) node = Some (x, (l, r)) ->
nat_of_N (var cfg node) < n ->
n = S m ->
BDDneg_memo_OK_2 (fst (BDDneg_2 (fst (BDDneg_2 cfg l m)) r m)) memo ->
BDDneg_memo_OK_2 (fst (BDDneg_2 cfg node n))
(BDDneg_memo_put memo node (snd (BDDneg_2 cfg node n))).
Lemma BDDneg_1_lemma' :
forall (bound : nat) (arg : BDDconfig * ad * BDDneg_memo),
BDDconfig_OK (fst (fst arg)) ->
config_node_OK (fst (fst arg)) (snd (fst arg)) ->
BDDneg_memo_OK_2 (fst (fst arg)) (snd arg) ->
(is_internal_node (fst (fst arg)) (snd (fst arg)) ->
nat_of_N (var (fst (fst arg)) (snd (fst arg))) < bound) ->
fst (BDDneg_1 arg bound) = BDDneg_2 (fst (fst arg)) (snd (fst arg)) bound /\
BDDneg_memo_OK_2 (fst (fst (BDDneg_1 arg bound))) (snd (BDDneg_1 arg bound)).
Lemma BDDdummy_lemma_3 :
forall bound : nat,
(forall m : nat,
m < bound ->
forall (cfg : BDDconfig) (node1 node2 : ad) (memo : BDDor_memo),
BDDconfig_OK cfg ->
BDDor_memo_OK cfg memo ->
config_node_OK cfg node1 ->
config_node_OK cfg node2 ->
(is_internal_node cfg node1 ->
is_internal_node cfg node2 ->
max (nat_of_N (var cfg node1)) (nat_of_N (var cfg node2)) < m) ->
BDDconfig_OK (fst (BDDor_1 cfg memo node1 node2 m)) /\
BDDor_memo_OK (fst (BDDor_1 cfg memo node1 node2 m))
(snd (snd (BDDor_1 cfg memo node1 node2 m))) /\
config_node_OK (fst (BDDor_1 cfg memo node1 node2 m))
(fst (snd (BDDor_1 cfg memo node1 node2 m))) /\
nodes_preserved cfg (fst (BDDor_1 cfg memo node1 node2 m)) /\
BDDvar_le
(var (fst (BDDor_1 cfg memo node1 node2 m))
(fst (snd (BDDor_1 cfg memo node1 node2 m))))
(BDDvar_max (var cfg node1) (var cfg node2)) = true /\
bool_fun_eq
(bool_fun_of_BDD (fst (BDDor_1 cfg memo node1 node2 m))
(fst (snd (BDDor_1 cfg memo node1 node2 m))))
(bool_fun_or (bool_fun_of_BDD cfg node1) (bool_fun_of_BDD cfg node2))) ->
forall (cfg : BDDconfig) (node1 node2 : ad) (memo : BDDor_memo),
BDDconfig_OK cfg ->
BDDor_memo_OK cfg memo ->
config_node_OK cfg node1 ->
config_node_OK cfg node2 ->
(is_internal_node cfg node1 ->
is_internal_node cfg node2 ->
max (nat_of_N (var cfg node1)) (nat_of_N (var cfg node2)) < bound) ->
BDDor_memo_lookup memo node1 node2 = None ->
in_dom (BDDvar * (ad * ad)) node1 (fst cfg) = true ->
node2 = BDDone \/ in_dom (BDDvar * (ad * ad)) node2 (fst cfg) = true ->
is_internal_node cfg node1 ->
in_dom (BDDvar * (ad * ad)) node2 (fst cfg) = true ->
is_internal_node cfg node2 ->
forall bound' : nat,
bound = S bound' ->
max (nat_of_N (var cfg node1)) (nat_of_N (var cfg node2)) < bound ->
BDDcompare (var cfg node1) (var cfg node2) = Datatypes.Lt ->
BDDconfig_OK (fst (BDDor_1 cfg memo node1 node2 bound)) /\
BDDor_memo_OK (fst (BDDor_1 cfg memo node1 node2 bound))
(snd (snd (BDDor_1 cfg memo node1 node2 bound))) /\
config_node_OK (fst (BDDor_1 cfg memo node1 node2 bound))
(fst (snd (BDDor_1 cfg memo node1 node2 bound))) /\
nodes_preserved cfg (fst (BDDor_1 cfg memo node1 node2 bound)) /\
BDDvar_le
(var (fst (BDDor_1 cfg memo node1 node2 bound))
(fst (snd (BDDor_1 cfg memo node1 node2 bound))))
(BDDvar_max (var cfg node1) (var cfg node2)) = true /\
bool_fun_eq
(bool_fun_of_BDD (fst (BDDor_1 cfg memo node1 node2 bound))
(fst (snd (BDDor_1 cfg memo node1 node2 bound))))
(bool_fun_or (bool_fun_of_BDD cfg node1) (bool_fun_of_BDD cfg node2)).
Lemma BDDor_1_lemma :
forall (bound : nat) (cfg : BDDconfig) (node1 node2 : ad)
(memo : BDDor_memo),
BDDconfig_OK cfg ->
BDDor_memo_OK cfg memo ->
config_node_OK cfg node1 ->
config_node_OK cfg node2 ->
(is_internal_node cfg node1 ->
is_internal_node cfg node2 ->
max (nat_of_N (var cfg node1)) (nat_of_N (var cfg node2)) < bound) ->
BDDconfig_OK (fst (BDDor_1 cfg memo node1 node2 bound)) /\
BDDor_memo_OK (fst (BDDor_1 cfg memo node1 node2 bound))
(snd (snd (BDDor_1 cfg memo node1 node2 bound))) /\
config_node_OK (fst (BDDor_1 cfg memo node1 node2 bound))
(fst (snd (BDDor_1 cfg memo node1 node2 bound))) /\
nodes_preserved cfg (fst (BDDor_1 cfg memo node1 node2 bound)) /\
BDDvar_le
(var (fst (BDDor_1 cfg memo node1 node2 bound))
(fst (snd (BDDor_1 cfg memo node1 node2 bound))))
(BDDvar_max (var cfg node1) (var cfg node2)) = true /\
bool_fun_eq
(bool_fun_of_BDD (fst (BDDor_1 cfg memo node1 node2 bound))
(fst (snd (BDDor_1 cfg memo node1 node2 bound))))
(bool_fun_or (bool_fun_of_BDD cfg node1) (bool_fun_of_BDD cfg node2)).
Lemma BDDdummy_lemma_2 :
forall bound : nat,
(forall m : nat,
m < bound ->
forall (cfg : BDDconfig) (node1 node2 : ad) (memo : BDDor_memo),
BDDconfig_OK cfg ->
BDDor_memo_OK cfg memo ->
config_node_OK cfg node1 ->
config_node_OK cfg node2 ->
(is_internal_node cfg node1 ->
is_internal_node cfg node2 ->
max (nat_of_N (var cfg node1)) (nat_of_N (var cfg node2)) < m) ->
BDDconfig_OK (fst (BDDor_1 cfg memo node1 node2 m)) /\
BDDor_memo_OK (fst (BDDor_1 cfg memo node1 node2 m))
(snd (snd (BDDor_1 cfg memo node1 node2 m))) /\
config_node_OK (fst (BDDor_1 cfg memo node1 node2 m))
(fst (snd (BDDor_1 cfg memo node1 node2 m))) /\
nodes_preserved cfg (fst (BDDor_1 cfg memo node1 node2 m)) /\
BDDvar_le
(var (fst (BDDor_1 cfg memo node1 node2 m))
(fst (snd (BDDor_1 cfg memo node1 node2 m))))
(BDDvar_max (var cfg node1) (var cfg node2)) = true /\
bool_fun_eq
(bool_fun_of_BDD (fst (BDDor_1 cfg memo node1 node2 m))
(fst (snd (BDDor_1 cfg memo node1 node2 m))))
(bool_fun_or (bool_fun_of_BDD cfg node1) (bool_fun_of_BDD cfg node2))) ->
forall (cfg : BDDconfig) (node1 node2 : ad) (memo : BDDor_memo),
BDDconfig_OK cfg ->
BDDor_memo_OK cfg memo ->
config_node_OK cfg node1 ->
config_node_OK cfg node2 ->
(is_internal_node cfg node1 ->
is_internal_node cfg node2 ->
max (nat_of_N (var cfg node1)) (nat_of_N (var cfg node2)) < bound) ->
BDDor_memo_lookup memo node1 node2 = None ->
in_dom (BDDvar * (ad * ad)) node1 (fst cfg) = true ->
node2 = BDDone \/ in_dom (BDDvar * (ad * ad)) node2 (fst cfg) = true ->
is_internal_node cfg node1 ->
in_dom (BDDvar * (ad * ad)) node2 (fst cfg) = true ->
is_internal_node cfg node2 ->
forall bound' : nat,
bound = S bound' ->
max (nat_of_N (var cfg node1)) (nat_of_N (var cfg node2)) < bound ->
BDDcompare (var cfg node1) (var cfg node2) = Datatypes.Eq ->
BDDconfig_OK (fst (BDDor_1 cfg memo node1 node2 bound)) /\
BDDor_memo_OK (fst (BDDor_1 cfg memo node1 node2 bound))
(snd (snd (BDDor_1 cfg memo node1 node2 bound))) /\
config_node_OK (fst (BDDor_1 cfg memo node1 node2 bound))
(fst (snd (BDDor_1 cfg memo node1 node2 bound))) /\
nodes_preserved cfg (fst (BDDor_1 cfg memo node1 node2 bound)) /\
BDDvar_le
(var (fst (BDDor_1 cfg memo node1 node2 bound))
(fst (snd (BDDor_1 cfg memo node1 node2 bound))))
(BDDvar_max (var cfg node1) (var cfg node2)) = true /\
bool_fun_eq
(bool_fun_of_BDD (fst (BDDor_1 cfg memo node1 node2 bound))
(fst (snd (BDDor_1 cfg memo node1 node2 bound))))
(bool_fun_or (bool_fun_of_BDD cfg node1) (bool_fun_of_BDD cfg node2)).
Lemma bool_fun_one_zero_eq : ~ bool_fun_eq bool_fun_one bool_fun_zero.
Lemma bool_fun_zero_one_eq : ~ bool_fun_eq bool_fun_zero bool_fun_one.
Definition augment (vb : var_binding) (x : BDDvar)
(b : bool) (y : BDDvar) := if BDDvar_eq x y then b else vb y.
Lemma BDDneg_2_lemma :
forall (bound : nat) (cfg : BDDconfig) (node : ad),
BDDconfig_OK cfg ->
config_node_OK cfg node ->
(is_internal_node cfg node -> nat_of_N (var cfg node) < bound) ->
BDDconfig_OK (fst (BDDneg_2 cfg node bound)) /\
(forall (x : BDDvar) (l r a : ad),
MapGet _ (fst cfg) a = Some (x, (l, r)) ->
MapGet _ (fst (fst (BDDneg_2 cfg node bound))) a = Some (x, (l, r))) /\
(is_internal_node cfg node ->
is_internal_node (fst (BDDneg_2 cfg node bound))
(snd (BDDneg_2 cfg node bound)) /\
var cfg node =
var (fst (BDDneg_2 cfg node bound)) (snd (BDDneg_2 cfg node bound))) /\
config_node_OK (fst (BDDneg_2 cfg node bound))
(snd (BDDneg_2 cfg node bound)) /\
bool_fun_eq
(bool_fun_of_BDD (fst (BDDneg_2 cfg node bound))
(snd (BDDneg_2 cfg node bound)))
(bool_fun_neg (bool_fun_of_BDD cfg node)).