(* Lemma join_te_denote : forall te1 te2 id b t1, (join_te te1 te2) ! id = Some (t1, b) -> (exists b1, te1 ! id = Some (t1, b || b1)) /\ match te2 ! id with Some (t2,b2) => b = b && b2 | None => True end.  Lemma typecheck_environ_join1: forall rho Delta1 Delta2, var_types Delta1 = var_types Delta2 -> glob_types Delta1 = glob_types Delta2 ->  typecheck_environ Delta1 rho -> typecheck_environ (join_tycon Delta1 Delta2) rho. *)
Definition tycontext_evolve (Delta Delta' : tycontext) :=
(forall id, match (temp_types Delta) ! id, (temp_types Delta') ! id with
| Some t, Some t' => t=t'
| None, None => True
| _, _ => False
end)
/\ (forall id, (var_types Delta) ! id = (var_types Delta') ! id)
/\ ret_type Delta = ret_type Delta'
/\ (forall id, (glob_types Delta) ! id = (glob_types Delta') ! id)
/\ (forall id, (glob_specs Delta) ! id = (glob_specs Delta') ! id)
/\ (forall id, (annotations Delta) ! id = (annotations Delta') ! id).

(* Lemma typecheck_environ_join2: forall rho Delta Delta1 Delta2, tycontext_evolve Delta Delta1 -> tycontext_evolve Delta Delta2 -> typecheck_environ Delta2 rho -> typecheck_environ (join_tycon Delta1 Delta2) rho. *)
Lemma tc_val_ptr_lemma {CS: compspecs} :
forall rho m Delta id t a,
typecheck_environ Delta rho ->
denote_tc_assert (typecheck_expr Delta (Etempvar id (Tpointer t a))) rho m ->
strict_bool_val (eval_id id rho) (Tpointer t a) = Some true ->
tc_val (Tpointer t a) (eval_id id rho).