{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nThe class of *primitive recursive functions* is the smallest class of [[functions|0EPAT51DXQ]] $f \\colon \\N^k \\to \\N$, for $k \\ge 0$, with the following properties.\n\n1. It contains the constant function $0$ of arity $0$, and the successor function $S(x) = x + 1$.\n2. It contains the projections $P^k_i(x_1, \\ldots, x_k) = x_i$ for $1 \\le i \\le k$.\n3. It is closed under composition: if $g \\colon \\N^m \\to \\N$ and $h_1, \\ldots, h_m \\colon \\N^k \\to \\N$ are in the class, so is $\\bar x \\mapsto g(h_1(\\bar x), \\ldots, h_m(\\bar x))$.\n4. It is closed under primitive recursion: if $g \\colon \\N^k \\to \\N$ and $h \\colon \\N^{k+2} \\to \\N$ are in the class, so is the function $f \\colon \\N^{k+1} \\to \\N$ given below.\n\n$$f(0, \\bar x) = g(\\bar x), \\qquad f(y + 1, \\bar x) = h(y, f(y, \\bar x), \\bar x).$$\n\nHere $\\N = \\set{0, 1, 2, \\ldots}$ is the set of [[natural numbers|0MWKJ44V5A]].\n\n## Remarks\n\nExample: addition is primitive recursive.\nTake $g = P^1_1$ and $h(y, z, x) = S(P^3_2(y, z, x))$, which are in the class by clauses 1, 2 and 3.\nClause 4 gives $f(0, x) = x$ and $f(y + 1, x) = f(y, x) + 1$, so $f(y, x) = x + y$.\nIn the same way, multiplication, exponentiation, the factorial and truncated subtraction are primitive recursive.\n\nNon-example: the [[Ackermann function|N470JF7ZJX]] is total and computable but not primitive recursive.\nIts diagonal $n \\mapsto A(n, n)$ eventually exceeds every unary function in the class.\n\nA set or relation is primitive recursive when its characteristic function is.\n",
  "commit": "547b6eddb8f2feb8d579f2d633d22a27b7e132fc",
  "front": {
    "defines": "5NVA2JRHPV",
    "kind": "definition",
    "msc": [
      "03D20"
    ],
    "name": "Primitive recursive function",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Primitive_recursive_function"
      }
    ],
    "tag": "XZV7BD3D66",
    "uses": [
      "0MWKJ44V5A",
      "0EPAT51DXQ"
    ]
  },
  "kind": "definition",
  "link": "https://math2.tamnd.com/node/XZV7BD3D66/",
  "links": [
    {
      "field": "defines",
      "target": "5NVA2JRHPV"
    },
    {
      "field": "uses",
      "target": "0MWKJ44V5A"
    },
    {
      "field": "uses",
      "target": "0EPAT51DXQ"
    }
  ],
  "markdown": "https://math2.tamnd.com/node/XZV7BD3D66.md",
  "msc": [
    "03D20"
  ],
  "name": "Primitive recursive function",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/XZV/XZV7BD3D66.md",
  "status": null,
  "tag": "XZV7BD3D66",
  "uri": "m2://XZV7BD3D66",
  "url": "https://math2.tamnd.com/wiki/primitive-recursive-function-definition/",
  "writing": {
    "tag": "XZV7BD3D66",
    "kind": "definition",
    "level": "W0",
    "next": [
      {
        "what": "an inventory row",
        "note": "the row of the inventory that the node accounts for",
        "have": 0,
        "want": 1
      },
      {
        "what": "a source with a locator",
        "have": 0,
        "want": 1
      }
    ]
  }
}
