Definition bs_of_cfg := fst cfg.Definition share_of_cfg := fst (snd cfg).Definition fl_of_cfg := fst (snd (snd cfg)).Definition cnt_of_cfg := fst (snd (snd (snd cfg))).Definition negm_of_cfg := fst (snd (snd (snd (snd cfg)))).Definition orm_of_cfg := fst (snd (snd (snd (snd (snd cfg))))).Definition um_of_cfg := snd (snd (snd (snd (snd (snd cfg))))).

(* Specifications: *)
Lemma cfg_comp : cfg = (bs_of_cfg, (share_of_cfg, (fl_of_cfg, (cnt_of_cfg, (negm_of_cfg, (orm_of_cfg, um_of_cfg)))))).
Lemma bs_of_cfg_OK : BDDstate_OK bs_of_cfg.
Lemma share_of_cfg_OK : BDDsharing_OK bs_of_cfg share_of_cfg.
Lemma fl_of_cfg_OK : BDDfree_list_OK bs_of_cfg fl_of_cfg cnt_of_cfg.
Lemma cnt_of_cfg_OK : cnt_OK bs_of_cfg cnt_of_cfg.
Lemma negm_of_cfg_OK : BDDneg_memo_OK bs_of_cfg negm_of_cfg.
Lemma orm_of_cfg_OK : BDDor_memo_OK bs_of_cfg orm_of_cfg.
Lemma um_of_cfg_OK : BDDuniv_memo_OK bs_of_cfg um_of_cfg.
Lemma nodes_reachable_lemma_1 : forall (bs : BDDstate) (node node' : ad), nodes_reachable bs node node' -> node = node' \/ (exists x : BDDvar, (exists l : ad, (exists r : ad, MapGet _ bs node = Some (x, (l, r)) /\ (nodes_reachable bs l node' \/ nodes_reachable bs r node')))).
Lemma nodes_reachable_trans : forall (bs : BDDstate) (node1 node2 node3 : ad), nodes_reachable bs node1 node2 -> nodes_reachable bs node2 node3 -> nodes_reachable bs node1 node3.
Lemma reachable_node_OK_1 : forall (bs : BDDstate) (n : nat) (node1 node2 : ad), BDDstate_OK bs -> n = nat_of_N (bs_node_height bs node1) -> node_OK bs node1 -> nodes_reachable bs node1 node2 -> node_OK bs node2.
Lemma reachable_node_OK : forall (bs : BDDstate) (node1 node2 : ad), BDDstate_OK bs -> node_OK bs node1 -> nodes_reachable bs node1 node2 -> node_OK bs node2.
Lemma nodes_reachableBDDzero : forall (bs : BDDstate) (node : ad), BDDstate_OK bs -> nodes_reachable bs BDDzero node -> node = BDDzero.
Lemma nodes_reachableBDDone : forall (bs : BDDstate) (node : ad), BDDstate_OK bs -> nodes_reachable bs BDDone node -> node = BDDone.
Lemma used_node'_used_node_bs : forall (bs : BDDstate) (ul : list ad) (node : ad), used_node_bs bs ul node -> used_node'_bs bs ul node.
Lemma high_used_bs : forall (bs : BDDstate) (ul : list ad) (x : BDDvar) (l r node : ad), used_node_bs bs ul node -> MapGet _ bs node = Some (x, (l, r)) -> used_node_bs bs ul r.
Lemma high_used'_bs : forall (bs : BDDstate) (ul : list ad) (x : BDDvar) (l r node : ad), BDDstate_OK bs -> used_node'_bs bs ul node -> MapGet _ bs node = Some (x, (l, r)) -> used_node'_bs bs ul r.
Lemma low_used_bs : forall (bs : BDDstate) (ul : list ad) (x : BDDvar) (l r node : ad), used_node_bs bs ul node -> MapGet _ bs node = Some (x, (l, r)) -> used_node_bs bs ul l.
Lemma low_used'_bs : forall (bs : BDDstate) (ul : list ad) (x : BDDvar) (l r node : ad), BDDstate_OK bs -> used_node'_bs bs ul node -> MapGet _ bs node = Some (x, (l, r)) -> used_node'_bs bs ul l.
Lemma high_used : forall (cfg : BDDconfig) (ul : list ad) (x : BDDvar) (l r node : ad), used_node cfg ul node -> MapGet _ (fst cfg) node = Some (x, (l, r)) -> used_node cfg ul r.
Lemma high_used' : forall (cfg : BDDconfig) (ul : list ad) (x : BDDvar) (l r node : ad), BDDconfig_OK cfg -> used_node' cfg ul node -> MapGet _ (fst cfg) node = Some (x, (l, r)) -> used_node' cfg ul r.
Lemma low_used : forall (cfg : BDDconfig) (ul : list ad) (x : BDDvar) (l r node : ad), used_node cfg ul node -> MapGet _ (fst cfg) node = Some (x, (l, r)) -> used_node cfg ul l.
Lemma low_used' : forall (cfg : BDDconfig) (ul : list ad) (x : BDDvar) (l r node : ad), BDDconfig_OK cfg -> used_node' cfg ul node -> MapGet _ (fst cfg) node = Some (x, (l, r)) -> used_node' cfg ul l.
Lemma used_node_OK_bs : forall (bs : BDDstate) (ul : list ad) (node : ad), BDDstate_OK bs -> used_list_OK_bs bs ul -> used_node_bs bs ul node -> node_OK bs node.
Lemma used_node'_OK_bs : forall (bs : BDDstate) (ul : list ad) (node : ad), BDDstate_OK bs -> used_list_OK_bs bs ul -> used_node'_bs bs ul node -> node_OK bs node.
Lemma used_node_OK : forall (cfg : BDDconfig) (ul : list ad) (node : ad), BDDconfig_OK cfg -> used_list_OK cfg ul -> used_node cfg ul node -> config_node_OK cfg node.
Lemma used_node'_OK : forall (cfg : BDDconfig) (ul : list ad) (node : ad), BDDconfig_OK cfg -> used_list_OK cfg ul -> used_node' cfg ul node -> config_node_OK cfg node.
Lemma nodes_preserved_used_nodes_preserved : forall (cfg cfg' : BDDconfig) (ul : list ad), nodes_preserved cfg cfg' -> used_nodes_preserved cfg cfg' ul.
Lemma node_preserved_bs_reachable_1 : forall bs bs' : BDDstate, BDDstate_OK bs -> forall (n : nat) (node node' : ad), n = nat_of_N (bs_node_height bs node) -> node_preserved_bs bs bs' node -> nodes_reachable bs node node' -> nodes_reachable bs' node node'.
Lemma node_preserved_bs_reachable : forall (bs bs' : BDDstate) (node node' : ad), BDDstate_OK bs -> node_preserved_bs bs bs' node -> nodes_reachable bs node node' -> nodes_reachable bs' node node'.
Lemma node_preserved_bs_trans : forall (bs1 bs2 bs3 : BDDstate) (node : ad), BDDstate_OK bs1 -> node_preserved_bs bs1 bs2 node -> node_preserved_bs bs2 bs3 node -> node_preserved_bs bs1 bs3 node.
Lemma used_nodes_preserved_trans : forall (cfg1 cfg2 cfg3 : BDDconfig) (ul : list ad), BDDconfig_OK cfg1 -> used_nodes_preserved cfg1 cfg2 ul -> used_nodes_preserved cfg2 cfg3 ul -> used_nodes_preserved cfg1 cfg3 ul.
Lemma used_nodes_preserved_refl : forall (cfg : BDDconfig) (ul : list ad), used_nodes_preserved cfg cfg ul.
Lemma BDDzero_preserved : forall bs bs' : BDDstate, BDDstate_OK bs -> node_preserved_bs bs bs' BDDzero.
Lemma BDDone_preserved : forall bs bs' : BDDstate, BDDstate_OK bs -> node_preserved_bs bs bs' BDDone.
Lemma used_nodes_preserved_preserved_bs : forall (bs bs' : BDDstate) (ul : list ad) (node : ad), used_nodes_preserved_bs bs bs' ul -> used_node_bs bs ul node -> node_preserved_bs bs bs' node.
Lemma used_nodes_preserved_preserved'_bs : forall (bs bs' : BDDstate) (ul : list ad) (node : ad), BDDstate_OK bs -> used_nodes_preserved_bs bs bs' ul -> used_node'_bs bs ul node -> node_preserved_bs bs bs' node.
Lemma node_preserved_OK_bs : forall (bs bs' : BDDstate) (node : ad), node_OK bs node -> node_preserved_bs bs bs' node -> node_OK bs' node.
Lemma used_nodes_preserved_list_OK_bs : forall (bs bs' : BDDstate) (ul : list ad), used_list_OK_bs bs ul -> used_nodes_preserved_bs bs bs' ul -> used_list_OK_bs bs' ul.
Lemma used_nodes_preserved_list_OK : forall (cfg cfg' : BDDconfig) (ul : list ad), used_list_OK cfg ul -> used_nodes_preserved cfg cfg' ul -> used_list_OK cfg' ul.
Lemma used_node_cons_node_ul : forall (cfg : BDDconfig) (ul : list ad) (node : ad), used_node cfg (node :: ul) node.
Lemma used_node'_cons_node_ul : forall (cfg : BDDconfig) (ul : list ad) (node : ad), used_node' cfg (node :: ul) node.
Lemma used_node_cons_node'_ul : forall (cfg : BDDconfig) (ul : list ad) (node node' : ad), used_node cfg ul node -> used_node cfg (node' :: ul) node.
Lemma used_node'_cons_node'_ul : forall (cfg : BDDconfig) (ul : list ad) (node node' : ad), used_node' cfg ul node -> used_node' cfg (node' :: ul) node.
Lemma used_nodes_preserved_bs_cons : forall (bs bs' : BDDstate) (ul : list ad) (node : ad), used_nodes_preserved_bs bs bs' (node :: ul) -> used_nodes_preserved_bs bs bs' ul.
Lemma used_nodes_preserved_cons : forall (cfg cfg' : BDDconfig) (ul : list ad) (node : ad), used_nodes_preserved cfg cfg' (node :: ul) -> used_nodes_preserved cfg cfg' ul.
Lemma node_OK_list_OK_bs : forall (bs : BDDstate) (ul : list ad) (node : ad), node_OK bs node -> used_list_OK_bs bs ul -> used_list_OK_bs bs (node :: ul).
Lemma node_OK_list_OK : forall (cfg : BDDconfig) (ul : list ad) (node : ad), config_node_OK cfg node -> used_list_OK cfg ul -> used_list_OK cfg (node :: ul).
Lemma used_nodes_preserved_node_OK : forall (cfg cfg' : BDDconfig) (ul : list ad) (node : ad), BDDconfig_OK cfg -> used_list_OK cfg ul -> used_node cfg ul node -> used_nodes_preserved cfg cfg' ul -> config_node_OK cfg' node.
Lemma used_nodes_preserved_node_OK' : forall (cfg cfg' : BDDconfig) (ul : list ad) (node : ad), BDDconfig_OK cfg -> used_list_OK cfg ul -> used_node' cfg ul node -> used_nodes_preserved cfg cfg' ul -> config_node_OK cfg' node.
Lemma used_nodes_preserved_used_node : forall (cfg cfg' : BDDconfig) (ul : list ad) (node : ad), BDDconfig_OK cfg -> used_nodes_preserved cfg cfg' ul -> used_node cfg ul node -> used_node cfg' ul node.
Lemma used_nodes_preserved_used_node' : forall (cfg cfg' : BDDconfig) (ul : list ad) (node : ad), BDDconfig_OK cfg -> used_nodes_preserved cfg cfg' ul -> used_node' cfg ul node -> used_node' cfg' ul node.
Lemma bool_fun_of_BDD_1_change_bound : forall bs : BDDstate, BDDstate_OK bs -> forall (bound : nat) (node : ad), nat_of_N (bs_node_height bs node) < bound -> bool_fun_eq (bool_fun_of_BDD_1 bs node bound) (bool_fun_of_BDD_1 bs node (S (nat_of_N (bs_node_height bs node)))).
Lemma bool_fun_of_BDD_bs_zero : forall bs : BDDstate, BDDstate_OK bs -> bool_fun_eq (bool_fun_of_BDD_bs bs BDDzero) bool_fun_zero.
Lemma bool_fun_of_BDD_bs_one : forall bs : BDDstate, BDDstate_OK bs -> bool_fun_eq (bool_fun_of_BDD_bs bs BDDone) bool_fun_one.
Lemma bool_fun_of_BDD_bs_int : forall bs : BDDstate, BDDstate_OK bs -> forall (x : BDDvar) (l r node : ad), MapGet _ bs node = Some (x, (l, r)) -> bool_fun_eq (bool_fun_of_BDD_bs bs node) (bool_fun_if x (bool_fun_of_BDD_bs bs r) (bool_fun_of_BDD_bs bs l)).
Lemma bool_fun_of_BDD_one : forall cfg : BDDconfig, BDDconfig_OK cfg -> bool_fun_eq (bool_fun_of_BDD cfg BDDone) bool_fun_one.
Lemma bool_fun_of_BDD_zero : forall cfg : BDDconfig, BDDconfig_OK cfg -> bool_fun_eq (bool_fun_of_BDD cfg BDDzero) bool_fun_zero.
Lemma bool_fun_of_BDD_int : forall (cfg : BDDconfig) (x : BDDvar) (l r node : ad), BDDconfig_OK cfg -> MapGet _ (fst cfg) node = Some (x, (l, r)) -> bool_fun_eq (bool_fun_of_BDD cfg node) (bool_fun_if x (bool_fun_of_BDD cfg r) (bool_fun_of_BDD cfg l)).
Lemma bool_fun_of_BDD_1_ext : forall (bound : nat) (bs : BDDstate) (node : ad), bool_fun_ext (bool_fun_of_BDD_1 bs node bound).
Lemma bool_fun_of_BDD_bs_ext : forall (bs : BDDstate) (node : ad), bool_fun_ext (bool_fun_of_BDD_bs bs node).
Lemma BDDvar_independent_1 : forall bs : BDDstate, BDDstate_OK bs -> forall (n : nat) (node : ad) (x : BDDvar), n = nat_of_N (bs_node_height bs node) -> node_OK bs node -> Nleb (bs_node_height bs node) x = true -> bool_fun_independent (bool_fun_of_BDD_bs bs node) x.
Lemma BDDvar_independent_bs : forall bs : BDDstate, BDDstate_OK bs -> forall (node : ad) (x : BDDvar), node_OK bs node -> Nleb (bs_node_height bs node) x = true -> bool_fun_independent (bool_fun_of_BDD_bs bs node) x.
Lemma BDDvar_independent_low : forall bs : BDDstate, BDDstate_OK bs -> forall (x : BDDvar) (l r node : ad), MapGet _ bs node = Some (x, (l, r)) -> bool_fun_independent (bool_fun_of_BDD_bs bs l) x.
Lemma BDDvar_independent_high : forall bs : BDDstate, BDDstate_OK bs -> forall (x : BDDvar) (l r node : ad), MapGet _ bs node = Some (x, (l, r)) -> bool_fun_independent (bool_fun_of_BDD_bs bs r) x.
Lemma bool_fun_of_BDD_bs_high : forall bs : BDDstate, BDDstate_OK bs -> forall (x : BDDvar) (l r node : ad), MapGet _ bs node = Some (x, (l, r)) -> bool_fun_eq (bool_fun_of_BDD_bs bs r) (bool_fun_restrict (bool_fun_of_BDD_bs bs node) x true).
Lemma bool_fun_of_BDD_bs_low : forall bs : BDDstate, BDDstate_OK bs -> forall (x : BDDvar) (l r node : ad), MapGet _ bs node = Some (x, (l, r)) -> bool_fun_eq (bool_fun_of_BDD_bs bs l) (bool_fun_restrict (bool_fun_of_BDD_bs bs node) x false).
Lemma BDDunique_1 : forall (bs : BDDstate) (share : BDDsharing_map), BDDstate_OK bs -> BDDsharing_OK bs share -> forall (n : nat) (node1 node2 : ad), n = max (nat_of_N (bs_node_height bs node1)) (nat_of_N (bs_node_height bs node2)) -> node_OK bs node1 -> node_OK bs node2 -> bool_fun_eq (bool_fun_of_BDD_bs bs node1) (bool_fun_of_BDD_bs bs node2) -> node1 = node2.
Lemma BDDunique : forall (cfg : BDDconfig) (node1 node2 : ad), BDDconfig_OK cfg -> config_node_OK cfg node1 -> config_node_OK cfg node2 -> bool_fun_eq (bool_fun_of_BDD cfg node1) (bool_fun_of_BDD cfg node2) -> Neqb node1 node2 = true.
Lemma nodes_preserved_bs_bool_fun_1 : forall (bs1 bs2 : BDDstate) (n : nat) (node : ad), n = nat_of_N (bs_node_height bs1 node) -> BDDstate_OK bs1 -> BDDstate_OK bs2 -> nodes_preserved_bs bs1 bs2 -> node_OK bs1 node -> bool_fun_eq (bool_fun_of_BDD_bs bs2 node) (bool_fun_of_BDD_bs bs1 node).
Lemma nodes_preserved_bs_bool_fun : forall (bs1 bs2 : BDDstate) (node : ad), BDDstate_OK bs1 -> BDDstate_OK bs2 -> nodes_preserved_bs bs1 bs2 -> node_OK bs1 node -> bool_fun_eq (bool_fun_of_BDD_bs bs2 node) (bool_fun_of_BDD_bs bs1 node).
Lemma nodes_preserved_bool_fun : forall (cfg1 cfg2 : BDDconfig) (node : ad), BDDconfig_OK cfg1 -> BDDconfig_OK cfg2 -> nodes_preserved cfg1 cfg2 -> config_node_OK cfg1 node -> bool_fun_eq (bool_fun_of_BDD cfg2 node) (bool_fun_of_BDD cfg1 node).
Lemma nodes_preserved_neg_memo_OK : forall (bs bs' : BDDstate) (negm : BDDneg_memo), nodes_preserved_bs bs bs' -> BDDstate_OK bs -> BDDstate_OK bs' -> BDDneg_memo_OK bs negm -> BDDneg_memo_OK bs' negm.
Lemma nodes_preserved_or_memo_OK : forall (bs bs' : BDDstate) (orm : BDDor_memo), nodes_preserved_bs bs bs' -> BDDstate_OK bs -> BDDstate_OK bs' -> BDDor_memo_OK bs orm -> BDDor_memo_OK bs' orm.
Lemma nodes_preserved_um_OK : forall (bs bs' : BDDstate) (um : BDDuniv_memo), nodes_preserved_bs bs bs' -> BDDstate_OK bs -> BDDstate_OK bs' -> BDDuniv_memo_OK bs um -> BDDuniv_memo_OK bs' um.
Lemma node_preserved_bs_bool_fun_1 : forall (n : nat) (bs bs' : BDDstate) (node : ad), BDDstate_OK bs -> BDDstate_OK bs' -> node_preserved_bs bs bs' node -> node_OK bs node -> n = nat_of_N (bs_node_height bs node) -> bool_fun_eq (bool_fun_of_BDD_bs bs' node) (bool_fun_of_BDD_bs bs node).
Lemma node_preserved_bs_bool_fun : forall (bs bs' : BDDstate) (node : ad), BDDstate_OK bs -> BDDstate_OK bs' -> node_preserved_bs bs bs' node -> node_OK bs node -> bool_fun_eq (bool_fun_of_BDD_bs bs' node) (bool_fun_of_BDD_bs bs node).
Lemma node_preserved_bs_node_height_eq : forall (bs bs' : BDDstate) (node : ad), BDDstate_OK bs -> BDDstate_OK bs' -> node_preserved_bs bs bs' node -> node_OK bs node -> Neqb (bs_node_height bs' node) (bs_node_height bs node) = true.
Lemma node_preserved_node_height_eq : forall (cfg cfg' : BDDconfig) (node : ad), BDDconfig_OK cfg -> BDDconfig_OK cfg' -> node_preserved cfg cfg' node -> config_node_OK cfg node -> Neqb (node_height cfg' node) (node_height cfg node) = true.
Lemma used_nodes_preserved_node_height_eq : forall (cfg cfg' : BDDconfig) (ul : list ad) (node : ad), BDDconfig_OK cfg -> BDDconfig_OK cfg' -> used_nodes_preserved cfg cfg' ul -> used_list_OK cfg ul -> used_node cfg ul node -> Neqb (node_height cfg' node) (node_height cfg node) = true.
Lemma used_nodes_preserved'_node_height_eq : forall (cfg cfg' : BDDconfig) (ul : list ad) (node : ad), BDDconfig_OK cfg -> BDDconfig_OK cfg' -> used_nodes_preserved cfg cfg' ul -> used_list_OK cfg ul -> used_node' cfg ul node -> Neqb (node_height cfg' node) (node_height cfg node) = true.
Lemma used_nodes_preserved_bs_bool_fun : forall (bs bs' : BDDstate) (ul : list ad) (node : ad), BDDstate_OK bs -> BDDstate_OK bs' -> used_nodes_preserved_bs bs bs' ul -> used_list_OK_bs bs ul -> used_node_bs bs ul node -> bool_fun_eq (bool_fun_of_BDD_bs bs' node) (bool_fun_of_BDD_bs bs node).
Lemma used_nodes_preserved'_bs_bool_fun : forall (bs bs' : BDDstate) (ul : list ad) (node : ad), BDDstate_OK bs -> BDDstate_OK bs' -> used_nodes_preserved_bs bs bs' ul -> used_list_OK_bs bs ul -> used_node'_bs bs ul node -> bool_fun_eq (bool_fun_of_BDD_bs bs' node) (bool_fun_of_BDD_bs bs node).
Lemma used_nodes_preserved_bool_fun : forall (cfg cfg' : BDDconfig) (ul : list ad) (node : ad), BDDconfig_OK cfg -> BDDconfig_OK cfg' -> used_nodes_preserved cfg cfg' ul -> used_list_OK cfg ul -> used_node cfg ul node -> bool_fun_eq (bool_fun_of_BDD cfg' node) (bool_fun_of_BDD cfg node).
Lemma used_nodes_preserved'_bool_fun : forall (cfg cfg' : BDDconfig) (ul : list ad) (node : ad), BDDconfig_OK cfg -> BDDconfig_OK cfg' -> used_nodes_preserved cfg cfg' ul -> used_list_OK cfg ul -> used_node' cfg ul node -> bool_fun_eq (bool_fun_of_BDD cfg' node) (bool_fun_of_BDD cfg node).