Conversion rules¶
In CIC, there is an internal reduction mechanism. In particular, it can decide if two programs are intentionally equal (one says convertible). Convertibility is described in this section.
α-conversion¶
Two terms are α-convertible if they are syntactically
equal ignoring differences in the names of variables bound within the expression.
For example forall x, x + 0 = x
is α-convertible with forall y, y + 0 = y
.
β-reduction¶
We want to be able to identify some terms as we can identify the application of a function to a given argument with its result. For instance the identity function over a given type \(T\) can be written \(λx:T.~x\). In any global environment \(E\) and local context \(Γ\), we want to identify any object \(a\) (of type \(T\)) with the application \(((λ x:T.~x)~a)\). We define for this a reduction (or a conversion) rule we call \(β\):
We say that \(\subst{t}{x}{u}\) is the β-contraction of \(((λx:T.~t)~u)\) and, conversely, that \(((λ x:T.~t)~u)\) is the β-expansion of \(\subst{t}{x}{u}\).
According to β-reduction, terms of the Calculus of Inductive Constructions enjoy some fundamental properties such as confluence, strong normalization, subject reduction. These results are theoretically of great importance but we will not detail them here and refer the interested reader to [Coq85].
ι-reduction¶
A specific conversion rule is associated to the inductive objects in the global environment. We shall give later on (see Section Well-formed inductive definitions) the precise rules but it just says that a destructor applied to an object built from a constructor behaves as expected. This reduction is called ι-reduction and is more precisely studied in [PM93a][Wer94].
δ-reduction¶
We may have variables defined in local contexts or constants defined in the global environment. It is legal to identify such a reference with its value, that is to expand (or unfold) it into its value. This reduction is called δ-reduction and shows as follows.
- Delta-Local
- \[\frac{% \WFE{\Gamma}% \hspace{3em}% (x:=t:T) ∈ Γ% }{% E[Γ] ⊢ x~\triangleright_Δ~t% }\]
- Delta-Global
- \[\frac{% \WFE{\Gamma}% \hspace{3em}% (c:=t:T) ∈ E% }{% E[Γ] ⊢ c~\triangleright_δ~t% }\]
ζ-reduction¶
Coq allows also to remove local definitions occurring in terms by replacing the defined variable by its value. The declaration being destroyed, this reduction differs from δ-reduction. It is called ζ-reduction and shows as follows.
- Zeta
- \[\frac{% \WFE{\Gamma}% \hspace{3em}% \WTEG{u}{U}% \hspace{3em}% \WTE{\Gamma::(x:=u:U)}{t}{T}% }{% E[Γ] ⊢ \letin{x}{u:U}{t}~\triangleright_ζ~\subst{t}{x}{u}% }\]
η-expansion¶
Another important concept is η-expansion. It is legal to identify any term \(t\) of functional type \(∀ x:T,~U\) with its so-called η-expansion
for \(x\) an arbitrary variable name fresh in \(t\).
Note
We deliberately do not define η-reduction:
This is because, in general, the type of \(t\) need not to be convertible to the type of \(λ x:T.~(t~x)\). E.g., if we take \(f\) such that:
then
We could not allow
because the type of the reduced term \(∀ x:\Type(2),~\Type(1)\) would not be convertible to the type of the original term \(∀ x:\Type(1),~\Type(1)\).
Proof Irrelevance¶
It is legal to identify any two terms whose common type is a strict proposition \(A : \SProp\). Terms in a strict propositions are therefore called irrelevant.
Convertibility¶
Let us write \(E[Γ] ⊢ t \triangleright u\) for the contextual closure of the relation \(t\) reduces to \(u\) in the global environment \(E\) and local context \(Γ\) with one of the previous reductions β, δ, ι or ζ.
We say that two terms \(t_1\) and \(t_2\) are βδιζη-convertible, or simply convertible, or equivalent, in the global environment \(E\) and local context \(Γ\) iff there exist terms \(u_1\) and \(u_2\) such that \(E[Γ] ⊢ t_1 \triangleright … \triangleright u_1\) and \(E[Γ] ⊢ t_2 \triangleright … \triangleright u_2\) and either \(u_1\) and \(u_2\) are identical up to irrelevant subterms, or they are convertible up to η-expansion, i.e. \(u_1\) is \(λ x:T.~u_1'\) and \(u_2 x\) is recursively convertible to \(u_1'\), or, symmetrically, \(u_2\) is \(λx:T.~u_2'\) and \(u_1 x\) is recursively convertible to \(u_2'\). We then write \(E[Γ] ⊢ t_1 =_{βδιζη} t_2\).
Apart from this we consider two instances of polymorphic and cumulative (see Chapter Polymorphic Universes) inductive types (see below) convertible
if we have subtypings (see below) in both directions, i.e.,
and
Furthermore, we consider
convertible if
and we have that \(c\) and \(c'\) are the same constructors of different instances of the same inductive types (differing only in universe levels) such that
and
and we have
The convertibility relation allows introducing a new typing rule which says that two convertible well-formed types have the same inhabitants.