Health warning — the Lean port in this fork is a research prototype. Expect bugs. It is tested differentially against the OCaml implementation, and testing samples behaviour: it does not prove the two agree. Some parts are tested much less thoroughly than others; the contract says which parts are supported, which are refused, and how deeply each is tested. Do not rely on it for anything where a wrong answer matters without checking the result independently. Bug reports are welcome.
The badges above and the inherited workflows cover upstream OCaml/CHERI;
they do not certify the fork's Lean backend. Fork checks are recorded in
the manual validation evidence
(checked 2026-09-25 at bb487dda7c56981e76d67f53ae16e874cfe5ed61).
This fork adds a Lean 4 port of the semantics — generated from the
same Lem model and differentially validated against the OCaml
implementation on the documented differential lanes: an executable C
semantics living natively in Lean 4. See
lean_frontend/README.md.
What the port promises, and what it refuses: lean_frontend/CONTRACT.md —
every execution ends with the oracle's verdict, a loud refusal naming the unsupported feature, a resource
outcome, or a registered deviation; any other outcome is a defect.
The port was developed primarily by AI agents (Claude, Anthropic)
working under the direction and review of Mike Dodds; the upstream
Cerberus semantics is by the people listed below. The fork-specific build
recipe and limits are in that frontend README (checked 2026-09-25 against
bb487dda7c56981e76d67f53ae16e874cfe5ed61, with gates in its linked follow-up record).
SC concurrency development: start with the SC concurrency master plan. It governs the build, independent acceptance criteria and early mainline landings. The previous prototype is a quarry for separately validated machinery; it is not the implementation roadmap. Current implementation status is recorded in the plan.
See https://www.cl.cam.ac.uk/~pes20/cerberus/.
To build Cerberus, you need opam (>= 2.0.0, see here to install) and OCaml (>= 4.12.0).
First install the dependencies (including lem and menhir) using opam:
$ opam install --deps-only ./cerberus-lib.opam ./cerberus.opamThen build the CLI using:
$ makeThe CLI can then be used either from the source directory using:
$ dune exec cerberus -- ARG1 .. ARGNor, after doing $ make install, using the cerberus executable.
To fully remove all object and Lem generated files:
$ make distclean
To remove the object files, but keep the Lem generated files (allowing for faster build when only working on .ml files):
$ make clean
$ cerberus --exec file1.c ... fileN.cThis will elaborate to Core, link, look for a main() function, and start executing the Core from there. To see a printout of the return value, and to get a machine-friendly collection of stdout and stderr,
add the --batch argument.
$ cerberus --args="arg1","arg2" file.c-
The C abstract syntax (Cabs) and the Ail intermediate representation can be printed with
--ast=cabsand--ast=ail. -
The Ail intermediate representation and the Core program can be pretty-printed with
--pp=ailand--pp=core.
$ cerberus file1.c ... fileN.cThis will elaborate the C translation units to Core programs, and link them, before returning silently.
Include directories can be added with the usual -I, and macros can be forwarded to the preprocessor using -D (and unset with -U).
For more, see cerberus --help
Various C programs can be found in tests/.
Install the common dependencies and the following extra ones:
- angstrom (0.15.0)
$ opam install angstromThen run:
$ make cerberus-bmcTo run:
$ cerberus-bmc --helpInstall the common dependencies and some backend specific ones (see here for details):
$ opam install --deps-only ./cerberus-web.opam ./cerberus-lib.opamThen:
$ make webThis copies all the available web instances as webcerb.* and the web server as cerberus-webserver to the source root directory.
Next, build the webapp providing the UI (this requires the node package manager npm):
$ make uiThe first command sets up a deployment directory at public/_deployment containing a default configuration config.json.
To run the server with that default configuration:
$ ./cerberus-webserver -c public/_deployment/config.json(If you intend to move and run the server binary to another location, you will need the cerberus-lib package to first be installed in with opam)
You can also compile all the targets with:
$ make allFor a local build, run:
$ docker build -t cerberus:release -f Dockerfile.ubuntu .which creates a Docker image than can be used for example with:
$ docker run --volume `PWD`:/data/ cerberus:release cerberus tests/tcc/00_assignment.c --pp=coreThis image contains all the source code.
Contributors:
- Kayvan Memarian
- Christopher Pulte
- Thomas Sewell
- Victor B. F. Gomes
- Stella Lau
- Kyndylan Nienhuis
- Dhruv Makwana
- Justus Matthiesen
- James Lingard
- David Chisnall
- Robert N. M. Watson
- Peter Sewell
- Vadim Zaliva
The main Cerberus developer is Kayvan Memarian. Victor Gomes made substantial contributions across the system. Kyndylan Nienhuis worked on the operational semantics for C11 concurrency. Stella Lau is the main developer of Cerberus BMC. The CN backend is by Christopher Pulte and Thomas Sewell. The CHERI memory model is by Vadim Zaliva. Cerberus originated with Justus Matthiesen's 2010-11 Part II project dissertation and his 2011-12 MPhil dissertation. James Lingard's 2013-14 MPhil dissertation developed a certifying translation validator for simple C programs for the Clang front-end, w.r.t. the Cerberus and Vellvm semantics.
This software was developed largely within the Rigorous Engineering of Mainstream Systems (REMS) project at the University of Cambridge. It has received funding from the European Research Council (ERC) under the European Union's Horizon 2020 research and innovation programme (grant agreement No 789108, ELVER); the EPSRC Programme Grant REMS: Rigorous Engineering of Mainstream Systems (EP/K008528/1); an EPSRC Leadership Fellowship EP/H005633 (Sewell); a Gates Cambridge Scholarship (Nienhuis); an MIT EECS Graduate Alumni Fellowship (Lau); and Google.