{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nLet $\\mathcal{C}$ be a [[category|A2DE66937D]] and let $(T, \\eta, \\mu)$ be a [[monad|FF6XXA6D1A]] on $\\mathcal{C}$, with unit $\\eta \\colon \\mathrm{Id} \\to T$ and multiplication $\\mu \\colon T T \\to T$.\nThe *Kleisli category* $\\mathcal{C}_T$ is the category given as follows.\n\n1. Its objects are the objects of $\\mathcal{C}$.\n2. A morphism $X \\to Y$ in $\\mathcal{C}_T$ is a morphism $f \\colon X \\to T Y$ in $\\mathcal{C}$.\n3. The composite of $f \\colon X \\to T Y$ and $g \\colon Y \\to T Z$ is $g \\circ_T f = \\mu_Z \\circ T g \\circ f \\colon X \\to T Z$.\n4. The identity on $X$ is $\\eta_X \\colon X \\to T X$.\n\n## Remarks\n\nThe monad laws $\\mu \\circ T \\eta = \\mathrm{id} = \\mu \\circ \\eta T$ and $\\mu \\circ T \\mu = \\mu \\circ \\mu T$ give the identity laws and the associativity of $\\circ_T$.\nThe functor $\\mathcal{C} \\to \\mathcal{C}_T$, $f \\mapsto \\eta \\circ f$, has a right adjoint $\\mathcal{C}_T \\to \\mathcal{C}$ that sends $X$ to $T X$ and $f$ to $\\mu \\circ T f$, and this adjunction induces $T$.\n\nExample: let $T$ be the monad $X \\mapsto X \\sqcup \\set{\\ast}$ on $\\mathbf{Set}$, with $\\eta_X$ the inclusion and $\\mu_X$ sending both added points to $\\ast$.\nA Kleisli morphism $X \\to Y \\sqcup \\set{\\ast}$ is a partial function from $X$ to $Y$, undefined where the value is $\\ast$, and $\\circ_T$ is composition of partial functions.\nSo $\\mathbf{Set}_T$ is isomorphic to the category of sets and partial functions.\n\nNon-example: composing $f \\colon X \\to T Y$ and $g \\colon Y \\to T Z$ by $T g \\circ f$ alone gives a morphism $X \\to T T Z$, not $X \\to T Z$.\nWithout the multiplication $\\mu$, clause 3 does not produce a morphism of the right type.\n\nFor the monad of a variety on $\\mathbf{Set}$, the Kleisli category is equivalent to the category of free algebras of the variety and the homomorphisms between them.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "defines": "D9YHA46YWM",
    "kind": "definition",
    "msc": [
      "18C20",
      "18C15"
    ],
    "name": "Kleisli category",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Kleisli_category"
      }
    ],
    "tag": "53TSQ57J0H",
    "uses": [
      "A2DE66937D",
      "FF6XXA6D1A"
    ]
  },
  "kind": "definition",
  "link": "https://tamnd.github.io/math2/node/53TSQ57J0H/",
  "links": [
    {
      "field": "defines",
      "target": "D9YHA46YWM"
    },
    {
      "field": "uses",
      "target": "A2DE66937D"
    },
    {
      "field": "uses",
      "target": "FF6XXA6D1A"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/53TSQ57J0H.md",
  "msc": [
    "18C20",
    "18C15"
  ],
  "name": "Kleisli category",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/53T/53TSQ57J0H.md",
  "status": null,
  "tag": "53TSQ57J0H",
  "uri": "m2://53TSQ57J0H",
  "url": "https://tamnd.github.io/math2/wiki/kleisli-category-definition/",
  "writing": {
    "tag": "53TSQ57J0H",
    "kind": "definition",
    "level": "W0",
    "next": [
      {
        "what": "a source with a locator",
        "have": 0,
        "want": 1
      }
    ]
  }
}
