Instance positive_Serializer : Serializer positive.(* This is the first example of a "typical" serializer: it combines more
   primitive serializers (in this case, just for byte and positive) together in
   order to serialize a Z. *)
Definition Z_serialize (z : Z) : IOStreamWriter.t :=
  match z with
  | Z0 => serialize x00
  | Zpos p => IOStreamWriter.append (fun _ => serialize x01)
                                    (fun _ => serialize p)
  | Zneg p => IOStreamWriter.append (fun _ => serialize x02)
                                    (fun _ => serialize p)
  end.

Lemma Z_serialize_deserialize_id : serialize_deserialize_id_spec Z_serialize Z_deserialize.