Definition var (cfg : BDDconfig) (node : ad) :=
  match MapGet _ (fst cfg) node with
  | None => (* Error *)  BDDzero
  | Some (x, (l, r)) => x
  end.Definition low (cfg : BDDconfig) (node : ad) :=
  match MapGet _ (fst cfg) node with
  | None => (* Error *)  N0
  | Some (x, (l, r)) => l
  end.Definition high (cfg : BDDconfig) (node : ad) :=
  match MapGet _ (fst cfg) node with
  | None => (* Error *)  N0
  | Some (x, (l, r)) => r
  end.Definition config_node_OK (cfg : BDDconfig) := node_OK (fst cfg).Definition is_internal_node (cfg : BDDconfig) (node : ad) :=
  exists x : BDDvar,
    (exists l : ad,
       (exists r : ad, MapGet _ (fst cfg) node = Some (x, (l, r)))).

Lemma BDDvar_ordered_high : forall (cfg : BDDconfig) (node : ad), BDDconfig_OK cfg -> is_internal_node cfg node -> is_internal_node cfg (high cfg node) -> BDDcompare (var cfg (high cfg node)) (var cfg node) = Datatypes.Lt.