{
  "id": "cn",
  "name": "CN",
  "aka": [
    "Fulminate"
  ],
  "summary": "Write ownership and correctness specifications as comments in C code; CN checks them with an SMT solver, or turns them into runtime checks for testing.",
  "use_if": [
    "You want to prove existing systems C code free of undefined behavior and correct against specifications, with mostly automatic proofs.",
    "You want the same specifications to drive runtime checking and random testing (Fulminate) before you attempt a proof."
  ],
  "avoid_if": [
    "Your code uses threads, unions, floating point or variadic functions; CN rejects or does not support these.",
    "You need a production-ready tool; its authors describe it as research tooling."
  ],
  "effort": "auto-active",
  "open": "open-source",
  "license": "BSD-2-Clause (with listed exceptions)",
  "maintainers": [
    "University of Cambridge",
    "University of Pennsylvania"
  ],
  "links": {
    "repo": "https://github.com/rems-project/cn",
    "docs": "https://rems-project.github.io/cn-tutorial/",
    "paper": "http://www.cl.cam.ac.uk/users/pes20/cn-draft.pdf",
    "tutorial": "https://rems-project.github.io/cn-tutorial/"
  },
  "components": [
    {
      "role": "frontend",
      "name": "Cerberus C front end",
      "ref": "cerberus",
      "ref_kind": "semantics",
      "assurance": "trusted",
      "note": "Cerberus's own parser and type checker turn C into its Core language. C files are first run through the system preprocessor."
    },
    {
      "role": "semantics",
      "name": "Cerberus Core semantics with the VIP memory model",
      "ref": "cerberus",
      "ref_kind": "semantics",
      "assurance": "trusted",
      "note": "CN works on a simplified form of Cerberus Core. By default it uses the VIP memory object model for pointer provenance."
    },
    {
      "role": "translation",
      "name": "CN type checker",
      "assurance": "trusted",
      "note": "Infers ownership (resources) and reduces checks to SMT queries. Soundness of type checking was proved for a formalised core of the system (POPL 2023); the implementation is not verified."
    },
    {
      "role": "checker",
      "name": "Z3",
      "ref": "z3",
      "ref_kind": "prover",
      "assurance": "trusted",
      "note": "Default SMT solver."
    },
    {
      "role": "checker",
      "name": "cvc5",
      "ref": "cvc5",
      "ref_kind": "prover",
      "assurance": "trusted",
      "note": "Alternative solver, chosen with --solver-type cvc5."
    },
    {
      "role": "compiler",
      "name": "GCC or Clang",
      "assurance": "trusted"
    }
  ],
  "verifies": [
    {
      "target": "c",
      "note": "Sequential C; specifications are written in /*@ ... @*/ comments."
    }
  ],
  "properties": {
    "no-ub": {
      "status": "full",
      "note": "CN checks that code is free of undefined behavior as defined by the Cerberus semantics of ISO C.",
      "source": "https://github.com/rems-project/cn"
    },
    "functional": {
      "status": "full",
      "note": "Functions are checked against pre- and postconditions over ownership and values.",
      "source": "http://www.cl.cam.ac.uk/users/pes20/cn-draft.pdf"
    },
    "equivalence": {
      "status": "none",
      "note": "No built-in way to compare two programs. You can prove that both meet the same specification."
    },
    "info-flow": {
      "status": "none",
      "note": "No support for secrecy or timing properties was found in the documentation."
    },
    "concurrency": {
      "status": "none",
      "note": "The 2026 PLDI paper says the specification language and tools do not yet support concurrency.",
      "source": "https://www.cl.cam.ac.uk/~pes20/pldi2026-paper155-supplementary.pdf"
    },
    "termination": {
      "status": "none",
      "note": "Specifications have preconditions, postconditions and loop invariants but no termination measures, so proofs say nothing about termination.",
      "source": "https://github.com/rems-project/cn/blob/main/manual/manual.md"
    }
  },
  "features": {
    "core.integers": {
      "status": "full",
      "note": "Signed overflow and other integer undefined behavior are rejected.",
      "source": "https://rems-project.github.io/cn-tutorial/getting-started/tutorials/verif-numeric/"
    },
    "core.floats": {
      "status": "none",
      "note": "The type checker reports floats as unsupported.",
      "source": "https://github.com/rems-project/cn/blob/4b4c33c/lib/check.ml#L157"
    },
    "core.heap": {
      "status": "full",
      "note": "Ownership of heap cells is tracked in separation logic. Allocation uses cn_malloc and cn_free_sized in place of malloc and free.",
      "source": "https://rems-project.github.io/cn-tutorial/getting-started/tutorials/alloc/"
    },
    "core.arrays": {
      "status": "full",
      "note": "Iterated ownership over array ranges, with automatic inference for common access patterns.",
      "source": "http://www.cl.cam.ac.uk/users/pes20/cn-draft.pdf"
    },
    "core.loops": {
      "status": "partial",
      "note": "Loop invariants can be given only on for and while loops.",
      "source": "https://github.com/rems-project/cn/blob/main/manual/manual.md"
    },
    "core.recursion": {
      "status": "full",
      "note": "Recursive C functions are checked against their specifications. Recursive specification functions are not unfolded automatically; you unfold them or state lemmas by hand.",
      "source": "https://github.com/rems-project/cn/blob/main/manual/manual.md"
    },
    "core.higher-order": {
      "status": "partial",
      "note": "The test suite checks calls through function pointers to known functions; the tutorial does not cover them.",
      "source": "https://github.com/rems-project/cn/blob/main/tests/cn/fun_ptr_three_opts.c"
    },
    "core.concurrency": {
      "status": "none",
      "note": "Not supported; locks had to be commented out in the pKVM case study.",
      "source": "http://www.cl.cam.ac.uk/users/pes20/cn-draft.pdf"
    },
    "core.io": {
      "status": "unknown",
      "note": "No documentation found on specifying I/O or system calls."
    },
    "core.stdlib": {
      "status": "partial",
      "note": "The tutorial covers allocation (cn_malloc, cn_free_sized). No general specifications of the C standard library were found.",
      "source": "https://rems-project.github.io/cn-tutorial/getting-started/tutorials/alloc/"
    },
    "c.provenance": {
      "status": "partial",
      "note": "Uses the VIP provenance model, which allows integer-pointer casts. The repo's VIP test notes list round-trip casts and provenance through bytes as still to do.",
      "source": "https://github.com/rems-project/cn/blob/main/tests/cn_vip_testsuite/README.md"
    },
    "c.unions": {
      "status": "none",
      "note": "Programs with union types are rejected (\"unsupported union types\").",
      "source": "https://github.com/rems-project/cn/blob/main/tests/cn/unsupported_union.error.c.verify"
    },
    "c.bitfields": {
      "status": "none",
      "note": "The Cerberus front end that CN uses rejects bit-fields as not yet supported.",
      "source": "https://github.com/rems-project/cerberus/blob/master/frontend/model/cabs_to_ail.lem"
    },
    "c.varargs": {
      "status": "none",
      "note": "Variadic functions are rejected as unsupported.",
      "source": "https://github.com/rems-project/cn/blob/4b4c33c/lib/core_to_mucore.ml#L1203"
    },
    "c.setjmp": {
      "status": "none",
      "note": "Not supported by the underlying Cerberus semantics.",
      "source": "https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-981.pdf"
    },
    "c.volatile": {
      "status": "none",
      "note": "The underlying Cerberus semantics does not model volatile beyond syntax checks.",
      "source": "https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-981.pdf"
    },
    "c.inline-asm": {
      "status": "none",
      "note": "Not supported by the underlying Cerberus semantics.",
      "source": "https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-981.pdf"
    }
  },
  "trust": {
    "checker": {
      "level": "amber",
      "summary": "Z3 or cvc5 decides each check; no proof certificates by default.",
      "note": "An experimental option (--coq-proof-log) exports a proof log to Rocq; it is not on by default. Lemmas CN cannot prove can be exported as Rocq statements to prove by hand.",
      "source": "https://github.com/rems-project/cn/blob/4b4c33c/bin/verify.ml"
    },
    "semantics": {
      "level": "amber",
      "summary": "Built on the Cerberus C semantics; CN's own model on top is tested by its suite.",
      "note": "Cerberus has published validation (GCC torture tests, Csmith). CN uses a simplified form of it plus the VIP memory model, and the 2023 paper notes it ignores C's loose evaluation order.",
      "source": "http://www.cl.cam.ac.uk/users/pes20/cn-draft.pdf"
    },
    "frontend": {
      "level": "amber",
      "summary": "Cerberus's own C front end, separate from the compiler that builds the binary."
    },
    "binary_gap": {
      "level": "red",
      "summary": "The binary comes from GCC or Clang, which are not verified.",
      "note": "A 2023 MSc thesis (CN2Islaris) explored carrying CN specifications to compiled code with Islaris; this is research, not part of CN.",
      "source": "https://github.com/rems-project/CN2Islaris"
    },
    "escape_hatches": {
      "level": "amber",
      "summary": "Functions and lemmas marked trusted are not checked; findable by grep, not listed.",
      "note": "A trusted annotation makes CN accept a function's or lemma's specification without proof, and --skip leaves functions unchecked. The checker collects trusted functions but does not report them in its result.",
      "source": "https://github.com/rems-project/cn/blob/main/manual/manual.md"
    }
  },
  "stage_evidence": {
    "public_artifact": {
      "met": true,
      "evidence": "https://github.com/rems-project/cn"
    },
    "published_use": {
      "met": true,
      "evidence": "http://www.cl.cam.ac.uk/users/pes20/cn-draft.pdf",
      "note": "Verification of the buddy allocator of Google's pKVM hypervisor (POPL 2023)."
    },
    "installs_on_current": {
      "met": true,
      "evidence": "https://github.com/rems-project/cn#installation",
      "note": "Install from source with opam, or use Docker images built by CI for amd64 and arm64."
    },
    "user_docs": {
      "met": true,
      "evidence": "https://rems-project.github.io/cn-tutorial/",
      "note": "Tutorial and reference documentation, marked as work in progress."
    },
    "external_users": {
      "met": null,
      "note": "Papers so far are by the CN team (Cambridge, Penn, Oxford). No published use by an outside group was found."
    },
    "soundness_channel": {
      "met": true,
      "evidence": "https://github.com/rems-project/cn/issues",
      "note": "Public GitHub issue tracker."
    }
  },
  "production_users": [],
  "last_release": {
    "version": "main@4b4c33c",
    "date": "2026-11-26",
    "source": "https://github.com/rems-project/cn/commits/main"
  },
  "used_for": [
    {
      "name": "pKVM buddy allocator (POPL 2023)",
      "url": "http://www.cl.cam.ac.uk/users/pes20/cn-draft.pdf"
    },
    {
      "name": "pKVM hyp allocator, testing and proof (PLDI 2026)",
      "url": "https://www.cl.cam.ac.uk/~pes20/pldi2026-paper155-supplementary.pdf",
      "note": "Found four bugs in the hypervisor code, which the pKVM team fixed."
    }
  ],
  "last_checked": "2026-11-26",
  "attestation": "maintainer",
  "claimed_by_authors": false,
  "sources": [
    {
      "url": "https://github.com/rems-project/cn",
      "title": "CN repository and README",
      "accessed": "2026-11-26"
    },
    {
      "url": "https://github.com/rems-project/cn/blob/main/manual/manual.md",
      "title": "CN manual",
      "accessed": "2026-11-26"
    },
    {
      "url": "https://rems-project.github.io/cn-tutorial/",
      "title": "CN tutorial",
      "accessed": "2026-11-26"
    },
    {
      "url": "http://www.cl.cam.ac.uk/users/pes20/cn-draft.pdf",
      "title": "CN: Verifying Systems C Code with Separation-Logic Refinement Types (POPL 2023)",
      "accessed": "2026-11-26"
    },
    {
      "url": "https://www.cl.cam.ac.uk/~pes20/pldi2026-paper155-supplementary.pdf",
      "title": "Code-Specify-Test-Debug-Prove (PLDI 2026)",
      "accessed": "2026-11-26"
    },
    {
      "url": "https://github.com/rems-project/cn/blob/main/LICENSE",
      "title": "CN license",
      "accessed": "2026-11-26"
    }
  ],
  "computed": {
    "kind": "toolchains",
    "methodology_version": "0.1",
    "built": "2026-11-26",
    "links": {
      "html": "/toolchains/cn/",
      "json": "/toolchains/cn.json",
      "markdown": "/toolchains/cn.md"
    },
    "stage": {
      "stage": 0,
      "name": "Research",
      "criteria": [
        {
          "key": "public_artifact",
          "stage": 0,
          "label": "Publicly available",
          "met": true,
          "evidence": "https://github.com/rems-project/cn",
          "computed": false
        },
        {
          "key": "published_use",
          "stage": 0,
          "label": "At least one published verification uses it",
          "met": true,
          "evidence": "http://www.cl.cam.ac.uk/users/pes20/cn-draft.pdf",
          "note": "Verification of the buddy allocator of Google's pKVM hypervisor (POPL 2023).",
          "computed": false
        },
        {
          "key": "recent_release",
          "stage": 1,
          "label": "Released or updated in the last 12 months",
          "met": true,
          "evidence": "https://github.com/rems-project/cn/commits/main",
          "note": "Latest release: main@4b4c33c, 2026-11-26.",
          "computed": true
        },
        {
          "key": "installs_on_current",
          "stage": 1,
          "label": "Installs and runs on current platforms",
          "met": true,
          "evidence": "https://github.com/rems-project/cn#installation",
          "note": "Install from source with opam, or use Docker images built by CI for amd64 and arm64.",
          "computed": false
        },
        {
          "key": "user_docs",
          "stage": 1,
          "label": "User documentation or tutorial",
          "met": true,
          "evidence": "https://rems-project.github.io/cn-tutorial/",
          "note": "Tutorial and reference documentation, marked as work in progress.",
          "computed": false
        },
        {
          "key": "external_users",
          "stage": 1,
          "label": "Used by a group other than its authors",
          "met": null,
          "note": "Papers so far are by the CN team (Cambridge, Penn, Oxford). No published use by an outside group was found.",
          "computed": false
        },
        {
          "key": "production_users",
          "stage": 2,
          "label": "Verified code in production at two or more independent organizations",
          "met": false,
          "note": "None recorded.",
          "computed": true
        },
        {
          "key": "checker_not_red",
          "stage": 2,
          "label": "Checker axis is not red",
          "met": true,
          "computed": true
        },
        {
          "key": "semantics_not_red",
          "stage": 2,
          "label": "Semantics axis is not red",
          "met": true,
          "computed": true
        },
        {
          "key": "soundness_channel",
          "stage": 2,
          "label": "Public channel for soundness bugs",
          "met": true,
          "evidence": "https://github.com/rems-project/cn/issues",
          "note": "Public GitHub issue tracker.",
          "computed": false
        }
      ],
      "missing_for_next": [
        "external_users"
      ]
    }
  }
}