Definition bool_fun_independent (bf : bool_fun) (x : BDDvar) :=
forall vb : var_binding,
bool_fun_eval bf (augment vb x true) =
bool_fun_eval bf (augment vb x false).

(* Specifications: *)
Lemma bool_fun_independent_lemma :
forall (bf : bool_fun) (x : BDDvar) (vb : var_binding) (b : bool),
bool_fun_ext bf ->
bool_fun_independent bf x ->
bool_fun_eval bf (augment vb x b) = bool_fun_eval bf vb.
Lemma bool_fun_independent_zero :
forall (cfg : BDDconfig) (x : BDDvar),
BDDconfig_OK cfg -> bool_fun_independent (bool_fun_of_BDD cfg BDDzero) x.
Lemma bool_fun_independent_one :
forall (cfg : BDDconfig) (x : BDDvar),
BDDconfig_OK cfg -> bool_fun_independent (bool_fun_of_BDD cfg BDDone) x.
Lemma in_dom_is_internal :
forall (cfg : BDDconfig) (node : ad),
in_dom _ node (fst cfg) = true -> is_internal_node cfg node.
Lemma internal_node_lemma :
forall (cfg : BDDconfig) (node : ad),
BDDconfig_OK cfg ->
is_internal_node cfg node ->
Neqb (low cfg node) (high cfg node) = false /\
BDDbounded (fst cfg) (low cfg node) (var cfg node) /\
BDDbounded (fst cfg) (high cfg node) (var cfg node).
Lemma high_bounded :
forall (cfg : BDDconfig) (node : ad),
BDDconfig_OK cfg ->
is_internal_node cfg node ->
BDDbounded (fst cfg) (high cfg node) (var cfg node).
Lemma low_bounded :
forall (cfg : BDDconfig) (node : ad),
BDDconfig_OK cfg ->
is_internal_node cfg node ->
BDDbounded (fst cfg) (low cfg node) (var cfg node).
Lemma high_OK :
forall (cfg : BDDconfig) (node : ad),
BDDconfig_OK cfg ->
is_internal_node cfg node -> config_node_OK cfg (high cfg node).
Lemma low_OK :
forall (cfg : BDDconfig) (node : ad),
BDDconfig_OK cfg ->
is_internal_node cfg node -> config_node_OK cfg (low cfg node).
Lemma low_high_neq :
forall (cfg : BDDconfig) (node : ad),
BDDconfig_OK cfg ->
is_internal_node cfg node -> Neqb (low cfg node) (high cfg node) = false.
Lemma BDDvar_independent_1 :
forall (cfg : BDDconfig) (n : nat) (node : ad) (x : BDDvar),
BDDconfig_OK cfg ->
is_internal_node cfg node ->
n = nat_of_N (var cfg node) ->
BDDcompare (var cfg node) x = Datatypes.Lt ->
bool_fun_independent (bool_fun_of_BDD cfg node) x.
Lemma BDDvar_independent_high :
forall (cfg : BDDconfig) (node : ad),
BDDconfig_OK cfg ->
is_internal_node cfg node ->
bool_fun_independent (bool_fun_of_BDD cfg (high cfg node)) (var cfg node).
Lemma BDDvar_independent_low :
forall (cfg : BDDconfig) (node : ad),
BDDconfig_OK cfg ->
is_internal_node cfg node ->
bool_fun_independent (bool_fun_of_BDD cfg (low cfg node)) (var cfg node).
Lemma bool_fun_of_BDDzero :
forall cfg : BDDconfig,
BDDconfig_OK cfg -> bool_fun_eq (bool_fun_of_BDD cfg BDDzero) bool_fun_zero.
Lemma bool_fun_of_BDDone :
forall cfg : BDDconfig,
BDDconfig_OK cfg -> bool_fun_eq (bool_fun_of_BDD cfg BDDone) bool_fun_one.
Lemma bool_fun_of_BDDhigh :
forall (cfg : BDDconfig) (node : ad),
BDDconfig_OK cfg ->
is_internal_node cfg node ->
bool_fun_eq (bool_fun_of_BDD cfg (high cfg node))
(bool_fun_restrict (bool_fun_of_BDD cfg node) (var cfg node) true).
Lemma bool_fun_of_BDDlow :
forall (cfg : BDDconfig) (node : ad),
BDDconfig_OK cfg ->
is_internal_node cfg node ->
bool_fun_eq (bool_fun_of_BDD cfg (low cfg node))
(bool_fun_restrict (bool_fun_of_BDD cfg node) (var cfg node) false).
Lemma internal_node_not_constant_1 :
forall cfg : BDDconfig,
BDDconfig_OK cfg ->
forall (n : nat) (node : ad),
is_internal_node cfg node ->
n = nat_of_N (var cfg node) ->
~ bool_fun_eq (bool_fun_of_BDD cfg node) bool_fun_zero /\
~ bool_fun_eq (bool_fun_of_BDD cfg node) bool_fun_one.
Lemma internal_node_not_constant :
forall (cfg : BDDconfig) (node : ad),
BDDconfig_OK cfg ->
is_internal_node cfg node ->
~ bool_fun_eq (bool_fun_of_BDD cfg node) bool_fun_zero /\
~ bool_fun_eq (bool_fun_of_BDD cfg node) bool_fun_one.
Lemma bool_fun_neq_internal_zero :
forall (cfg : BDDconfig) (node : ad),
BDDconfig_OK cfg ->
is_internal_node cfg node ->
~ bool_fun_eq (bool_fun_of_BDD cfg node) (bool_fun_of_BDD cfg BDDzero).
Lemma bool_fun_neq_internal_one :
forall (cfg : BDDconfig) (node : ad),
BDDconfig_OK cfg ->
is_internal_node cfg node ->
~ bool_fun_eq (bool_fun_of_BDD cfg node) (bool_fun_of_BDD cfg BDDone).
Lemma bool_fun_neq_zero_one :
forall cfg : BDDconfig,
BDDconfig_OK cfg ->
~ bool_fun_eq (bool_fun_of_BDD cfg BDDzero) (bool_fun_of_BDD cfg BDDone).
Lemma bool_fun_neq_one_zero :
forall cfg : BDDconfig,
BDDconfig_OK cfg ->
~ bool_fun_eq (bool_fun_of_BDD cfg BDDone) (bool_fun_of_BDD cfg BDDzero).
Lemma bool_fun_neq_lemma :
forall bf1 bf2 : bool_fun, ~ bool_fun_eq bf1 bf2 -> ~ bool_fun_eq bf2 bf1.
Lemma no_duplicate_node :
forall (cfg : BDDconfig) (node1 node2 : ad),
BDDconfig_OK cfg ->
is_internal_node cfg node1 ->
is_internal_node cfg node2 ->
var cfg node1 = var cfg node2 ->
high cfg node1 = high cfg node2 ->
low cfg node1 = low cfg node2 -> node1 = node2.
Lemma BDDunique_1 :
forall cfg : BDDconfig,
BDDconfig_OK cfg ->
forall (n : nat) (node1 node2 : ad),
n = max (nat_of_N (var cfg node1)) (nat_of_N (var cfg node2)) ->
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) ->
node1 = node2.
Lemma BDDunique :
forall cfg : BDDconfig,
BDDconfig_OK cfg ->
forall node1 node2 : ad,
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) ->
node1 = node2.
Lemma bool_fun_eq_lemma :
forall (bf1 bf2 : bool_fun) (x : BDDvar),
bool_fun_ext bf1 ->
bool_fun_ext bf2 ->
bool_fun_eq (bool_fun_restrict bf1 x true) (bool_fun_restrict bf2 x true) ->
bool_fun_eq (bool_fun_restrict bf1 x false) (bool_fun_restrict bf2 x false) ->
bool_fun_eq bf1 bf2.
Lemma bool_fun_preservation_1 :
forall cfg cfg' : BDDconfig,
BDDconfig_OK cfg ->
BDDconfig_OK cfg' ->
(forall (x : BDDvar) (l r a : ad),
MapGet _ (fst cfg) a = Some (x, (l, r)) ->
MapGet _ (fst cfg') a = Some (x, (l, r))) ->
forall (n : nat) (node : ad),
n = nat_of_N (var cfg node) ->
config_node_OK cfg node ->
bool_fun_eq (bool_fun_of_BDD cfg' node) (bool_fun_of_BDD cfg node).
Lemma bool_fun_preservation :
forall (cfg cfg' : BDDconfig) (node : ad),
BDDconfig_OK cfg ->
BDDconfig_OK cfg' ->
(forall (x : BDDvar) (l r a : ad),
MapGet _ (fst cfg) a = Some (x, (l, r)) ->
MapGet _ (fst cfg') a = Some (x, (l, r))) ->
config_node_OK cfg node ->
bool_fun_eq (bool_fun_of_BDD cfg' node) (bool_fun_of_BDD cfg node).