Definition BDDalloc (cfg : BDDconfig) (x : BDDvar) 
    (l r : ad) :=
    match cfg with
    | (bs, (share, counter)) =>
        let share' := BDDshare_put share x l r counter in
        let bs' := MapPut _ bs counter (x, (l, r)) in
        let counter' := ad_S counter in (bs', (share', counter'), counter)
    end.

Lemma BDDsharing_lookup_semantics : forall (bs : BDDstate) (share : BDDsharing_map) (n l r : ad) (x : BDDvar), BDDsharing_OK bs share -> (BDDshare_lookup share x l r = Some n <-> MapGet _ bs n = Some (x, (l, r))).