Reference. CakeML: A verified implementation of ML
Cite
Cited by (14)
Cobblestone: A Divide-and-Conquer Approach for Automating Formal Verification kasibatla-2026-cobblestone
Scaling Instruction-Selection Verification against Authoritative ISA Semantics mcloughlin-2025-scaling
Formally Verified Cloud-Scale Authorization chakarov-2025-formally
Verus: A Practical Foundation for Systems Verification lattuada-2024-verus
Verified Extraction from Coq to OCaml forster_etal_2024
Correctly Compiling Proofs About Programs Without Proving Compilers Correct seo-2024-correctly
Coqlex: Generating formally verified lexers Ouedraogo_2023
A compiler consists of a sequence of phases going from lexical analysis to code generation. Ideally, the formal verification of a compiler should include the formal verification of each component of the tool-chain. An example is the CompCert project, a formally verified C compiler, that comes with associated tools and proofs that allow to formally verify most of those components.
However, some components, in particular the lexer, remain unverified. In fact, the lexer of Compcert is generated using OCamllex, a lex-like OCaml lexer generator that produces lexers from a set of regular expressions with associated semantic actions. Even though there exist various approaches, like CakeML or Verbatim++, to write verified lexers, they all have only limited practical applicability.
In order to contribute to the end-to-end verification of compilers, we implemented a generator of verified lexers whose usage is similar to OCamllex. Our software, called Coqlex, reads a lexer specification and generates a lexer equipped with a Coq proof of its correctness. It provides a formally verified implementation of most features of standard, unverified lexer generators.
The conclusions of our work are two-fold: Firstly, verified lexers gain to follow a user experience similar to lex/flex or OCamllex, with a domain-specific syntax to write lexers comfortably. This introduces a small gap between the written artifact and the verified lexer, but our design minimizes this gap and makes it practical to review the generated lexer. The user remains able to prove further properties of their lexer. Secondly, it is possible to combine simplicity and decent performance. Our implementation approach that uses Brzozowski derivatives is noticeably simpler than the previous work in Verbatim++ that tries to generate a deterministic finite automaton (DFA) ahead of time, and it is also noticeably faster thanks to careful design choices.
We wrote several example lexers that suggest that the convenience of using Coqlex is close to that of standard verified generators, in particular, OCamllex. We used Coqlex in an industrial project to implement a verified lexer of Ada. This lexer is part of a tool to optimize safety-critical programs, some of which are very large. This experience confirmed that Coqlex is usable in practice, and in particular that its performance is good enough. Finally, we performed detailed performance comparisons between Coqlex, OCamllex, and Verbatim++. Verbatim++ is the state-of-the-art tool for verified lexers in Coq, and the performance of its lexer was carefully optimized in previous work by Egolf and al. (2022). Our results suggest that Coqlex is two orders of magnitude slower than OCamllex, but two orders of magnitude faster than Verbatim++.
Verified compilers and other language-processing tools are becoming important tools for safety-critical or security-critical applications. They provide trust and replace more costly approaches to certification, such as manually reading the generated code. Verified lexers are a missing piece in several Coq-based verified compilers today. Coqlex comes with safety guarantees, and thus shows that it is possible to build formally verified front-ends.
CN: Verifying Systems C Code with Separation-Logic Refinement Types pulte-2023-cn
Simuliris: A Separation Logic Framework for Verifying Concurrent Program Optimizations gaher_etal_simuliris_2022
Today’s compilers employ a variety of non-trivial optimizations to achieve good performance. One key trick compilers use to justify transformations of concurrent programs is to assume that the source program has no data races: if it does, they cause the program to have undefined behavior (UB) and give the compiler free rein. However, verifying correctness of optimizations that exploit this assumption is a non-trivial problem. In particular, prior work either has not proven that such optimizations preserve program termination (particularly non-obvious when considering optimizations that move instructions out of loop bodies), or has treated all synchronization operations as external functions (losing the ability to reorder instructions around them).
In this work we present Simuliris, the first simulation technique to establish termination preservation (under a fair scheduler) for a range of concurrent program transformations that exploit UB in the source language. Simuliris is based on the idea of using ownership to reason modularly about the assumptions the compiler makes about programs with well-defined behavior. This brings the benefits of concurrent separation logics to the space of verifying program transformations: we can combine powerful reasoning techniques such as framing and coinduction to perform thread-local proofs of non-trivial concurrent program optimizations. Simuliris is built on a (non-step-indexed) variant of the Coq-based Iris framework, and is thus not tied to a particular language. In addition to demonstrating the effectiveness of Simuliris on standard compiler optimizations involving data race UB, we also instantiate it with Jung et al.’s Stacked Borrows semantics for Rust and generalize their proofs of interesting type-based aliasing optimizations to account for concurrency.
Deriving efficient program transformations from rewrite rules li-2021-deriving
Compositional optimizations for CertiCoq paraskevopoulou-2021-compositional
Zippy LL(1) parsing with derivatives EdelmannZippy2020
QED at Large: A Survey of Engineering of Formally Verified Software ringer-2019-qed
One Step at a Time: A Functional Derivation of Small-Step Evaluators from Big-Step Counterparts vesely-2019-one
Cites 31 works (3 here)
With notes (3)
Validating LR(1) Parsers jourdanValidatingLRParsers2012
Verified Software Toolchain appel_vst_2011
Formal verification of a realistic compiler leroy_formal_2009
External (28)
- Steps towards Verified Implementations of HOL Light (2013)
- Proof Pearl: A Verified Bignum Implementation in x86-64 Machine Code (2013)
- Proof-producing synthesis of ML from higher-order logic (2012)
- The OpenTheory Standard Theory Library (2011)
- TRX: A Formally Verified Parser Interpreter (2011)
- Simple, Functional, Sound and Complete Parsing for All Context-Free Grammars (2011)
- Relaxed-memory concurrency and verified compilation (2011)
- OutsideIn(X) Modular type inference with local assumptions (2011)
- A Verified Runtime for a Verified Theorem Prover (2011)
- A verified compiler for an impure functional language (2010)
- (Nominal) Unification by Recursive Descent with Triangular Substitutions (2010)
- A certified framework for compiling and executing garbage-collected languages (2010)
- Verified just-in-time compiler on x86 (2010)
- A Certified Implementation of ML with Structural Polymorphism (2010)
- Verified, Executable Parsing (2009)
- Coinductive big-step operational semantics (2009)
- Extensible Proof-Producing Compilation (2009)
- The semantics of x86-CC multiprocessor machine code (2009)
- Semantics Engineering with PLT Redex (2009)
- A Sound Semantics for OCaml light (2008)
- Towards a mechanized metatheory of standard ML (2007)
- Mechanized Metatheory for the Masses: The PoplMark Challenge (2005)
- Type Inference Verified: Algorithm W in Isabelle/HOL (1999)
- The Definition of Standard ML (Revised) (1997)
- VLISP: A verified implementation of Scheme (1995)
- A Syntactic Approach to Type Soundness (1994)
- A theory of type polymorphism in programming (1978)
- HOL4 (http://hol.sourceforge.net)