A Normalizing Computation Rule for Propositional Extensionality in HigherOrder Minimal Logic
T Y P E S
A Normalizing Computation Rule for Propositional Extensionality in HigherOrder Minimal Logic
Robin Adams 0
Thierry Coquand 0
0 Universitetet i Bergen , Institutt for Informatikk, Postboks 7800, N5020 BERGEN, Norway https://orcid.org/0000000273201976
The univalence axiom expresses the principle of extensionality for dependent type theory. However, if we simply add the univalence axiom to type theory, then we lose the property of canonicity  that every closed term computes to a canonical form. A computation becomes ?stuck? when it reaches the point that it needs to evaluate a proof term that is an application of the univalence axiom. So we wish to find a way to compute with the univalence axiom. While this problem has been solved with the formulation of cubical type theory, where the computations are expressed using a nominal extension of lambdacalculus, it may be interesting to explore alternative solutions, which do not require such an extension.
and phrases type theory; univalence; canonicity

1
Introduction
isotoid : A ' B ? A = B
The univalence axiom of Homotopy Type theory (HoTT) [11] postulates a constant
that is an inverse to the obvious function A = B ? A ' B. However, if we simply add
this constant to MartinL?f type theory, then we lose the important property of canonicity ?
that every closed term of type A computes to a unique canonical object of type A. When a
computation reaches a point where we eliminate a path (proof of equality) formed by isotoid,
it gets ?stuck?.
As possible solutions to this problem, we may try to do with a weaker property than
canonicity, such as propositional canonicity: that every closed term of type N is propositionally
equal to a numeral, as conjectured by Voevodsky. Or we may attempt to change the definition
of equality to make isotoid definable [9], or add a nominal extension to the syntax of the type
theory (e.g. Cubical Type Theory [3]).
We could also try a more conservative approach, and simply attempt to find a reduction
relation for a type theory involving isotoid that satisfies all three of the properties above.
There seems to be no reason a priori to believe this is not possible, but it is difficult to do
because the full Homotopy Type Theory is a complex and interdependent system. We can
tackle the problem by adding univalence to a much simpler system, finding a wellbehaved
reduction relation, then doing the same for more and more complex systems, gradually
approaching the full strength of HoTT.
In this paper, we present a system we call PHOML, or predicative higherorder minimal
logic. It is a type theory with three kinds of typing judgement. There are proofs which
inhabit propositions, which are the terms of type ?. The canonical propositions are those
constructed from ? by implication ?. There are terms which inhabit types, which are the
simple types over ?. Thirdly, there are paths which inhabit equations M =A N , where M
and N are terms of type A.
There are two canonical forms for proofs of M =? N . For any term ? : ?, we have
ref (?) : ? =? ?. We also add univalence for this system, in this form: if ? : ? ? ? and
: ? ? ?, then univ?,? (?, ) : ? =? ?.
This entails that in PHOML, two propositions that are logically equivalent are equal.
Every function of type ? ? ? that can be constructed in PHOML must therefore respect
logical equivalence. That is, for any F and logically equivalent x, y we must have that F x
and F y are logically equivalent. Moreover, if for x : ? we have that F x is logically equivalent
to Gx, then F =??? G. Every function of type (? ? ?) ? ? must respect this equality;
and so on. This is the manifestation in PHOML of the principle that only homotopy invariant
constructions can be performed in homotopy type theory. (See Section 3.1.)
We present a callbyname reduction relation for this system, and prove that every typable
term reduces to a canonical form. From this, it follows that the system is consistent.
For the future, we wish to include the equations in ?, allowing for propositions such as
M =A N ? N =A M . We wish to expand the system with universal quantification, and
expand it to a 2dimensional system (with equations between proofs). We then wish to add
more inductive types and more dimensions, getting ever closer to full homotopy type theory.
1.1
Related Work
Another system with many of the same aims is cubical type theory (CTT) [3]. A similar
canonicity result has been proved for CTT [6].
The system PHOML is almost a subsystem of cubical type theory. We can attempt to
embed PHOML into cubical type theory, mapping ? to the universe U , and an equation
M =A N to either the type Path A M N or to Id A M N . However, PHOML has more
definitional equalities than the relevant fragment of cubical type theory; that is, there are
definitionally equal terms in PHOML that are mapped to terms that are not definitionally
equal in cubical type theory. In particular, ref (x)+ p and p are definitionally equal, whereas
the terms compix[]p and p are not definitionally equal in cubical type theory (but they are
propositionally equal). See Section 3.2.1 for more information.
Other systems with similar aims include Harper and Licata [7], who prove canonicity for
a system that includes equality reflection; and Angiuli, Harper and Wilson [1] who prove
canonicity for a system with univalence, dependent types and some higher inductive types,
but without any universes.
The proofs in this paper have been formalized in Agda. The formalization is available at
https://github.com/radams78/TYPES2016.
2
Predicative HigherOrder Minimal Logic with Extensional Equality
We call the following type theory PHOML, or predicative higherorder minimal logic with
extensional equality.
2.1
Syntax
Fix three disjoint, infinite sets of variables, which we shall call term variables, proof variables
and path variables. We shall use x and y as term variables, p and q as proof variables, e as a
path variable, and z for a variable that may come from any of these three sets.
The syntax of PHOML is given by the grammar:
Type
Term
Proof
Path
Context
Judgement
A, B, C ::=
L, M, N, ?, ?, ? ::=
?, ::=
P, Q ::=
?, ?, ? ::=
J ::=
?  A ? B
x  ?  ? ? ?  ?x : A.M  M N
p  ?p : ?.?  ?  P +  P ?
e  ref (M )  P ?? Q  univ?,? (P, Q) 
???e : x =A y.P  PMN Q
hi  ?, x : A  ?, p : ?  ?, e : M =A N
? ` valid  ? ` M : A  ? ` ? : ? 
? ` P : M =A N
In the path ???e : x =A y.P , the term variables x and y must be distinct. (We also have
x 6? e 6? y, thanks to our stipulation that term variables and path variables are disjoint.)
The term variable x is bound within M in the term ?x : A.M , and the proof variable p is
bound within ? in ?p : ?.?. The three variables e, x and y are bound within P in the path
???e : x =A y.P . We identify terms, proofs and paths up to ?conversion. We write E[z := F ]
for the result of substituting F for z within E, using ?conversion to avoid variable capture.
We shall use the word ?expression? to mean either a type, term, proof, path, or equation
(an equation having the form M =A N ). We shall use E, F , S and T as metavariables that
range over expressions.
Note that we use both Roman letters M , N and Greek letters ?, ?, ? to range over terms.
Intuitively, a term is understood as either a proposition or a function, and we shall use Greek
letters for terms that are intended to be propositions. Formally, there is no significance to
which letter we choose.
Note also that the types of PHOML are just the simple types over ?; therefore, no
variable can occur in a type.
2.1.1
Intuitive Explanation
The intuition behind the new expressions is as follows (see also the rules of deduction
in Figure 2). For any object M : A, there is the trivial path ref (M ) : M =A M . The
constructor ?? ensures congruence for ? ? if P : ? =? ?0 and Q : ? =? ?0 then P ?? Q :
? ? ? =? ?0 ? ?0. The constructor univ gives ?univalence? (propositional extensionality)
for our propositions: if ? : ? ? ? and : ? ? ?, then univ?,? (?, ) is a path ? =? ?. The
constructors + and ? denote the action of transport along a path: if P is a path of type
? =? ?, then P + is a proof of ? ? ?, and P ? is a proof of ? ? ?.
The constructor ??? gives functional extensionality. Let F and G be functions of type
A ? B. If F x =B Gy whenever x =A y, then F =A?B G. More formally, if P is a path of
type F x =B Gy that depends on x : A, y : A and e : x =A y, then ???e : x =A y.P is a path
of type F =A?B G.
Finally, if P is a path M =A?B M 0, and Q is a path N =A N 0, then PMN Q is a path
M N =B M 0N 0.
Note. The equations M =A N are quite different from the identity types in MartinL?f
Type Theory. In MartinL?f Type Theory, the only constructor for the identity type is ref ( ).
In our system, the constructors for M =A N to vary with the type A.
The equations ? =? ? have two constructors:
ref (?) is a canonical path of ? =? ?.
If ? : ? ? ? and : ? ? ?, then univ?,? (?, ) is a canonical path of ? =? ?.
The equations F =A?B G have two constructors:
ref (F ) is a canonical path of F =A?B F
If P is a path of F x =B Gy that depends on x : A, y : A and e : x =A y, then
???e : x =A y.P is a canonical path of F =A?B G.
We therefore define the canonical paths to be those of the form ref (M ), univ?,? (?, ) or
???e : x =A y.P (see Definition 19).
2.1.2
Substitution and Path Substitution
Intuitively, if N and N 0 are equal then M [x := N ] and M [x := N 0] should be equal. To
handle this syntactically, we introduce a notion of path substitution. If N , M and M 0 are
terms, x a term variable, and P a path, then we shall define a path N {x := P : M = M 0}.
The intention is that, if ? ` P : M =A M 0 and ?, x : A ` N : B then ? ` N {x := P : M =
M 0} : N [x := M ] =B N [x := M 0] (see Lemma 17).
I Definition 1 (Path Substitution). Given terms M1, . . . , Mn and N1, . . . , Nn; paths P1,
. . . , Pn; term variables x1, . . . , xn; and a term L, define the path
L{x1 := P1 : M1 = N1, . . . , xn := Pn : Mn = Nn}
as follows.
y{~x := P~ : M~ = N~ } d=ef ref (y)
?{~x := P~ : M~ = N~ } d=ef ref (?)
(LL0){~x := P~ : M~ = N~ }
(y 6? x1, . . . , xn)
d=ef L{~x := P~ : M~ = N~ }L0[~x:=M~ ]L0[~x:=N~ ]L0{~x := P~ : M~ = N~ }
(?y : A.L){~x := P~ : M~ = N~ }
d=ef ???e : a =A a0.L{~x := P~ : M~ = N~ , y := e : a = a0}
(? ? ?){~x := P~ : M~ = N~ } d=ef ?{~x := P~ : M~ = N~ } ?? ?{~x := P~ : M~ = N~ }
We shall often omit the endpoints M~ and N~ .
I Note 2. The case n = 0 is permitted, and we shall have that, if ? ` M : A then
? ` M {} : M =A M . There are thus two paths from a term M to itself: ref (M ) and M {}.
They are not always equal; for example, (?x : A.x){} ? ???e : x =A y.e, which (after we
define the reduction relation) will not be convertible with ref (?x : A.x).
The following lemma shows how substitution and path substitution interact.
I Lemma 3. Let ~y be a sequences of variables and x a distinct variable. Then
1. M [x := N ]{~y := P~ : L~ = L~0}
? M {x := N {~y := P~ : L~ = L~0} : N [~y := L~] = N [~y := L~0], ~y := P~ : L~ = L~0}
2. M {~y := P~ : L~ = L~0}[x := N ]
? M {~y := P~ [x := N ] : L~[x := N ] = L~0[x := N ], x := ref (N ) : N = N }
Proof. An easy induction on M in all cases.
I Note 4. The familiar substitution lemma also holds as usual: t[z~1 := s~1][z~2 := s~2] ?
t[z~1 := s~1[z~2 := s~2], z~2 := s~2]. We cannot form a lemma about the fourth case, simplifying
M {~x := P~ }{~y := Q~ }, because M {~x := P~ } is a path, and path substitution can only be
applied to a term.
We introduce a notation for simultaneous substitution and path substitution of several
variables:
I Definition 5. A substitution is a function that maps term variables to terms, proof variables
to proofs, and path variables to paths. We write E[?] for the result of substituting the
expression ?(z) for z in E, for each variable z in the domain of ?.
A path substitution ? is a function whose domain is a finite set of term variables, and
which maps each term variable to a path. Given a path substitution ? and substitutions ?, ?
with the same domain {x1, . . . , xn}, we write
M {? : ? = ?} for M {x1 := ? (x1) : ?(x1) = ?(x1), . . . , ? (xn) : ?(xn) = ?(xn)} .
2.1.3
CallByName Reduction
I Definition 6 (CallByName Reduction). Define the relation of callbyname reduction ?
on the expressions. The inductive definition is given by the rules in Figure 1.
J
Reduction on Terms
(?x : A.M )N ? M [x := N ]
? ? ?0
? ? ? ? ?0 ? ?
? ? ?0
? ? ? ? ? ? ?0
M ? M 0
M N ? M 0N
Reduction on Proofs
(?p : ?.?)
?
? ? ?0
? ?0
P ? Q
P + ? Q+
univ?,? (?, )+
P ? Q
P ? ? Q?
Reduction on Paths
? ?[p := ] ref (?)+ ? ?p : ?.p ref (?)? ? ?p : ?.p
? ?
univ?,? (?, )? ?
(???e : x =A y.P )MN Q ? P [x := M, y := N, e := Q]
ref (?x : A.M )NN0 P ? M {x := P : N = N 0}
ref (?) ?? ref (?) ? ref (? ? ?)
ref (?) ?? univ?,? (?, ) ? univ???,??? (?p : ? ? ?.?q : ?.?(pq), ?p : ? ? ?.?q : ?. (pq))
univ?,? (?, ) ?? ref (?) ? univ???,??? (?p : ? ? ?.?q : ?.p( q), ?p : ? ? ?.?q : ?.p(?q))
univ?,? (?, ) ?? univ?0,?0 (?0, 0)
? univ???0,???0 (?p : ? ? ?0.?q : ?.?0(p( q)), ?p : ? ? ?0.?q : ?. 0(p(?q)))
P ? P 0
PMN Q ? P M0N Q
M ? M 0
ref (M )NN0 P ? ref (M 0)NN0 P
P ? P 0
P ?? Q ? P 0 ?? Q
Q ? Q0
P ?? Q ? P ?? Q0
We write for the reflexive transitive closure of ?, and we write ?? for the reflexive
symmetric transitive closure of ?. We say an expression E is in normal form iff there is no
expression F such that E ? F .
Proof. Induction on M ? N . The only difficult case is ?contraction. We have
((?x : A.M )N ){? : ? = ?}
?(???e : x =A x0.M {? : ? = ?, x := e : x = x0})N[?]N[?]N {? : ? = ?}
?M {? : ? = ?, x := N {? } : N [?] = N [?]}
?M [x := N ]{? : ? = ?}
(Lemma 3)
J
I Note 9.
1. Reduction on proofs and paths does not respect term substitution. For example, let
M ? ?x : ?.x. Then we have
ref (?y : ?.y0)?? ref (?) ? y0{y := ref (?) : ? = ?} ? ref (y0)
(ref (?y : ?.y0)?? ref (?))[y0 := M ] ? ref (?y : ?.M )?? ref (?)
ref (y0) [y0 := M ] ? ref (M ) ? ref (?x : ?.x)
Expression (1) does not reduce to (2). Instead, (1) reduces to
M {y := ref (?) : ? = ?}? ???e : x =? x0.x{y := ref (?) : ? = ?, x := e : x = x0}
? ???e : x =? x0.e .
2. Reduction on terms does respect substitution: if M ? N then M [x := P ] ? N [x := P ],
as is easily shown by induction on M ? N .
2.2
Rules of Deduction
The rules of deduction of PHOML are given in Figure 2.
2.2.1
Metatheorems
In the lemmas that follow, the letter J stands for any of the expressions that may occur to
the right of the turnstile in a judgement, i.e. valid, M : A, ? : ?, or P : M =A N .
I Lemma 10 (Context Validity). Every derivation of ?, ? ` J has a subderivation of
? ` valid.
Proof. Induction on derivations.
I Lemma 11 (Weakening). If ? ` J , ? ? ? and ? ` valid then ? ` J .
Proof. Induction on derivations.
I Lemma 12 (Type Validity).
1. If ? ` ? : ? then ? ` ? : ?.
2. If ? ` P : M =A N then ? ` M : A and ? ` N : A.
(
1
)
(2)
J
J
Proof. Induction on derivations. The cases where ? or P is a variable use Context Validity. J
I Lemma 13 (Generation).
1. If ? ` x : A then x : A ? ?.
2. If ? ` ? : A then A ? ?.
3. If ? ` ? ? ? : A then ? ` ? : ?, ? ` ? : ? and A ? ?.
4. If ? ` ?x : A.M : B then there exists C such that ?, x : A ` M : C and B ? A ? C.
Contexts
? ` valid ? ` ? : ?
(hi) hi ` valid (ctxT) ?,x : A ` valid (ctxP) ?,p : ? ` valid
(ctxE) ??,`e M:M: A=A ?N``Nva:liAd
(varT) ?? `` xva:liAd (x : A ? ?) (varP) ?? `` vpa:li?d (p : ? ? ?)
? ` valid
(varE) ? ` e : M =A N (e : M =A N ? ?)
Terms
Proofs
Paths
(?) ??`` ?va:li?d (?) ? `??`: ?? ???`: ?? : ?
(appT) ? ` M :?A`?MBN :?B` N : A (?T) ? `??,xx :: AA.M`M: A: B? B
(appP) ? ` ? : ? ? ? ? ` : ? (?P) ? ` ?p : ?.? : ? ? ?
?,p : ? ` ? : ?
? ` ? : ?
(convP) ? ` ? ?:?` ??: ?` ? : ? (? ???)
(ref) ? ` ref?(M`M): M:A=A M (??) ??``PP: ???=Q? :??0 ???`=Q?:??0 =????00
(univ) ? ` ? : ? ? ? ? ` : ? ? ?
? ` univ?,? (?, ) : ? =? ?
(plus) ?? `` PP+: ?:?=?? ?? (minus) ?? `` PP?: ?:?=?? ??
(???)
?,x : A,y : A,e : x =A y ` P : Mx =B Ny
? ` M : A ? B ? ` N : A ? B
? ` ???e : x =A y.P : M =A?B N
(appE) ? ` P : M =A?B M0 ? ` Q : N =A N0 ? ` N : A ? ` N0 : A
? ` PNN0Q : MN =B M0N0
(convE) ? ` P : M =A N ? ` M0 : A ? ` N0 : A (M ??M0,N ??N0)
? ` P : M0 =A N0
5. If ? ` M N : A then there exists B such that ? ` M : B ? A and ? ` N : B.
6. If ? ` p : ?, then there exists ? such that p : ? ? ? and ? ???.
7. If ? ` ?p : ?.? : ?, then there exists ? such that ?, p : ? ` ? : ? and ? ??(? ? ?).
8. If ? ` ? : ? then there exists ? such that ? ` ? : ? ? ? and ? ` : ?.
9. If ? ` e : M =A N , then there exist M 0, N 0 such that e : M 0 =A N 0 ? ? and M ??M 0,
N ??N 0.
10. If ? ` ref (M ) : N =A P , then we have ? ` M : A and M ??N ??P .
11. If ? ` P ?? Q : ? =A ?, then there exist ?1, ?2, ?1, ?2 such that ? ` P : ?1 =? ?1,
? ` Q : ?2 =? ?2, ? ??(?1 ? ?1), ? ??(?2 ? ?2), and A ? ?.
12. If ? ` univ?,? (?, ) : ? =A ?, then we have ? ` ? : ? ? ?, ? ` : ? ? ?, ? ???, ? ???
and A ? ?.
13. If ? ` ???e : x =A y.P : M =B N then there exists C such that ?, x : A, y : A, e : x =A
y ` P : M x =C N y and B ? A ? C.
14. If ? ` PMM0 Q : N =A N 0, then there exist B, F and G such that ? ` P : F =B?A G,
? ` Q : M =B M 0, N ??F M and N 0 ??GM 0.
15. If ? ` P + : ?, then there exist ?, ? such that ? ` P : ? =? ? and ? ??(? ? ?).
16. If ? ` P ? : ?, there exist ?, ? such that ? ` P : ? =? ? and ? ??(? ? ?).
Proof. Induction on derivations.
2.2.2
Substitutions
I Definition 14. Let ? and ? be contexts. A substitution from ? to ?1, ? : ? ? ?, is a
substitution whose domain is dom ? such that:
for every term variable x : A ? ?, we have ? ` ?(x) : A;
for every proof variable p : ? ? ?, we have ? ` ?(p) : ?[?];
for every path variable e : M =A N ? ?, we have ? ` ?(e) : M [?] =A N [?].
I Lemma 15 (WellTyped Substitution). If ? ` J , ? : ? ? ? and ? ` valid, then ? ` J [?].
Proof. Induction on derivations.
I Definition 16. If ?, ? : ? ? ? and ? is a path substitution whose domain is the term
variables in dom ?, then we write ? : ? = ? : ? ? ? iff, for each variable x : A ? ?, we have
? ` ? (x) : ?(x) =A ?(x).
I Lemma 17 (Path Substitution). If ? : ? = ? : ? ? ? and ? ` M : A and ? ` valid, then
? ` M {? : ? = ?} : M [?] =A M [?].
Proof. Induction on derivations.
I Proposition 18 (Subject Reduction). If ? ` s : T and s
t then ? ` t : T .
Proof. It is sufficient to prove the case s ? t. The proof is by a case analysis on s ? t,
using the Generation, WellTyped Substitution and Path Substitution Lemmas. J
1 These have also been called context morphisms, for example in Hoffman [5].
J
J
J
2.2.3
Canonicity
I Definition 19 (Canonical Object).
The canonical propositions, are given by the grammar
? ::= ?  ? ? ?
A canonical proof is one of the form ?p : ?.?.
A canonical path is one of the form ref (M ), univ?,? (?, ) or ???e : x =A y.P .
I Lemma 20. Suppose ? reduces to a canonical proposition ?, and ? ???. Then ? reduces
to ?.
Proof. This follows from the fact that ? satisfies the diamond property, and every canonical
proposition ? is a normal form. J
2.2.4
Neutral Expressions
I Definition 21 (Neutral). The neutral terms, paths and proofs are given by the grammar
Neutral term
Neutral proof
Neutral path
Mn ::= x  MnN
?n ::= p  Pn+  Pn?  ?n
Pn ::= e  Pn ?? Q  Q ?? Pn  (Pn)MN Q
3
Examples
We present two examples illustrating the way that proofs and paths behave in PHOML. In
each case, we compare the example with the same construction performed in cubical type
theory.
3.1
Functions Respect Logical Equivalence
As discussed in the introduction, every function of type ? ? ? that can be constructed in
PHOML must respect logical equivalence. This fact can actually be proved in PHOML, in
the following sense: there exists a proof ? of
f : ? ? ?, x : ?, y : ?, p : x ? y, q : y ? x ` ? : f x ? f y
and a proof of f y ? f x in the same context. Together, these can be read as a proof of ?if
f : ? ? ? and x and y are logically equivalent, then f x and f y are logically equivalent?.
Specifically, take
? d=ef (ref (f )xy univx,y (p, q))+ .
Note that this is not possible in MartinL?f Type Theory.
In cubical type theory, we can construct a term ? such that
f : Prop ? Prop, x : Prop, y : Prop, p : x.1 ? y.1, q : y.1 ? x.1 ` ? : (f x).1 ? (f y).1
In fact, we can go further and prove that equality of propositions is equal to logical equivalence.
That is, we can prove
Path U (Path Prop x y) ((x.1 ? y.1) ? (y.1 ? x.1)) .
3.2
Computation with Paths
Let > d=ef ? ? ?. Using propositional extensionality, we can construct a path of type
> = > ? >, and hence a proof of > ? (> ? >). Now, there are two canonical proofs of
> ? (> ? >). We might strongly expect that the proof we have constructed is the one that
we used to construct the path > = > ? >, but let us check that this is the one that our
computation rules produce.
We define
> := ? ? ?, ? := ?p : ?.p, I := ?x : ?.x, F := ?x : ?.> ? x,
H := ?h.h> .
Let ? be the context
? d=ef x : ?, y : ?, e : x =? y .
? ` ?p : > ? x.e+(p?)
? ` ?m : y.?n : >.e?m
? ` univ ?p : > ? x.e?m, ?m : y.?n : >.e?m
Let P ? univ (?p : > ? x.e+(p?), ?m : y.?n : >.e?m). Then
) ` ???e : x =? y.P
) ` (ref (H))F I (???e : x =? y.P )
) ` ((ref (H))F I (???e : x =? y.P ))?
And now we compute:
: (> ? x) ? y
: y ? (> ? x)
: (> ? x) =? y
: F =??? I
: (> ? >) =? >
: > ? (> ? >)
((ref (H))F I (???e : x =? y.P ))?
((h>){h := ???e : x =? y.P : F = I})?
?((???e : x =? y.P )>>(ref (>)))?
?(P [x := >, y := >, e := ref (>)])?
?univ ?p : > ? >.ref (>)+ (p?), ?m : >.?n : >.ref (>)? m
?
??m : >.?n : >.ref (>)? m
Therefore, given proofs ?, : >, we have
((ref (H))F I (???e : x =? y.P ))??
? .
(3)
(4)
(5)
Y =? X ? Y
Thus, the construction gives a proof of > ? (> ? >) which, given two proofs of >, selects
the first. We could have anticipated this: consider the context ? d=ef X : ?, Y : ?, p : X. By
replacing in our example some occurrences of > with X and others with Y , and replacing ?
with p, we can obtain a path
and hence a proof of Y ? (X ? Y ). By parametricity, any proof that we can construct in
the context ? of this proposition must return the left input.
3.2.1
Comparison with Cubical Type Theory
In cubical type theory, we say that a type A is a proposition iff any two terms of type A are
propositionally equal; that is, there exists a path between any two terms of type A. Let
isProp (A) d=ef ?x, y : A.Path A x y
Prop d=ef ?X : U.isProp (X) .
and let Prop be the type of all types in U that are propositions:
Let ? be any type in the universe U that is a proposition; that is, there exists a term of
type isProp (?). (? may be the empty type, but we do not require this in what follows.)
Define
> := ? ? ?
Then there exists a term >Prop of type isProp (>) (we omit the details). Define
I := ?X : Prop.X.1, F := ?X : Prop.> ? X.1,
H := ?h.h(>, >Prop)
Then we have
` > : U
` I : Prop ? U
` F : Prop ? U
` H : (Prop ? U ) ? U
From the fact that univalence is provable in cubical type theory [3], we can construct a
term Q such that
` Q : Path (Prop ? U ) I F .
Hence we have
` hiiH(Qi) : Path U HI HF
which is definitionally equal to
` hiiH(Qi) : Path U > ? > >
From this, we can apply transport to create a term Q0 : > ? > ? >. Applying this to any
terms ?, : > gives a term that is definitionally equal to
Q0? = mapid> mapid> ?
where mapid represents transport across the trivial path:
mapidA t d=ef compi A [] t
(i does not occur in A) .
(For the details of the calculation, see Appendix A.)
The cubical model of type theory given in [2] validates the equations mapidX x = x and
Q0? = ?. However, these are not definitional equalities in the version of cubical type theory
given in [3].
4
Computable Expressions
We now proceed with the proof of canonicity for PHOML. Our proof follows the lines
of the GirardTait reducibility method [10]: we define what it means to be a computable
term (proof, path) of a given type (proposition, equation), and prove: (
1
) every typable
expression is computable (2) every computable expression reduces to either a neutral or a
canonical expression. In particular, every closed computable expression reduces to a canonical
expression.
In this section, we use E, F , S and T as metavariables that range over expressions. In
each case, either E and F are terms and S and T are types; or E and F are proofs and S
and T are propositions; or E and F are paths and S and T are equations.
I Definition 22 (Computable Expression). We define the relation = E : T , read ?E is a
computable expression of type T ?, as follows.
= ? : ? iff ? reduces to a neutral proof.
For ? and ?0 canonical propositions, = ? : ? ? ?0 iff, for all such that = : ?, we have
= ? : ?0.
If ? reduces to the canonical proposition ?, then = ? : ? iff = ? : ?.
= P : ? =? ? iff = P + : ? ? ? and = P ? : ? ? ?.
= P : M =A?B M 0 iff, for all Q, N , N 0 such that = N : A and = N 0 : A and
= Q : N =A N 0, then we have = PNN0 Q : M N =B M 0N 0.
= M : A iff = M {} : M =A M .
Note that the last three clauses define = M : A and = P : M =A N simultaneously by
recursion on A.
I Definition 23 (Computable Substitution). Let ? be a substitution with domain dom ?. We
write = ? : ? and say that ? is a computable substitution on ? iff, for every entry z : T in ?,
we have = ?(z) : T [?].
We write = ? : ? = ? : ?, and say ? is a computable path substitution between ? and ?,
iff, for every term variable entry x : A in ?, we have = ? (x) : ?(x) =A ?(x).
I Lemma 24 (Conversion). If = E : S and S ??T then = E : T .
Proof. This follows easily from the definition and Lemma 20.
I Lemma 25 (Expansion). If = F : T and E ? F then = E : T .
Proof. An easy induction, using the fact that callbyname reduction respects path
substitution (Lemma 8). J
I Lemma 26 (Reduction). If = E : T and E ? F then = F : T .
Proof. An easy induction, using the fact that callbyname reduction is confluent (Lemma
7). J
I Definition 27. We introduce a closed term cA for every type A such that = cA : A.
def
c? = ?
cA?B d=ef ?x : A.cB
I Lemma 28. = cA : A
Proof. An easy induction on A.
J
J
I Lemma 29 (Weak Normalization).
1. If = ? : ? then ? reduces to either a neutral proof or canonical proof.
2. If = P : M =A N then P reduces either to a neutral path or canonical path.
3. If = M : A then M reduces either to a canonical proposition or a ?term.
Proof. We prove by induction on the canonical proposition ? that, if = ? : ?, then ? reduces
to a neutral proof or a canonical proof of ?.
If = ? : ? then ? reduces to a neutral proof. Now, suppose = ? : ? ? ?0. Then = ?p : ?0,
so ?p reduces to either a neutral proof or canonical proof by the induction hypothesis. This
reduction must proceed either by reducing ? to a neutral proof, or reducing ? to a ?proof
then ?reducing.
We then prove by induction on the type A that, if = P : M =A N , then P reduces to a
neutral path or a canonical path. The two cases are straightforward.
Now, suppose = M : A, i.e. = M {} : M =A M . Let A ? A1 ? ? ? ? ? An ? ?. Then
= M {}cA1 cA1 cA1 {}cA2 cA2 ? ? ? cAn {} : M cA1 ? ? ? cAn =? M cA1 ? ? ? cAn .
Therefore, M cA1 ? ? ? cAn reduces to a canonical proposition. The reduction must consist
either in reducing M to a canonical proposition (if n = 0), or reducing M to a ?expression
then performing a ?reduction. J
I Lemma 30. If = M : A ? B then M reduces to a ?expression.
Proof. Similar to the last paragraph of the previous proof.
J
I Lemma 31. For any term ? that reduces to a canonical proposition, we have = ref (?) :
? =? ?.
Proof. In fact we prove that, for any terms M and ? such that ? reduces to a canonical
proposition, we have = ref (M ) : ? =? ?.
It is sufficient to prove the case where ? is a canonical proposition. We must show that
= ref (M )+ : ? ? ? and = ref (M )? : ? ? ?. So let = ? : ?. Then = ref (M )+ ? : ? and
= ref (M )? ? : ? by Expansion (Lemma 25), as required. J
I Lemma 32. = ? : ? if and only if ? reduces to a canonical proposition.
Proof. If = ? : ? then = ?{}+ : ? ? ?. Therefore ? ? ? reduces to a canonical proposition,
and so ? must reduce to a canonical proposition.
Conversely, suppose ? reduces to a canonical proposition ?. We have ?{} ?{}, and
?{} ref (?) for every canonical proposition ?. Therefore, = ?{} : ? =? ? by Expansion
(Lemma 25). Hence = ? : ?. J
I Lemma 33. If ? is a neutral proof and ? reduces to a canonical proposition, then = ? : ?.
Proof. It is sufficient to prove the case where ? is a canonical proposition. The proof is by
induction on ?.
If ? ? ?, then = ? : ? immediately from the definition.
If ? ? ? ? ?, then let = : ?. We have that ? is neutral, hence = ? : ? by the
induction hypothesis. J
I Lemma 34. Let = M : A and = N : A. If P is a neutral path, then = P : M =A N .
Proof. The proof is by induction on A.
For A ? ?: we have that P + and P ? are neutral proofs, and M and N reduce to
canonical propositions (by Lemma 32), so = P + : M ? N and = P ? : N ? M by Lemma
33, as required.
For A ? B ? C: let = L : B, = L0 : B and = Q : L =B L0. Then we have = M L : C,
= N L0 : C and PLL0 Q is a neutral path, hence = PLL0 Q : M L =C N L0 by the induction
hypothesis, as required. J
I Lemma 35. If = M : A then = ref (M ) : M =A M .
Proof. If A ? ?, this is just Lemma 31.
So suppose A ? B ? C. Using Lemma 30, Reduction (Lemma 26) and Expansion
(Lemma 25), we may assume that M is a ?term. Let M ? ?y : D.N .
Let = L : B and = L0 : B and = P : L =B L0. We must show that
= ref (?y : D.N )LL0 P : (?y : D.N )L =C (?y : D.N )L0 .
By Expansion and Conversion, it is sufficient to prove
= N {y := P : L = L0} : N [y := L] =C N [y := L0] .
We have that = (?y : D.N ){} : ?y : D.N =B?C ?y : D.N , and so
= (???e : y =D y0.N {y := e : y = y0})LL0 P : (?y : D.N )L =C (?y : D.N )L0 ,
and the result follows by Reduction and Conversion.
I Lemma 36. If = P : ? =? ?0 and = Q : ? =? ?0 then = P ?? Q : ? ? ? =? ?0 ? ?0.
Proof. By Reduction (Lemma 26) and Expansion (Lemma 25), we may assume that P and
Q are either neutral, or have the form ref (?) or univ?,? ( , ?) or ???e : x =A y.?.
?
We cannot have that P reduces to a ???path; for let ?0 reduce to the canonical proposition
?1 ? ? ? ? ? ?n ? ?. Then we have
J
= P +pq1 ? ? ? qn : ?
and so P +pq1 ? ? ? qn must reduce to a neutral path. Similarly, Q cannot reduce to a ???path.
If either P or Q is neutral then P ?? Q is neutral, and the result follows from Lemma 34.
Otherwise, let = ? : ? ? ? and = ?0. We must show that = (P ?? Q)+? : ?0.
If P ? ref (M ) and Q ? ref (N ), then we have
(P ?? Q)+? ? ref (M ? N )+ ? ? ? .
Now, = P ? : ?, hence = : ? by Reduction, and so = ? : ?. Therefore, = Q+(? ) : ?0,
and hence by Reduction = ? : ?0 as required.
If P ? ref (M ) and Q ? univN,N0 (?, ?0), then we have
(P ?? Q)+? ? univM?N,M?N0 (?pq.?(pq), ?pq.?0(pq))+ ?
We have = P ? : ?, hence = : ? by Reduction, and so = ? : ?. Therefore, = Q+(? ) : ?0,
and hence by Reduction = ?(? ) : ?0 as required.
The other two cases are similar. J
I Lemma 37. If = ? : ? ? ? and = : ? ? ? then = univ?,? (?, ) : ? =? ?.
Proof. We must show that = univ?,? (?, )+ : ? ? ? and = univ?,? (?, )? : ? ? ?. These
follow from the hypotheses, using Expansion (Lemma 25). J
5
Proof of Canonicity
I Theorem 38.
1. If ? ` J and = ? : ?, then = J [?].
2. If ? ` M : A and = ? : ? = ? : ?, then = M {? : ? = ?} : M [?] =A M [?].
Proof. The proof is by induction on derivations. Most cases are straightforward, using the
lemmas from Section 4. We deal with one case here, the rule (?T ).
?, x : A ` M : B
? ` ?x : A.M : A ? B
1. We must show that
= ?x : A.M [?] : A ? B .
So let = Q : N =A N 0. Define the path substitution ? by
? (x) ? Q,
? (y) ? ref (?(y)) (y ? dom ?)
Then we have = ? : (?, x := N ) = (?, x := N 0) : ?, x : A, and so the induction hypothesis
gives
= M {? } : M [?, x := N ] =B M [?, x := N 0]
We observe that M {? } ? M [?]{x := Q : N = N 0} (Lemma 3), and so by Expansion
(Lemma 25) and Conversion (Lemma 24) we have
= (?x : A.M [?]){}NN0 Q : (?x : A.M [?])N =B (?x : A.M [?])N 0
as required.
2. We must show that
= ???e : x =A y.M {? : ? = ?, x := e : x = y} : ?x : A.M [?] =A?B ?x : A.M [?] .
So let = P : N =A N 0. The induction hypothesis gives
and so we have
=(???e : x =A y.M {? : ? = ?, x := e : x = y})NN0 P
:(?x : A.M [?])N =B (?x : A.M [?])N 0
by Expansion and Conversion, as required.
= M {? : ? = ?, x := P : N = N 0} : M [?, x := N ] =B M [?, x := N 0] ,
J
I Corollary 39. Let ? be a context in which no term variables occur.
1. If ? ` ? : ? then ? reduces to a neutral proof or canonical proof.
2. If ? ` P : M =A N then P reduces to a neutral path or canonical path.
Proof. Let id be the substitution ? ? ? such that id(x) d=ef x. If ? ` valid then = id : ?
using Lemmas 33 and 34.
Therefore, if ? ` E : T then = E[id] : T [id], that is, = E : T . Hence E reduces to a
neutral expression or canonical expression. J
I Corollary 40 (Canonicity). Let ? be a context with no term variables.
1. If ? ` ? : ? then ? reduces to a neutral proof.
2. If ? ` ? : ? ? ? then ? reduces either to a neutral proof, or a proof ?p : ?0. where ? ???0
and ?, p : ? ` : ?.
3. If ? ` P : ? =? ? then P reduces either to a neutral path; or to ref (?) where ? ??? ???;
or to univ?0,?0 (?, ) where ? ???0, ? ???0, ? ` ? : ? ? ? and ? ` : ? ? ?.
4. If ? ` P : M =A?B M 0 then P reduces either to a neutral path; or to ref (N ) where
M ??M 0 ??N ; or to ???e : x =A y.Q where ?, x : A, y : A, e : x =A y ` Q : M x =B M 0y.
Proof. A closed expression cannot be neutral, so from the previous corollary every typed
closed expression must reduce to a canonical expression. We now apply case analysis to the
possible forms of canonical expression, and use the Generation Lemma. J
I Corollary 41 (Conistency). There is no ? such that ` ? : ?.
I Note 42. We have not proved canonicity for terms. However, we can observe that PHOML
restricted to terms and types is just the simplytyped lambda calculus with one atomic type
? and two constants ? and ?; and our reduction relation restricted to this fragment is head
reduction. Canonicity for this system is already a wellknown result (see e.g. [4, Ch. 4]).
6
Conclusion and Future Work
We have presented a system with propositional extensionality, and shown that it satisfies the
property of canonicity. This gives hope that it will be possible to find a computation rule for
homotopy type theory that satisfies canonicity, and that does not involve extending the type
theory, either with a nominal extension of the syntax as in cubical type theory or otherwise.
We now intend to do the same for stronger and stronger systems, getting ever closer to
full homotopy type theory. The next steps will be:
a system with infinitely many propositional universes ?0, ?1, . . . , where each equations
M =A N is an object of a universe ?n for some n, allowing us to form propositions such
as M =A N ? N =A M .
a system with universal quantification over the types A, allowing us to form propositions
such as ?x : A.x =A x and ?x, y : A.x =A y ? y =A x
Ultimately, we hope to approach full homotopy type theory. The study of how the
reduction relation and its properties change as we move up and down this hierarchy of
systems should reveal facts about computing with univalence that might be lost when
working in a more complex system such as homotopy type theory or cubical type theory.
2
4
5
6
7
8
9
10
11
Cyril Cohen, Thierry Coquand, Simon Huber, and Anders M?rtberg. Cubical type theory:
a constructive interpretation of the univalence axiom. CoRR, abs/1611.02108, 2016. URL:
http://arxiv.org/abs/1611.02108.
JeanYves Girard. Proofs and Types. Cambridge University Press, 1989.
Martin Hofmann. Syntax and semantics of dependent types. In Semantics and Logics of
Computation, pages 79?130. Cambridge University Press, 1997.
Simon Huber. Canonicity for cubical type theory. CoRR, abs/1607.04156, 2016. arXiv:
1607.04156.
Daniel R. Licata and Robert Harper. Canonicity for 2dimensional type theory. In John
Field and Michael Hicks, editors, POPL, pages 337?348. ACM, 2012. doi:10.1145/
2103656.2103697.
Zhaohui Luo. Computation and Reasoning: A Type Theory for Computer Science.
Number 11 in International Series of Monographs on Computer Science. Oxford University Press,
1994.
Andrew Polonsky. Internalization of extensional equality. CoRR, abs/1401.1148, 2014.
arXiv:1401.1148.
W. W. Tait. Intensional iinterpretation of ffunctional of finite type i. Journal of Symbolic
Logic, 32:198?212, 1967.
The Univalent Foundations Program. Homotopy Type Theory: Univalent Foundations of
Mathematics. The Univalent Foundations Program, Institute for Advanced Study, 2013.
URL: https://homotopytypetheory.org/book.
A
Calculation in Cubical Type Theory
We can prove that, if X is a proposition, then the type ?f : > ? X.P ath X x (f I) is
contractible (we omit the details). Let e[X, x, p] be the term such that
X : Prop, x : X.1, p : ?f : > ? X.1.Path X.1 x (f I)
`e[X, x, p] : Path (?f : > ? X.1.Path X.1 x (f I)) h?t : >.x, 1X.1i p
Let step1[X, x] d=ef hh?t : >.x, 1X.1i, ?p : ?f : > ? X.1.Path X.1 x (f I).e[X, x, p]i. Then
X : Prop, x : X.1 ` step1[X, x] : isContr(?f : > ? X.1.Path X.1 x (f I)) .
Let step2[X] ? ?x : X.1.step1[X, x]. Then Let E[X] ? h?f : > ? X.1.f I, step2[X]i. Then
X : Prop ` E[X] : Equiv (> ? X.1) X.1
X : Prop ` step2[X] : isEquiv (> ? X.1) X.1 (?f : > ? X.1.f I) .
From this equivalence, we want to get a path from > ? X.1 to X.1 in U . We apply the
proof of univalence in [3]
Let P [X] ? hiiGlue[(i = 0) 7? (> ? X.1, E[X]), (i = 1) 7? (X.1, equivkX.1)]X.1. Then
X : Prop ` P [X] : Path U (> ? X.1) X.1
Let Q ? hii?x : Prop.P [X]i. Then
` Q : Path (Prop ? U ) F I
This is the term in cubical type theory that corresponds to ???e : x =? y.P in PHOML
(formula 3). We now construct terms corresponding to formulas (4) and (5):
` hiiH(Qi) : Path U (> ? >) >
` ?x : >.compi(H(Q(1 ? i)))[]x : > ? > ? >
Let us write output for this term:
output d=ef ?x : >.compi(H(Q(1 ? i)))[]x .
And we calculate (using the notation from [3] section 6.2):
= ?x : >.compi(Glue[(i = 1) 7? (> ? >, E[>]), (i = 0) 7? (>, equivk>)]>)[]x
output
= ?x : >.compi(Q(1 ? i)>)[]x
= ?x : >.compi(P [>](1 ? i))[]x
= ?x : >.glue[1F 7? t1]a1
= ?x : >.t1
= ?x : >.(equiv E[>] [] mapid> x).1
= ?x : >.(contr(step1[>, mapid> x])[]).1
= ?x : >.(compi
(?f : > ? >.Path > (mapid> x) (f I))
[]
h?t : >.mapid> x, 1mapid>(x)i).1
= ?x : >.mapid>?> (?y : >.mapid> x)
Therefore,
output m n
= mapid>?> (?y : >.mapid> m)n
? (compi(> ? >)[](?:>.mapid> m))n
= mapid> mapid> m
B
Proof of Confluence
I Lemma 44.
1. If E ? F then E B F .
2. If E F then E B? F .
3. If E B? F then E F .
Proof. These are easily proved by induction.
J
The proof follows the same lines as the proof given in [8].
I Definition 43 (Parallel OneStep Reduction). Define the notion of parallel onestep reduction
B by the rules given in Figure 3. Let B? be the transitive closure of B.
Our reason for defining B is that it satisfies the diamond property:
Reduction on Terms
(?x : A.M )N B M [x := N ]
Reduction on Proofs
M B M 0
M N B M 0N
Reduction on Paths
(???e : x =A y.P )MN Q B P [x := M, y := N, e := Q]
ref (?x : A.M )NN0 P B M {x := P : N = N 0}
ref (?) ?? ref (?) B ref (? ? ?)
ref (?) ?? univ?,? (?, ) B univ???,??? (?p : ? ? ?.?q : ?.?(pq), ?p : ? ? ?.?q : ?. (pq))
univ?,? (?, ) ?? ref (?) B univ???,??? (?p : ? ? ?.?q : ?.p( q), ?p : ? ? ?.?q : ?.p(?q))
univ?,? (?, ) ?? univ?0,?0 (?0, 0)
Buniv???0,???0 (?p : ? ? ?0.?q : ?.?0(p( q)), ?p : ? ? ?0.?q : ?. 0(p(?q)))
P B P 0
PMN Q B P M0N Q
M B N
ref (M )NN0 P B ref (M 0)NN0 P
ref (?) ?? ref (?) B ref (? ? ?) and ref (?) ?? ref (?) B ref (?0) ?? ref (?0)
where ? B ?0 and ? B ?0. In this case, we have ref (? ? ?) B ref (?0 ? ?0) and ref (?0) ??
ref (?0) B ref (?0 ? ?0). J
I Corollary 46. If E B? F and E B? G then there exists H such that F B? H and G B? H.
I Corollary 47. If E
Proof. Immediate from the previous corollary and Lemma 44.
J
1 Carlo Angiuli , Robert Harper, and Todd Wilson. Computational higherdimensional type theory . In Giuseppe Castagna and Andrew D. Gordon, editors, Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages, POPL 2017 , Paris, France, January 1820 , 2017 , pages 680  693 . ACM, 2017 . doi: 10 .1145/3093333.3009861.
In Ralph Matthes and Aleksy Schubert, editors, 19th International Conference on Types for Proofs and Programs (TYPES 2013 ), volume 26 of Leibniz International Proceedings in Informatics (LIPIcs) , pages 107  128 , Dagstuhl, Germany, 2014 . Schloss DagstuhlLeibnizZentrum fuer Informatik . doi: 10 .4230/LIPIcs.TYPES. 2013 . 107 .