{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Definition\n\nLet $S$ be a set of sorts and let $\\Sigma$ be an $S$-sorted signature.\nAn *algebraic specification* is a pair $(\\Sigma, E)$, where $E$ is a set of [[equations|PKD440G2XW]] between $\\Sigma$-terms with variables, each side of the same sort.\nA *model* of $(\\Sigma, E)$ is a [[many-sorted $\\Sigma$-algebra|WAQJJ5GX68]] that satisfies every equation of $E$.\nA model $I$ is *initial* if for every model $A$ there is exactly one [[homomorphism|KBXSZC6BV1]] $I \\to A$.\nThe *abstract data type* specified by $(\\Sigma, E)$ is the class of initial models of $(\\Sigma, E)$.\n\n## Remarks\n\nInitial models exist, and any two of them are isomorphic, so the abstract data type is one isomorphism class of algebras; this is the [[initial algebra semantics|HVF403PQ4H]] of the specification.\nAn initial model has two features.\nEvery element is the value of a ground term (\"no junk\"), and two ground terms are equal in it only if $E$ proves them equal (\"no confusion\").\n\nExample: sorts $\\mathrm{nat}$ and $\\mathrm{bool}$; constants $\\mathrm{true}, \\mathrm{false} \\colon \\mathrm{bool}$ and $0 \\colon \\mathrm{nat}$; operations $s \\colon \\mathrm{nat} \\to \\mathrm{nat}$ and $\\mathrm{iszero} \\colon \\mathrm{nat} \\to \\mathrm{bool}$; equations $\\mathrm{iszero}(0) = \\mathrm{true}$ and $\\mathrm{iszero}(s(x)) = \\mathrm{false}$.\nThe model with carriers $\\N$ and $\\set{\\mathrm{true}, \\mathrm{false}}$ is initial.\nEach element is the value of a ground term, and two ground terms with the same value are equal by the equations.\n\nNon-example: the model with one element in each sort satisfies $E$ but is not initial.\nA homomorphism from it to the model above would send its single Boolean element to both $\\mathrm{true}$ and $\\mathrm{false}$, which is impossible.\n",
  "commit": "ff8a40749dc16545e3d2fc637f6b0196e81d0bfa",
  "front": {
    "defines": "86144NHH59",
    "kind": "definition",
    "msc": [
      "68Q65",
      "08A70"
    ],
    "name": "Abstract data type as an algebra",
    "sources": [
      {
        "url": "https://en.wikipedia.org/wiki/Abstract_data_type"
      }
    ],
    "tag": "QPT5H6MM99",
    "uses": [
      "WAQJJ5GX68",
      "HVF403PQ4H",
      "KBXSZC6BV1",
      "PKD440G2XW"
    ]
  },
  "kind": "definition",
  "link": "https://tamnd.github.io/math2/node/QPT5H6MM99/",
  "links": [
    {
      "field": "defines",
      "target": "86144NHH59"
    },
    {
      "field": "uses",
      "target": "WAQJJ5GX68"
    },
    {
      "field": "uses",
      "target": "HVF403PQ4H"
    },
    {
      "field": "uses",
      "target": "KBXSZC6BV1"
    },
    {
      "field": "uses",
      "target": "PKD440G2XW"
    }
  ],
  "markdown": "https://tamnd.github.io/math2/node/QPT5H6MM99.md",
  "msc": [
    "68Q65",
    "08A70"
  ],
  "name": "Abstract data type as an algebra",
  "prov": null,
  "role": "",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/QPT/QPT5H6MM99.md",
  "status": null,
  "tag": "QPT5H6MM99",
  "uri": "m2://QPT5H6MM99",
  "url": "https://tamnd.github.io/math2/wiki/abstract-data-type-as-an-algebra-definition/",
  "writing": {
    "tag": "QPT5H6MM99",
    "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
      }
    ]
  }
}
