Definition BDDimpl (cfg : BDDconfig) (negm : BDDneg_memo) 
  (orm : BDDor_memo) (node1 node2 : ad) :=
  match BDDneg cfg negm node1 with
  | (cfg', (node1', negm')) =>
      match BDDor cfg' orm node1' node2 with
      | (cfg'', (node, orm')) => (cfg'', (node, (negm', orm')))
      end
  end.

Lemma BDDimpl_keeps_config_OK : forall (cfg : BDDconfig) (negm : BDDneg_memo) (orm : BDDor_memo) (node1 node2 : ad), BDDconfig_OK cfg -> BDDneg_memo_OK_2 cfg negm -> BDDor_memo_OK cfg orm -> config_node_OK cfg node1 -> config_node_OK cfg node2 -> BDDconfig_OK (fst (BDDimpl cfg negm orm node1 node2)).