Program Definition CoNat_coalg : @CoAlgebra Type_Cat S_nat_func :=
{|
Alg_Carrier := CoNat;
Constructors :=
fun x : CoNat =>
match x return unit + CoNat  with
| CoO => inl tt
| CoS x' => inr x'
end
|}.
(* morphism from another alg to CoNat_coalg *)
Program Definition CoNat_coalg_morph coalg' : CoAlgebra_Hom CoNat_coalg coalg'
:=
{|
Alg_map :=
cofix f (x : Alg_Carrier coalg') : CoNat :=
match Constructors coalg' x return CoNat with
| inl _ => CoO
| inr s => CoS (f s)
end
|}.
Next Obligation. (* coalg_map_com *)
(* CoNat_coalg_morph defined *)
(* The following two lemmas help go around Bug 5215. *)

Lemma inr_inl A B (x : A) (y : B) : inr x = inl y → False.
Program Definition CoNat_alg_term : (𝟘_ S_nat_coalg_cat)%object :=
{|
terminal := CoNat_coalg;
t_morph := CoNat_coalg_morph
|}.