Fixpoint BDDexl (cfg : BDDconfig) (ul : list ad) (node : ad)
 (ly : list BDDvar) {struct ly} : BDDconfig * ad :=
  match ly with
  | nil => (cfg, node)
  | y :: ly' =>
      match BDDexl cfg ul node ly' with
      | (cfg1, node1) => BDDex cfg1 (node1 :: ul) y node1
      end
  end.

Lemma BDDexl_lemma : forall (ly : list BDDvar) (cfg : BDDconfig) (ul : list ad) (node : ad), BDDconfig_OK cfg -> used_list_OK cfg ul -> used_node' cfg ul node -> BDDconfig_OK (fst (BDDexl cfg ul node ly)) /\ config_node_OK (fst (BDDexl cfg ul node ly)) (snd (BDDexl cfg ul node ly)) /\ used_nodes_preserved cfg (fst (BDDexl cfg ul node ly)) ul /\ bool_fun_eq (bool_fun_of_BDD (fst (BDDexl cfg ul node ly)) (snd (BDDexl cfg ul node ly))) (bool_fun_exl (bool_fun_of_BDD cfg node) ly).