Translates OCaml programs to Coq for formal verification of properties like invariants, absence of failures, and backward compatibility.
coq-of-ocaml is a tool that translates OCaml code into similar-looking Coq programs, enabling formal verification of complex properties like invariant preservation or absence of failures. It is designed for large-scale projects, as demonstrated by verifying 80% of files in the 100,000-line OCaml core of the Tezos cryptocurrency protocol. The tool focuses on a subset of OCaml, particularly purely functional and monadic programs, to facilitate reliable proof writing.
OCaml developers working on large-scale, safety-critical systems such as blockchain protocols, financial software, or embedded systems who need formal verification of code properties. It is also suited for researchers or engineers interested in applying Coq-based formal methods to existing OCaml codebases.
Developers choose coq-of-ocaml for its ability to handle extensive codebases with stable generated Coq code, avoiding generated variable names and supporting proof integration akin to organizing test files. Its unique selling point is enabling formal verification at scale, as proven by its use in Tezos, with a philosophy inspired by TypeScript that brings proofs to a typed language rather than adding types.
Formal verification for OCaml, with Rocq
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Successfully used to verify 80% of files in the 100,000-line OCaml core of Tezos, demonstrating practical application at blockchain scale.
Generates Coq code that closely resembles the original OCaml without generated variable names, ensuring readability and stability across changes.
Allows writing proofs by induction and organizing proof files like tests, as shown in examples, facilitating systematic verification workflows.
Covers essential features like functions, type definitions, monadic programs, and modules, enabling translation of millions of lines of code.
Excludes side-effects outside monads and object-oriented programming, limiting use with codebases that rely on these features.
GADTs, polymorphic variants, and extensible types have only partial support, often requiring axioms or manual fixes, as admitted in the README.
Requires a compiled project with Merlin configuration, which can be challenging for non-dune build systems or inexperienced users.