intros.
assert (A: classify_bool t =
match t with
| Tint _ _ _ => bool_case_i
| Tpointer _ _ | Tarray _ _ _ | Tfunction _ _ _ => if Archi.ptr64 then bool_case_l else bool_case_i
| Tfloat F64 _ => bool_case_f
| Tfloat F32 _ => bool_case_s
| Tlong _ _ => bool_case_l
| _ => bool_default
end).
{
unfold classify_bool; destruct t; simpl; auto. destruct i; auto.
}
unfold bool_val. rewrite A.
unfold sem_cast, classify_cast; remember Archi.ptr64 as ptr64; destruct t; simpl; auto; destruct v; auto.
destruct (Int.eq i0 Int.zero); auto.
destruct ptr64; auto. destruct (Mem.weak_valid_pointer m b (Ptrofs.unsigned i0)); auto.
destruct (Int64.eq i Int64.zero); auto.
destruct (negb ptr64); auto. destruct (Mem.weak_valid_pointer m b (Ptrofs.unsigned i)); auto.
destruct f; auto.
destruct f; auto.
destruct f; auto.
destruct f; auto.
destruct (Float.cmp Ceq f0 Float.zero); auto.
destruct f; auto.
destruct (Float32.cmp Ceq f0 Float32.zero); auto.
destruct f; auto.
destruct ptr64; auto.
destruct (Int.eq i Int.zero); auto.
destruct ptr64; auto.
destruct ptr64; auto.
destruct ptr64; auto. destruct (Int64.eq i Int64.zero); auto.
destruct ptr64; auto.
destruct ptr64; auto.
destruct ptr64; auto. destruct (Mem.weak_valid_pointer m b (Ptrofs.unsigned i)); auto.
destruct (Mem.weak_valid_pointer m b (Ptrofs.unsigned i)); auto.
destruct ptr64; auto.
destruct ptr64; auto. destruct (Int.eq i Int.zero); auto.
destruct ptr64; auto. destruct (Int64.eq i Int64.zero); auto.
destruct ptr64; auto.
destruct ptr64; auto.
destruct ptr64; auto. destruct (Mem.weak_valid_pointer m b (Ptrofs.unsigned i)); auto.
destruct (Mem.weak_valid_pointer m b (Ptrofs.unsigned i)); auto.
destruct ptr64; auto.
destruct ptr64; auto. destruct (Int.eq i Int.zero); auto.
destruct ptr64; auto. destruct (Int64.eq i Int64.zero); auto.
destruct ptr64; auto.
destruct ptr64; auto.
destruct ptr64; auto. destruct (Mem.weak_valid_pointer m b (Ptrofs.unsigned i)); auto.
destruct (Mem.weak_valid_pointer m b (Ptrofs.unsigned i)); auto.
Qed.
(** Relation between Boolean value and Boolean negation. *)

Lemma notbool_bool_val:
forall v t m,
sem_notbool v t m =
match bool_val v t m with None => None | Some b => Some(Val.of_bool (negb b)) end.