Proof using.
intros.
unfold pair_serialize, pair_deserialize.
destruct a.
cheerios_crush.
Qed.
Global Instance pair_Serializer : Serializer (A * B).
Definition sum_serialize (x : A + B) : IOStreamWriter.t :=
match x with
| inl a => IOStreamWriter.append (fun _ => serialize true)
(fun _ => serialize a)
| inr b => IOStreamWriter.append (fun _ => serialize false)
(fun _ => serialize b)
end.
Definition sum_deserialize : ByteListReader.t (A + B) :=
b <- deserialize ;;
match b with
| true => inl <$> deserialize
| false => inr <$> deserialize
end.

Lemma sum_serialize_deserialize_id :
serialize_deserialize_id_spec sum_serialize sum_deserialize.