Definition node_OK (bs : BDDstate) (node : ad) :=
    node = BDDzero \/ node = BDDone \/ in_dom _ node bs = true.

Lemma BDDalloc_keeps_sharing_OK : forall (cfg : BDDconfig) (l r : ad) (x : BDDvar), BDDconfig_OK cfg -> node_OK (fst cfg) l -> node_OK (fst cfg) r -> (forall (x' : BDDvar) (l' r' a : ad), MapGet _ (fst cfg) a = Some (x', (l', r')) -> (x, (l, r)) <> (x', (l', r'))) -> BDDsharing_OK (fst (fst (BDDalloc cfg x l r))) (fst (snd (fst (BDDalloc cfg x l r)))).