Definition is_defchar (mv: memval) :=
  match mv with
    | Byte _ => True
    | _ => False
  end.Inductive extcall_storebytes_sem
  (F V: Type) (ge: Genv.t F V): list memval -> list val -> mem -> trace -> val -> mem -> Prop :=
  | extcall_storebytes_sem_intro: forall (b: block) (ofs: int) bytes m m',
      Zlength bytes > 0 ->
      Forall is_defchar bytes ->
      Mem.storebytes m b (Int.unsigned ofs) bytes = Some m' ->
      extcall_storebytes_sem ge bytes (Vptr b ofs :: nil) m E0 Vundef m'.Inductive extcall_storebytes_sem
  (F V: Type) (ge: Genv.t F V): list memval -> list val -> mem -> trace -> val -> mem -> Prop :=
  | extcall_storebytes_sem_intro: forall (b: block) (ofs: int) bytes m m',
      Zlength bytes > 0 ->
      Forall is_defchar bytes ->
      Mem.storebytes m b (Int.unsigned ofs) bytes = Some m' ->
      extcall_storebytes_sem ge bytes (Vptr b ofs :: nil) m E0 Vundef m'.

(* Specifications: *)
Lemma extcall_storebytes_sem_inject_comm: forall (F V : Type) (ge : Genv.t F V) (vargs : list val) (m1 : mem) (t : trace) (m2 : mem) (f : block -> option (block * Z)) (m1' : mem) (vargs' : list val) bytes, meminj_preserves_globals ge f -> extcall_storebytes_sem ge bytes vargs m1 t Vundef m2 -> Mem.inject f m1 m1' -> val_list_inject f vargs vargs' -> exists (m2' : mem), extcall_storebytes_sem ge bytes vargs' m1' t Vundef m2' /\ Mem.inject f m2 m2' /\ Mem.unchanged_on (loc_unmapped f) m1 m2 /\ Mem.unchanged_on (loc_out_of_reach f m1) m1' m2'.
Lemma storebytes_sem_inject_comm: forall F V (ge: Genv.t F V) m1 m1' m2 bytes b ofs j b' delta, Mem.storebytes m1 b (Int.unsigned ofs) bytes = Some m1' -> Zlength bytes > 0 -> Forall is_defchar bytes -> meminj_preserves_globals ge j -> Mem.inject j m1 m2 -> j b = Some (b', delta) -> exists m2', Mem.storebytes m2 b' (Int.unsigned (Int.add ofs (Int.repr delta))) bytes = Some m2' /\ Mem.inject j m1' m2' /\ Mem.unchanged_on (loc_unmapped j) m1 m1' /\ Mem.unchanged_on (loc_out_of_reach j m1) m2 m2'.