(* 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                                                     *)


(* Contribution to the Coq Library   V6.3 (July 1999)                    *)

(****************************************************************)
(*           The Calculus of Inductive Constructions            *)
(*                       COQ v5.10                              *)
(*                                                              *)
(* Laurent Arditi.  Laboratoire I3S. CNRS ura 1376.             *)
(* Universite de Nice - Sophia Antipolis                        *)
(* arditi@unice.fr, http://wwwi3s.unice.fr/~arditi/lolo.html    *)
(*                                                              *)
(* date: november 1995                                          *)
(* file: Fill_proof.v                                           *)
(* contents: proof of a memory block instruction: Fills cx words*)
(* in memory starting at address di with value                  *)
(* verification that impl -> specif                             *)
(****************************************************************)

Require Import Fill_spec.
Require Import Fill_impl.


Parameter DC_a : BV.	Axiom DC_asize : lengthbv DC_a = a_size.
Parameter DC_d : BV.	Axiom DC_dsize : lengthbv DC_d = d_size.

Lemma cx_cx' :
 forall t : nat,
 cx t di_init cx_init al_init mem_init =
 cx' t di_init cx_init al_init mem_init DC_a DC_d.
(* Goal: forall t : nat, @eq BV (cx t di_init cx_init al_init mem_init) (cx' t di_init cx_init al_init mem_init DC_a DC_d) *)
unfold cx' in |- *. unfold compo' in |- *. unfold cx3 in |- *. unfold cx_2_1, compo_2_1 in |- *.
(* Goal: @eq Memo (if IsNull (cx2 n (di1 di_init cx_init al_init mem_init DC_a DC_d) (cx1 di_init cx_init al_init mem_init DC_a DC_d) (al1 di_init cx_init al_init mem_init DC_a DC_d) (mem1 di_init cx_init al_init mem_init DC_a DC_d) (ad1 di_init cx_init al_init mem_init DC_a DC_d) (da1 di_init cx_init al_init mem_init DC_a DC_d)) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (ad2 n di_init cx_init al_init mem_init di_init al_init)) al_init) (if IsNull (cx2 n di_init cx_init al_init mem_init di_init al_init) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (ad2 n di_init cx_init al_init mem_init di_init al_init)) al_init) *)
(* Goal: @eq BV al_init (da2 n di_init cx_init al_init mem_init di_init al_init) *)
(* Goal: @eq BV al_init (al n di_init cx_init al_init mem_init) *)
unfold di1, cx1, al1, mem1, ad1, da1 in |- *. simple induction t. auto.
(* Goal: forall (n : nat) (_ : @eq Memo (mem n di_init cx_init al_init mem_init) (mem2 n di_init cx_init al_init mem_init di_init al_init)), @eq Memo (mem (S n) di_init cx_init al_init mem_init) (mem2 (S n) di_init cx_init al_init mem_init di_init al_init) *)
intros. rewrite cx_t. rewrite cx2_t. rewrite H. trivial.
Qed.

Lemma di_di' :
 forall t : nat,
 di t di_init cx_init al_init mem_init =
 di' t di_init cx_init al_init mem_init DC_a DC_d.
(* Goal: @eq Memo (if IsNull (cx n di_init cx_init al_init mem_init) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (compo' BV di3 n di_init cx_init al_init mem_init DC_a DC_d)) al_init) (if IsNull (cx2 n di_init cx_init al_init mem_init di_init al_init) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (ad2 n di_init cx_init al_init mem_init di_init al_init)) al_init) *)
(* Goal: @eq BV al_init (da2 n di_init cx_init al_init mem_init di_init al_init) *)
(* Goal: @eq BV al_init (al n di_init cx_init al_init mem_init) *)
unfold di' in |- *. unfold compo' in |- *.
(* Goal: @eq Memo (if IsNull (cx2 n (di1 di_init cx_init al_init mem_init DC_a DC_d) (cx1 di_init cx_init al_init mem_init DC_a DC_d) (al1 di_init cx_init al_init mem_init DC_a DC_d) (mem1 di_init cx_init al_init mem_init DC_a DC_d) (ad1 di_init cx_init al_init mem_init DC_a DC_d) (da1 di_init cx_init al_init mem_init DC_a DC_d)) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (ad2 n di_init cx_init al_init mem_init di_init al_init)) al_init) (if IsNull (cx2 n di_init cx_init al_init mem_init di_init al_init) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (ad2 n di_init cx_init al_init mem_init di_init al_init)) al_init) *)
(* Goal: @eq BV al_init (da2 n di_init cx_init al_init mem_init di_init al_init) *)
(* Goal: @eq BV al_init (al n di_init cx_init al_init mem_init) *)
unfold di3 in |- *. unfold ad_2_1, compo_2_1 in |- *. unfold di1, cx1, al1, mem1, ad1, da1 in |- *.
(* Goal: forall t : nat, @eq Memo (mem t di_init cx_init al_init mem_init) (mem2 t di_init cx_init al_init mem_init di_init al_init) *)
simple induction t. auto.
(* Goal: forall (n : nat) (_ : @eq Memo (mem n di_init cx_init al_init mem_init) (mem2 n di_init cx_init al_init mem_init di_init al_init)), @eq Memo (mem (S n) di_init cx_init al_init mem_init) (mem2 (S n) di_init cx_init al_init mem_init di_init al_init) *)
intros. rewrite di_t. rewrite ad2_t. rewrite H.
replace (cx n di_init cx_init al_init mem_init) with
 (cx' n di_init cx_init al_init mem_init DC_a DC_d).
(* Goal: @eq BV (if IsNull (cx3 (di_2_1 n di_init cx_init al_init mem_init DC_a DC_d) (cx_2_1 n di_init cx_init al_init mem_init DC_a DC_d) (al_2_1 n di_init cx_init al_init mem_init DC_a DC_d) (mem_2_1 n di_init cx_init al_init mem_init DC_a DC_d) (ad_2_1 n di_init cx_init al_init mem_init DC_a DC_d) (da_2_1 n di_init cx_init al_init mem_init DC_a DC_d)) then ad2 n di_init cx_init al_init mem_init di_init al_init else BV_increment (ad2 n di_init cx_init al_init mem_init di_init al_init)) (if IsNull (cx2 n di_init cx_init al_init mem_init di_init al_init) then ad2 n di_init cx_init al_init mem_init di_init al_init else BV_increment (ad2 n di_init cx_init al_init mem_init di_init al_init)) *)
(* Goal: @eq BV (cx' n di_init cx_init al_init mem_init DC_a DC_d) (cx n di_init cx_init al_init mem_init) *)
unfold cx', compo' in |- *. unfold cx3 in |- *. unfold cx_2_1, compo_2_1 in |- *.
(* Goal: @eq Memo (if IsNull (cx2 n (di1 di_init cx_init al_init mem_init DC_a DC_d) (cx1 di_init cx_init al_init mem_init DC_a DC_d) (al1 di_init cx_init al_init mem_init DC_a DC_d) (mem1 di_init cx_init al_init mem_init DC_a DC_d) (ad1 di_init cx_init al_init mem_init DC_a DC_d) (da1 di_init cx_init al_init mem_init DC_a DC_d)) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (ad2 n di_init cx_init al_init mem_init di_init al_init)) al_init) (if IsNull (cx2 n di_init cx_init al_init mem_init di_init al_init) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (ad2 n di_init cx_init al_init mem_init di_init al_init)) al_init) *)
(* Goal: @eq BV al_init (da2 n di_init cx_init al_init mem_init di_init al_init) *)
(* Goal: @eq BV al_init (al n di_init cx_init al_init mem_init) *)
unfold di1, cx1, al1, mem1, ad1, da1 in |- *.
(* Goal: @eq BV al_init al_init *)
trivial. rewrite cx_cx'. trivial.
Qed.


Lemma al_al' :
 forall t : nat,
 al t di_init cx_init al_init mem_init =
 al' t di_init cx_init al_init mem_init DC_a DC_d.
(* Goal: forall t : nat, @eq BV (al t di_init cx_init al_init mem_init) (al' t di_init cx_init al_init mem_init DC_a DC_d) *)
intro.
(* Goal: @eq BV al_init (al n di_init cx_init al_init mem_init) *)
rewrite al_constant.
(* Goal: @eq BV al_init (al' t di_init cx_init al_init mem_init DC_a DC_d) *)
unfold al' in |- *.
(* Goal: @eq Memo (if IsNull (cx n di_init cx_init al_init mem_init) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (compo' BV di3 n di_init cx_init al_init mem_init DC_a DC_d)) al_init) (if IsNull (cx2 n di_init cx_init al_init mem_init di_init al_init) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (ad2 n di_init cx_init al_init mem_init di_init al_init)) al_init) *)
(* Goal: @eq BV al_init (da2 n di_init cx_init al_init mem_init di_init al_init) *)
(* Goal: @eq BV al_init (al n di_init cx_init al_init mem_init) *)
unfold compo' in |- *.
(* Goal: @eq BV al_init (al3 (di_2_1 t di_init cx_init al_init mem_init DC_a DC_d) (cx_2_1 t di_init cx_init al_init mem_init DC_a DC_d) (al_2_1 t di_init cx_init al_init mem_init DC_a DC_d) (mem_2_1 t di_init cx_init al_init mem_init DC_a DC_d) (ad_2_1 t di_init cx_init al_init mem_init DC_a DC_d) (da_2_1 t di_init cx_init al_init mem_init DC_a DC_d)) *)
unfold al3 in |- *.
(* Goal: @eq BV al_init (al_2_1 t di_init cx_init al_init mem_init DC_a DC_d) *)
unfold al_2_1 in |- *.
(* Goal: @eq BV al_init (compo_2_1 BV al2 t di_init cx_init al_init mem_init DC_a DC_d) *)
unfold compo_2_1 in |- *.
(* Goal: @eq BV al_init (al2 t (di1 di_init cx_init al_init mem_init DC_a DC_d) (cx1 di_init cx_init al_init mem_init DC_a DC_d) (al1 di_init cx_init al_init mem_init DC_a DC_d) (mem1 di_init cx_init al_init mem_init DC_a DC_d) (ad1 di_init cx_init al_init mem_init DC_a DC_d) (da1 di_init cx_init al_init mem_init DC_a DC_d)) *)
rewrite al2_constant.
(* Goal: @eq BV al_init (al1 di_init cx_init al_init mem_init DC_a DC_d) *)
unfold al1 in |- *.
(* Goal: @eq BV al_init al_init *)
trivial.
Qed.

Lemma mem_mem' :
 forall t : nat,
 mem t di_init cx_init al_init mem_init =
 mem' t di_init cx_init al_init mem_init DC_a DC_d.
(* Goal: forall t : nat, @eq Memo (mem t di_init cx_init al_init mem_init) (mem' t di_init cx_init al_init mem_init DC_a DC_d) *)
unfold mem', compo' in |- *.
(* Goal: forall t : nat, @eq Memo (mem t di_init cx_init al_init mem_init) (mem3 (di_2_1 t di_init cx_init al_init mem_init DC_a DC_d) (cx_2_1 t di_init cx_init al_init mem_init DC_a DC_d) (al_2_1 t di_init cx_init al_init mem_init DC_a DC_d) (mem_2_1 t di_init cx_init al_init mem_init DC_a DC_d) (ad_2_1 t di_init cx_init al_init mem_init DC_a DC_d) (da_2_1 t di_init cx_init al_init mem_init DC_a DC_d)) *)
unfold mem3 in |- *.
(* Goal: forall t : nat, @eq Memo (mem t di_init cx_init al_init mem_init) (mem_2_1 t di_init cx_init al_init mem_init DC_a DC_d) *)
unfold mem_2_1, compo_2_1 in |- *.
(* Goal: @eq Memo (if IsNull (cx2 n (di1 di_init cx_init al_init mem_init DC_a DC_d) (cx1 di_init cx_init al_init mem_init DC_a DC_d) (al1 di_init cx_init al_init mem_init DC_a DC_d) (mem1 di_init cx_init al_init mem_init DC_a DC_d) (ad1 di_init cx_init al_init mem_init DC_a DC_d) (da1 di_init cx_init al_init mem_init DC_a DC_d)) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (ad2 n di_init cx_init al_init mem_init di_init al_init)) al_init) (if IsNull (cx2 n di_init cx_init al_init mem_init di_init al_init) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (ad2 n di_init cx_init al_init mem_init di_init al_init)) al_init) *)
(* Goal: @eq BV al_init (da2 n di_init cx_init al_init mem_init di_init al_init) *)
(* Goal: @eq BV al_init (al n di_init cx_init al_init mem_init) *)
unfold di1, cx1, al1, mem1, ad1, da1 in |- *.
(* Goal: forall t : nat, @eq Memo (mem t di_init cx_init al_init mem_init) (mem2 t di_init cx_init al_init mem_init di_init al_init) *)
simple induction t.
(* Goal: @eq Memo (mem O di_init cx_init al_init mem_init) (mem2 O di_init cx_init al_init mem_init di_init al_init) *)
(* Goal: forall (n : nat) (_ : @eq Memo (mem n di_init cx_init al_init mem_init) (mem2 n di_init cx_init al_init mem_init di_init al_init)), @eq Memo (mem (S n) di_init cx_init al_init mem_init) (mem2 (S n) di_init cx_init al_init mem_init di_init al_init) *)
auto.

(* Goal: forall (n : nat) (_ : @eq Memo (mem n di_init cx_init al_init mem_init) (mem2 n di_init cx_init al_init mem_init di_init al_init)), @eq Memo (mem (S n) di_init cx_init al_init mem_init) (mem2 (S n) di_init cx_init al_init mem_init di_init al_init) *)
intros.
(* Goal: @eq Memo (mem (S n) di_init cx_init al_init mem_init) (mem2 (S n) di_init cx_init al_init mem_init di_init al_init) *)
rewrite mem2_t.
(* Goal: @eq Memo (mem (S n) di_init cx_init al_init mem_init) (if IsNull (cx2 n di_init cx_init al_init mem_init di_init al_init) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (ad2 n di_init cx_init al_init mem_init di_init al_init)) (da2 n di_init cx_init al_init mem_init di_init al_init)) *)
rewrite mem_t.
(* Goal: @eq Memo (if IsNull (cx n di_init cx_init al_init mem_init) then mem n di_init cx_init al_init mem_init else MemoWrite (mem n di_init cx_init al_init mem_init) (BV_to_nat (di n di_init cx_init al_init mem_init)) (al n di_init cx_init al_init mem_init)) (if IsNull (cx2 n di_init cx_init al_init mem_init di_init al_init) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (ad2 n di_init cx_init al_init mem_init di_init al_init)) (da2 n di_init cx_init al_init mem_init di_init al_init)) *)
rewrite H.
(* Goal: @eq Memo (if IsNull (cx n di_init cx_init al_init mem_init) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (di n di_init cx_init al_init mem_init)) (al n di_init cx_init al_init mem_init)) (if IsNull (cx2 n di_init cx_init al_init mem_init di_init al_init) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (ad2 n di_init cx_init al_init mem_init di_init al_init)) (da2 n di_init cx_init al_init mem_init di_init al_init)) *)
replace (al n di_init cx_init al_init mem_init) with al_init.
(* Goal: @eq Memo (if IsNull (cx n di_init cx_init al_init mem_init) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (di n di_init cx_init al_init mem_init)) al_init) (if IsNull (cx2 n di_init cx_init al_init mem_init di_init al_init) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (ad2 n di_init cx_init al_init mem_init di_init al_init)) (da2 n di_init cx_init al_init mem_init di_init al_init)) *)
(* Goal: @eq BV al_init (al n di_init cx_init al_init mem_init) *)
replace (da2 n di_init cx_init al_init mem_init di_init al_init) with al_init.
(* Goal: @eq Memo (if IsNull (cx n di_init cx_init al_init mem_init) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (di n di_init cx_init al_init mem_init)) al_init) (if IsNull (cx2 n di_init cx_init al_init mem_init di_init al_init) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (ad2 n di_init cx_init al_init mem_init di_init al_init)) al_init) *)
(* Goal: @eq BV al_init (da2 n di_init cx_init al_init mem_init di_init al_init) *)
(* Goal: @eq BV al_init (al n di_init cx_init al_init mem_init) *)
rewrite (di_di' n).
(* Goal: @eq Memo (if IsNull (cx n di_init cx_init al_init mem_init) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (di' n di_init cx_init al_init mem_init DC_a DC_d)) al_init) (if IsNull (cx2 n di_init cx_init al_init mem_init di_init al_init) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (ad2 n di_init cx_init al_init mem_init di_init al_init)) al_init) *)
(* Goal: @eq BV al_init (da2 n di_init cx_init al_init mem_init di_init al_init) *)
(* Goal: @eq BV al_init (al n di_init cx_init al_init mem_init) *)
unfold di' in |- *.
(* Goal: @eq Memo (if IsNull (cx n di_init cx_init al_init mem_init) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (compo' BV di3 n di_init cx_init al_init mem_init DC_a DC_d)) al_init) (if IsNull (cx2 n di_init cx_init al_init mem_init di_init al_init) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (ad2 n di_init cx_init al_init mem_init di_init al_init)) al_init) *)
(* Goal: @eq BV al_init (da2 n di_init cx_init al_init mem_init di_init al_init) *)
(* Goal: @eq BV al_init (al n di_init cx_init al_init mem_init) *)
unfold compo' in |- *.
(* Goal: @eq Memo (if IsNull (cx n di_init cx_init al_init mem_init) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (di3 (di_2_1 n di_init cx_init al_init mem_init DC_a DC_d) (cx_2_1 n di_init cx_init al_init mem_init DC_a DC_d) (al_2_1 n di_init cx_init al_init mem_init DC_a DC_d) (mem_2_1 n di_init cx_init al_init mem_init DC_a DC_d) (ad_2_1 n di_init cx_init al_init mem_init DC_a DC_d) (da_2_1 n di_init cx_init al_init mem_init DC_a DC_d))) al_init) (if IsNull (cx2 n di_init cx_init al_init mem_init di_init al_init) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (ad2 n di_init cx_init al_init mem_init di_init al_init)) al_init) *)
(* Goal: @eq BV al_init (da2 n di_init cx_init al_init mem_init di_init al_init) *)
(* Goal: @eq BV al_init (al n di_init cx_init al_init mem_init) *)
unfold di3 in |- *.
(* Goal: @eq Memo (if IsNull (cx n di_init cx_init al_init mem_init) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (ad_2_1 n di_init cx_init al_init mem_init DC_a DC_d)) al_init) (if IsNull (cx2 n di_init cx_init al_init mem_init di_init al_init) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (ad2 n di_init cx_init al_init mem_init di_init al_init)) al_init) *)
(* Goal: @eq BV al_init (da2 n di_init cx_init al_init mem_init di_init al_init) *)
(* Goal: @eq BV al_init (al n di_init cx_init al_init mem_init) *)
unfold ad_2_1, compo_2_1 in |- *.
(* Goal: @eq Memo (if IsNull (cx2 n (di1 di_init cx_init al_init mem_init DC_a DC_d) (cx1 di_init cx_init al_init mem_init DC_a DC_d) (al1 di_init cx_init al_init mem_init DC_a DC_d) (mem1 di_init cx_init al_init mem_init DC_a DC_d) (ad1 di_init cx_init al_init mem_init DC_a DC_d) (da1 di_init cx_init al_init mem_init DC_a DC_d)) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (ad2 n di_init cx_init al_init mem_init di_init al_init)) al_init) (if IsNull (cx2 n di_init cx_init al_init mem_init di_init al_init) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (ad2 n di_init cx_init al_init mem_init di_init al_init)) al_init) *)
(* Goal: @eq BV al_init (da2 n di_init cx_init al_init mem_init di_init al_init) *)
(* Goal: @eq BV al_init (al n di_init cx_init al_init mem_init) *)
unfold di1, cx1, al1, mem1, ad1, da1 in |- *.
(* Goal: @eq Memo (if IsNull (cx n di_init cx_init al_init mem_init) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (ad2 n di_init cx_init al_init mem_init di_init al_init)) al_init) (if IsNull (cx2 n di_init cx_init al_init mem_init di_init al_init) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (ad2 n di_init cx_init al_init mem_init di_init al_init)) al_init) *)
(* Goal: @eq BV al_init (da2 n di_init cx_init al_init mem_init di_init al_init) *)
(* Goal: @eq BV al_init (al n di_init cx_init al_init mem_init) *)
rewrite (cx_cx' n).
(* Goal: @eq Memo (if IsNull (cx' n di_init cx_init al_init mem_init DC_a DC_d) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (ad2 n di_init cx_init al_init mem_init di_init al_init)) al_init) (if IsNull (cx2 n di_init cx_init al_init mem_init di_init al_init) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (ad2 n di_init cx_init al_init mem_init di_init al_init)) al_init) *)
(* Goal: @eq BV al_init (da2 n di_init cx_init al_init mem_init di_init al_init) *)
(* Goal: @eq BV al_init (al n di_init cx_init al_init mem_init) *)
unfold cx', compo', cx3 in |- *.
(* Goal: @eq Memo (if IsNull (cx_2_1 n di_init cx_init al_init mem_init DC_a DC_d) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (ad2 n di_init cx_init al_init mem_init di_init al_init)) al_init) (if IsNull (cx2 n di_init cx_init al_init mem_init di_init al_init) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (ad2 n di_init cx_init al_init mem_init di_init al_init)) al_init) *)
(* Goal: @eq BV al_init (da2 n di_init cx_init al_init mem_init di_init al_init) *)
(* Goal: @eq BV al_init (al n di_init cx_init al_init mem_init) *)
unfold cx_2_1, compo_2_1 in |- *.
(* Goal: @eq Memo (if IsNull (cx2 n (di1 di_init cx_init al_init mem_init DC_a DC_d) (cx1 di_init cx_init al_init mem_init DC_a DC_d) (al1 di_init cx_init al_init mem_init DC_a DC_d) (mem1 di_init cx_init al_init mem_init DC_a DC_d) (ad1 di_init cx_init al_init mem_init DC_a DC_d) (da1 di_init cx_init al_init mem_init DC_a DC_d)) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (ad2 n di_init cx_init al_init mem_init di_init al_init)) al_init) (if IsNull (cx2 n di_init cx_init al_init mem_init di_init al_init) then mem2 n di_init cx_init al_init mem_init di_init al_init else MemoWrite (mem2 n di_init cx_init al_init mem_init di_init al_init) (BV_to_nat (ad2 n di_init cx_init al_init mem_init di_init al_init)) al_init) *)
(* Goal: @eq BV al_init (da2 n di_init cx_init al_init mem_init di_init al_init) *)
(* Goal: @eq BV al_init (al n di_init cx_init al_init mem_init) *)
unfold di1, cx1, al1, mem1, ad1, da1 in |- *.
(* Goal: @eq BV al_init al_init *)
trivial.

(* Goal: @eq BV al_init (da2 n di_init cx_init al_init mem_init di_init al_init) *)
(* Goal: @eq BV al_init (al n di_init cx_init al_init mem_init) *)
rewrite da2_constant.
(* Goal: @eq BV al_init al_init *)
trivial.

(* Goal: @eq BV al_init (al n di_init cx_init al_init mem_init) *)
rewrite al_constant.
(* Goal: @eq BV al_init al_init *)
trivial.
Qed.

Theorem Fill_ok :
 forall t : nat,
 di t di_init cx_init al_init mem_init =
 di' t di_init cx_init al_init mem_init DC_a DC_d /\
 cx t di_init cx_init al_init mem_init =
 cx' t di_init cx_init al_init mem_init DC_a DC_d /\
 al t di_init cx_init al_init mem_init =
 al' t di_init cx_init al_init mem_init DC_a DC_d /\
 mem t di_init cx_init al_init mem_init =
 mem' t di_init cx_init al_init mem_init DC_a DC_d.
(* Goal: and (@eq BV (al t di_init cx_init al_init mem_init) (al' t di_init cx_init al_init mem_init DC_a DC_d)) (@eq Memo (mem t di_init cx_init al_init mem_init) (mem' t di_init cx_init al_init mem_init DC_a DC_d)) *)
split. apply di_di'.
(* Goal: and (@eq BV (al t di_init cx_init al_init mem_init) (al' t di_init cx_init al_init mem_init DC_a DC_d)) (@eq Memo (mem t di_init cx_init al_init mem_init) (mem' t di_init cx_init al_init mem_init DC_a DC_d)) *)
split. apply cx_cx'.
(* Goal: and (@eq BV (al t di_init cx_init al_init mem_init) (al' t di_init cx_init al_init mem_init DC_a DC_d)) (@eq Memo (mem t di_init cx_init al_init mem_init) (mem' t di_init cx_init al_init mem_init DC_a DC_d)) *)
split. apply al_al'. apply mem_mem'.
Qed.
