(** * Encoding and decoding values *)
Definition inj_bytes (bl: list byte) : list memval :=
List.map Byte bl.
Fixpoint proj_bytes (vl: list memval) : option (list byte) :=
match vl with
| nil => Some nil
| Byte b :: vl' =>
match proj_bytes vl' with None => None | Some bl => Some(b :: bl) end
| _ => None
end.
Remark length_inj_bytes:
forall bl, length (inj_bytes bl) = length bl.
Remark proj_inj_bytes:
forall bl, proj_bytes (inj_bytes bl) = Some bl.

(* Specifications: *)
Lemma inj_proj_bytes:
forall cl bl, proj_bytes cl = Some bl -> cl = inj_bytes bl.
Lemma inj_proj_bytes:
forall cl bl, proj_bytes cl = Some bl -> cl = inj_bytes bl.