{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nLet $\\sigma$ be a [[signature|WDVVEYD6AT]] with only function symbols and let $X$ be a set of variables.\nLet $A$ be a [[structure|983GZBQYT4]] of signature $\\sigma$, that is, an algebra, with operations $f^A$.\nLet $\\alpha \\colon X \\to A$ be a map, called an *assignment*.\nThe *value* $t^A[\\alpha]$ of a [[term|6D3WA7N2W4]] $t$ over $\\sigma$ and $X$ is defined by recursion on $t$:\n\n1. if $t$ is a variable $x \\in X$, then $t^A[\\alpha] = \\alpha(x)$;\n2. if $t$ is a constant symbol $c$, then $t^A[\\alpha] = c^A$;\n3. if $t = f(t_1, \\ldots, t_n)$ for a function symbol $f$ of arity $n \\ge 1$, then $t^A[\\alpha] = f^A(t_1^A[\\alpha], \\ldots, t_n^A[\\alpha])$.\n\n## Remarks\n\nThe recursion is well defined because every term has a unique reading.\nThe value depends only on the values of $\\alpha$ at the variables that occur in $t$.\nIf these variables are among $x_1, \\ldots, x_n$ and $\\alpha(x_i) = a_i$, one writes $t^A(a_1, \\ldots, a_n)$.\n\nExample: in the ring $(\\Z, +, \\cdot, 0, 1)$, let $t = x \\cdot (y + 1)$ and $\\alpha(x) = 3$, $\\alpha(y) = 4$.\nClause 1 gives $x \\mapsto 3$ and $y \\mapsto 4$, clause 2 gives $1 \\mapsto 1$, and clause 3 twice gives $y + 1 \\mapsto 5$ and $t \\mapsto 15$.\n\nNon-example: computing $x \\cdot (y + 1)$ at the same assignment as $3 \\cdot 4 + 1 = 13$ is not term evaluation.\nThe outermost symbol of $t$ is $\\cdot$ applied to $x$ and $y + 1$, so clause 3 requires the product of the values $3$ and $5$.\n\nHomomorphisms commute with evaluation: if $h \\colon A \\to B$ is a homomorphism, then $h(t^A[\\alpha]) = t^B[h \\circ \\alpha]$.\nIn Mathlib term evaluation is `FirstOrder.Language.Term.realize`.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "defines": "DH30WTA26T",
    "kind": "definition",
    "msc": [
      "08A40",
      "03C07"
    ],
    "name": "Term evaluation",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Term_(logic)"
      }
    ],
    "tag": "VA41ZY2HTF",
    "uses": [
      "6D3WA7N2W4",
      "WDVVEYD6AT",
      "983GZBQYT4"
    ]
  },
  "kind": "definition",
  "link": "https://tamnd.github.io/math2/node/VA41ZY2HTF/",
  "links": [
    {
      "field": "defines",
      "target": "DH30WTA26T"
    },
    {
      "field": "uses",
      "target": "6D3WA7N2W4"
    },
    {
      "field": "uses",
      "target": "WDVVEYD6AT"
    },
    {
      "field": "uses",
      "target": "983GZBQYT4"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/VA41ZY2HTF.md",
  "msc": [
    "08A40",
    "03C07"
  ],
  "name": "Term evaluation",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/VA4/VA41ZY2HTF.md",
  "status": null,
  "tag": "VA41ZY2HTF",
  "uri": "m2://VA41ZY2HTF",
  "url": "https://tamnd.github.io/math2/wiki/term-evaluation-definition/",
  "writing": {
    "tag": "VA41ZY2HTF",
    "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
      }
    ]
  }
}
