(* 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 New.
Variable N : nat.
Definition var_env'_dash (ve : var_env') (n : nat) :=
if leb N n then ve (n - N) else false.
Definition var_env''_dash (ve : var_env'') :=
var_env'_to_env'' N (2 * N) (var_env'_dash (var_env''_to_env' ve)).
Fixpoint be_dash (be : bool_expr) : bool_expr :=
match be with
| Zero => Zero
| One => One
| Var x => Var (N_of_nat (N + nat_of_N x))
| Neg be' => Neg (be_dash be')
| Or be1 be2 => Or (be_dash be1) (be_dash be2)
| ANd be1 be2 => ANd (be_dash be1) (be_dash be2)
| Impl be1 be2 => Impl (be_dash be1) (be_dash be2)
| Iff be1 be2 => Iff (be_dash be1) (be_dash be2)
end.
Fixpoint renamef (f : ad -> ad) (be : bool_expr) {struct be} : bool_expr :=
match be with
| Zero => Zero
| One => One
| Var x => Var (f x)
| Neg be' => Neg (renamef f be')
| Or be1 be2 => Or (renamef f be1) (renamef f be2)
| ANd be1 be2 => ANd (renamef f be1) (renamef f be2)
| Impl be1 be2 => Impl (renamef f be1) (renamef f be2)
| Iff be1 be2 => Iff (renamef f be1) (renamef f be2)
end.
Definition renfnat (n m : nat) := if leb n m then m else m + N.
Definition renfnad (n : nat) (x : ad) := N_of_nat (renfnat n (nat_of_N x)).

Lemma eval_dash_lemma1 :
forall (be : bool_expr) (ve : var_env'),
eval_be' be ve = eval_be' (be_dash be) (var_env'_dash ve).