split; intros; induction v. simpl in *.
rewrite PTree.gempty in *. congruence.
simpl in *. destruct a. inv H. rewrite PTree.gsspec in *. if_tac in H0.
inv H0. auto. intuition.
inv H0.
simpl in *. destruct a. simpl in *. rewrite PTree.gsspec. destruct H0.
inv H0. if_tac. auto. intuition. inv H. if_tac. subst.
clear - H0 H3. rewrite in_map_iff in *. destruct H3. exists (i,ty). auto.
apply IHv; auto.
Qed.

(* Specifications: *)
Lemma set_inside : forall i0 t1 t p id,
list_disjoint (map fst p) (i0 :: map fst t) ->
(fold_right
(fun param : ident * type =>
PTree.set (fst param) (snd param, true))
(PTree.set i0 (t1, false)
(fold_right
(fun (temp : ident * type) (tenv : PTree.t (type * bool)) =>
let (id, ty) := temp in PTree.set id (ty, false) tenv)
(PTree.empty (type * bool)) t)) p) ! id =
(PTree.set i0 (t1, false) (
(fold_right
(fun param : ident * type =>
PTree.set (fst param) (snd param, true))
(fold_right
(fun (temp : ident * type) (tenv : PTree.t (type * bool)) =>
let (id, ty) := temp in PTree.set id (ty, false) tenv)
(PTree.empty (type * bool)) t)) p)) ! id
.
Lemma func_tycontext_t_sound : func_tycontext_t_denote.
Definition cast_no_val_change (from: type)(to:type) : bool :=
match from, to with
| Tint _ _ _, Tint I32 _ _ => true
| Tpointer _ _, Tpointer _ _ =>
eqb_type from to ||
negb (eqb_type from int_or_ptr_type) &&
negb (eqb_type to int_or_ptr_type)
| Tfloat F64 _ , Tfloat F64 _ => true
| Tfloat F32 _ , Tfloat F32 _ => true
| _, _ => false
end.
Lemma cast_no_change : forall v from to m,
tc_val from v ->
is_true (cast_no_val_change from to) ->
Cop.sem_cast v from to m = Some v.
Lemma tc_exprlist_length : forall {CS: compspecs} Delta tl el rho phi,
denote_tc_assert (typecheck_exprlist Delta tl el) rho phi ->
length tl = length el.
Lemma neutral_cast_tc_val : forall {CS: compspecs} e t rho phi Delta,
true = is_neutral_cast (implicit_deref (typeof e)) t ->
denote_tc_assert (isCastResultType (implicit_deref (typeof e)) t  e) rho phi ->
denote_tc_assert (typecheck_expr Delta e) rho phi ->
typecheck_environ Delta rho ->
tc_val t (eval_expr e rho).