The Rocq Prover | |
---|---|
![]() | |
Original author(s) | Thierry Coquand, Gérard Huet, Christine Paulin-Mohring, Bruno Barras, Jean-Christophe Filliâtre, Hugo Herbelin, Chetan Murthy, Yves Bertot, Pierre Castéran |
Developer(s) | INRIA, École Polytechnique, University of Paris-Sud, Paris Diderot University, CNRS, ENS Lyon |
Initial release | 1 May 1989 (version 4.10) |
Stable release | |
Repository | github |
Written in | OCaml |
Operating system | Cross-platform |
Available in | English |
Type | Proof assistant |
License | LGPLv2.1 |
Website | rocq-prover |
The Rocq Prover (previously known as Coq) is an interactive theorem prover first released in 1989. It allows the expression of mathematical assertions, mechanical checking of proofs of these assertions, assists in finding formal proofs using proof automation routines and extraction of a certified program from the constructive proof of its formal specification.
Rocq works within the theory of the calculus of inductive constructions, a derivative of the calculus of constructions . Rocq is not an automated theorem prover but includes automatic theorem proving tactics (procedures) and various decision procedures.
The Association for Computing Machinery awarded Thierry Coquand, Gérard Huet, Christine Paulin-Mohring, Bruno Barras, Jean-Christophe Filliâtre, Hugo Herbelin, Chetan Murthy, Yves Bertot, and Pierre Castéran with the 2013 ACM Software System Award for Rocq (when it was still named Coq).
When viewed as a programming language, Rocq implements a dependently typed functional programming model; [2] when viewed as a logical system, it implements a higher-order type theory. The development of Rocq has been supported since 1984 by French Institute for Research in Computer Science and Automation (INRIA), in collaboration with many other French and international research institutions. The development of Rocq was initiated by Gérard Huet and Thierry Coquand, and more than 200 people, [3] mainly researchers, have contributed features to the core system since its inception. The implementation team has successively been coordinated by Gérard Huet, Christine Paulin-Mohring, Hugo Herbelin, and Matthieu Sozeau. Rocq is mainly implemented in OCaml with a bit of C. The core system can be extended by way of a plug-in mechanism. [4]
Rocq provides a specification language called Gallina. [5] Programs written in Gallina have the weak normalization property, implying that they always terminate. This is a distinctive property of the language, since infinite loops (non-terminating programs) are common in other programming languages. [6]
As an example of a proof written in Rocq, consider a proof of a lemma which states that taking the successor of a natural number flips its parity. The fold-unfold tactic introduced by Danvy [7] is used to help keep the proof simple.
Ltacfold_unfold_tacticname:=intros;unfoldname;foldname;reflexivity.RequireImportArithNatBool.Fixpointis_even(n:nat):bool:=matchnwith|0=>true|Sn'=>eqb(is_evenn')falseend.Lemmafold_unfold_is_even_0:is_even0=true.Proof.fold_unfold_tacticis_even.Qed.Lemmafold_unfold_is_even_S:foralln':nat,is_even(Sn')=eqb(is_evenn')false.Proof.fold_unfold_tacticis_even.Qed.Lemmasuccessor_flips_evenness:foralln:nat,is_evenn=negb(is_even(Sn)).Proof.intron.rewrite->(fold_unfold_is_even_Sn).destruct(is_evenn).*simpl.reflexivity.*simpl.reflexivity.Qed.
Georges Gonthier of Microsoft Research in Cambridge, England and Benjamin Werner of INRIA used Rocq to create a surveyable proof of the four color theorem, which was completed in 2002. [8] Their work led to the development of the SSReflect ("Small Scale Reflection") package, which was a significant extension to Rocq. [9] Despite its name, most of the features added to Rocq by SSReflect are general-purpose features and are not limited to the computational reflective programming style of proof. These features include:
set
tactic with more powerful matchingSSReflect is distributed as part of the main Rocq distribution since Coq 8.7. [10]
In addition to constructing Gallina terms explicitly, Rocq supports the use of tactics written in the built-in language Ltac or in OCaml. These tactics automate the construction of proofs, carrying out trivial or obvious steps in proofs. [15] Several tactics implement decision procedures for various theories. For example, the "ring" tactic decides the theory of equality modulo ring or semiring axioms via associative-commutative rewriting. [16] For example, the following proof establishes a complex equality in the ring of integers in just one line of proof: [17]
RequireImportZArith.OpenScopeZ_scope.Goalforallabc:Z,(a+b+c)^2=a*a+b^2+c*c+2*a*b+2*a*c+2*b*c.intros;ring.Qed.
Built-in decision procedures are also available for the empty theory ("congruence"), propositional logic ("tauto"), quantifier-free linear integer arithmetic ("lia"), and linear rational/real arithmetic ("lra"). [18] [19] Further decision procedures have been developed as libraries, including one for Kleene algebras [20] and another for certain geometric goals. [21]
The old name Coq means 'rooster' in French and is a wordplay on the name of Thierry Coquand, calculus of constructions or CoC, and stems from a French tradition of naming research development tools after animals. [22] Up until 1991, Coquand was implementing a language called the calculus of constructions and it was simply called CoC then. In 1991, a new implementation based on the extended calculus of inductive constructions was begun and the name changed from CoC to Coq in an indirect reference to Coquand, who developed the calculus of constructions along with Gérard Huet and contributed to the calculus of inductive constructions with Christine Paulin-Mohring. [23]
On October 11, 2023, the development team announced that Coq will be renamed The Rocq Prover in coming months, and began updating the code base, website, and associated tools. [24] The official renaming happened with the release of Rocq 9.0 in March 2025. [25]
The new name refers to Inria Rocquencourt, where the system was initially developed, and is related to the mythical bird Roc, which allows keeping the bird references from the previous name. [26]