Sorts
sort::=
Set
|
Prop
|
SProp
|
Type
|
Type @{ _ }
|
Type @{ qualid |? universe }
universe::=
max ( universe_expr+, )
|
_
|
universe_expr
universe_expr::=
universe_name + natural?
The types of types are called sorts.
All sorts have a type and there is an infinite well-founded typing
hierarchy of sorts whose base sorts are ,
and .
The sort intends to be the type of logical propositions. If is a
logical proposition then it denotes the class of terms representing
proofs of . An object belonging to
witnesses the fact that is
provable. An object of type is called a proposition.
We denote propositions by form
.
This constitutes a semantic subclass of the syntactic class term
.
The sort is like but the propositions in
are known to have irrelevant proofs (all proofs are
equal). Objects of type are called
strict propositions.
See SProp (proof irrelevant propositions) for information about using
, and [GCST19] for meta theoretical
considerations.
The sort intends to be the type of small sets. This includes data
types such as booleans and naturals, but also products, subsets, and
function types over these data types.
We denote specifications (program types) by specif
.
This constitutes a semantic subclass of the syntactic class term
.
, and themselves can be manipulated as ordinary terms.
Consequently they also have a type. Because assuming simply that
has type leads to an inconsistent theory [Coq86], the language of
CIC has infinitely many sorts. There are, in addition to the base sorts,
a hierarchy of universes for any integer .
Like , all of the sorts contain small sets such as
booleans, natural numbers, as well as products, subsets and function
types over small sets. But, unlike , they also contain large sets,
namely the sorts and for , and all products, subsets
and function types over these sorts.
Formally, we call the set of sorts which is defined by:
Their properties, such as , , and
, are described in Subtyping rules.
Algebraic universes In practice, the Type hierarchy is
implemented using algebraic universes,
which appear in the syntax Type@{universe}
.
An algebraic universe is either a variable,
a successor of an algebraic universe (an expression ),
an upper bound of algebraic universes (an expression ),
or the base universe .
A graph of constraints between the universe variables is maintained
globally. To ensure the existence of a mapping of the universes to the
positive integers, the graph of constraints must remain acyclic.
Typing expressions that violate the acyclicity of the graph of
constraints results in a Universe inconsistency
error.
The user does not have to mention explicitly the universe when
referring to the universe Type@{u}
. One only writes Type
. The system
itself generates for each instance of Type
a new variable for the
universe and checks that the constraints between these indexes can be
solved. From the user point of view we consequently have . We
shall make precise in the typing rules the constraints between the
indices.
The syntax Type@{qualid | universe}
is used with
Polymorphic Universes when quantifying over all sorts including
and .