End BDDexl_results.
Definition BDDsubst (cfg : BDDconfig) (ul : list ad)
(node1 : ad) (x : BDDvar) (node2 : ad) :=
match BDDvar_make gc cfg ul x with
| (cfg1, nodex) =>
match BDDiff gc cfg1 (nodex :: ul) nodex node2 with
| (cfg2, node3) =>
match BDDimpl gc cfg2 (node3 :: ul) node3 node1 with
| (cfg3, node4) => BDDuniv cfg3 (node4 :: ul) x node4
end
end
end.

(* Specifications: *)
Lemma BDDsubst_lemma :
forall (cfg : BDDconfig) (ul : list ad) (node1 : ad)
(x : BDDvar) (node2 : ad),
BDDconfig_OK cfg ->
used_list_OK cfg ul ->
used_node' cfg ul node1 ->
used_node' cfg ul node2 ->
BDDconfig_OK (fst (BDDsubst cfg ul node1 x node2)) /\
config_node_OK (fst (BDDsubst cfg ul node1 x node2))
(snd (BDDsubst cfg ul node1 x node2)) /\
used_nodes_preserved cfg (fst (BDDsubst cfg ul node1 x node2)) ul /\
bool_fun_eq
(bool_fun_of_BDD (fst (BDDsubst cfg ul node1 x node2))
(snd (BDDsubst cfg ul node1 x node2)))
(bool_fun_subst1 x (bool_fun_of_BDD cfg node2) (bool_fun_of_BDD cfg node1)).