Category Theory: Definitions
Programming with Categories (DRAFT) - Fong, Bartosz, Spivak 2020
A category is a network of composable relationships.
(Definition)
A category C consists of four constituents: (i) a set Ob"C", elements of which are called objects of C; (ii) for every pair of objects c; d 2 Ob"C" a set C"c; d", elements of which are called morphisms from c to d and often denoted f : c ! d; (iii) for every object c, a specified morphism idc 2 C"c; c" called the identity morphism for c; and (iv) for every three objects b; c; d and morphisms f : b ! c and 1 : c ! d, a specified morphism "1 β¦ f ": b ! d called the composite of 1 after f (sometimes denoted f # 1). These constituents are subject to three constraints: Left unital: for any f : c ! d, the equation idc β¦ f f holds; Right unital: for any f : c ! d, the equation f β¦ idd f holds; Associative: for any f1 : c1 ! c2, f2 : c2 ! c3, and f3 : c3 ! c4, the following equation holds " f3 β¦ f2" β¦ f1 f3 β¦ " f2 β¦ f1": If f : c ! d is a morphism, we again call c the domain and d the codomain of f .
=============================================================================== Category Theory Applied to Functional Programming - Juan Pedro Villa Isaza 2014
(Definition) A category π consists of: β’ Objects π, π, π, ... β’ Morphisms or arrows π, π, β, ... β’ For each morphism π, domain and codomain objects π = dom(π) and π = cod(π), respectively. We then write π βΆ π β π. β’ For each object π, an identity morphism idπ βΆ π β π. β’ For each pair of morphisms π βΆ π β π and π βΆ π β π, a composite morphism π β π βΆ π β π. That is, for each pair of morphisms π and π with cod(π) = dom(π), a composite morphism π β π βΆ dom(π) β cod(π). We may then draw a diagram like that of Figure 2.2
Composition of morphisms associates to the right. Therefore, for all morphisms π βΆ π β π, π βΆ π β π, and β βΆ π β π, β β π β π denotes β β (π β π). The category is subject to the following axioms: β’ For all morphisms π βΆ π β π, π βΆ π β π, and β βΆ π β π, β β (π β π) = β β π β π = (β β π) β π, (2.1) that is, composition of morphisms is associative or, equivalently, the diagram in Figure 2.3a is commutative. β’ For all morphisms π βΆ π β π, idπ β π = π = π β idπ , (2.2) that is, identity morphisms are identities for the composition of morphisms or, equivalently, the diagram in Figure 2.3b is commutative.
=============================================================================== Categories and Haskell: An introduction to the mathematics behind modern FP by Jan-Willem Buurlage
Definition 1.1. A category C = (O, A, β¦) consists of: β’ a collection O of objects, written a, b, . . . β O. β’ a collection A of arrows written f, g, . . . β A between these objects, e.g. f : a β b. β’ a notion of composition f β¦ g of arrows. β’ an identity arrow ida for each object a β O. The composition operation and identity arrow should satisfy the following laws:
Composition: If f : a β b and g : b β c then g β¦ f : a β c.
Composition with identity arrows: If f : x β a and g : a β x where x is arbitrary, then: ida β¦ f = f, g β¦ ida = g.
Associativity: If f : a β b, g : b β c and h : c β d then: (h β¦ g) β¦ f = h β¦ (g β¦ f)
If f : a β b, then we say that a is the domain and b is the codomain of f. It is also written as: dom(f) = a, cod(f) = b. The composition g β¦ f is only defined on arrows f and g if the domain of g is equal to the codomain of f. We will write for objects and arrows respectively simply a β C and f β C, instead of a β O and f β A.
Last updated
Was this helpful?