Instance N_Serializer : Serializer N.
(* The other main way to define a serializer is to use an isomorphism to another type that is already serializable. *)
Definition nat_serialize n : IOStreamWriter.t := serialize (N.of_nat n).
Definition nat_deserialize : ByteListReader.t nat := N.to_nat <$> deserialize.

(* This proof is typical for serializers defined by converting to and from a type that is already serializable. Unfold the serializer and deserializer, call serialize_deserialize_id_crush, and then use the proof that the conversion functions are inverses. *)
Lemma nat_serialize_deserialize_id :
serialize_deserialize_id_spec nat_serialize nat_deserialize.