{
  "aliases": null,
  "backlinks": null,
  "body": "\n## Statement\n\nA key property of formulas is that they can be uniquely parsed to determine the structure of the formula in terms of its propositional variables and logical connectives. When formulas are written in infix notation, as above, unique readability is ensured through an appropriate use of parentheses in the definition of formulas. Alternatively, formulas can be written in Polish notation or reverse Polish notation, eliminating the need for parentheses altogether.\n\nThe inductive definition of infix formulas in the previous section can be converted to a formal grammar in Backus-Naur form:\n\n```bnf\n\u003cformula\u003e ::= \u003cpropositional variable\u003e\n| ( ¬ \u003cformula\u003e )\n| ( \u003cformula\u003e ∧ \u003cformula\u003e)\n| ( \u003cformula\u003e ∨ \u003cformula\u003e )\n| ( \u003cformula\u003e → \u003cformula\u003e )\n| ( \u003cformula\u003e ↔ \u003cformula\u003e )\n```\n\nIt can be shown that any expression matched by the grammar has a balanced number of left and right parentheses, and any nonempty initial segment of a formula has more left than right parentheses. This fact can be used to give an algorithm for parsing formulas. For example, suppose that an expression *x* begins with $( \\lnot$. Starting after the second symbol, match the shortest subexpression *y* of *x* that has balanced parentheses. If *x* is a formula, there is exactly one symbol left after this expression, this symbol is a closing parenthesis, and *y* itself is a formula. This idea can be used to generate a recursive descent parser for formulas.\n",
  "commit": "4a3290d299c8b2cd6493fce2296920ba7f82d942",
  "front": {
    "inventory": [
      "5K9WYPXDNF"
    ],
    "kind": "statement",
    "name": "Well-formed formulas (wffs)",
    "role": "proposition",
    "sources": [
      {
        "locator": "Propositional formula, section Well-formed formulas (wffs)",
        "mention": "wikipedia://en/1557634#9LZG",
        "note": "adopted",
        "sections": [
          "Statement"
        ],
        "wikipedia": "en:1557634@r1345686870"
      }
    ],
    "tag": "YY0NKGTXVG"
  },
  "kind": "statement",
  "link": "https://math2.tamnd.com/node/YY0NKGTXVG/",
  "links": null,
  "markdown": "https://math2.tamnd.com/node/YY0NKGTXVG.md",
  "msc": null,
  "name": "Well-formed formulas (wffs)",
  "prov": null,
  "role": "proposition",
  "source": "https://github.com/tamnd/math2/blob/main/nodes/YY0/YY0NKGTXVG.md",
  "status": null,
  "tag": "YY0NKGTXVG",
  "uri": "m2://YY0NKGTXVG",
  "url": "https://math2.tamnd.com/wiki/well-formed-formulas-wffs/",
  "writing": {
    "tag": "YY0NKGTXVG",
    "kind": "statement",
    "level": "W0",
    "next": [
      {
        "what": "edge uses out",
        "note": "each definition that the statement needs",
        "have": 0,
        "want": 1
      }
    ]
  }
}
