{"id":16313677,"url":"https://github.com/alhassy/catscheatsheet","last_synced_at":"2026-02-07T17:04:22.788Z","repository":{"id":108700340,"uuid":"147585595","full_name":"alhassy/CatsCheatSheet","owner":"alhassy","description":"This project is to contain a listing of common theorems in elementary category theory.","archived":false,"fork":false,"pushed_at":"2020-04-29T23:21:26.000Z","size":8205,"stargazers_count":72,"open_issues_count":1,"forks_count":4,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-24T04:38:28.163Z","etag":null,"topics":["category-theory","cheatsheet","functors","gluing-morphisms","html","pdf","reference"],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alhassy.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-09-05T22:15:04.000Z","updated_at":"2024-11-25T08:55:19.000Z","dependencies_parsed_at":null,"dependency_job_id":"54b8b49c-4b31-48ae-9555-3580daf11d66","html_url":"https://github.com/alhassy/CatsCheatSheet","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/alhassy/CatsCheatSheet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alhassy%2FCatsCheatSheet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alhassy%2FCatsCheatSheet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alhassy%2FCatsCheatSheet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alhassy%2FCatsCheatSheet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alhassy","download_url":"https://codeload.github.com/alhassy/CatsCheatSheet/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alhassy%2FCatsCheatSheet/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264853418,"owners_count":23673637,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["category-theory","cheatsheet","functors","gluing-morphisms","html","pdf","reference"],"created_at":"2024-10-10T21:52:01.608Z","updated_at":"2026-02-07T17:04:17.727Z","avatar_url":"https://github.com/alhassy.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1\u003e CatsCheatSheet \u003c/h1\u003e\n\nThis project is to contain a listing of common theorems in elementary category theory.\n\n**The repo contains other articles I've written on Category Theory;**\n**which may be read in a blog-format at:**\n\u003chttps://alhassy.github.io/blog/categories/#categorytheory\u003e\n\n**The listing sheet, as PDF, can be found [here](https://github.com/alhassy/CatsCheatSheet/blob/master/CheatSheet.pdf)**,\nwhile below is an unruly html rendition.\n\nThis reference sheet is built around the system \u003chttps://github.com/alhassy/CheatSheet\u003e\n\n\n# Table of Contents\n\n1.  [Categories](#org190f6a8)\n2.  [“Gluing” Morphisms Together](#org417a0df)\n3.  [Functors](#org42710d1)\n4.  [Naturality](#orgd826582)\n5.  [Adjunctions](#org18cc334)\n6.  [Constant Combinators](#orge6a49a5)\n7.  [Monics and Epics](#org61d71cb)\n8.  [Isos](#orgbb74ee3)\n9.  [Skolemisation](#org4b4d8fd)\n10. [Initiality](#org1176ce5)\n11. [Colimits](#orgbbe90f6)\n12. [Limits](#orgc00a537)\n13. [Sums](#orgd3b4147)\n14. [Products](#org52f269b)\n15. [Finitary Sums and Products](#org6d13b13)\n16. [Mixing products and coproducts](#org08ec4d2)\n17. [References](#org824df47)\n18. [To Read](#orgf2ec4a5)\n19. [Monoidal and Closed Categories](#org53fdf4f)\n20. [Enrichment \u0026 Internal Algebraic Structures](#org08ad92a)\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\u003ca id=\"org190f6a8\"\u003e\u003c/a\u003e\n\n# Categories\n\nA **category** 𝒞 consists of a collection of “objects” \\(\\Obj\\, 𝒞\\),\n  a collection of  “(homo)morphisms” \\(\\Hom_𝒞(a,b)\\) for any \\(a,b : \\Obj\\,𝒞\\)\n  \u0026#x2014;also denoted “\\(a \\,\\to_𝒞\\, b\\)”\u0026#x2014;,\n  an operation \\(\\Id\\) associating a morphism \\(\\Idₐ : \\Hom(a,a)\\) to each object \\(a\\),\n  and a dependently-typed “composition” operation\n  \\(\\_∘\\_ : ∀\\{A \\, B \\, C : \\Obj\\} → \\Hom(B,C) → \\Hom(A,B) → \\Hom(A,C)\\)\n  that is required to be associative with \\(\\Id\\) as identity.\n\nIt is convenient to define a pair of operations \\(\\src, \\tgt\\) from morphisms to objects\nas follows:\n\n\\begin{flalign*}\n    f : X \\to_𝒞 Y \\quad\\equiv\\quad \\mathsf{src}\\; f = X \\;\\land\\; \\mathsf{tgt}\\; f = Y\n   \u0026\u0026\n   \\tag*{$\\src,\\tgt$-Definition}\n   \\label{src-tgt-Definition}\n\\end{flalign*}\n\nInstead of \\(\\Hom_𝒞\\) we can instead assume primitive a ternary relation\n\\(\\_:\\_→_𝒞\\_\\) and regain \\(\\Hom_𝒞\\) precisely when the relation is functional\nin its last two arguments:\n\\eqn{type-Unique}{f : A \\to_𝒞 B \\;\\;\\land\\;\\; f : A' \\to_𝒞 B' \\;\\implies\\; A=A' \\;\\land\\; B=B'}\nWhen this condition is dropped, we obtain a *pre-category*; e.g., the familiar *Sets*\nis a pre-category that is usually treated as a category by making morphisms\ncontain the information about their source and target: \\((A, f, B) : A → B\\)\nrather than just \\(f\\).\n\\newline\n *This is sometimes easier to give than Hom! C.f. Alg(F).*\n\\room\n\nHere's an equivalence-preserving property that is useful in algebraic calculations,\n\nExamples:\n\n-   [Linear Algebra:](https://arxiv.org/abs/1312.4818) Matrices with real number values determine a category whose objects are the natural numbers,\n    morphisms \\(n → m\\) are \\(n × m\\) matrices, \\(\\Id\\) is the identity matrix, and composition\n    is matrix multiplication.\n\n-   Each preorder determines a category: The objects are the elements\n    and there is a morphism \\(a → b\\) named, say, “\\((a, b)\\)”, precisely when \\(a \\leq b\\);\n    composition boils down to transitivity of \\(\\leq\\).\n\n-   Each monoid \\((M, ⊕, e)\\) gives rise to a category: The objects and the arrows\n    are both the elements of\\(M\\), and \\(k : m → n \\;≡\\; k ⊕ m = n\\).\n    E.g., \\((ℕ, ×, 1)\\) gives rise to a category whose products are gcd's\n    and so properties of products are thus gcd theorems!\n\n-   Each digraph determines a category: The objects are the nodes\n    and the paths are the morphisms typed with their starting and ending node.\n    Composition is catenation of paths and identity is the empty path.\n\n-   Suppose we have an \\`interface', in the programming sense,\n    of constant, function, and relation symbols \u0026#x2014;this is also called a *signature*.\n\n    Let 𝒯 be any collection of sentences in the first-order language of signature \\(\\Sigma\\).\n    Then we can define a category \\(\\mathsf{Mod}\\,𝒯\\) whose objects are\n    implementations of interface \\(\\Sigma\\) satisfying constraints 𝒯, and whose morphisms\n    are functions that preserve the \\(\\Sigma\\) structure.\n    Ignoring constraints 𝒯 gives us \\`functor algebras'.\n\n    Particular examples include monoids and structure-preserving maps between them;\n    likewise digraphs, posets, rings, etc and their homomorphisms.\n\n\\room\n\nEven when morphisms are functions, the objects need not be sets:\nSometimes the objects are *operations* \u0026#x2014;with an appropriate definition\nof typing for the functions. The categories of *F*-algebras are an example\nof this.\n\n\n\u003ca id=\"org417a0df\"\u003e\u003c/a\u003e\n\n# “Gluing” Morphisms Together\n\nTraditional function application is replaced by the more generic concept of\nfunctional *composition* suggested by morphism-arrow chaining:\n\nWhenever we have two morphisms such that the target type of one\nof them, say \\(g : B ← A\\) is the same as the source type of the other,\nsay \\(f : C ← B\\) then “\\(f\\) after \\(g\\)”, their *composite morphism*,\n\\(f ∘ g : C ← A\\) can be defined. It “glues” \\(f\\) and \\(g\\) together,\n“sequentially”:\n\nComposition is the basis for gluing morphisms together to build more complex morphisms.\nHowever, not every two morphisms can be glued together by composition.\n\n\\room\n\nTypes provide the interface for putting morphisms together to obtain more complex functions.\n\n\\room\n\nA *split* arises wherever two morphisms do not compose but share the same source.\n\n-   Since they share the same source, their outputs can be paired: \\(c ↦ (f\\, c, g\\, c)\\).\n-   This duplicates the input so that the functions can be executed in “parallel” on it.\n\n\\room\n\nA *product* appears when there is no explicit relationship between the types of the morphisms.\n\n-   We regard their sources as projections of a product, whence they can be seen as *splits*.\n-   This \\((c, d) ↦ (f\\, c, g\\, d)\\) corresponds to the “parallel” application of \\(f\\) and \\(g\\),\n    each with its *own* input.\n\n\\room\n\nAn *either* arises wherever two morphisms do not compose but share the same target.\n\n-   Apply \\(f\\) if the input is from the “\\(A\\) side” or apply \\(g\\) if it is from the “\\(B\\) side”.\n-   This is a “case analysis” of the input with branches being either \\(f\\) or \\(g\\).\n\n\\room\n\nA *sum* appears when there is no explicit relationship between the types of the morphisms.\n\n-   We regard their targets as injections into a sum, whence they can be seen as *eithers*.\n\n\\room\n\nA *transpose* arises when we need to combine a binary morphism with a unary morphism.\n\n-   I.e., it arises when a composition chain is interrupted by an extra product argument.\n-   Express \\(f\\) as a *C*-indexed family, \\(f_c : A → B\\), of morphisms such that applying a function at any index\n    behaves like \\(f\\); i.e., \\(f_c \\, a = f(c, a)\\). Each \\(f_c\\) can now be composed with \\(g\\).\n    Let \\(\\transpose{(\\;)}\\) denote the operation \\(f ↦ f_c\\).\n\n\\vspace{-0.5em}\n\n\\vspace{1em}\n\n\n\u003ca id=\"org42710d1\"\u003e\u003c/a\u003e\n\n# Functors\n\nA **functor** *F : 𝒜 → ℬ* is a pair of mappings, denoted by one name,\nfrom the objects, and morphisms, of 𝒜 to those of ℬ such that\nit respects the categorical structure:\n\n\\vspace{1em}\n\nThe two axioms are equivalent to the single statement that\n*functors distribute over finite compositions, with \\(\\Id\\) being the empty composition:*\n\\[ F(f_0 ∘ \\cdots ∘ f_{n-1}) \\;=\\; F\\, f_0 ∘ \\cdots ∘ F\\, f_{n-1} \\]\n\nUse of Functors.\n\n-   In the definition of a category, “objects” are “just things” for which no internal\n    structure is observable by categorical means \u0026#x2014;composition, identities, morphisms, typing.\n    *Functors form the tool to deal with “structured” objects.*\n\n    Indeed in 𝒮ℯ𝓉 the aspect of a structure is that it has “constituents”, and that it is possible\n    to apply a function to all the individual constituents; this is done by\n    *F f : F A → F B*.\n\n-   For example, let \\(\\bin A = A × A\\) and \\(\\bin f = (x, y) ↦ (f\\, x, f\\, y)\\).\n    So \\(\\bin\\) is or represents the structure of pairs; \\(\\bin\\, A\\) is the set of pairs of *A*,\n    and \\(\\bin\\, f\\) is the function that applies *f* to each constituent of a pair.\n    -   A *binary operation on A* is then just a function \\(\\bin A → A\\);\n        in the same sense we obtain *F-ary operations*.\n\n-   Also, *Seq* is or represents the structure of sequences; *Seq A* is the structure of sequences\n    over *A*, and *Seq f* is the function that applies *f* to each constituent of a sequence.\n\n-   Even though *F A* is still just an object, a thing with no observable internal structure, the\n    functor properties enable to exploit the “structure” of *F A* by allowing us to “apply”\n    an *f* to each “constituent” by using *F f*.\n\n\\vspace{1em}\n\nCategory \\(𝒜lℊ(F)\\)\n\n-   For a functor *F : 𝒜 → 𝒟*, this category has *F-algebras*, *F*-ary operations in 𝒟 as, objects\n    \u0026#x2014; i.e., objects are 𝒟-arrows \\(F\\, A → A\\) \u0026#x2014;\n    and *F*-homomorphisms as morphisms, and it inherits composition and identities from 𝒟.\n\n    Note that category axiom \\eqref{unique-Type} is not fulfilled since a function can be\n    a homomorphism between several distinct operations. However, we pretend it is a category\n    in the way discussed earlier, and so the carrier of an algebra is fully determined by\n    the operation itself, so that the operation itself can be considered the algebra.\n\n    \u003cdiv class=\"org-center\"\u003e\n    *\\ref{comp-Homomorhism} renders a semantic property as a syntactic condition!*\n    \u003c/div\u003e\n\n\\vspace{1em}\n\n-   A **contravariant functor** 𝒞 → 𝒟 is just a functor *𝒞ᵒᵖ → 𝒟*.\n-   A **bifunctor** from 𝒞 to 𝒟 is just a functor *𝒞² → 𝒟*.\n\n\n\u003ca id=\"orgd826582\"\u003e\u003c/a\u003e\n\n# Naturality\n\nA natural transformation is nothing but a structure preserving map between functors.\n“Structure preservation” makes sense, here, since we've seen already that a functor\nis, or represents, a structure that objects might have.\n\n\\room\n\nAs discussed before for the case *F : 𝒞 → 𝒮ℯ𝓉*, each *F A* denotes a structured set\nand *F* denotes the structure itself.\n\n\\hspace{-1em}:\n\\(\\bin\\) is the structure of pairs, *Seq* is the structure of sequences,\n*Seq Seq* the structure of sequences of sequences,\n\\(\\bin \\, Seq\\) the structure of pairs of sequences \u0026#x2014;which is naturally isomorphic\nto \\(Seq \\, \\bin\\) the structure of sequences of pairs!\u0026#x2014;, and so on.\n\n\\room\n\nA “transformation” from structure *F* to structure *G* is a family of functions \\newline\n\\(η : ∀\\{A\\} → F\\, A → G\\, A\\); and it is “natural” if each \\(η_A\\) doesn't affect the *constituents*\nof the structured elements in *F A* but only reshapes the structure of the elements,\nfrom an *F*-structure to a *G*-structure.\n\n\\vspace{0em}\n\n\u003cdiv class=\"org-center\"\u003e\n*Reshaping the structure by η commutes with subjecting the constituents to an arbitrary morphism.*\n\u003c/div\u003e\n\n\\vspace{-2em}\n\nThis is \\`naturally' remembered: Morphism \\(η_{\\tgt\\, f}\\) has type \\(F (\\tgt\\, f) → G(\\tgt\\, f)\\) and therefore\nappears at the target side of an occurrence of *f*; similarly \\(η_{\\src\\, f}\\) occurs at the source side of an *f*.\n*Moreover* since η is a transformation *from* *F* to *G*, functor *F* occurs at the source side of an η\nand functor *G* at the target side.\n\n\\room\n\n-   One also says *ηₐ is natural in* its parameter *a*.\n\n-   If we take \\(G = \\Id\\), then natural transformations are *F*-homomorphisms.\n    Thus, naturality is a kind of homomorphism condition.\n\n-   Indeed, a natural transformation is a sort-of homomorphism in that the image of a morphism\n    after reshaping is the same as the reshaping of the image.\n\n\\room\n\nExample natural transformations\n\n-   *rev : Seq →̣ Seq : [a₁, …, aₙ] ↦ [aₙ, …, a₁]*\n    reverses its argument thereby reshaping a sequence structure into a sequence structure without affecting the constituents.\n\n-   *inits : Seq →̣ Seq Seq : [a₁, …, aₙ] ↦ [[], [a₁], ⋯, [a₁, …, aₙ]]*\n    yields all initial parts of its argument\n    thereby reshaping a sequence structure into a sequence of sequences structure, not affecting\n    the constituents of its argument.\n\n\\room\n\n\\room\n\n**Category ℱ𝓊𝓃𝒸(𝒞, 𝒟)**\nconsists of functors *𝒞 → 𝒟* as objects and natural transformations between them as arrows.\nThe identity transformation is indeed an identity for transformation composition, which is associative.\n\n\\room\n\n**Heuristic** To prove \\(φ = φ₁ ∘ ⋯ ∘ φₙ : F →̣ G\\) is a natural transformation, it suffices\nto show that each \\(φᵢ\\) is a natural transformation.\nE.g., without even knowing the definitions, naturality of\n*tails = Seq rev ∘ inits ∘ rev* can be proven \u0026#x2014;just type checking!\n\n\\iffalse\n\n-   Theorem \\eqref{ntrf-Compose} renders proofs of semantic properties to be trivial type checking!\n-   E.g., It's trivial to prove *tails = rev ﹔ inits ﹔ Seq rev* is a natural transformation\n    by type checking, but to prove the naturality equation by using the naturality equations of\n    *rev* and *inits* \u0026#x2014;no definitions required\u0026#x2014; necessitates more writing, and worse: Actual thought!\n\n\\fi\n\n\n\u003ca id=\"org18cc334\"\u003e\u003c/a\u003e\n\n# Adjunctions\n\nAn adjunction is a particular one-one correspondence between different kinds of\nmorphisms in different categories.\n\n\\room\n\nAn **adjunction** consists of two functors \\(L : 𝒜 → ℬ\\) and \\(R : ℬ → 𝒜\\),\nas well as two (not necessarily natural!) transformations\n\\(η : \\Id → RL\\) and \\(ε : LR → \\Id\\) such that\n\n\\vspace{-1em}\n\nReading right-to-left: In the equation \\(ε_B ∘ L f = g\\) there is a unique solution to the unknown \\(f\\).\nDually for the other direction.\n\n\\room\n\nThat is,\n*each L-algebra g is uniquely determined \u0026#x2014;as an L-map followed by an ε-reduce---*\n*by its restriction to the adjunction's unit η.*\n\n\\room\n\nA famous example is “Free ⊣ Forgetful”, e.g. to *define* the list datatype, for which the above\nbecomes: Homomorphisms on lists are uniquely determined, as a map followed by a reduce,\nby their restriction to the singleton sequences.\n\n\\room\n\nWe may call \\(f\\) the restriction, or lowering, of \\(g\\) to the “unital case”\nand write \\(f = ⌊g⌋ = R g ∘ η_A\\). Also, we may call \\(g\\) the extension, or raising,\nof \\(f\\) to an *L*-homomorphism and write \\(g = ⌈f⌉ = ε_B ∘ L f\\). The above equivalence\nnow reads:\n\n\\room\n\\vspace{1ex}\nNote that ⌈ is like \\`r' and the argument to ⌈⌉ must involve the *R*-ight adjoint in its type;\n\n\\room\n\nThis equivalence expresses that \\`lad' \\(⌊⌋\\), from \\emph{l}eft \\emph{ad}jungate,\nand \\`rad' \\(⌈⌉\\), from \\emph{r}ight \\emph{ad}jungate, are each other's inverses\nand constitute a correspondence between certain morphisms.\n*Being a bijective pair, lad and rad are injective, surjective, and undo one another.*\n\n\\room\n\nWe may think of ℬ as having all complicated problems so we abstract\naway some difficulties by \\emph{r}aising up to a cleaner, simpler, domain\nvia rad ⌈⌉; we then solve our problem there, then go back \\emph{down} to\nthe more complicated concrete issue via ⌊⌋, lad.\n\\newline\n( E.g., ℬ is the category of monoids, and 𝒜 is the category of sets; \\(L\\) is the list functor. )\n\nAlso,\n\n-   Left adjoints preserve colimits such as initial objects and sums.\n-   Right adjoints preserve limits such as terminal objects and products.\n\n\n\u003ca id=\"orge6a49a5\"\u003e\u003c/a\u003e\n\n# Constant Combinators\n\nOpposite to the identity functions which do not lose any information,\nwe find functions which lose all, or almost all, information.\nRegardless of their input, the output of these functions is always the\nsame value.\n\n\\(\\K : 𝒞 → ℱ𝓊𝓃𝒸(𝒟,𝒞)\\)\n\n-   For objects \\(x\\), the \\`\\`constant functor'':\n    \\(\\K{x}\\, y = x\\) and \\(\\K{x}\\, f = \\Id_x\\) for objects \\(y\\) and morphisms \\(f\\).\n-   For morphisms \\(f\\), the \\`\\`constant natural transformation'':\n    \\(\\K{f} : \\K{(\\src f)} →̣ \\K{(\\tgt f)}\\)\n    sending objects \\(y\\) to morphism \\(\\K{f}\\, y = f\\).\n\n\\room\nSometimes it is convenient to notate \\(\\const{c} = \\K \\, c\\)\nand refer to this as the *everywhere c* operation.\n\nThe following property defines constant functors at the \\`pointfree level':\n\nConstant functors force any difference in behaviour for any two\nfunctors to disappear:\n\nInterestingly, functor composition and application\nare bridged explicitly by the constant functor:\n\n\n\u003ca id=\"org61d71cb\"\u003e\u003c/a\u003e\n\n# Monics and Epics\n\nIdentity functions and constant functions are limit points of the\nfunctional spectrum with respect to information preservation.\nAll the other functions are in-between: They “lose” some information,\nwhich is regarded as uninteresting for some reason.\n\n\\room\n\nHow do functions lose information?\nBasically in two ways: They may be “blind” enough to confuse different\ninputs, by mapping them to the same output, or they may ignore values\nof their target. For instance, \\(\\const{c}\\) confuses all inputs\nby mapping them all onto \\(c\\). Moreover, it ignores all values of its\ntarget apart from \\(c\\).\n\n\\room\n\nFunctions which do not confuse their inputs are called *monics*:\nThey are “post-cancellable”:\n\nFunctions which do not ignore values of their target are called\n*epics*: They are “pre-cancellable”:\n\nIntuitively, \\(h = k\\) on all points of their source precisely when\nthey are equal on all image points of \\(f\\), since \\(f\\) being epic means\nit outputs all values of their source.\n\n\\room\n\nIt is easy to check that “the” identity function is monic and epic,\nwhile any constant function \\(\\const{c}\\) is not monic and is only\nepic when its target consists only of \\(c\\).\n\n\n\u003ca id=\"orgbb74ee3\"\u003e\u003c/a\u003e\n\n# Isos\n\nAn arrow is an *iso* iff it is invertible; i.e., there is an “inverse” morphism\n\\(f\\inverse\\) with\n\\eqn{inverse-Char}{ f ∘ f\\inverse = \\Id \\landS f\\inverse ∘ f = \\Id}\n\nTo *construct* \\(f\\inverse\\), we begin by identifying its type which may give\ninsight into its necessary \\`shape' \u0026#x2014;e.g., as a sum or a product\u0026#x2014;\nthen we pick one of these equations and try to reduce it as much as possible\nuntil we arrive at a definition of \\(f˘\\), or its \\`components'.\n\n-   E.g.,\n    \\(coassocr = [\\Id + \\inl, \\inr ∘ \\inr]\\) of type \\((A + B) + C ≅ A + (B + C)\\),\n    its inverse  *coassocl* must be of the shape \\([x, [y, z]]\\) for unknowns\n    \\(x,y,z\\) which can be calculated\n    by solving the equation \\([x, [y, z]] ∘ coassocr = \\Id\\) \u0026#x2014;Do it!\n\n\\room\n\nThe following rules can be of help if \\(f\\inverse\\) is found handier than isomorphism \\(f\\)\nin reasoning,\n\n\\begineqns\n\n\\eqn{inverse-Shunting1}{ f ∘ x = y \\equivS x = f\\inverse ∘ y}\n\n\\eqn{inverse-Shunting2}{ x ∘ f = y \\equivS x = y ∘ f\\inverse}\n\n\\endeqns\n\n\\room\n\\room\n\nIsos are necessarily monic and epic, but in general the other way\naround is not true.\n\n\\room\n\nIsomorphisms are very important because they convert data from one\n“format”, say \\(A\\), to another format, say \\(B\\), without losing\ninformation. So \\(f\\) and \\(f˘\\) are faithful protocols between the two\nformats \\(A\\) and \\(B\\).\nOf course, these formats contain the same “amount” of information\nalthough the same data adopts a “different” shape in each of them.\n─c.f. \\nameref{SeqPair-is-Pair-Seq}.\n\n\\room\n\nIsomorphic data domains are regarded as “abstractly” the same;\nthen one write \\(A ≅ B\\).\n\nFinally, note that all classes of functions referred to so far\n\u0026#x2014;identities, constants, epics, monics, and isos\u0026#x2014;\nare closed under composition.\n\nMonics to the initial object are necessarily isos!\n\n\n\u003ca id=\"org4b4d8fd\"\u003e\u003c/a\u003e\n\n# Skolemisation\n\nIf a property \\(P\\) holds for precisely one class of isomorphic objects,\nand for any two objects in the same class there is precisely one\nisomorphism from one to the other, then we say that\n*the P-object is unique up to unique isomorphism*.\nFor example, in 𝒮ℯ𝓉 the one-point set is unique up to a unique isomorphism,\nbut the two-point set is not.\n\n\\room\n\nFor example, an object *A* is \\`\\`initial'' iff\n\\(∀ B  \\;•\\;  ∃₁ f  \\;•\\;  f : A → B\\), and such objects are unique\nup to unique isomorphism \u0026#x2014;prove it!\nThe formulation of the definition is clear but it's not very well suited for *algebraic manipulation*.\n\n\\room\n\nA convenient formulation is obtained by \\`skolemisation': An assertion of the form\n\\[ ∀ x \\;•\\; ∃₁ y \\;•\\; R \\, x \\, y \\]\nis equivalent to: There's a function ℱ such that\n\\[ \\, \\hspace{13em} ∀ x, y \\;•\\; R \\, x \\, y \\;≡\\; y = ℱ\\, x  \\hspace{8em}\\text{\\sc(ℱ-Char)} \\]\nIn the former formulation it is the existential quantification “\\(∃ y\\)” inside the scope of a universal\none that hinders effective calculation. In the latter formulation the existence claim is brought to a\nmore global level: A reasoning need no longer be interrupted by the declaration and naming of the\nexistence of a unique \\(y\\) that depends on \\(x\\); it can be denoted just \\(ℱ\\, x\\).\nAs usual, the final universal quantification can be omitted, thus simplifying the formulation once more.\n\n\\room\n\nIn view of the important role of the various \\(y\\)'s, these \\(y\\)'s deserve a particular notation that\ntriggers the reader of their particular properties. We employ bracket notation such as \\(⦇ x ⦈\\)\nfor such \\(ℱ\\, x\\): An advantage of the bracket notation is that no extra parentheses are needed\nfor composite arguments \\(x\\), which we expect to occur often.\n\n\\room\n\nThe formula *characterising* \\(ℱ\\) may be called \\`ℱ-Char' and it immediately give us some results\nby truthifying each side, namely \\`Self' and \\`Id'. A bit more on the naming:\n\n\u003ctable border=\"2\" cellspacing=\"0\" cellpadding=\"6\" rules=\"groups\" frame=\"hsides\"\u003e\n\n\n\u003ccolgroup\u003e\n\u003ccol  class=\"org-left\" /\u003e\n\n\u003ccol  class=\"org-left\" /\u003e\n\u003c/colgroup\u003e\n\u003ctbody\u003e\n\u003ctr\u003e\n\u003ctd class=\"org-left\"\u003eType\u003c/td\u003e\n\u003ctd class=\"org-left\"\u003ePossibly non-syntactic constraint on notation being well-formed\u003c/td\u003e\n\u003c/tr\u003e\n\n\n\u003ctr\u003e\n\u003ctd class=\"org-left\"\u003eSelf\u003c/td\u003e\n\u003ctd class=\"org-left\"\u003eIt, itself, is a solution\u003c/td\u003e\n\u003c/tr\u003e\n\n\n\u003ctr\u003e\n\u003ctd class=\"org-left\"\u003eId\u003c/td\u003e\n\u003ctd class=\"org-left\"\u003eHow \\(\\Id\\) can be expressed using it\u003c/td\u003e\n\u003c/tr\u003e\n\n\n\u003ctr\u003e\n\u003ctd class=\"org-left\"\u003eUniq\u003c/td\u003e\n\u003ctd class=\"org-left\"\u003eIts problem has a unique solution\u003c/td\u003e\n\u003c/tr\u003e\n\n\n\u003ctr\u003e\n\u003ctd class=\"org-left\"\u003eFusion\u003c/td\u003e\n\u003ctd class=\"org-left\"\u003eHow it behaves with respect to composition\u003c/td\u003e\n\u003c/tr\u003e\n\n\n\u003ctr\u003e\n\u003ctd class=\"org-left\"\u003eComposition\u003c/td\u003e\n\u003ctd class=\"org-left\"\u003eHow two instances, in full subcategories, compose\u003c/td\u003e\n\u003c/tr\u003e\n\u003c/tbody\u003e\n\u003c/table\u003e\n\nNote that the last 3 indicate how the concept interacts with the categorical structure:\n\\(=, ﹔, \\Id\\). Also note that Self says there's at least one solution and Uniq says there is\nat most one solution, so together they are equivalent to ℱ-Char \u0026#x2014;however those two proofs\nare usually not easier nor more elegant than a proof of ℱ-Char directly.\n\n\\room\n\n**Proving ℱ-Char** is straightforwardly accomplished by providing a definition for ℱ\nand establishing ℱ-Char \u0026#x2014;these two steps can be done in parallel! Almost every such\nproof has the following format, or a circular implication thereof: For arbitrary \\(x\\) and \\(y\\),\n\n\u003cdiv class=\"calculation\"\u003e\nR \\kern0.5ex x \\kern0.5ex y\n\\step[≡]{}\n⋮\n\\step[≡]{}\ny = \\text{“an expression not involving $y$”}\n\\step[≡]{ 𝒹ℯ𝒻𝒾𝓃ℯ $ℱ \\, x$ to be the right side of the previous equation }\ny = ℱ \\kern0.5ex x\n\n\u003c/div\u003e\n\n\n\u003ca id=\"org1176ce5\"\u003e\u003c/a\u003e\n\n# Initiality\n\nAn object *0 is initial* if there's a mapping \\(⦇-⦈\\), from objects to morphisms,\nsuch that \\ref{initial-Char} holds; from which we obtain a host of useful corollaries.\nAlternative notations for \\(⦇ B ⦈\\) are \\(\\text{!`}_B\\), or \\(⦇0 → B⦈\\) to make the\ndependency on 0 explicit.\n\n\\vspace{1em}\n\nThese laws become much more interesting when the category is built upon another\none and the typing is expressed as one or more equations in the underlying\ncategory. In particular the importance of fusion laws cannot be over-emphasised;\nit is proven by a strengthening step of the form\n\\(f ∘ ⦇B⦈ : 0 → C \\providedS ⦇B⦈ : 0 → B \\lands f : B → C\\).\n\n\\room\n\nFor example, it can be seen that the datatype of sequences is \\`the' initial object\nin a suitable category, and the mediator \\(⦇-⦈\\) captures\n“definitions by induction on the structure”! Hence induction arguments\ncan be replaced by initiality arguments! Woah!\n\n\n\u003ca id=\"orgbbe90f6\"\u003e\u003c/a\u003e\n\n# Colimits\n\nEach colimit is a certain initial object, and each initial object is a certain colimit.\n\n-   A *diagram in 𝒞* is a functor \\(D : 𝒟 → 𝒞\\).\n\n-   Recall \\nameref{constant-combinator} yielding a functor on objects ---\\(\\const{C}\\, x = C\\) for objects \\(x\\) and\n    \\(\\const{C}\\, f = \\Id_C\\) for morphisms *f*\u0026#x2014; and a natural transformation on arrows\n    ---\\(\\const{g} = x \\mapsto g : \\const{A} →̣ \\const{B}\\) for morphism \\(g : A → B\\).\n\n-   The category \\(⋁D\\), built upon 𝒞, has objects \\(γ : D →̣ \\const{C}\\) called “co-cones”, for\n    some object \\(C =: \\tgt\\, γ\\), and a morphism from \\(γ\\) to \\(δ\\) is a 𝒞-morphism \\(x\\) such that \\(\\const{x} ∘ γ = δ\\).\n\n    *\\`Cones' sit upright on their base, \\(D\\), on a table; \\`CoCones' sit upright on a co-table!*\n\n-   A *colimit for D* is an initial object in \\(⋁ D\\); which may or may not exist.\n\n\\room\n\nWriting \\(-╱γ\\) for \\(⦇-⦈\\) and working out the definition of co-cone in terms of equations in 𝒞,\n  we obtain: *\\(γ : Obj(⋁D)\\) is a colimit for \\(D\\)* if there is a mapping \\(-╱γ\\) such that *╱-Type* and\n*╱-Char* hold.\n\n\\room\n\\room\n\nLet \\(()_x : \\varnothing →̣ \\K{x}\\) be the natural transformation from the\nempty functor \\(\\varnothing : \\mathbf{0} \\to 𝒞\\) to the constant functor.\n\\vspace{-0.8em}\n\nCocones under \\(D\\) correspond one-to-one with arrows from its colimit:\n\\vspace{-0.8em}\n\n\n\u003ca id=\"orgc00a537\"\u003e\u003c/a\u003e\n\n# Limits\n\nDually, the category \\(⋀D\\) has objects being “cones” \\(γ : \\const{C} →̣ D\\) where \\(C =: \\src\\, γ\\)\nis a 𝒞-object, and a morphism to \\(γ\\) *from* \\(δ\\) is a 𝒞-morphism \\(x\\) such that \\(γ ∘ \\const{x} = δ\\).\nIn terms of 𝒞, *\\(γ : Obj(⋀ D)\\) is a limit for \\(D\\)* if there is a mapping \\(γ╲-\\) such that\nthe following ╲-Type and ╲-Char hold, from which we obtain a host of corollaries.\nAs usual, there is the implicit well-formedness condition.\n\n\\vspace{-1em}\n\n\\newpage\n\n\n\u003ca id=\"orgd3b4147\"\u003e\u003c/a\u003e\n\n# Sums\n\nTake \\(D\\) and \\(𝒟\\) as suggested by \\(D𝒟 = \\left( \\overset{A}{•} \\;\\;\\; \\overset{B}{•} \\right)\\).\nThen a cocone δ for \\(D\\) is a two-member family \\(δ = (f, g)\\) with\n\\(f : A → C\\) and \\(g : B → C\\), where \\(C = \\tgt\\, δ\\).\n\n\\room\n\nLet \\(γ=(\\inl, \\inr)\\) be a colimit for \\(D\\), let \\(A + B = \\tgt\\,γ\\), and write\n\\([f, g]\\) in-place of \\(γ╲(f, g)\\), then the ╲-laws yield:\n*\\((\\inl, \\inr, A+B)\\) form a sum of \\(A\\) and \\(B\\)* if there is a mapping \\([-,-]\\)\nsuch that \\ref{[]-Type} and \\ref{[]-Char} hold.\n\n\\room\n\\room\n\nIn the pointwise setting, notice that the cancellation law serves to define the casing construct [-,-].\nThen that casing is a form of conditional can be read from the characterisation.\nWith this view, fusion, post-distributivity of composition over casing is just\nthe usual law that function application distributes over conditionals\nand the casing extensionality law is the body-idempotency of conditionals.\n\n\\room\n\nFor categories in which sums exist, we define for \\(f : A → B\\) and \\(g : C → D\\),\n\n\\begineqns\n\n\\eqn{+-Definition}{ f + g = [ \\inl ∘ f, \\inr ∘ g] : A + C → B + D}\n\n\\eqn{Injections-Naturality}{ (f + g) ∘ \\inl = f ∘ \\inl \\landS (f + g) ∘ \\inr = \\inr ∘ g }\n\n\\eqn{Extensionality}{ [h ∘ \\inl , h ∘ \\inr] = h}\n\n\\eqn{Absorption}{ [h, j] ∘ (f + g) = [h ∘ f, j ∘ g] }\n\n\\eqn{+-BiFunctoriality}{ \\Id + \\Id = \\Id \\landS (f + g) ∘ (h + j) = (f ∘ h) + (g ∘ j)}\n\n\\eqn{Structural Equality}{ [f,g] = [h, j] \\equivS f = h \\lands g = j }\n\n\\endeqns\n\n\\newpage\n\n\n\u003ca id=\"org52f269b\"\u003e\u003c/a\u003e\n\n# Products\n\nTake \\(D\\) and \\(𝒟\\) as suggested by \\(D𝒟 = \\left( \\overset{A}{•} \\;\\;\\; \\overset{B}{•} \\right)\\).\nThen a cone δ for \\(D\\) is a two-member family \\(δ = (f, g)\\) with\n\\(f : C → A\\) and \\(g : C → B\\), where \\(C = \\tgt\\, δ\\).\n\n\\room\n\nLet \\(γ=(\\fst, \\snd)\\) be a limit for \\(D\\), let \\(A + B = \\tgt\\,γ\\), and write\n\\(⟨f, g⟩\\) in-place of \\((f, g)╱γ\\), then the ╱-laws yield:\n*\\((\\fst, \\snd, A × B)\\) form a product of A and B* if there is an operation\n\\(⟨-,-⟩\\) satisfying the Char and Type laws below; from which we obtain a host of corollaries.\n\n\\room\n\\room\n\nThe characterisation says that the essential properties of ordered pairs\nis that their components are retrievable and they are\ncompletely determined by their components.\n\n\\room\n\nNotice that the cancellation rule is essentially the *definitions of projections* in the pointwise setting;\nlikewise absorption is akin to the pointwise definition of the product bi-map.\n\n\\room\n\nThe fusion laws give us a pointfree rendition of their usual pointwise\ndefinitions: All applications have been lifted to compositions!\n\n\\room\n\nFor categories in which products exist, we define for \\(f : A → B\\) and \\(g : C → D\\),\n\n\\begineqns\n\n\\eqn{x-Definition}{ f × g = ⟨ f ∘ \\fst, g ∘ \\snd ⟩ : A × C → B × D}\n\n\\eqn{Projections-Naturality}{ \\fst ∘ (f × g) = f ∘ \\fst \\landS \\snd ∘ (f × g) = g ∘ \\snd }\n\n\\eqn{Extensionality}{ ⟨\\fst ∘ h, \\snd ∘ h⟩ = h}\n\n\\eqn{Absorption}{ (f × g) ∘ ⟨h, j⟩ = ⟨f ∘ h, g ∘ j⟩ }\n\n\\eqn{x-BiFunctoriality}{ \\Id × \\Id = \\Id \\landS (f × g) ∘ (h × j) = (f ∘ h) × (g ∘ j)}\n\n\\eqn{Structural Equality}{ ⟨f,g⟩ = ⟨h, j⟩ \\equivS f = h \\lands g = j }\n\n\\endeqns\n\n\n\u003ca id=\"org6d13b13\"\u003e\u003c/a\u003e\n\n# Finitary Sums and Products\n\nAll properties studied for binary *splits* and binary *eithers* extend to the\nfinitary case. For the particular situation \\(n = 1\\), we will have \\(⟨f⟩=[f]=f\\)\nand \\(\\inl = \\fst = \\Id\\), of course.\n\n\\room\n\nFor the particular situation \\(n = 0\\),\nfinitary products “degenerate” to terminal object 1 and finitary sums “degenerate” to initial object 0.\nThe standard notation for the empty split \\(⟨⟩\\) is \\(!_C\\), where \\(C\\) is the source.\nDually, the standard notation for the empty either \\([]\\) is \\(?_C\\).\n\n\\eqn{Empty Exchange Rule}{ ⟨⟩_0 = []_1 }\n\n\n\u003ca id=\"org08ec4d2\"\u003e\u003c/a\u003e\n\n# Mixing products and coproducts\n\nAny \\(f : A + B → C × D\\) can be expressed alternatively as an *either*\nor as a *split*. It turns out that both formats are identical:\n\n\\vspace{-1.5em}\n\\eqn{Exchange Rule}{ ⟨[f,g], [h,j]⟩ = [⟨f,h⟩,⟨g,j⟩] }\n\nE.g., \\(\\mathsf{undistr}  = ⟨[\\fst, \\fst], \\snd + \\snd⟩ = [\\Id × \\inl, \\Id × \\inr] : (A × B) + (A × C) → A × (B + C)\\).\n\n\\begineqns\n\n\\eqn{Cool-Property}{ [f × g, h × k] \\;=\\; ⟨ [f, h] ∘ (\\fst + \\fst), [g, k] ∘ (\\snd + \\snd)⟩ }\n\n\\eqn{Co-cool-Property}{ ⟨f + g, h + k⟩ \\;=\\; [ (\\inl × \\inl) ∘ ⟨f, h⟩, (\\inr × \\inr) ∘ ⟨g, k⟩] }\n\n\\endeqns\n\n\\room\n\nAlso, since constants ignore their inputs,\n\n\n\u003ca id=\"org824df47\"\u003e\u003c/a\u003e\n\n# References\n\n[A Gentle Introduction to Category Theory ─ the calculational approach](https://maartenfokkinga.github.io/utwente/mmf92b.pdf)\n\\newline\nby [Maarten Fokkinga](https://maartenfokkinga.github.io/utwente/)\n\n\\vspace{1em}\n\nAn excellent introduction to category theory with examples motivated from programming, in-particular\nworking with sequences. All steps are shown in a calculational style \u0026#x2014;which Fokkinga\nhas made [available](https://ctan.org/tex-archive/macros/latex/contrib/calculation) for use with LaTeX\u0026#x2014; thereby making it suitable for self-study.\n\n\\vspace{1em}\n\nClear, concise, and an illuminating read.\n\n\\vspace{1em}\n\nI've deviated from his exposition by using backwards composition \\`∘' rather\nthan diagrammatic composition \\`;', as such my limit notation is his colimit notation! Be careful.\n\n\\vspace{1em}\n\nI've also consulted the delightful read [Program Design by Calculation](http://www4.di.uminho.pt/~jno/ps/pdbc_part.pdf) of [José Oliveira](http://www4.di.uminho.pt/~jno/).\n\n\\vspace{0.5em}\n\nVery accessible for anyone who wants an introduction to functional programming!\nThe category theory is mostly implicit, but presented elegantly!\n\n\\vspace{-0.5em}\n\n\n\u003ca id=\"orgf2ec4a5\"\u003e\u003c/a\u003e\n\n# To Read\n\n-   [Toposes, Triples and Theories](http://www.cwru.edu/artsci/math/wells/pub/ttt.html) by Michael Barr and Charles Wells\n-   [Seven Sketches in Compositionality: An Invitation to Applied Category Theory](https://arxiv.org/pdf/1803.05316.pdf)\n-   [Frobenius algebras and ambidextrous adjunctions](https://arxiv.org/abs/math/0502550) by Aaron Lauda\n-   [Functorial Semantics of Algebraic Theories](http://www.tac.mta.ca/tac/reprints/articles/5/tr5.pdf) by F. William Lawvere\n-   [Basic Concepts of Enriched Category Theory](http://www.tac.mta.ca/tac/reprints/articles/10/tr10.pdf) by G.M. Kelly\n-   [Rosetta Stone](http://golem.ph.utexas.edu/category/2008/03/physics_topology_logic_and_com.html)\n-   [Category Theory for Computing Science \u0026#x2013; Michael Barr and Charles Wells](http://www.math.mcgill.ca/triples/Barr-Wells-ctcs.pdf)\n\nMonoidal:\n\n-   [Elementary remarks on units in monoidal categories](https://arxiv.org/pdf/math/0507349.pdf)\n-   [ASSOCIATIVITY CONSTRAINTS IN MONOIDAL CATEGORIES](http://math.uchicago.edu/~may/TQFT/Boyarchenko%20on%20associativity.pdf)\n-   [Tensor Categories](http://mtm.ufsc.br/~ebatista/2016-2/tensor_categories.pdf)\n\n\\newpage\n\n\n\u003ca id=\"org53fdf4f\"\u003e\u003c/a\u003e\n\n# Monoidal and Closed Categories\n\nIt is rather common that we have a notion of pairing for types for which there is a unit type.\nExamples include products with the initial object, sums with the terminal object, or for\nthe category of endofunctors: Functor composition with the identity functor.\n\n\\room\n\nA *monoidal category* *(𝒞, ⊗, I, α, λ, ρ)* consists of a category 𝒞 with bifunctor\n\\newline\n\\(\\_{}⊗\\_{} : 𝒞^2 → 𝒞\\) and object *I : Obj 𝒞*\n\u0026#x2014;referred to as the ‘tensor product’ and ‘tensor unit\u0026#x2014;\nand three natural isomorphisms:\n\\newline\nThe ‘(right-to-left) associator’ *α\u003csub\u003eA, B, C\u003c/sub\u003e : A ⊗ (B ⊗ C) ≅ (A ⊗ B) ⊗ C* and\n\\newline\nthe ‘unitors’  *λ\u003csub\u003eA\u003c/sub\u003e : I ⊗ A ≅ A* and *ρ\u003csub\u003eA\u003c/sub\u003e : A ⊗ I ≅ A* such that:\n\n1.  The order of re-parensization, outer-most or inner-most first, does not matter; i.e.,\n    the two obvious maps witnessing \\(A ⊗ (B ⊗ (C ⊗ D)) → ((A ⊗ B) ⊗ C) ⊗ D\\) are identical:\n    \\(α_{A ⊗ B, C, D} \\;∘\\; α_{A, B, C ⊗ D} \\eqs α_{A, B, C} ⊗ \\Id_D \\;∘\\; α_{A, B ⊗ C, D}\\;∘\\; \\Id_A ⊗ α_{B, C, D}\\).\n\n2.  Unit elimination paths are the same even if unnecessary associtivity is performed; i.e.,\n    the two obvious maps witnessing \\(A ⊗ (I ⊗ B) → A ⊗ B\\) are identical:\n    \\newline\n    \\(\\Id_A ⊗ λ_B \\eqs (ρ_A ⊗ \\Id_B) \\;∘\\; α_{A, I, B}\\).\n\nMnemonic: λ, ‘L’ambda, is for ‘L’eft unitor; ρ, ‘R’ho, is for ‘R’ight unitor.\n\n\\room\n\nUnfolding some of that up yields:\n\n-   \\(\\Id ⊕ \\Id = \\Id\\) and \\((f ∘ g) ⊗ (h ∘ k) = (f ⊗ h) ∘ (g ⊗ k)\\)\n-   \\(α ∘ (f ⊗ (g ⊗ h)) = ((f ⊗ g) ⊗ h) ∘ α\\)\n-   \\(λ ∘ (\\Id ⊗ f) = f ∘ λ\\)\n-   \\(ρ ∘ (f ⊗ \\Id) = f ∘ ρ\\)\n\n**Mac Lane's coherence theorem:** Any well-typed diagram built from ⊗, α, λ, ρ commutes.\n\n\\room\n\n\\eqn{Unit-Equivalence-Left}{ \\Id ⊗ f = \\Id ⊗ g  \\equivS  f = g }\n\\eqn{Unit-Equivalence-Right}{ f ⊗ \\Id = g ⊗ \\Id \\equivS  f = g }\n\n\\room\n\nThe apparent complexity of the definition of monoidal categories vanishes\nwhen a [geometrical notation](https://qchu.wordpress.com/2012/11/05/introduction-to-string-diagrams/) is used \u0026#x2014;the coherence laws simply become\nexpected geometric operations on the plane.\nThe geometric interpretation is sound and complete\n\u0026#x2014;i.e., equal morphisms yield ‘equal’ pictures, and conversely.\n\n( [A survey of graphical languages for monoidal categories](https://www.mathstat.dal.ca/~selinger/papers/graphical-2up.pdf) )\n\n\\room\n\nExamples\n\n-   Common examples include preordered monoids thought of as monoidal categories.\n-   Functor categories \\(𝒞^𝒞\\) with tensor being functor composition.\n-   Any category with finite co/products is monoidal using sums or products; e.g., 𝒮ℯ𝓉.\n-   ℛℯ𝓁 with Cartesian product is monoidal, even though this is *not*\n    a categorical product.\n-   The ‘free strict monoidal category’ on 𝒞 has objects being\n    finite lists of 𝒞-objects where an arrow exists only between equal length\n    lists and it is a list of 𝒞-morphisms between the corresponding components;\n    tensor is catenation with the empty list as the unit object.\n-   Symmetric monoidal categories are closed under products, and this has a right\n    adjoint yielding functor categories of sym. mon. cats.\n    -   (Mat(K), ⊗, 1): The category whose objects are natural numbers and whose arrows M : m → n are n × m matrices taking values in field K. Composition is matrix multiplication, the monoidal\n\nproduct is multiplication of natural numbers (on objects) and the [Kronecker product](https://en.wikipedia.org/wiki/Kronecker_product#Definition) of matrices (on arrows). This category is essentially the category of finite-dimensional vector spaces over K, with a chosen basis for all of its objects.\n\n\\room\n\nInterestingly, tensor distributes over sums: `(A + B) ⊗ C ≅ (A ⊗ C) + (B ⊗ C)`.\n\n\\room\n\nA **lax monoidal functor** \\(F : 𝒱 ⟶ 𝒱′\\) is a functor that sub-factors over product:\n\\(F \\, x_0 ⊗ ⋯ ⊗ F\\, x_n ⟶̇ F(x₀ ⊗ ⋯ ⊗ x_n)\\).\n\n\\room\n\n\\room\nA **Cartesian-closed category** is a monoidal category where the tensor\nis categorical product and all exponentials exist.\nThese categories are in correspondence with the models of simply typed\nlambda-calculus. If it has all finite sums as well, then it's known as\n**bicartesian closed**, in which case products necessarily distribute over sums.\n\n𝒱 is **semicartesian** if any of the following equivalent statements is true.\n\n1.  Unit object \\(I\\) is terminal; in which case one says 𝒱 is **semicartesian.**\n2.  It has a natural ‘deletion’ \\(‼_X : X ⟶ I\\) with \\(‼_I = \\Id_I\\).\n3.  It has natural ‘projections’ \\(πᵢ : X₁ ⊗ X₂ ⟶ Xᵢ\\) with \\(π₁ : I ⊗ I ≅ I : λ˘\\).\n\nIf in addition it is symmetric with (natural involution) \\(σ : X ⊗ Y ⟶ Y ⊗ X\\)\nand has a natural ‘diagonal’ \\(Δ_X : X ⟶ X ⊗ X\\)\nsuch that the obvious maps \\(X ⟶ X\\) coincide\n\u0026#x2014; i.e., \\(λ ∘ (! ⊗ Id) ∘ Δ = Id = ρ ∘ (Id ⊗ !) ∘ Δ\\),\n“duplicating data, then deleting a copy, is the same as doing nothing”\u0026#x2014;\nthen it is necessairly cartesian!\n\n\\room\n\nAn *exponential for Y* is characterised by the following adjoint isomorphism\nthat is natural in *Y* and *Z:*\n\n\\room\n\n-   Note that ⌊\\_⌋ generalises currying, and ⌈\\_⌉ generalises uncurrying.\n-   The counit \\(\\eval_Z = ⌈\\Id_{Y ➩ z}⌉ : (Y ➩ Z) ⊗ Y → Z\\) is called the *evaluation morphism.*\n\n\\room\nWhen exponentials always exists, one refers to \\(\\_{}➩\\_{} : 𝒞 × 𝒞^{op} → 𝒞\\)\nas *the internal hom* and says *(𝒞, ⊗, I, α, λ, ρ, ➩)* is a **closed monoidal category**.\n\n\\room\nIn the cartesian case, the *entire* collection of morphisms \\(X → Y\\)\nis encoded by the *single* object \\(X ➩ Y\\). That is, \\(X → Y \\quad≅\\quad 1 → (X ➩ Y)\\) in 𝒮ℯ𝓉.\n\n\\room\n\n\\room\nMore generally, a **closed category** is a category 𝒞 with a bifunctor\n\\(\\_{}➩\\_{}\\) and two ‘coherent’ transformations as above.\n\n\\room\n\nIt is common to notate \\(X ➩ Y, ⌊f⌋\\) by \\(Y^X, \\transpose{f}\\).\n\n\n\u003ca id=\"org08ad92a\"\u003e\u003c/a\u003e\n\n# Enrichment \u0026 Internal Algebraic Structures\n\nA **Category 𝒳 enriched in a monoidal category 𝒱** or a **𝒱-category**\n  is essentially a category but its hom-types are objects of 𝒱.\n  Formally, there is a collection `Obj 𝒳` and for each pair `A, B`\n  of such ‘objects’ there is a ‘hom-object’ `𝒳(A, B)` in 𝒱,\n  and there are two 𝒱-morphisms:\n\n1.  Composition: \\(μ_{A, B, C} : 𝒳(B, C) ⊗ 𝒳(A, B) ⟶ 𝒳(A, C)\\)\n    -   Associativity: The two obvious ways \\((𝒳(C, D) ⊗ 𝒳(B, C)) ⊗ 𝒳(A, B) ⟶ 𝒳(A, D)\\)\n        coincide.\n2.  Identities:  \\(η_A : I ⟶ 𝒳(A, A)\\).\n    -   Unity: The obvious maps \\(I ⊗ 𝒳(A, B) ⟶ 𝒳(A, B)\\) coincide,\n        as do the obvious maps \\(𝒳(A, B) ⊗ I ⟶ 𝒳(A, B)\\).\n\n\\room\nA usual category is just a 𝒮ℯ𝓉-category.\n\n\\room\nA *monoid in 𝒱* is an object \\(M\\) along with two morphisms\n\\(μ : M ⊗ M ⟶ M, η : I ⟶ M\\) such that the former is associative\nand has the latter as unit. Notice that monoids *in* 𝒱 are ‘untyped’\nanalogues of 𝒱-categories. A ‘monad’ is a monoid in a category\nof endofunctors with composition as tensor.\n\n-   If M is a monoid in 𝒱 and F : 𝒱 ⟶ 𝒲 is a monoidal functor,\n    then F M is a monoid in 𝒲. Woah!\n\n\\room\nIn a monoidal category with natural transformations ‘discard’\n\\(!_X : X ⟶̇ I\\) and ‘duplicate’ \\(Δ_X : X ⟶̇ X ⊗ X\\),\nsuch as Cartesian monoidal categories, a *group* is like a monoid but with\nan additional morphism \\(i : M ⟶ M\\) such that the inverse axioms\nhold; e.g., \\(e = x · x^{-1}\\) takes the point-free shape\n\\(η ∘ !_M = μ ∘ (\\Id ⊗ i) ∘ Δ\\).\nIn an arbitrary monoidal category, a *Hopf algebra* is like a group\nwhere \\(Δ_M\\) and \\(!_M\\) exist for our specific \\(M\\). These generalise groups.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falhassy%2Fcatscheatsheet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falhassy%2Fcatscheatsheet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falhassy%2Fcatscheatsheet/lists"}