(* This program is free software; you can redistribute it and/or      *)
(* modify it under the terms of the GNU Lesser General Public License *)
(* as published by the Free Software Foundation; either version 2.1   *)
(* of the License, or (at your option) any later version.             *)
(*                                                                    *)
(* This program is distributed in the hope that it will be useful,    *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of     *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *)
(* GNU General Public License for more details.                       *)
(*                                                                    *)
(* You should have received a copy of the GNU Lesser General Public   *)
(* License along with this program; if not, write to the Free         *)
(* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *)
(* 02110-1301 USA                                                     *)
Section BDD_alloc.
Variable gc : BDDconfig -> list ad -> BDDconfig.
Hypothesis gc_is_OK : gc_OK gc.
(* The arguments for the allocation function *)
Variable cfg : BDDconfig.
Variable x : BDDvar.
Variable l r : ad.
Variable ul : list ad.
(* Conditions on the arguments for the allocation function *)
Hypothesis cfg_OK : BDDconfig_OK cfg.
Hypothesis ul_OK : used_list_OK cfg ul.
Hypothesis l_used' : used_node' cfg ul l.
Hypothesis r_used' : used_node' cfg ul r.
Hypothesis l_neq_r : Neqb l r = false.
Hypothesis
xl_lt_x :
forall (xl : BDDvar) (ll rl : ad),
MapGet _ (bs_of_cfg cfg) l = Some (xl, (ll, rl)) ->
BDDcompare xl x = Datatypes.Lt.
Hypothesis
xr_lt_x :
forall (xr : BDDvar) (lr rr : ad),
MapGet _ (bs_of_cfg cfg) r = Some (xr, (lr, rr)) ->
BDDcompare xr x = Datatypes.Lt.
Hypothesis
no_dup :
forall (x' : BDDvar) (l' r' a : ad),
MapGet _ (bs_of_cfg cfg) a = Some (x', (l', r')) ->
(x, (l, r)) <> (x', (l', r')).
Let new_cfg := gc cfg ul.

Lemma BDD_OK_r : BDD_OK (bs_of_cfg new_cfg) r.