Definition force_valid_pointers m v1 v2 :=
match v1, v2 with
| Vptr b1 ofs1, Vptr b2 ofs2 =>
    (Mem.valid_pointer m b1 (Ptrofs.unsigned ofs1) &&
    Mem.valid_pointer m b2 (Ptrofs.unsigned ofs2))%bool
| _, _ => false
end.Definition blocks_match op v1 v2 :=
match op with Cop.Olt | Cop.Ogt | Cop.Ole | Cop.Oge =>
  match v1, v2 with
    Vptr b _, Vptr b2 _ => b=b2
    | _, _ => False
  end
| _ => True
end.

Lemma pointer_cmp_eval: forall (Delta : tycontext) (cmp : Cop.binary_operation) (e1 e2 : expr) sh1 sh2, is_comparison cmp = true -> forall (jm : juicy_mem) (rho : environ), (tc_expr Delta e1 rho) (m_phi jm) -> (tc_expr Delta e2 rho) (m_phi jm) -> blocks_match cmp (eval_expr e1 rho) (eval_expr e2 rho) -> typecheck_environ Delta rho -> nonidentity sh1 -> nonidentity sh2 -> (mapsto_ sh1 (typeof e1) (eval_expr e1 rho) * TT)%pred (m_phi jm) -> (mapsto_ sh2 (typeof e2) (eval_expr e2 rho) * TT)%pred (m_phi jm) -> eqb_type (typeof e1) int_or_ptr_type = false -> eqb_type (typeof e2) int_or_ptr_type = false -> Cop.sem_binary_operation cenv_cs cmp (eval_expr e1 rho) (typeof e1) (eval_expr e2 rho) (typeof e2) (m_dry jm) = Some (force_val (sem_binary_operation' cmp (typeof e1) (typeof e2) (eval_expr e1 rho) (eval_expr e2 rho))).