Fixpoint BDDuniv_1 (cfg : BDDconfig) (ul : list ad) 
 (node : ad) (y : BDDvar) (bound : nat) {struct bound} : 
 BDDconfig * ad :=
  match bound with
  | O => (* Error *)  (initBDDconfig, BDDzero)
  | S bound' =>
      match MapGet2 _ (um_of_cfg cfg) node y with
      | Some node' => (cfg, node')
      | None =>
          match MapGet _ (fst cfg) node with
          | None => (cfg, node)
          | Some (x, (l, r)) =>
              match BDDcompare x y with
              | Datatypes.Lt => (cfg, node)
              | Datatypes.Eq => BDDand gc cfg ul l r
              | Datatypes.Gt =>
                  match BDDuniv_1 cfg ul l y bound' with
                  | (cfgl, nodel) =>
                      match BDDuniv_1 cfgl (nodel :: ul) r y bound' with
                      | (cfgr, noder) =>
                          match
                            BDDmake gc cfgr x nodel noder
                              (noder :: nodel :: ul)
                          with
                          | (cfg', node') =>
                              (BDDuniv_memo_put cfg' y node node', node')
                          end
                      end
                  end
              end
          end
      end
  end.

(* Specifications: *)
Lemma BDDuniv_1_lemma : forall (bound : nat) (cfg : BDDconfig) (ul : list ad) (u : BDDvar) (node : ad), nat_of_N (node_height cfg node) < bound -> BDDconfig_OK cfg -> used_list_OK cfg ul -> used_node' cfg ul node -> BDDconfig_OK (fst (BDDuniv_1 cfg ul node u bound)) /\ config_node_OK (fst (BDDuniv_1 cfg ul node u bound)) (snd (BDDuniv_1 cfg ul node u bound)) /\ used_nodes_preserved cfg (fst (BDDuniv_1 cfg ul node u bound)) ul /\ Nleb (node_height (fst (BDDuniv_1 cfg ul node u bound)) (snd (BDDuniv_1 cfg ul node u bound))) (node_height cfg node) = true /\ bool_fun_eq (bool_fun_of_BDD (fst (BDDuniv_1 cfg ul node u bound)) (snd (BDDuniv_1 cfg ul node u bound))) (bool_fun_forall u (bool_fun_of_BDD cfg node)).