Category theory is a general theory of mathematical structures and their relations. It was introduced by Samuel Eilenberg and Saunders Mac Lane in the mid-20th century in their foundational work on algebraic topology. Category theory can be used in most areas of mathematics. In particular, many constructions of new mathematical objects from previous ones that appear similarly in several contexts are conveniently expressed and unified in terms of categories. Examples include quotient spaces, direct products, completion, and duality. Many areas of computer science also rely on category theory, such as functional programming and semantics. A category is formed by two sorts of objects: the objects of the category, and the morphisms, which relate two objects called the source and the target of the morphism. A morphism is often represented by an arrow from its source to its target (see the figure). Morphisms can be composed if the target of the first morphism equals the source of the second one. Morphism composition has similar properties as function composition (associativity and existence of an identity morphism for each object). Morphisms are often some sort of functions, but this is not always the case. For example, a monoid may be viewed as a category with a single object, whose morphisms are the elements of the monoid. The second fundamental concept of category theory is the concept of a functor, which plays the role of a morphism between two categories 𝒞1 and 𝒞2: it maps objects of 𝒞1 to objects of 𝒞2 and morphisms of 𝒞1 to morphisms of 𝒞2 in such a way that sources are mapped to sources, and targets are mapped to targets (or, in the case of a contravariant functor, sources are mapped to targets and vice-versa). A third fundamental concept is a natural transformation that may be viewed as a morphism of functors.
Categories, objects, and morphisms
Categories A category 𝒞 consists of the following three mathematical entities:
A class ob(𝒞), whose elements are called objects; A class hom(𝒞), whose elements are called morphisms or maps or arrows. Each morphism f has a source object a and target object b.The expression f:a→b would be verbally stated as "f is a morphism from a to b".The expression hom(a,b) – alternatively expressed as hom𝒞(a,b), mor(a,b), or 𝒞(a,b) – denotes the hom-class of all morphisms from a to b. A binary operation ∘, called composition of morphisms, such that for any three objects a, b, and c, we have∘:hom(b,c)×hom(a,b)→hom(a,c)The composition of f:a→b and g:b→c is written as g∘f or gf, governed by two axioms: Associativity: If f:a→b, g:b→c, and h:c→d then h∘(g∘f)=(h∘g)∘f Identity: For every object x, there exists a morphism 1x:x→x (also denoted as idx) called the identity morphism for x, such that for every morphism f:a→b, we have1b∘f=f=f∘1aFrom the axioms, it can be proved that there is exactly one identity morphism for every object.
Example A prototypical example of a category is Set, the category of sets and functions between them. The objects of Set are just sets, and a morphism from a set X to a set Y is a function f : X → Y. The category axioms are satisfied since every set has an identity function, and since composition of functions is associative.
Morphisms Relations among morphisms (such as fg = h) are often depicted using commutative diagrams, with "points" (corners) representing objects and "arrows" representing morphisms. Morphisms can have any of the following properties. A morphism f : a → b is:
a monomorphism (or monic) if f ∘ g1 = f ∘ g2 implies g1 = g2 for all morphisms g1, g2 : x → a. an epimorphism (or epic) if g1 ∘ f = g2 ∘ f implies g1 = g2 for all morphisms g1, g2 : b → x. a bimorphism if f is both epic and monic. an isomorphism if there exists a morphism g : b → a such that f ∘ g = 1b and g ∘ f = 1a. an endomorphism if a = b. end(a) denotes the class of endomorphisms of a. an automorphism if f is both an endomorphism and an isomorphism. aut(a) denotes the class of automorphisms of a. a retraction if a right inverse of f exists, i.e. if there exists a morphism g : b → a with f ∘ g = 1b. a section if a left inverse of f exists, i.e. if there exists a morphism g : b → a with g ∘ f = 1a. Every retraction is an epimorphism, and every section is a monomorphism. Furthermore, the following three statements are equivalent:
f is a monomorphism and a retraction; f is an epimorphism and a section; f is an isomorphism.
Functors
Functors are structure-preserving maps between categories. They can be thought of as morphisms in the category of all (small) categories. A (covariant) functor F from a category C to a category D, written F : C → D, consists of:
for each object x in C, an object F(x) in D; and for each morphism f : x → y in C, a morphism F(f) : F(x) → F(y) in D, such that the following two properties hold:
For every object x in C, F(1x) = 1F(x); For all morphisms f : x → y and g : y → z, F(g ∘ f) = F(g) ∘ F(f). A contravariant functor F: C → D is like a covariant functor, except that it "turns morphisms around" ("reverses all the arrows"). More specifically, every morphism f : x → y in C must be assigned to a morphism F(f) : F(y) → F(x) in D. In other words, a contravariant functor acts as a covariant functor from the opposite category Cop to D.
Natural transformations
A natural transformation is a relation between two functors. Functors often describe "natural constructions" and natural transformations then describe "natural homomorphisms" between two such constructions. Sometimes two quite different constructions yield "the same" result; this is expressed by a natural isomorphism between the two functors. If F and G are (covariant) functors between the categories C and D, then a natural transformation η from F to G associates to every object X in C a morphism ηX : F(X) → G(X) in D such that for every morphism f : X → Y in C, we have ηY ∘ F(f) = G(f) ∘ ηX; this means that the following diagram is commutative:
The two functors F and G are called naturally isomorphic if there exists a natural transformation from F to G such that ηX is an isomorphism for every object X in C.
Other concepts
Universal constructions, limits, and colimits
… excerpt ends here. Continue reading the full article.


