{
  "format": "automata-studio/workspace",
  "schema": 1,
  "app": "dev",
  "machine": "TM",
  "config": {
    "sym": {
      "eps": "ε",
      "any": "Σ",
      "blank": "⊔",
      "leftMarker": "⊢",
      "rightMarker": "⊣",
      "stackBottom": "Z",
      "lambda": "λ"
    }
  },
  "sigma": [
    "0",
    "1"
  ],
  "stackAlpha": [
    "0",
    "1",
    "w",
    " ",
    "=",
    ">",
    "{",
    "c",
    "o",
    "n",
    "s",
    "t",
    "[",
    "m",
    ",",
    "]",
    ".",
    "p",
    "l",
    "i",
    "(",
    "'",
    ")",
    "a",
    "x",
    "e",
    "g",
    "h",
    ";",
    "r",
    "u",
    "M",
    "-",
    "}",
    "⊔",
    "X"
  ],
  "outputAlpha": [],
  "tapeCount": 1,
  "states": [
    {
      "id": "s1",
      "x": 140,
      "y": 208,
      "name": "q0"
    },
    {
      "id": "s2",
      "x": 319,
      "y": 255,
      "name": "q1"
    },
    {
      "id": "s3",
      "x": 319,
      "y": 160,
      "name": "wipe"
    },
    {
      "id": "s4",
      "x": 498,
      "y": 255,
      "name": "q2"
    },
    {
      "id": "s5",
      "x": 677,
      "y": 255,
      "name": "q3"
    },
    {
      "id": "s6",
      "x": 677,
      "y": 160,
      "name": "q4"
    },
    {
      "id": "s7",
      "x": 856,
      "y": 208,
      "name": "q5"
    },
    {
      "id": "s8",
      "x": 498,
      "y": 160,
      "name": "done"
    }
  ],
  "transitions": [
    {
      "id": "t1",
      "from": "s1",
      "to": "s2",
      "symbol": "0",
      "write": "⊔",
      "dir": "R"
    },
    {
      "id": "t2",
      "from": "s1",
      "to": "s3",
      "symbol": "1",
      "write": "⊔",
      "dir": "R"
    },
    {
      "id": "t3",
      "from": "s2",
      "to": "s2",
      "symbol": "0",
      "write": "0",
      "dir": "R"
    },
    {
      "id": "t4",
      "from": "s2",
      "to": "s4",
      "symbol": "1",
      "write": "1",
      "dir": "R"
    },
    {
      "id": "t5",
      "from": "s4",
      "to": "s4",
      "symbol": "X",
      "write": "X",
      "dir": "R"
    },
    {
      "id": "t6",
      "from": "s4",
      "to": "s5",
      "symbol": "0",
      "write": "X",
      "dir": "L"
    },
    {
      "id": "t7",
      "from": "s4",
      "to": "s6",
      "symbol": "⊔",
      "write": "⊔",
      "dir": "L"
    },
    {
      "id": "t8",
      "from": "s5",
      "to": "s5",
      "symbol": "0",
      "write": "0",
      "dir": "L"
    },
    {
      "id": "t9",
      "from": "s5",
      "to": "s5",
      "symbol": "1",
      "write": "1",
      "dir": "L"
    },
    {
      "id": "t10",
      "from": "s5",
      "to": "s5",
      "symbol": "X",
      "write": "X",
      "dir": "L"
    },
    {
      "id": "t11",
      "from": "s5",
      "to": "s1",
      "symbol": "⊔",
      "write": "⊔",
      "dir": "R"
    },
    {
      "id": "t12",
      "from": "s6",
      "to": "s6",
      "symbol": "X",
      "write": "⊔",
      "dir": "L"
    },
    {
      "id": "t13",
      "from": "s6",
      "to": "s7",
      "symbol": "1",
      "write": "⊔",
      "dir": "L"
    },
    {
      "id": "t14",
      "from": "s7",
      "to": "s7",
      "symbol": "0",
      "write": "0",
      "dir": "L"
    },
    {
      "id": "t15",
      "from": "s7",
      "to": "s8",
      "symbol": "⊔",
      "write": "0",
      "dir": "S"
    },
    {
      "id": "t16",
      "from": "s3",
      "to": "s3",
      "symbol": "0",
      "write": "⊔",
      "dir": "R"
    },
    {
      "id": "t17",
      "from": "s3",
      "to": "s3",
      "symbol": "X",
      "write": "⊔",
      "dir": "R"
    },
    {
      "id": "t18",
      "from": "s3",
      "to": "s8",
      "symbol": "⊔",
      "write": "⊔",
      "dir": "S"
    }
  ],
  "startId": "s1",
  "accepts": [
    "s8"
  ],
  "notes": [],
  "dividers": [],
  "blocks": [],
  "meta": {
    "title": "Proper subtraction: m ∸ n",
    "blurb": "Input 0ᵐ10ⁿ; output 0^max(m−n, 0). Each round erases a 0 from the front of m and cancels one 0 of n, marking it X. When n runs out, the last erased 0 is put back and the marks and the 1 are cleared; when m runs out first, the answer is 0 and everything goes.",
    "inputs": [
      {
        "w": "1",
        "expect": "accept",
        "label": "0 ∸ 0"
      },
      {
        "w": "0010",
        "expect": "accept",
        "label": "2 ∸ 1"
      },
      {
        "w": "01",
        "expect": "accept",
        "label": "1 ∸ 0"
      },
      {
        "w": "000000010",
        "expect": "accept",
        "label": "7 ∸ 1"
      },
      {
        "w": "0",
        "expect": "reject",
        "label": ""
      },
      {
        "w": "1010",
        "expect": "reject",
        "label": ""
      },
      {
        "w": "11",
        "expect": "reject",
        "label": ""
      },
      {
        "w": "100000010",
        "expect": "reject",
        "label": ""
      }
    ],
    "library": {
      "author": {
        "login": "thethinkmachine"
      },
      "license": "CC-BY-4.0",
      "tags": [
        "textbook",
        "hopcroft",
        "arithmetic",
        "computing-a-function"
      ],
      "difficulty": "intermediate",
      "chapter": "Hopcroft, Motwani & Ullman, ch. 8 (proper subtraction)"
    }
  }
}
