Require Export VST.veric.Clight_base.
Local Open Scope pred.
Definition tc_expr {CS: compspecs} (Delta: tycontext) (e: expr) : environ -> mpred:=
fun rho => denote_tc_assert (typecheck_expr Delta e) rho.
Definition tc_exprlist {CS: compspecs} (Delta: tycontext) (t : list type) (e: list expr) : environ -> mpred :=
fun rho => denote_tc_assert (typecheck_exprlist Delta t e) rho.
Definition tc_lvalue {CS: compspecs} (Delta: tycontext) (e: expr) : environ -> mpred :=
fun rho => denote_tc_assert (typecheck_lvalue Delta e) rho.
Definition tc_temp_id {CS: compspecs} (id : positive) (ty : type)
(Delta : tycontext) (e : expr) : environ -> mpred  :=
fun rho => denote_tc_assert (typecheck_temp_id id ty Delta e) rho.
Definition tc_expropt {CS: compspecs} Delta (e: option expr) (t: type) : environ -> mpred :=
match e with None => `!!(t=Tvoid)
| Some e' => tc_expr Delta (Ecast e' t)
end.
Definition tc_temp_id_load id tfrom Delta v : environ -> mpred  :=
fun rho => !! (exists tto, (temp_types Delta) ! id = Some tto
/\ tc_val tto (eval_cast tfrom tto (v rho))).
Hint Resolve extend_prop : core.
Ltac extend_tc_prover :=
match goal with
| |- _ => solve [immediate]
| |- _ => apply extend_prop
| |- _ => first
[ simple apply extend_tc_bool
| simple apply extend_tc_int_or_ptr_type
| simple apply extend_tc_andp
| simple apply extend_tc_andp'
| simple apply extend_tc_Zge
| simple apply extend_tc_Zle
| simple apply extend_tc_iszero
| simple apply extend_tc_nonzero
| simple apply extend_tc_nodivover
| simple apply extend_tc_nobinover
| simple apply extend_tc_samebase
| simple apply extend_tc_ilt
| simple apply extend_tc_llt
| simple apply extend_isCastResultType
| simple apply extend_tc_test_eq
| simple apply extend_tc_test_order]
| |- boxy _ (denote_tc_assert (if ?A then _ else _) _) => destruct A
| |- boxy _ (denote_tc_assert match tc_bool ?A _ with _ => _ end _) =>
destruct A
| |- boxy _ (denote_tc_assert match ?A with Some _ => _ | None => _ end _) =>
destruct A
end.
Hint Resolve extend_tc_expr extend_tc_temp_id extend_tc_temp_id_load extend_tc_exprlist extend_tc_expropt extend_tc_lvalue : core.
Hint Resolve (@extendM_refl rmap _ _ _ _ _) : core.

Lemma tc_bool_i:
forall {cs: compspecs} b e rho w,
b = true -> app_pred (denote_tc_assert (tc_bool b e) rho) w.