Recent from talks
Nothing was collected or created yet.
Calculus of constructions
View on WikipediaIn 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, the CoC and its variants have been the basis for Rocq and other proof assistants.
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)[citation needed].
General traits
[edit]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.[1]
Usage
[edit]The CoC has been developed alongside the Rocq proof assistant. As features were added (or possible liabilities removed) to the theory, they became available in Rocq.
Variants of the CoC are used in other proof assistants, such as Matita and Lean.
The basics of the calculus of constructions
[edit]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 with each natural-deduction proof in intuitionistic propositional logic. The calculus of constructions extends this isomorphism to proofs in the full intuitionistic predicate calculus, which includes proofs of quantified statements (which we will also call "propositions").
Terms
[edit]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, 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
[edit]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
[edit]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 to mean the result of substituting the term for the free variable in the term .
An inference rule is written in the form
- ,
which means
- if is a valid judgment, then so is .
Inference rules for the calculus of constructions
[edit]1.
2.
3.
4.
5.
6.
Defining logical operators
[edit]The calculus of constructions has very few basic operators: the only logical operator for forming propositions is . However, this one operator is sufficient to define all the other logical operators:
Defining data types
[edit]The basic data types used in computer science can be defined within the calculus of constructions:
- Booleans
- Naturals
- Product
- Disjoint union
Note that Booleans and Naturals are defined in the same way as in Church encoding. However, additional problems arise from propositional extensionality and proof irrelevance.[2]
See also
[edit]References
[edit]- ^ Coquand, Thierry; Gallier, Jean H. (July 1990). "A Proof of Strong Normalization for the Theory of Constructions Using a Kripke-Like Interpretation". Technical Reports (Cis) (568): 14.
- ^ "Standard Library | The Coq Proof Assistant". coq.inria.fr. Retrieved 2020-08-08.
Sources
[edit]- Coquand, Thierry; Huet, Gérard (1988). "The Calculus of Constructions" (PDF). Information and Computation. 76 (2–3): 95–120. doi:10.1016/0890-5401(88)90005-3.
- Also available freely accessible online: Coquand, Thierry; Huet, Gérard (1986). The calculus of constructions (Technical report). INRIA, Centre de Rocquencourt. 530.
Note terminology is rather different. For instance, () is written [x : A] B.
- Also available freely accessible online: Coquand, Thierry; Huet, Gérard (1986). The calculus of constructions (Technical report). INRIA, Centre de Rocquencourt. 530.
- Bunder, M. W.; Seldin, Jonathan P. (2004). "Variants of the Basic Calculus of Constructions". CiteSeerX 10.1.1.88.9497.
- Frade, Maria João (2009). "Calculus of Inductive Constructions" (PDF). Archived from the original (talk) on 2014-05-29. Retrieved 2013-03-03.
- Huet, Gérard (1988). "Induction Principles Formalized in the Calculus of Constructions" (PDF). In Fuchi, K.; Nivat, M. (eds.). Programming of Future Generation Computers. North-Holland. pp. 205–216. ISBN 0444704108. Archived from the original (PDF) on 2015-07-01. — An application of the CoC
Calculus of constructions
View on GrokipediaOverview
Definition and Core Principles
The Calculus of Constructions (CoC) is a dependently typed lambda calculus that extends the simply typed lambda calculus by incorporating sorts such as Type (denoted *) and Kind (denoted □), which enable types to be expressed as terms and support higher-order dependencies between types.90005-3) This framework allows for the construction of types that depend on terms, facilitating the encoding of mathematical propositions and proofs within a unified system.[5] CoC operates within the paradigm of pure type systems, characterized by an impredicative universe Type where types can be quantified over themselves, and it embodies the Curry-Howard isomorphism, which equates logical proofs with typed programs, thereby supporting both constructive programming and theorem proving.90005-3) The impredicativity of Type permits definitions that refer to the universe itself, enhancing expressiveness for higher-order logic while maintaining consistency through the stratification provided by Kind.[6] A distinguishing trait of CoC is its purity: it begins without built-in constants, with all mathematical objects constructed solely via lambda abstraction and application, which aligns with principles of constructive mathematics by emphasizing explicit constructions over classical assumptions.[5] This design enables the formalization of intuitionistic logic and has established CoC as the foundational type theory for proof assistants like Coq, which extends it with inductive definitions, and Lean, which builds upon a variant with universe hierarchies.[7]Historical Development
The Calculus of Constructions (CoC) originated in the mid-1980s at INRIA, developed by Thierry Coquand and Gérard Huet as a higher-order typed lambda calculus aimed at mechanizing mathematical proofs. It built upon Per Martin-Löf's intuitionistic type theory, which introduced dependent types to encode propositions and proofs uniformly, and Jean-Yves Girard's System F, which provided impredicative polymorphism through universal quantification.[8] These influences addressed limitations in earlier systems like Nuprl, which, while based on Martin-Löf's predicative approach, struggled with fully integrating higher-order logic and impredicativity for concise proof representations.[9] CoC's design also drew from lambda calculus foundations and the Automath project by Niklaus de Bruijn, which pioneered the Curry-Howard isomorphism for viewing proofs as programs in a type-theoretic setting.[8] Coquand's PhD thesis, defended on January 31, 1985, presented the initial version of CoC as a higher-order extension of Automath, emphasizing constructive proofs in natural deduction style.[8] This was followed by the seminal paper "Constructions: A Higher Order Proof System for Mechanizing Mathematics," published in the proceedings of EUROCAL '85, which formalized CoC and introduced dependent types within a lambda calculus framework, enabling the encoding of mathematical structures and proofs as typed terms.[10] The system included sorts for types and propositions, supporting both predicative and impredicative constructions, and included a proof of consistency relative to Martin-Löf's theory.[5] Development accelerated in the late 1980s, leading to the Calculus of Inductive Constructions (CIC) around 1989, an extension of CoC by Coquand and Christine Paulin that incorporated primitive inductive definitions for defining recursive data types like natural numbers and lists directly in the type system.[8] This evolution added an impredicative sort Prop for propositions and allowed inductive types to be used in type definitions, enhancing expressiveness for proof assistants while maintaining strong normalization.[11] The key publication, "Inductively Defined Types" (1990), detailed these rules and properties, bridging CoC's higher-order logic with Martin-Löf-style induction.[11] By the early 1990s, CIC formed the basis for the Coq proof assistant, with initial implementations in versions 5.6 (1991) and 5.8 (1993), integrating CoC's core into a practical tool for formal verification and program extraction.[8] This period marked CoC's transition from theoretical formalism to foundational role in interactive theorem proving, influencing subsequent developments in type theory throughout the decade.Syntax
Terms and Syntax Rules
The calculus of constructions (CoC) defines terms through an abstract syntax that treats types as first-class citizens, allowing for the construction of both proofs and programs within a unified framework.[1] Terms are built from a small set of primitive constructors, encompassing variables, applications, lambda abstractions for dependent functions, and dependent products (which generalize both function types and universal quantification).[1] This syntax enables the encoding of higher-order logic and typed lambda calculus features without relying on built-in constants or axioms in the pure system; all structures are derived compositionally from these primitives.[1] Polymorphism is achieved through dependent products over the universe sort, without separate syntactic constructs for type abstraction. The formal syntax can be specified using a BNF-like notation, where terms (which include both expressions and types) are defined as follows:t ::= x (variable)
| Πx:A.t (dependent product)
| λx:A.t (lambda abstraction)
| t t (application)
t ::= x (variable)
| Πx:A.t (dependent product)
| λx:A.t (lambda abstraction)
| t t (application)
Sorts and Type Hierarchy
The Calculus of Constructions (CoC) employs a system of sorts to establish a structure for types, allowing types to be treated as terms while managing potential inconsistencies. In the core system, there is a single impredicative sort *, which serves as the universe of types and propositions, with the axiom * : *. This impredicativity permits definitions that quantify over the universe itself, supporting compact encodings of higher-order logic. However, the self-inhabitation * : * allows the construction of paradoxical terms, such as Girard's paradox, rendering the logic inconsistent for full higher-order propositional reasoning.[1][12] Later extensions address this by distinguishing an impredicative sort Prop for propositions (with products into Prop quantifying over Prop) from a predicative sort Type for types, often with Type : Type initially but refined to avoid paradoxes. In consistent variants, such as those underlying modern proof assistants, the type hierarchy is built upon a cumulative tower of universes denoted Type_i for nonnegative integers i, where each Type_i represents a predicative level of types. The inclusions are axiomatized as Type_i : Type_{i+1} for all i ≥ 0, enabling a term of type Type_i to also inhabit higher universes Type_j for j > i. Prop may be included as Type_0 or separately with impredicativity restricted to it. This setup allows types to be introspected and manipulated at the meta-level, as a type in Type_i is itself a term typed by Type_{i+1}, while preventing self-referential paradoxes by enforcing ascent through the indexed levels.[12][13] The dependent product type, written as , functions as the primitive for both function spaces and universal quantification, where the codomain may depend on the value of . Typing rules for the product respect the sort hierarchy: if and, under the assumption , , then provided is permitted by the system's axioms, such as in the impredicative case for * or Prop. This mechanism unifies computation and proof, allowing dependent functions to encode predicates and logical implications.[1] CoC is formalized as an instance of a pure type system (PTS) with sort in the core, where the axiom set includes * : *, and the rule set specifies valid product formations, such as . Impredicativity allows quantification over the entire hierarchy. In extended consistent versions, , with predicative rules where s is the max level, and special impredicative rules for Prop.[14][5] In contrast to the simply typed lambda calculus, which relies on a rigid assortment of atomic types without mechanisms for typing types themselves, CoC's sorts permit the universe to inhabit higher levels or itself, fostering impredicative polymorphism that supports advanced encodings of inductive types and higher-order logic within a unified framework.[15][12]Semantics
Beta-Equivalence and Reduction
In the calculus of constructions, beta-reduction defines the computational behavior of terms through substitution in applications. The one-step beta-reduction relation, denoted →_β, is the smallest congruence relation generated by two rules: for term-level application, (λx:A.M) N →_β [N/x]M, where substitution replaces free occurrences of x in M with N; and for type-level application, (Λx:A.M) B →_β [B/x]M, where B is a type term.[5] These rules capture the evaluation of lambda abstractions at both term and type levels, enabling the unfolding of definitions in a higher-order setting.90005-3) Multi-step reduction, denoted →_β^, extends one-step reduction transitively, allowing terms to be evaluated to normal forms where no further beta-redexes exist. Various reduction strategies guide the order of applying these rules, such as call-by-name, which evaluates the leftmost outermost redex first, and call-by-value, which reduces arguments to values before substitution.[16] Weak head reduction limits evaluation to the head of a term without descending into subterms, while strong head reduction fully normalizes under the head; these strategies ensure termination in well-typed terms but are defined syntactically here. The system exhibits confluence, meaning that if a term reduces to two different terms via →_β^, there exists a common reduct; this follows from the Church-Rosser theorem, which guarantees unique normal forms up to equivalence.90005-3) Beta-equivalence, denoted ≡_β, is the reflexive, symmetric, transitive closure of →_β and its inverse (beta-expansion), or equivalently, M ≡_β N if there exists P such that M →_β^* P and N →_β^* P. This relation identifies terms that compute to the same result, forming the basis for operational equality in the calculus.[5] An extension to beta-equivalence incorporates eta-equivalence for extensionality: λx:A. (M x) ≡_η M, provided x does not occur free in M, allowing abstraction over applications to be collapsed when the variable is unused. This rule is not part of the core reduction but enhances equivalence to capture functional extensionality. In the pure calculus of constructions, without definitions or axioms, convertibility coincides with beta-equivalence (or beta-eta if extended), serving as the computational notion of equality for terms.90005-3)Judgments and Typing
The type system of the Calculus of Constructions (CoC) relies on declarative judgments to specify the well-formedness of contexts, the formation of types at specific sorts, and the typing of terms relative to those types. These judgments form the foundation for ensuring the consistency and habitability of constructions within varying contexts, enabling the expression of dependent types where types themselves may vary based on term values.90005-3) The primary judgments are as follows:- Γ ⊢: This asserts that the context Γ is well-formed, meaning it consists of a valid sequence of variable declarations of the form , where each is a type and variables are distinct.
- Γ ⊢ A : s: This declares that is a valid type (or construction) of sort under context Γ, where sorts classify types hierarchically.
- Γ ⊢ M : A: This states that the term inhabits the type in context Γ, confirming as a valid proof or program relative to .
