(** [decode_val], applied to lists of memory values that are pairwise related by [memval_inject], returns values that are related by [Val.inject]. *)

(* Specifications: *)
Lemma proj_bytes_inject:
forall f vl vl',
list_forall2 (memval_inject f) vl vl' ->
forall bl,
proj_bytes vl = Some bl ->
proj_bytes vl' = Some bl.
Lemma check_value_inject:
forall f vl vl',
list_forall2 (memval_inject f) vl vl' ->
forall v v' q n,
check_value n v q vl = true ->
Val.inject f v v' -> v <> Vundef ->
check_value n v' q vl' = true.
Lemma proj_value_inject:
forall f q vl1 vl2,
list_forall2 (memval_inject f) vl1 vl2 ->
Val.inject f (proj_value q vl1) (proj_value q vl2).
Lemma proj_bytes_not_inject:
forall f vl vl',
list_forall2 (memval_inject f) vl vl' ->
proj_bytes vl = None -> proj_bytes vl' <> None -> In Undef vl.
Lemma check_value_undef:
forall n q v vl,
In Undef vl -> check_value n v q vl = false.
Lemma proj_value_undef:
forall q vl, In Undef vl -> proj_value q vl = Vundef.
Theorem decode_val_inject:
forall f vl1 vl2 chunk,
list_forall2 (memval_inject f) vl1 vl2 ->
Val.inject f (decode_val chunk vl1) (decode_val chunk vl2).