Instance Z_Serializer : Serializer Z :=
{| serialize := Z_serialize;
deserialize := Z_deserialize;
serialize_deserialize_id := Z_serialize_deserialize_id
|}.
Definition N_serialize n :=
match n with
| N0 => serialize false
| Npos p => IOStreamWriter.append (fun _ => serialize true)
(fun _ => serialize p)
end.
Definition N_deserialize : ByteListReader.t N :=
tag <- deserialize ;;
match tag with
| false => ByteListReader.ret N0
| true => Npos <$> deserialize
end.

Lemma N_serialize_deserialize_id :
serialize_deserialize_id_spec N_serialize N_deserialize.