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.

(* Specifications: *)
Lemma perm_order''_trans: forall x y z, perm_order'' x y -> perm_order'' y z -> perm_order'' x z.
Lemma mapsto_valid_pointer : forall b o sh t jm, nonidentity sh -> (mapsto_ sh (t) (Vptr b o) * TT)%pred (m_phi jm) -> Mem.valid_pointer (m_dry jm) b (Ptrofs.unsigned o) = true.
Lemma mapsto_is_pointer : forall sh t m v, mapsto_ sh t v m -> exists b, exists o, v = Vptr b o.
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))).
Lemma is_int_of_bool: forall i s b, is_int i s (Val.of_bool b).
Lemma pointer_cmp_no_mem_bool_type: forall (Delta : tycontext) cmp (e1 e2 : expr) sh1 sh2 x1 x b1 o1 b2 o2 i3 s3, is_comparison cmp = true-> eqb_type (typeof e1) int_or_ptr_type = false -> eqb_type (typeof e2) int_or_ptr_type = false -> forall (rho : environ) phi, eval_expr e1 rho = Vptr b1 o1 -> eval_expr e2 rho = Vptr b2 o2 -> blocks_match cmp (eval_expr e1 rho) (eval_expr e2 rho) -> denote_tc_assert (typecheck_expr Delta e1) rho phi -> denote_tc_assert (typecheck_expr Delta e2) rho phi -> (mapsto_ sh1 (typeof e1) (eval_expr e1 rho)) x -> (mapsto_ sh2 (typeof e2) (eval_expr e2 rho)) x1 -> typecheck_environ Delta rho -> is_int i3 s3 (force_val (sem_binary_operation' cmp (typeof e1) (typeof e2) (eval_expr e1 rho) (eval_expr e2 rho))).