(* An interpretation of BDDvar's *)
Definition var_binding := BDDvar -> bool.
(* A boolean function. However not all boolean functions represent a logical formula. *)
Definition bool_fun := var_binding -> bool.
(* Evaluation of a boolean function given a binding of variables *)
Definition bool_fun_eval (bf : bool_fun) (vb : var_binding) := bf vb.
(* The boolean functions representing ZERO and ONE *)
Definition bool_fun_zero (vb : var_binding) := false.
Definition bool_fun_one (vb : var_binding) := true.
Fixpoint bool_fun_of_BDD_1 (cfg : BDDconfig) (node : ad)
(bound : nat) {struct bound} : bool_fun :=
match MapGet _ (fst cfg) node with
| None => if Neqb node BDDzero then bool_fun_zero else bool_fun_one
| Some (x, (l, r)) =>
match bound with
| O => (* Error *)  bool_fun_zero
| S bound' =>
let bfl := bool_fun_of_BDD_1 cfg l bound' in
let bfr := bool_fun_of_BDD_1 cfg r bound' in
fun vb : var_binding => if vb x then bfr vb else bfl vb
end
end.

Lemma bool_fun_of_BDD_1_change_bound :
forall cfg : BDDconfig,
BDDconfig_OK cfg ->
forall (bound : nat) (node : ad),
nat_of_N (var cfg node) < bound ->
bool_fun_of_BDD_1 cfg node bound =
bool_fun_of_BDD_1 cfg node (S (nat_of_N (var cfg node))).