
Coq is an
interactive theorem prover first released in 1989. It allows for expressing
mathematical
Mathematics is an area of knowledge that includes the topics of numbers, formulas and related structures, shapes and the spaces in which they are contained, and quantities and their changes. These topics are represented in modern mathematics ...
assertions, mechanically checks proofs of these assertions, helps find formal proofs, and extracts a certified program from the
constructive proof of its
formal specification
In computer science, formal specifications are mathematically based techniques whose purpose are to help with the implementation of systems and software. They are used to describe a system, to analyze its behavior, and to aid in its design by veri ...
. Coq works within the theory of the
calculus of inductive constructions, a derivative of the
calculus of constructions
In mathematical logic and computer science, the calculus of constructions (CoC) is a type theory created by Thierry Coquand. It can serve as both a typed programming language and as constructive foundation for mathematics. For this second reason ...
. Coq is not an
automated theorem prover
Automated theorem proving (also known as ATP or automated deduction) is a subfield of automated reasoning and mathematical logic dealing with proving mathematical theorems by computer programs. Automated reasoning over mathematical proof was a ma ...
but includes automatic theorem proving
tactics
Tactic(s) or Tactical may refer to:
* Tactic (method), a conceptual action implemented as one or more specific tasks
** Military tactics
Military tactics encompasses the art of organizing and employing fighting forces on or near the battlefiel ...
(
procedures) and various
decision
Decision may refer to:
Law and politics
* Judgment (law), as the outcome of a legal case
*Landmark decision, the outcome of a case that sets a legal precedent
* ''Per curiam'' decision, by a court with multiple judges
Books
* ''Decision'' (nove ...
procedures.
The
Association for Computing Machinery
The Association for Computing Machinery (ACM) is a US-based international learned society for computing. It was founded in 1947 and is the world's largest scientific and educational computing society. The ACM is a non-profit professional member ...
awarded
Thierry Coquand,
Gérard Huet
Gérard Pierre Huet (; born 7 July 1947) is a French computer scientist, linguist and mathematician. He is senior research director at INRIA and mostly known for his major and seminal contributions to type theory, programming language theory an ...
,
Christine Paulin-Mohring
Christine Paulin-Mohring (born 1962) is a mathematical logician and computer scientist, and Professor at Paris-Saclay University, best known for developing the interactive theorem prover Coq.
Biography
Paulin-Mohring received her PhD in 1989 un ...
, Bruno Barras, Jean-Christophe Filliâtre, Hugo Herbelin, Chetan Murthy, Yves Bertot, and Pierre Castéran with the 2013
ACM Software System Award
The ACM Software System Award is an annual award that honors people or an organization "for developing a software system that has had a lasting influence, reflected in contributions to concepts, in commercial acceptance, or both". It is awarded by ...
for Coq.
Coq is a wordplay on the name of Thierry Coquand, Calculus of Constructions or "CoC" and is following the French tradition to name tools after animals (''coq'' in French meaning rooster).
Overview
When viewed as a programming language, Coq implements a
dependently typed
In computer science and logic, a dependent type is a type whose definition depends on a value. It is an overlapping feature of type theory and type systems. In intuitionistic type theory, dependent types are used to encode logic's quantifiers li ...
functional programming language
In computer science, functional programming is a programming paradigm where programs are constructed by applying and composing functions. It is a declarative programming paradigm in which function definitions are trees of expressions that ...
; when viewed as a logical system, it implements a
higher-order type theory
In mathematics, logic, and computer science, a type theory is the formal system, formal presentation of a specific type system, and in general type theory is the academic study of type systems. Some type theories serve as alternatives to set theor ...
. The development of Coq has been supported since 1984 by
INRIA
The National Institute for Research in Digital Science and Technology (Inria) () is a French national research institution focusing on computer science and applied mathematics.
It was created under the name ''Institut de recherche en informatiq ...
, now in collaboration with
École Polytechnique
École may refer to:
* an elementary school in the French educational stages normally followed by secondary education establishments (collège and lycée)
* École (river), a tributary of the Seine
The Seine ( , ) is a river in northern Franc ...
,
University of Paris-Sud
Paris-Sud University (French: ''Université Paris-Sud''), also known as University of Paris — XI (or as Université d'Orsay before 1971), was a French research university distributed among several campuses in the southern suburbs of Paris, in ...
,
Paris Diderot University, and
CNRS
The French National Centre for Scientific Research (french: link=no, Centre national de la recherche scientifique, CNRS) is the French state research organisation and is the largest fundamental science agency in Europe.
In 2016, it employed 31,63 ...
. In the 1990s,
ENS Lyon was also part of the project. The development of Coq was initiated by Gérard Huet and Thierry Coquand, and more than 40 people, 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. Coq is mainly implemented in
OCaml
OCaml ( , formerly Objective Caml) is a general-purpose, multi-paradigm programming language which extends the Caml dialect of ML with object-oriented features. OCaml was created in 1996 by Xavier Leroy, Jérôme Vouillon, Damien Doligez, D ...
with a bit of
C. The core system can be extended by way of a
plug-in
Plug-in, plug in or plugin may refer to:
* Plug-in (computing) is a software component that adds a specific feature to an existing computer program.
** Audio plug-in, adds audio signal processing features
** Photoshop plugin, a piece of softwar ...
mechanism.
The name means '
rooster
The chicken (''Gallus gallus domesticus'') is a domesticated junglefowl species, with attributes of wild species such as the grey and the Ceylon junglefowl that are originally from Southeastern Asia. Rooster or cock is a term for an adu ...
' in
French
French (french: français(e), link=no) may refer to:
* Something of, from, or related to France
** French language, which originated in France, and its various dialects and accents
** French people, a nation and ethnic group identified with Franc ...
and stems from a French tradition of naming research development tools after animals. Up until 1991, Coquand was implementing a language called the
Calculus of Constructions
In mathematical logic and computer science, the calculus of constructions (CoC) is a type theory created by Thierry Coquand. It can serve as both a typed programming language and as constructive foundation for mathematics. For this second reason ...
and it was simply called CoC at this time. In 1991, a new implementation based on the extended
Calculus of Inductive Constructions was started and the name was 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.
Coq provides a specification language called Gallina ("
hen" in Latin, Spanish, Italian and Catalan).
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,
and is one way to
avoid the halting problem.
As an example, a
proof of commutativity
This article contains mathematical proofs for some properties of addition of the natural numbers: the additive identity, commutativity, and associativity. These proofs are used in the article Addition of natural numbers.
Definitions
This article ...
of addition on natural numbers in Coq:
plus_comm =
fun n m : nat =>
nat_ind (fun n0 : nat => n0 + m = m + n0)
(plus_n_0 m)
(fun (y : nat) (H : y + m = m + y) =>
eq_ind (S (m + y))
(fun n0 : nat => S (y + m) = n0)
(f_equal S H)
(m + S y)
(plus_n_Sm m y)) n
: forall n m : nat, n + m = m + n
stands for
mathematical induction
Mathematical induction is a method for proving that a statement ''P''(''n'') is true for every natural number ''n'', that is, that the infinitely many cases ''P''(0), ''P''(1), ''P''(2), ''P''(3), ... all hold. Informal metaphors help ...
, for substitution of equals, and for taking the same function on both sides of the equality. Earlier theorems are referenced showing
and
.
Notable uses
Four color theorem and SSReflect extension
Georges Gonthier of
Microsoft Research
Microsoft Research (MSR) is the research subsidiary of Microsoft. It was created in 1991 by Richard Rashid, Bill Gates and Nathan Myhrvold with the intent to advance state-of-the-art computing and solve difficult world problems through technologi ...
in
Cambridge
Cambridge ( ) is a university city and the county town in Cambridgeshire, England. It is located on the River Cam approximately north of London. As of the 2021 United Kingdom census, the population of Cambridge was 145,700. Cambridge beca ...
,
England
England is a country that is part of the United Kingdom. It shares land borders with Wales to its west and Scotland to its north. The Irish Sea lies northwest and the Celtic Sea to the southwest. It is separated from continental Europe ...
and Benjamin Werner of
INRIA
The National Institute for Research in Digital Science and Technology (Inria) () is a French national research institution focusing on computer science and applied mathematics.
It was created under the name ''Institut de recherche en informatiq ...
used Coq to create a
surveyable proof of the
four color theorem
In mathematics, the four color theorem, or the four color map theorem, states that no more than four colors are required to color the regions of any map so that no two adjacent regions have the same color. ''Adjacent'' means that two regions sh ...
, which was completed in 2002.
Their work led to the development of the SSReflect ("Small Scale Reflection") package, which was a significant extension to Coq. Despite its name, most of the features added to Coq by SSReflect are general-purpose features and are not limited to the computational reflection style of proof. These features include:
* Additional convenient notations for irrefutable and refutable
pattern matching
In computer science, pattern matching is the act of checking a given sequence of tokens for the presence of the constituents of some pattern. In contrast to pattern recognition, the match usually has to be exact: "either it will or will not be ...
, on
inductive types with one or two constructors
* Implicit arguments for functions applied to zero arguments, which is useful when programming with
higher-order function
In mathematics and computer science, a higher-order function (HOF) is a function that does at least one of the following:
* takes one or more functions as arguments (i.e. a procedural parameter, which is a parameter of a procedure that is itse ...
s
* Concise anonymous arguments
* An improved
set
tactic with more powerful matching
* Support for reflection
SSReflect 1.11 is freely available, dual-licensed under the open source
CeCILL-B or CeCILL-2.0 license, and compatible with Coq 8.11.
Other applications
*
CompCert: an optimizing compiler for almost all of the
C programming language
''The C Programming Language'' (sometimes termed ''K&R'', after its authors' initials) is a computer programming book written by Brian Kernighan and Dennis Ritchie, the latter of whom originally designed and implemented the language, as well as ...
which is largely programmed and proven correct in Coq.
*
Disjoint-set data structure
In computer science, a disjoint-set data structure, also called a union–find data structure or merge–find set, is a data structure that stores a collection of Disjoint sets, disjoint (non-overlapping) Set (mathematics), sets. Equivalently ...
: correctness proof in Coq was published in 2007.
*
Feit–Thompson theorem: formal proof using Coq was completed in September 2012.
See also
*
Calculus of constructions
In mathematical logic and computer science, the calculus of constructions (CoC) is a type theory created by Thierry Coquand. It can serve as both a typed programming language and as constructive foundation for mathematics. For this second reason ...
*
Curry–Howard correspondence
In programming language theory and proof theory, the Curry–Howard correspondence (also known as the Curry–Howard isomorphism or equivalence, or the proofs-as-programs and propositions- or formulae-as-types interpretation) is the direct relat ...
*
Intuitionistic type theory
Intuitionistic type theory (also known as constructive type theory, or Martin-Löf type theory) is a type theory and an alternative foundation of mathematics.
Intuitionistic type theory was created by Per Martin-Löf, a Swedish mathematician and p ...
*
List of proof assistants
References
External links
The Coq proof assistant– the official English website
coq/coq– the project's source code repository on
GitHub
GitHub, Inc. () is an Internet hosting service for software development and version control using Git. It provides the distributed version control of Git plus access control, bug tracking, software feature requests, task management, co ...
JsCoq Interactive Online System– allows Coq to be run in a web browser, without the need for any software installation
– a library to process Coq snippets embedded in documents, showing goals and messages for each Coq sentence
Coq WikiMathematical Components library– widely used library of mathematical structures, part of which is the SSReflect proof language
Constructive Coq Repository at NijmegenMath Classes*{{Openhub, coq, Coq
; Textbooks
– a book on Coq by Yves Bertot and Pierre Castéran
Certified Programming with Dependent Types– online and printed textbook by Adam Chlipala
Software Foundations– online textbook by
Benjamin C. Pierce
Benjamin Crawford Pierce is the Henry Salvatori Professor of computer science at the University of Pennsylvania. Pierce joined Penn in 1998 from Indiana University and held research positions at the University of Cambridge and the University of E ...
et al.
An introduction to small scale reflection in Coq– a tutorial on SSReflect by Georges Gonthier and Assia Mahboubi
; Tutorials
Introduction to the Coq Proof Assistant– video lecture by
Andrew Appel at
Institute for Advanced Study
The Institute for Advanced Study (IAS), located in Princeton, New Jersey, in the United States, is an independent center for theoretical research and intellectual inquiry. It has served as the academic home of internationally preeminent scholar ...
Video tutorials for the Coq proof assistantby Andrej Bauer.
Proof assistants
Free theorem provers
Dependently typed languages
Educational math software
OCaml software
Free software programmed in OCaml
Functional languages
Programming languages created in 1984
1989 software
Extensible syntax programming languages