Yoneda lemma
In mathematics, the Yoneda lemma is arguably the most important result in category theory. It is an abstract result on functors of the type "morphisms into a fixed object". It is a vast generalisation of Cayley's theorem from group theory (viewing a group as a miniature category with just one object and only isomorphisms). It allows the embedding of any locally small category into a category of functors (contravariant set-valued functors) defined on that category. It also clarifies how the embedded category, of representable functors and their natural transformations, relates to the other objects in the  larger functor category. It is an important tool that underlies several modern developments in algebraic geometry and representation theory. It is named after Nobuo Yoneda. Generalities. The Yoneda lemma suggests that instead of studying the locally small category formula_1, one should study the category of all functors of formula_1 into formula_3 (the category of sets with functions as morphisms). formula_3 is a category we think we understand well, and a functor of formula_1 into formula_3 can be seen as a "representation" of formula_1 in terms of known structures. The original category formula_1 is contained in this functor category, but new  objects appear in the functor category, which were absent and "hidden" in formula_1. Treating these new objects just like the old ones often unifies and simplifies the theory. This approach is akin to (and in fact generalizes) the common method of studying a ring by investigating the modules over that ring. The ring takes the place of the category formula_1, and the category of modules over the ring is a category of functors defined on formula_1. Formal statement. Yoneda's lemma concerns functors from a fixed category formula_1 to the category of sets, formula_3. If formula_1 is a locally small  category (i.e. the hom-sets are actual sets and not proper classes), then each object formula_15 of formula_1 gives rise to a natural functor to formula_3 called a hom-functor. This functor is denoted: The (covariant) hom-functor formula_19 sends formula_20 to the set of morphisms formula_21 and sends a morphism formula_22 (where formula_20 and formula_24 are objects in formula_1) to the morphism formula_26 (composition with formula_27 on the left) that sends a morphism formula_28 in formula_21 to the morphism formula_30 in formula_31. That is, Let formula_34 be an arbitrary functor from formula_1 to formula_3. Then Yoneda's lemma says  that: Here the notation formula_37 denotes the category of functors from formula_1 to formula_3. Given a natural transformation formula_40 from formula_19 to formula_34, the corresponding element of formula_43 is formula_44; and given an element formula_45 of formula_43, the corresponding natural transformation is given by formula_47. Contravariant version. There is a contravariant version of Yoneda's lemma, which concerns contravariant functors from formula_1 to formula_3. This version involves the contravariant hom-functor which sends formula_51 to the hom-set formula_52. Given an arbitrary contravariant functor formula_53 from formula_1 to formula_3, Yoneda's lemma asserts that Naming conventions. The use of formula_19  for the covariant hom-functor and formula_58 for the contravariant hom-functor is not completely standard. Many texts and articles either use the opposite convention or completely unrelated symbols for these two functors. However, most modern algebraic geometry texts starting with Alexander Grothendieck's foundational EGA use the convention in this article. The mnemonic "falling into something" can be helpful in remembering that formula_19 is the covariant hom-functor. When the letter formula_15 is falling (i.e. a subscript), formula_19 assigns to an object formula_51 the morphisms from formula_15 into formula_51. Proof. Since formula_65 is a natural transformation, we have the  following commutative diagram: This diagram shows that the natural transformation formula_66 is completely determined by formula_67 since for each morphism formula_68 one has Moreover, any element formula_70 defines a natural transformation in this way. The proof in the contravariant case is completely analogous. The Yoneda embedding. An important special case of Yoneda's lemma is when the functor formula_71 from formula_1 to formula_3 is another hom-functor formula_74. In this case, the covariant version of Yoneda's lemma states that That is, natural transformations between hom-functors are in one-to-one correspondence with morphisms (in the reverse direction) between  the associated objects. Given a morphism formula_76 the associated natural transformation is denoted formula_77. Mapping each object formula_15 in formula_1 to its associated hom-functor formula_80 and each morphism formula_76 to the corresponding natural transformation formula_82 determines a contravariant functor formula_83 from formula_1 to formula_37, the functor category of all (covariant) functors from formula_1 to formula_3. One can interpret formula_83 as a covariant functor: The meaning of Yoneda's lemma in this setting is that the functor formula_90 is fully faithful, and therefore gives an embedding of formula_91 in the category of functors to formula_3. The collection of all functors  formula_93 is a subcategory of formula_94. Therefore, Yoneda embedding implies that the category formula_91 is isomorphic to the category formula_96. The contravariant version of Yoneda's lemma states that Therefore, formula_98 gives rise to a covariant functor from formula_1 to the category of contravariant functors to formula_3: Yoneda's lemma then states that any locally small category formula_1 can be embedded in the category of contravariant functors from formula_1 to formula_3 via formula_105. This is called the "Yoneda embedding". The Yoneda embedding is sometimes denoted by よ, the Hiragana kana Yo. Representable functor. The Yoneda embedding essentially states that for  every (locally small) category, objects in that category can be represented by presheaves, in a full and faithful manner. That is, for a presheaf "P". Many common categories are, in fact, categories of pre-sheaves, and on closer inspection, prove to be categories of sheaves, and as such examples are commonly topological in nature, they can be seen to be topoi in general. The Yoneda lemma provides a point of leverage by which the topological structure of a category can be studied and understood. In terms of (co)end calculus. Given two categories formula_107 and formula_108 with two functors formula_109, natural  transformations between them can be written as the following end. For any functors formula_111 and formula_112 the following formulas are all formulations of the Yoneda lemma. Preadditive categories, rings and modules. A "preadditive category" is a category where the morphism sets form abelian groups and the composition of morphisms is bilinear; examples are categories of abelian groups or modules. In a preadditive category, there is both a "multiplication" and an "addition" of morphisms, which is why preadditive categories are viewed as generalizations of rings. Rings are preadditive categories with one object. The Yoneda lemma remains true for preadditive categories if  we choose as our extension the category of "additive" contravariant functors from the original category into the category of abelian groups; these are functors which are compatible with the addition of morphisms and should be thought of as forming a "module category" over the original category. The Yoneda lemma then yields the natural procedure to enlarge a preadditive category so that the enlarged version remains preadditive — in fact, the enlarged version is an abelian category, a much more powerful condition. In the case of a ring formula_115, the extended category is the category of all right modules over formula_115, and  the statement of the Yoneda lemma reduces to the well-known isomorphism Relationship to Cayley's theorem. As stated above, the Yoneda lemma may be considered as a vast generalization of Cayley's theorem from group theory. To see this, let formula_1 be a category with a single object formula_121 such that every morphism is an isomorphism (i.e. a groupoid with one object). Then formula_122 forms a group under the operation of composition, and any group can be realized as a category in this way. In this context, a covariant functor formula_123 consists of a set formula_20 and a group  homomorphism formula_125, where formula_126 is the group of permutations of formula_20; in other words, formula_20 is a G-set. A natural transformation between such functors is the same thing as an equivariant map between formula_129-sets: a set function formula_130 with the property that formula_131 for all formula_28 in formula_129 and formula_134 in formula_20. (On the left side of this equation, the formula_136 denotes the action of formula_129 on formula_20, and on the right side the action on formula_24.) Now the covariant hom-functor formula_140 corresponds to the action of formula_129 on itself by left-multiplication (the contravariant version corresponds  to right-multiplication). The Yoneda lemma with formula_142 states that that is, the equivariant maps from this formula_129-set to itself are in bijection with formula_129. But it is easy to see that (1) these maps form a group under composition, which is a subgroup of formula_146, and (2) the function which gives the bijection is a group homomorphism. (Going in the reverse direction, it associates to every formula_28 in formula_129 the equivariant map of right-multiplication by formula_28.) Thus formula_129 is isomorphic to a subgroup of formula_146, which is the statement of Cayley's theorem. History. Yoshiki Kinoshita stated  in 1996 that the term "Yoneda lemma" was coined by Saunders Mac Lane following an interview he had with Yoneda.