{
  "tag": "KMBB0X",
  "kind": "concept",
  "slug": "correctness",
  "name": "Algorithm correctness",
  "aliases": [
    "Correctness of algorithms",
    "Partial and total correctness"
  ],
  "area": "foundations/correctness-and-invariants",
  "level": "intro",
  "summary": "An algorithm is correct if it returns a valid output for every legal input; correctness is proved, not tested.",
  "prereqs": [
    "loop-invariant"
  ],
  "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, Communications of the ACM 12(10) (1969)",
      "locator": "pp. 576 to 580"
    },
    {
      "paper": "doi:10.1090/psapm/019/0235771",
      "title": "R. W. Floyd, Assigning meanings to programs, in Mathematical Aspects of Computer Science, Proceedings of Symposia in Applied Mathematics 19, AMS (1967)",
      "locator": "pp. 19 to 32"
    },
    {
      "book": "isbn:9780201896831",
      "title": "Donald E. Knuth, The Art of Computer Programming, Volume 1, third edition",
      "locator": "Section 1.2.1"
    }
  ],
  "see_also": [
    "specification",
    "hoare-triple",
    "partial-correctness",
    "total-correctness",
    "assertion",
    "termination-proof",
    "program-verification",
    "property-based-testing"
  ],
  "url": "https://algorithm.tamnd.com/correctness/",
  "path": "nodes/foundations/correctness-and-invariants/correctness",
  "status": {
    "slug": "correctness",
    "h": {
      "level": 0,
      "max": 3,
      "label": "H0",
      "name": "no proof",
      "next": [
        "add a proof in proofs/ (06.5)"
      ]
    },
    "l": {
      "level": 0,
      "max": 4,
      "label": "L0",
      "name": "no Lean part",
      "next": [
        "name a Lean module in the lean field (07)"
      ]
    },
    "i": {},
    "v": {
      "level": 0,
      "max": 3,
      "label": "V0",
      "name": "none",
      "next": [
        "add viz/scene.ts or a figure (10)"
      ]
    },
    "w": {
      "level": 4,
      "max": 5,
      "label": "W4",
      "name": "complete",
      "next": [
        "a review of the text: no review record reviews/KMBB0X/text.yaml"
      ]
    }
  },
  "scene": false
}
