Coq is an interactive theorem prover first released in 1989. It allows for expressing

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

The Coq proof assistant

– the official English website

coq/coq

– the project's source code repository on

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 Wiki

Mathematical Components library

– widely used library of mathematical structures, part of which is the SSReflect proof language

Constructive Coq Repository at Nijmegen

Math 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 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

Video tutorials for the Coq proof assistant

by 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

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
In mathematics, a constructive proof is a method of proof that demonstrates the existence of a mathematical object by creating or providing a method for creating the object. This is in contrast to a non-constructive proof (also known as an existe ...

of its formal specification. 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 m ...

but includes automatic theorem proving tactics ( procedures) and various decision 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, 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 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 typedfunctional 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 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 theory as a foun ...

. 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 flowing in région Île-de-France
* École, Savoi ...

, 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
Paris Diderot University, also known as Paris 7 (french: Université Paris Diderot), was a French university located in Paris, France. It was one of the inheritors of the historic University of Paris, which was split into 13 universities in 197 ...

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

with a bit of C. The core system can be extended by way of a plug-in 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 adult m ...

' 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 France ...

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
Hen commonly refers to a female animal: a female chicken, other gallinaceous bird, any type of bird in general, or a lobster. It is also a slang term for a woman.
Hen or Hens may also refer to:
Places Norway
* Hen, Buskerud, a village in Ringe ...

" 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 of addition on natural numbers in Coq:
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 $m\; =\; m\; +\; 0$ and $S\; (m\; +\; y)\; =\; m\; +\; S\; y$.
Notable uses

Four color theorem and SSReflect extension

Georges Gonthier ofMicrosoft 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 College town, 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. Cam ...

, 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 by t ...

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, 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 functions
* 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
CompCert is a formally verified optimizing compiler for a large subset of the C99 programming language (known as Clight) which currently targets PowerPC, ARM, RISC-V, x86 and x86-64 architectures. This project, led by Xavier Leroy, started ...

: 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 (non-overlapping) sets. Equivalently, it stores a partition of a set ...

: 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 rela ...

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

* 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, continu ...

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 Wiki

Mathematical Components library

– widely used library of mathematical structures, part of which is the SSReflect proof language

Constructive Coq Repository at Nijmegen

Math 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 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
Andrew Wilson Appel (born 1960) is the Eugene Higgins Professor of computer science at Princeton University. He is especially well-known because of his compiler books, the ''Modern Compiler Implementation in ML'' () series, as well as ''Compiling ...

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 assistant

by 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