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

Lemma BDDalloc_semantics :
forall (cfg : BDDconfig) (l r : ad) (x : BDDvar),
BDDconfig_OK cfg ->
node_OK (fst cfg) l ->
node_OK (fst cfg) r ->
Neqb l r <> true ->
(forall (xl : BDDvar) (ll rl : ad),
MapGet _ (fst cfg) l = Some (xl, (ll, rl)) ->
BDDcompare xl x = Datatypes.Lt) ->
(forall (xr : BDDvar) (lr rr : ad),
MapGet _ (fst cfg) r = Some (xr, (lr, rr)) ->
BDDcompare xr x = Datatypes.Lt) ->
(forall (x' : BDDvar) (l' r' a : ad),
MapGet _ (fst cfg) a = Some (x', (l', r')) ->
(x, (l, r)) <> (x', (l', r'))) ->
BDDconfig_OK (fst (BDDalloc cfg x l r)) /\
MapGet _ (fst (fst (BDDalloc cfg x l r))) (snd (BDDalloc cfg x l r)) =
Some (x, (l, r)) /\
(forall (a l' r' : ad) (x' : BDDvar),
(MapGet _ (fst (fst (BDDalloc cfg x l r))) a = Some (x', (l', r')) ->
MapGet _ (fst cfg) a = Some (x', (l', r')) \/
snd (BDDalloc cfg x l r) = a) /\
(MapGet _ (fst cfg) a = Some (x', (l', r')) ->
MapGet _ (fst (fst (BDDalloc cfg x l r))) a = Some (x', (l', r')))) /\
node_OK (fst (fst (BDDalloc cfg x l r))) (snd (BDDalloc cfg x l r)).