Template:Short description Template:Use dmy dates {{#invoke:Infobox|infobox}}Template:Template other{{#invoke:Check for unknown parameters | check | showblankpositional=1 | unknown = Template:Main other | preview = Page using Template:Infobox software with unknown parameter "_VALUE_"|ignoreblank=y | AsOf | author | background | bodystyle | caption | collapsetext | collapsible | developer | discontinued | engine | engines | genre | included with | language | language count | language footnote | latest preview date | latest preview version | latest release date | latest release version | latest_preview_date | latest_preview_version | latest_release_date | latest_release_version | licence | license | logo | logo alt | logo caption | logo upright | logo size | logo title | logo_alt | logo_caption | logo_upright | logo_size | logo_title | middleware | module | name | operating system | operating_system | other_names | platform | programming language | programming_language | released | replaced_by | replaces | repo | screenshot | screenshot alt | screenshot upright | screenshot size | screenshot title | screenshot_alt | screenshot_upright | screenshot_size | screenshot_title | service_name | size | standard | title | ver layout | website | qid }}Template:Main other

File:Coq 8.5 stdlib proof.png
An interactive proof session in CoqIDE, showing the proof script on the left and the proof state on the right.

The Rocq Prover (previously known as Coq) is an interactive theorem prover first released in 1989. It allows the expression mathematical assertions, mechanical checking proofs of these assertions, assists in finding formal proofs using proof automation routines and extraction of certified programs 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).

OverviewEdit

When viewed as a programming language, Rocq implements a dependently typed functional programming model;<ref>A Tour of Rocq</ref> 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,<ref>A Brief History</ref> 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.<ref>Template:Cite book</ref>

Rocq provides a specification language called Gallina.<ref> Adam Chlipala. "Certified Programming with Dependent Types": "Library Universes". </ref> 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,<ref> Adam Chlipala. "Certified Programming with Dependent Types": "Library GeneralRec". "Library InductiveTypes". </ref> and is one way to avoid the halting problem. Along the lines of the Curry-Howard isomorphism, this corresponds to the proofs being constructive, since a non-terminating program corresponds to a proof by contradiction, which is not allowed.

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<ref>Template:Cite journal</ref> is used to help keep the proof simple.<syntaxhighlight lang="coq"> Ltac fold_unfold_tactic name := intros; unfold name; fold name; reflexivity.

Require Import Arith Nat Bool.

Fixpoint is_even (n : nat) : bool :=

 match n with
 | 0 =>
   true
 | S n' =>
   eqb (is_even n') false
 end.

Lemma fold_unfold_is_even_0:

 is_even 0 = true.

Proof.

 fold_unfold_tactic is_even.

Qed.

Lemma fold_unfold_is_even_S:

 forall n' : nat,
   is_even (S n') = eqb (is_even n') false.

Proof.

 fold_unfold_tactic is_even.

Qed.

Lemma successor_flips_evenness:

 forall n : nat,
   is_even n = negb (is_even (S n)).

Proof.

 intro n.
 rewrite -> (fold_unfold_is_even_S n).
 destruct (is_even n).
 * simpl.
   reflexivity.
 * simpl.
   reflexivity.

Qed.

</syntaxhighlight>

Notable usesEdit

Four color theorem and SSReflect extensionEdit

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.<ref name=":0">Template:Cite journal</ref> Their work led to the development of the SSReflect ("Small Scale Reflection") package, which was a significant extension to Rocq.<ref>Template:Cite journal</ref> 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:

  • Added convenient notations for irrefutable and refutable pattern matching, on inductive types with one or two constructors
  • Implicit arguments for functions applied to zero arguments, which is useful when programming with higher-order functions
  • Concise anonymous arguments
  • An improved set tactic with more powerful matching
  • Support for reflection

SSReflect is distributed as part of the main Rocq distribution since Coq 8.7.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

Other applicationsEdit

Template:See also

|CitationClass=web }}</ref>

  • Busy beaver: The value of the 5-state winning busy beaver was discovered by Heiner Marxen and Jürgen Buntrock in 1989, but only proved to be the winning fifth busy beaver — stylized as BB(5) — in 2024 using a proof in Rocq.<ref>{{#invoke:citation/CS1|citation

|CitationClass=web }}</ref><ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

Tactic languageEdit

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.<ref>Template:Cite journal</ref> 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.<ref>Template:Cite book</ref> For example, the following proof establishes a complex equality in the ring of integers in just one line of proof:<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

<syntaxhighlight lang="coq"> Require Import ZArith. Open Scope Z_scope. Goal forall a b c:Z,

   (a + b + c) ^ 2 =
    a * a + b ^ 2 + c * c + 2 * a * b + 2 * a * c + 2 * b * c.
 intros; ring.

Qed. </syntaxhighlight>

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").<ref>Template:Cite book</ref><ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> Further decision procedures have been developed as libraries, including one for Kleene algebras<ref>Template:Cite conference</ref> and another for certain geometric goals.<ref>Template:Cite book</ref>

NameEdit

File:Coq logo.png
Former logo

The old name {{#invoke:Lang|lang}} 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.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> 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.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

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.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref> The official renaming happened with the release of Rocq 9.0 in March 2025.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

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.<ref>{{#invoke:citation/CS1|citation |CitationClass=web }}</ref>

See alsoEdit

Template:Portal

ReferencesEdit

Template:Reflist

External linksEdit

Template:Sister project

Textbooks
Tutorials

Template:ML programming