Rocq

Last updated

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 release1 May 1989;36 years ago (1989-05-01) (version 4.10)
Stable release
9.0.0 [1]   OOjs UI icon edit-ltr-progressive.svg / 12 March 2025;4 months ago (12 March 2025)
Repository github.com/rocq-prover/rocq
Written in OCaml
Operating system Cross-platform
Available inEnglish
Type Proof assistant
License LGPLv2.1
Website rocq-prover.org
An interactive proof session in CoqIDE, showing the proof script on the left and the proof state on the right. 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 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.

Contents

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).

Overview

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.

Notable uses

Four color theorem and SSReflect extension

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:

SSReflect is distributed as part of the main Rocq distribution since Coq 8.7. [10]

Other applications

Tactic language

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]

Name

Former logo Coq logo.png
Former logo

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]

See also

References

  1. "Release Rocq 9.0.0". 12 March 2025.
  2. A Tour of Rocq
  3. A Brief History
  4. Avigad, Jeremy; Mahboubi, Assia (3 July 2018). Interactive Theorem Proving: 9th International Conference, ITP 2018, Held as ... Springer. ISBN   9783319948218 . Retrieved 21 October 2018.
  5. Adam Chlipala. "Certified Programming with Dependent Types": "Library Universes".
  6. Adam Chlipala. "Certified Programming with Dependent Types": "Library GeneralRec". "Library InductiveTypes".
  7. Danvy, Olivier (2022). "Fold–unfold lemmas for reasoning about recursive programs using the Coq proof assistant". Journal of Functional Programming. 32. doi: 10.1017/S0956796822000107 . ISSN   0956-7968.
  8. Gonthier, Georges (2008). "Formal Proof—The Four-Color Theorem" (PDF). Notices of the American Mathematical Society . 55 (11): 1382–1393. MR   2463991.
  9. Gonthier, Georges; Mahboubi, Assia (2010). "An introduction to small scale reflection in Coq". Journal of Formalized Reasoning. 3 (2): 95–152. doi:10.6092/ISSN.1972-5787/1979.
  10. "Version 8.7 Summary of changes". rocq-prover.org.
  11. Conchon, Sylvain; Filliâtre, Jean-Christophe (2007). "A persistent union-find data structure". In Russo, Claudio V.; Dreyer, Derek (eds.). Proceedings of the ACM Workshop on ML, 2007, Freiburg, Germany, October 5, 2007. Association for Computing Machinery. pp. 37–46. doi:10.1145/1292535.1292541. ISBN   978-1-59593-676-9.
  12. "Feit-Thompson theorem has been totally checked in Coq". Msr-inria.inria.fr. 20 September 2012. Archived from the original on 19 November 2016. Retrieved 25 September 2012.
  13. "[July 2nd 2024] We have proved "BB(5) = 47,176,870"". The Busy Beaver Challenge. 2 July 2024. Retrieved 2 July 2024.
  14. "The Busy Beaver Challenge". bbchallenge.org. Retrieved 2 July 2024.
  15. Kaiser, Jan-Oliver; Ziliani, Beta; Krebbers, Robbert; Régis-Gianas, Yann; Dreyer, Derek (30 July 2018). "Mtac2: typed tactics for backward reasoning in Coq". Proceedings of the ACM on Programming Languages. 2 (ICFP): 78:1–78:31. doi: 10.1145/3236773 . hdl: 21.11116/0000-0003-2E8E-B .
  16. Grégoire, Benjamin; Mahboubi, Assia (2005). "Proving Equalities in a Commutative Ring Done Right in Coq". In Hurd, Joe; Melham, Tom (eds.). Theorem Proving in Higher Order Logics: 18th International Conference, TPHOLs 2005, Oxford, UK, August 22–25, 2005, Proceedings. Lecture Notes in Computer Science. Berlin, Heidelberg: Springer. pp. 98–113. doi:10.1007/11541868_7. ISBN   978-3-540-31820-0.
  17. "The ring and field tactic families — Rocq Prover 9.0.0 documentation". rocq-prover.org. Retrieved 7 May 2025.
  18. Besson, Frédéric (2007). "Fast Reflexive Arithmetic Tactics the Linear Case and Beyond". In Altenkirch, Thorsten; McBride, Conor (eds.). Types for Proofs and Programs: International Workshop, TYPES 2006, Nottingham, UK, April 18–21, 2006, Revised Selected Papers. Lecture Notes in Computer Science. Vol. 4502. Berlin, Heidelberg: Springer. pp. 48–62. doi:10.1007/978-3-540-74464-1_4. ISBN   978-3-540-74464-1.
  19. "Micromega: solvers for arithmetic goals over ordered rings — Rocq Prover 9.0.0 documentation". rocq-prover.org. Retrieved 7 May 2025.
  20. Braibant, Thomas; Pous, Damien (2010). Kaufmann, Matt; Paulson, Lawrence C. (eds.). An Efficient Coq Tactic for Deciding Kleene Algebras. Interactive Theorem Proving: First International Conference, ITP 2010 Edinburgh, UK, July 11-14, 2010, Proceedings. Lecture Notes in Computer Science. Berlin, Heidelberg: Springer. pp. 163–178. doi:10.1007/978-3-642-14052-5_13. ISBN   978-3-642-14052-5. S2CID   3566183.
  21. Narboux, Julien (2004). "A Decision Procedure for Geometry in Coq". In Slind, Konrad; Bunker, Annette; Gopalakrishnan, Ganesh (eds.). Theorem Proving in Higher Order Logics: 17th International Conference, TPHOLS 2004, Park City, Utah, USA, September 14–17, 2004, Proceedings. Lecture Notes in Computer Science. Vol. 3223. Berlin, Heidelberg: Springer. pp. 225–240. doi:10.1007/978-3-540-30142-4_17. ISBN   978-3-540-30142-4. S2CID   11238876.
  22. "Frequently Asked Questions". GitHub . Retrieved 8 May 2019.
  23. "Introduction to the Calculus of Inductive Constructions" . Retrieved 21 May 2019.
  24. "Coq roadmap 069". GitHub .
  25. "Version 9.0 Summary of changes". rocq-prover.org.
  26. "An Overview of the Name's Evolution". rocq-prover.org.
Textbooks
Tutorials