Require Export VST.floyd.canon.
Local Open Scope logic.
Ltac refold_right_sepcon R :=
match R with
| @sepcon mpred _ _ ?R1 ?R' => let S := refold_right_sepcon R' in constr: (R1 :: S )
| _ => constr:(R :: nil)
end.
Arguments sem_cmp c !t1 !t2 / v1 v2.
(* The following line should not be needed, and was not needed in Coq 8.3, but in Coq 8.4 it seems to be necessary. *)
Hint Resolve (@LiftClassicalSep environ) : typeclass_instances.
Definition func_ptr' f v := func_ptr f v && emp.
Hint Resolve func_ptr_isptr: saturate_local.
Hint Resolve func_ptr'_isptr: saturate_local.
Hint Rewrite @subst_lift0' : subst.
Hint Rewrite @subst_lift0 (*@subst_lift0'*) @subst_lift0C : subst.
Hint Rewrite @subst_lift1 (*@subst_lift1'*) @subst_lift1C  : subst.
Hint Rewrite @subst_lift2 (*@subst_lift2'*) @subst_lift2C : subst.
Hint Rewrite @subst_lift3 (*@subst_lift3'*) @subst_lift3C : subst.
Hint Rewrite @subst_lift4 (*@subst_lift4'*) @subst_lift4C : subst.
Definition retval : environ -> val := eval_id ret_temp.
Hint Rewrite eval_id_same : norm.
Hint Rewrite eval_id_other using solve [clear; intro Hx; inversion Hx] : norm.
Hint Rewrite simpl_get_result1: norm.
Hint Rewrite retval_get_result1 : norm.
Hint Rewrite retval_ext_rval : norm.
Hint Rewrite retval_lemma1 : norm.
Hint Rewrite retval_make_args: norm2.
Fixpoint fold_right_and P0 (l: list Prop) : Prop :=
match l with
| nil => P0
| b::r => b  /\ fold_right_and P0 r
end.
Fixpoint fold_right_and_True (l: list Prop) : Prop :=
match l with
| nil => True
| b :: nil => b
| b::r => b /\ fold_right_and_True r
end.
Definition fold_right_PROP_SEP (l1: list Prop) (l2: list mpred) : mpred :=
match l1 with
| nil => fold_right_sepcon l2
| l => !! (fold_right_and_True l) && fold_right_sepcon l2
end.
Hint Rewrite typed_true_isptr using apply Coq.Init.Logic.I : norm.
Ltac super_unfold_lift_in H :=
cbv delta [liftx LiftEnviron Tarrow Tend lift_S lift_T
lift_prod lift_last lifted lift_uncurry_open lift_curry lift lift0
lift1 lift2 lift3] beta iota in H.
Ltac super_unfold_lift' :=
cbv delta [liftx LiftEnviron Tarrow Tend lift_S lift_T
lift_prod lift_last lifted lift_uncurry_open lift_curry lift lift0
lift1 lift2 lift3] beta iota.
Definition name (id: ident) := True.
Tactic Notation "name" ident(s) constr(id) :=
assert (s: name id) by apply Coq.Init.Logic.I.
Definition reflect_temps_f (rho: environ) (b: Prop) (i: ident) (t: type) : Prop :=
tc_val' t (eval_id i rho) /\ b.
Definition reflect_temps (Delta: tycontext) (rho: environ) : Prop :=
PTree.fold (reflect_temps_f rho) (temp_types Delta) True.

Lemma reflect_temps_valid:
forall Delta rho,
tc_environ Delta rho -> reflect_temps Delta rho.