In
mathematical logic
Mathematical logic is the study of Logic#Formal logic, formal logic within mathematics. Major subareas include model theory, proof theory, set theory, and recursion theory (also known as computability theory). Research in mathematical logic com ...
and
computer science
Computer science is the study of computation, information, and automation. Computer science spans Theoretical computer science, theoretical disciplines (such as algorithms, theory of computation, and information theory) to Applied science, ...
, the calculus of constructions (CoC) is a
type theory
In mathematics and theoretical computer science, a type theory is the formal presentation of a specific type system. Type theory is the academic study of type systems.
Some type theories serve as alternatives to set theory as a foundation of ...
created by
Thierry Coquand. It can serve as both a
typed programming language
A programming language is a system of notation for writing computer programs.
Programming languages are described in terms of their Syntax (programming languages), syntax (form) and semantics (computer science), semantics (meaning), usually def ...
and as
constructive foundation for mathematics. For this second reason, the CoC and its variants have been the basis for
Coq and other
proof assistant
In computer science and mathematical logic, a proof assistant or interactive theorem prover is a software tool to assist with the development of formal proofs by human–machine collaboration. This involves some sort of interactive proof edi ...
s.
Some of its variants include the calculus of inductive constructions (which adds inductive types), the calculus of (co)inductive constructions (which adds coinduction), and the predicative calculus of inductive constructions (which removes some
impredicativity
In mathematics, logic and philosophy of mathematics, something that is impredicative is a self-referencing definition. Roughly speaking, a definition is impredicative if it invokes (mentions or quantifies over) the set being defined, or (more com ...
).
General traits
The CoC is a higher-order
typed lambda calculus, initially developed by
Thierry Coquand. It is well known for being at the top of
Barendregt's
lambda cube. It is possible within CoC to define functions from terms to terms, as well as terms to types, types to types, and types to terms.
The CoC is
strongly normalizing, and hence
consistent
In deductive logic, a consistent theory is one that does not lead to a logical contradiction. A theory T is consistent if there is no formula \varphi such that both \varphi and its negation \lnot\varphi are elements of the set of consequences ...
.
Usage
The CoC has been developed alongside the
Coq proof assistant
In computer science and mathematical logic, a proof assistant or interactive theorem prover is a software tool to assist with the development of formal proofs by human–machine collaboration. This involves some sort of interactive proof edi ...
. As features were added (or possible liabilities removed) to the theory, they became available in Coq.
Variants of the CoC are used in other proof assistants, such as
Matita and
Lean.
The basics of the calculus of constructions
The calculus of constructions can be considered an extension of the
Curry–Howard isomorphism. The Curry–Howard isomorphism associates a term in the
simply typed lambda calculus
The simply typed lambda calculus (), a form
of type theory, is a typed interpretation of the lambda calculus with only one type constructor () that builds function types. It is the canonical and simplest example of a typed lambda calculus. The ...
with each
natural-deduction proof in
intuitionistic propositional logic. The calculus of constructions extends this isomorphism to proofs in the full intuitionistic
predicate calculus
Predicate or predication may refer to:
* Predicate (grammar), in linguistics
* Predication (philosophy)
* several closely related uses in mathematics and formal logic:
**Predicate (mathematical logic)
** Propositional function
**Finitary relation, ...
, which includes proofs of quantified statements (which we will also call "propositions").
Terms
A ''term'' in the calculus of constructions is constructed using the following rules:
*
is a term (also called ''type'');
*
is a term (also called ''prop'', the type of all propositions);
* Variables (
) are terms;
* If
and
are terms, then so is
;
* If
and
are terms and
is a variable, then the following are also terms:
**
,
**
.
In other words, the term syntax, in
Backus–Naur form
In computer science, Backus–Naur form (BNF, pronounced ), also known as Backus normal form, is a notation system for defining the Syntax (programming languages), syntax of Programming language, programming languages and other Formal language, for ...
, is then:
:
The calculus of constructions has five kinds of objects:
# ''proofs'', which are terms whose types are ''propositions'';
# ''propositions'', which are also known as ''small types'';
# ''predicates'', which are functions that return propositions;
# ''large types'', which are the types of predicates (
is an example of a large type);
#
itself, which is the type of large types.
β-equivalence
As with the untyped lambda calculus, the calculus of constructions uses a basic notion of equivalence of terms, known as
-equivalence. This captures the meaning of
-abstraction:
*
-equivalence is a congruence relation for the calculus of constructions, in the sense that
* If
and
, then
.
Judgments
The calculus of constructions allows proving typing judgments:
:
,
which can be read as the implication
: If variables
have, respectively, types
, then term
has type
.
The valid judgments for the calculus of constructions are derivable from a set of
inference rules. In the following, we use
to mean a sequence of type assignments
;
to mean terms; and
to mean either
or
. We shall write