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

Lemma BDDreplacel_used_nodes_preserved : used_nodes_preserved cfg (fst (BDDreplacel cfg ul node lx ly)) ul.