Section Map.
Variables A B:Set.
Variable f: A -> B.
Fixpoint Tmap (T: Tree A) : Tree B :=
match T with
Tempty => Tempty
| Branch0 t1 t2 => Branch0 (Tmap t1) (Tmap t2)
| Branch1 a t1 t2 => Branch1 (f a) (Tmap t1) (Tmap t2)
end.
induction T;intro i;case i;simpl;auto.
Defined.
induction i;intros a T;case T;simpl;intros;try (rewrite IHi);simpl;reflexivity.
Defined.
Definition map (S:Store A) : Store B :=
mkStore (index S) (Tmap (contents S)).
destruct S;unfold get,map,contents,index;apply Tget_Tmap.
Defined.
intros a S.
case S.
unfold push,map,contents,index.
intros;rewrite Tmap_Tadd;reflexivity.
Defined.

Theorem Full_map : forall S, Full S -> Full (map S).