Section Algebras.
Context {C : Category} (T : (C –≻ C)%functor).
(** A T-Algebra in category C for an endo-functor T : C → C is a pair (U, h) where U is an object of C and h : T _o U → U is an arrow in C. *)
Record Algebra : Type :=
{
Alg_Carrier : C;
Constructors : (T _o Alg_Carrier)%object –≻ Alg_Carrier
}.
(** A T-Algebra homomorphism from (U, h) to (U', h') is an arrow g : U → U' such that the following diagram commutes:  # <pre>  T _a g T _o U ——————————————> T _o U' |                      | |                      | |                      | h |                      | h' |                      | |                      | ↓                      ↓ U ————–——————————————> U g </pre> # *)
Record Algebra_Hom (alg alg' : Algebra) : Type :=
{
Alg_map : (Alg_Carrier alg) –≻ (Alg_Carrier alg');
Alg_map_com : ((Constructors alg') ∘ (T _a Alg_map)
= Alg_map ∘ (Constructors alg))%morphism
}.
Arguments Alg_map {_ _} _.
Arguments Alg_map_com {_ _} _.
(** Composition of algebra homomorphisms. The algebra maps are simply composed. *)
Program Definition Algebra_Hom_compose
{alg alg' alg'' : Algebra}
(h : Algebra_Hom alg alg')
(h' : Algebra_Hom alg' alg'')
: Algebra_Hom alg alg''
:=
{|
Alg_map := ((Alg_map h') ∘ (Alg_map h))%morphism
|}.
Next Obligation.
(** The identity algebra homomorphism. *)
Program Definition Algebra_Hom_id (alg : Algebra) : Algebra_Hom alg alg :=
{|
Alg_map := id
|}.

(** Identity algebra homomorphism is the left unit of compositon. *)
Theorem Algebra_Hom_id_unit_left
{alg alg' : Algebra}
(f : Algebra_Hom alg alg') :
(Algebra_Hom_compose f (Algebra_Hom_id alg')) = f.