{
  "tag": "7NVRNT",
  "kind": "concept",
  "slug": "loop-invariant",
  "name": "Loop invariant",
  "aliases": [
    "invariant"
  ],
  "area": "foundations/correctness-and-invariants",
  "level": "intro",
  "summary": "A statement about the variables of a loop that is true before each step. It is the main tool to prove that a loop is correct.",
  "sources": [
    {
      "book": "isbn:9780262046305",
      "title": "Cormen, Leiserson, Rivest and Stein, Introduction to Algorithms, fourth edition",
      "locator": "Section 2.1"
    },
    {
      "paper": "doi:10.1145/363235.363259",
      "title": "C. A. R. Hoare, An axiomatic basis for computer programming (1969)"
    }
  ],
  "url": "https://algorithm.tamnd.com/loop-invariant/",
  "path": "nodes/foundations/correctness-and-invariants/loop-invariant",
  "status": {
    "slug": "loop-invariant",
    "h": {
      "level": 0,
      "max": 3,
      "label": "",
      "name": "",
      "next": [
        "add a proof in proofs/ (06.5)"
      ]
    },
    "l": {
      "level": 0,
      "max": 4,
      "label": "",
      "name": "",
      "next": [
        "name a Lean module in the lean field (07)"
      ]
    },
    "i": {},
    "v": {
      "level": 0,
      "max": 3,
      "label": "",
      "name": "",
      "next": [
        "add viz/scene.ts or a figure (10)"
      ]
    },
    "w": {
      "level": 0,
      "max": 5,
      "label": "",
      "name": "",
      "next": [
        "the lead paragraph"
      ]
    }
  },
  "scene": false
}
