(* Lemma forward_setx: forall Espec {cs: compspecs} Delta P Q R id e, (PROPx P (LOCALx (tc_env Delta :: Q) (SEPx R)) |-- (tc_expr Delta e) && (tc_temp_id id (typeof e) Delta e) ) -> @semax cs Espec Delta (PROPx P (LOCALx Q (SEPx R))) (Sset id e) (normal_ret_assert (EX old:val, PROPx P (LOCALx (`eq (eval_id id) (subst id (`old) (eval_expr e)) :: map (subst id (`old)) Q) (SEPx R)))). *)

(* Specifications: *)
Lemma semax_switch_PQR:
forall {Espec: OracleKind}{CS: compspecs} ,
forall n Delta (Pre: environ->mpred) a sl (Post: ret_assert),
is_int_type (typeof a) = true ->
ENTAIL Delta, Pre |-- tc_expr Delta a ->
ENTAIL Delta, Pre |-- local (`(eq (Vint (Int.repr n))) (eval_expr a)) ->
@semax CS Espec Delta
Pre
(seq_of_labeled_statement (select_switch (Int.unsigned (Int.repr n)) sl))
(switch_ret_assert Post) ->
@semax CS Espec Delta Pre (Sswitch a sl) Post.
Lemma modulo_samerepr:
forall x y,
Z.modulo x Int.modulus = Z.modulo y Int.modulus ->
Int.repr x = Int.repr y.
Lemma select_switch_case_signed:
forall y n x c sl,
Z.modulo x Int.modulus = Z.modulo y Int.modulus ->
0 <= x < Int.modulus ->
select_switch_case n (LScons (Some x) c sl) =
if zeq (Int.unsigned (Int.repr y)) n then Some (LScons (Some x) c sl)
else select_switch_case n sl.