Ltac entbang :=
intros;
try match goal with POSTCONDITION := @abbreviate ret_assert _ |- _ =>
clear POSTCONDITION
end;
try match goal with MORE_COMMANDS := @abbreviate statement _ |- _ =>
clear MORE_COMMANDS
end;
match goal with
| |- local _ && ?P |-- _ => go_lower; (*simpl;*) try (*simple*) apply empTrue
| |- ?P |-- _ =>
match type of P with
| ?T => unify T mpred; pull_out_props
end
| |- _ => fail "The entailer tactic works only on entailments  _ |-- _ "
end;
(* The following lines are only a temporary solution. Many current proofs depend on one original feature of "entailer!": sem_cast expressions and sem_binary_operation' expressions will be simplified. This step was done in go_lower. But that is not a reasonable design. Current version of go_lower does not "simpl" user's expressions any longer---go_lower should be safe. Thus we add the following lines here. *)
repeat match goal with
| |- context [force_val (sem_binary_operation' ?op ?t1 ?t2 ?v1 ?v2)] =>
progress simpl (force_val (sem_binary_operation' op t1 t2 v1 v2))
end;
simpl sem_cast;
(* end of temporary solution *)
saturate_local;
ent_iter;
repeat change (mapsto_memory_block.spacer _ _ _ _) with emp;
first [ contradiction
| simple apply prop_right; my_auto
| match goal with |- ?Q |-- !! _ && ?Q' => constr_eq  Q Q';
simple apply prop_and_same_derives'; my_auto
end
| simple apply andp_right;
[apply prop_right; my_auto
| cancel; rewrite <- ?sepcon_assoc; autorewrite with norm ]
| normalize; cancel; rewrite <- ?sepcon_assoc
].
Tactic Notation "entailer" "!" := entbang.
Ltac elim_hyps :=  (* not in use anywhere? *)
repeat match goal with
| H: isptr ?x |- _ =>
let x1 := fresh x "_b" in let x2 := fresh x "_ofs" in
destruct x as [ | | | | | x1 x2]; inv H
| H: ptr_eq _ _ |- _ => apply ptr_eq_e in H; safe_subst_any
end.
Ltac aggressive :=
repeat split; auto; elim_hyps; simpl; (computable || auto).
(**** try this out here, for now ****)
Hint Rewrite Int.signed_repr using rep_omega : norm.
Hint Rewrite Int.unsigned_repr using rep_omega : norm.
Hint Rewrite Int64.signed_repr using rep_omega : norm.
Hint Rewrite Int64.unsigned_repr using rep_omega : norm.
(************** TACTICS FOR GENERATING AND EXECUTING TEST CASES *******)
Definition EVAR (x: Prop) := x.

(* Specifications: *)
Lemma EVAR_e: forall x, EVAR x -> x.
Hint Rewrite offset_val_sizeof_hack : norm.
Lemma offset_val_sizeof_hack2:
forall cenv t i j p,
isptr p ->
i=j ->
(offset_val (@sizeof cenv t * i) p = offset_val (@sizeof cenv t * j) p) = True.