Parametricity, Automorphisms of the Universe, and Excluded Middle
T Y P E S
Parametricity, Automorphisms of the Universe, and Excluded Middle
Michael Shulman 0 1 2 3 4
0 Supported by The United States Air Force Research Laboratory under agreement number FA955015 10053. The U.S. Government is authorized to reproduce and distribute reprints for Governmental purposes notwithstanding any copyright notation thereon. The views and conclusions contained herein endorsements, either expressed or implied, of the United States Air Force Research Laboratory, the U.S. Government, or Carnegie Mellon University
1 Department of Mathematics, University of San Diego, San Diego , USA
2 Auke B. Booij School of Computer Science, University of Birmingham , Birmingham , UK
3 Peter LeFanu Lumsdaine Mathematics Department, Stockholm University , Stockholm , Sweden
4 Marti?n H. Escardo? School of Computer Science, University of Birmingham , Birmingham , UK
It is known that one can construct nonparametric functions by assuming classical axioms. Our work is a converse to that: we prove classical axioms in dependent type theory assuming specific instances of nonparametricity. We also address the interaction between classical axioms and the existence of automorphisms of a type universe. We work over intensional MartinL?f dependent type theory, and for some results assume further principles including function extensionality, propositional extensionality, propositional truncation, and the univalence axiom. 2012 ACM Subject Classification Theory of computation ? Type theory Acknowledgements The firstnamed author would like to thank Uday Reddy for discussions about parametricity. We would also like to thank JeanPhilippe Bernardy for helpful comments, and Andrej Bauer for discussions and questions. The fact that the implication DNE ? LEM in Lemma 14 requires 0valued function extensionality was spotted by one of the referees. Since then, we have formalized the results to make sure we didn't miss similar assumptions. All results of the paper, except Section 3.1, are formalized in Agda [3]. All results of Sections 3.1 and 3.2 are formalized in Coq [6] in the files Spaces/BAut/Rigid.v and Spaces/Universe.v. So some results have been formalized twice, and no numbered result has been left unformalized.
and phrases relational parametricity; dependent type theory; univalent foundations; homotopy type theory; excluded middle; classical mathematics; constructive mathematics

1
Introduction: Parametricity in dependent type theory
Broadly speaking, parametricity statements assert that typepolymorphic functions definable
in some system must be natural in their type arguments, in some suitable sense. Reynolds?
original theory of relational parametricity [12] characterizes terms of the polymorphically
typed ?calculus System F. This theory has since been extended to richer and more expressive
type theories: to pure type systems by Bernardy, Jansson, and Paterson [2], and more
specifically to dependent type theory by Atkey, Ghani, and Johann [1].
Most parametricity results are metatheorems about a formal system and make claims
only about terms in the empty context. For instance, Reynolds? results show that the only
term of System F with type ??.? ? ? definable in the empty context is the polymorphic
identity function ??.?(x : ?).x. Similarly, Atkey, Ghani, and Johann [1, Thm. 2] prove
that any term f : QX:U X ? X definable in the empty context of MLTT must satisfy
e(fX (a)) = fY (e(a)) for all e : X ? Y and a : X in their model; it follows that f acts as the
identity on every type in their model, and hence no such closed term f can be provably not
equal to the polymorphic identity function.
Keller and Lasson showed that excluded middle is incompatible with parametricity of
the universe of types (in its usual formulation) [7]. In this paper, we show, within type
theory, that certain violations of parametricity are possible if and only if certain classical
principles hold. For example, we show that there is a function f : QX:U X ? X whose value
at the type 2 of booleans is different from the identity if and only if excluded middle holds
(Theorem 1, where one direction uses function extensionality).
These are theorems of dependent type theory, so they apply not only to closed terms
but in any context, and the violations of parametricity are expressed using negations of
MartinL?f?s identity type rather than judgemental (in)equality of terms. Similarly, we show
that excluded middle also follows from certain kinds of nontrivial automorphisms of the
universe.
We work throughout in intensional MartinL?f type theory, with at least ?, ?, identity,
finite, and natural numbers types, and a universe closed under these typeformers. For
concreteness, this may be taken to be the theory of [11], or of [14, A.2]. When results require
further axioms ? e.g. function extensionality, or univalence of the universe ? we include these
as explicit assumptions, to keep results as sharp as possible.
By the law of excluded middle, we mean always the version from univalent foundations [14,
3.4.1], namely that P + ?P for all propositions P . Here a type is called a ?proposition? (a
?mere proposition? in the terminology of [14]) if it has at most one element, meaning that
any two of its elements are equal in the sense of the identity type. Note that ?P (meaning
P ? 0) is not itself a proposition unless we assume function extensionality, at least for
0valued functions.
The propositional truncation of a type A is the universal proposition kAk admitting a
map from A. We axiomatize this as in [14, ?3.7], and always indicate explicitly when we are
assuming it. It is shown in [9] that propositional truncation implies function extensionality.
When propositional truncations exist, the disjunction of two propositions P ? Q is defined
to be kP + Qk. If P and Q are disjoint (i.e. ?(P + Q) holds), then P + Q is already a
proposition and hence equivalent to P ? Q. In particular, when we have propositional
truncations, the law of excluded middle could equivalently assert that P ? ?P for all
propositions P .
By a logical equivalence of types X and Y , written X ? Y , we mean two functions
X ? Y and Y ? X subject to no conditions at all.
By an equivalence of types X and Y we mean a function e : X ? Y that has both
a left and a right inverse, i.e. functions s, r : Y ? X with e(s(y)) = y for all y : Y and
r(e(x)) = x for all x : X. This notion of equivalence is logically equivalent to having a single
twosided inverse, which is all that we will need in this paper. But the notion of equivalence
is betterbehaved in univalent foundations (see [14, Chapter 4]); the reason is that the type
expressing ?being an equivalence? is a proposition, in the presence of function extensionality,
whereas the type expressing ?having a twosided inverse? may in general have more than one
inhabitant, in particular affecting the consistency of the univalence axiom.
2
Classical axioms from nonparametricity
In this section, we give a number of ways in which classical axioms can be derived from
specific violations of parametricity.
2.1
Polymorphic endomaps
Say that a function f : QX:U X ? X is natural under equivalence if for any two types X
and Y and any equivalence e : X ? Y , we have e(fX (x)) = fY (e(x)) for any x : X, where
we have written fX as a shorthand for f (X) and used the equality sign = to denote identity
types.
I Theorem 1. If there is a function f : QX:U X ? X such that f2 is not pointwise equal
to the identity (i.e. ? Qx:2 f2(x) = x) and f is natural under equivalence, then the law of
excluded middle holds. Assuming function extensionality, the converse also holds.
Proof. First we derive excluded middle from f . To begin, note that if ? Qx:2 f2(x) = x, then
we cannot have both f2(tt) = tt and f2(ff) = ff, since then we could prove Qx:2 f2(x) = x
by case analysis on x. But then by case analysis on f2(tt) and f2(ff), we must have
(f2(tt) = ff) + (f2(ff) = tt). Without loss of generality, suppose f2(tt) = ff.
Now let P be an arbitrary proposition. We do case analysis on fP +1(inr(?)) : P + 1.
1. If it is of the form inl(p) with p : P , we conclude immediately that P holds.
2. If it is of the form inr(?), then P cannot hold, for if we had p : P , then the map
e : 2 ? P + 1 defined by e(ff) = inl(p) and e(tt) = inr(?) would be an equivalence, and
hence e(f2(x)) = fP +1(e(x)) for all x : 2 and so inl(p) = e(ff) = e(f2(tt)) = fP +1(e(tt)) =
fP +1(inr(?)) = inr(?), which is a contradiction.
Therefore P or not P .
For the converse, [14, Exercise 6.9], suppose excluded middle holds, let X : U and
x : X, and consider the type Px0:X (x0 6= x), where a 6= b means ?(a = b). By excluded
middle, this is either contractible or not. (A type Y is contractible if Py:Y Qy0:Y (y = y0).
Assuming function extensionality, this is a proposition.) If it is contractible, define fX (x) to
be the center of contraction (the point y in the definition of contractibility); otherwise define
fX (x) = x. J
I Remark.
1. If we assume univalence, any f : QX:U X ? X is automatically natural under equivalence,
so that assumption can be dispensed with. And, of course, if function extensionality
holds (which follows from univalence) then the hypothesis ? Qx:2 f2(x) = x is equivalent
to f2 6= ?(x : 2).x.
2. We do not know whether the converse direction of Theorem 1 is provable without function
extensionality.
The preceding proof can be generalized as follows. We say that a point x : X is isolated
if the type x = y is decidable for all y : Y , i.e. if we have Qy:X (x = y) + (x 6= y).
I Lemma 2. A point x : X is isolated if and only if X is equivalent to Y + 1, for some
type Y , by a map that sends x to inr(?).
Proof. Since inr(?) is isolated, such an equivalence certainly implies that x is isolated.
Conversely, from Qy:X (x = y) + (x 6= y) we can construct a function d : X ? 2 such
that d(y) = tt if and only if x = y and d(y) = ff, and if and only if x 6= y. Let Y be
Py:X (d(y) = ff); it is straightforward to show X ' Y + 1.
If we had function extensionality (for 0valued functions), we could dispense with d and
define Y = Py:X (x 6= y), since then x 6= y would be a proposition. In general we use
d(y) = ff as it is always a proposition (since 2 has decidable equality, hence its identity
types are propositions by Hedberg?s theorem); this is necessary to show that the composite
Y + 1 ? X ? Y + 1 acts as the identity on Y . J
I Theorem 3. If there is a function f : QX:U X ? X such that fX (x) 6= x for some
isolated point x : X and f is natural under equivalence, then the law of excluded middle holds.
Assuming function extensionality, the converse also holds.
Proof. To derive excluded middle from f , let Y and X ' Y + 1 be as in Lemma 2, and let
P be an arbitrary proposition. We do case analysis on fP ?Y +1(inr(?)) : P ? Y + 1.
1. If it is of the form inl((p, y)) with p : P , we conclude immediately that P holds.
2. If it is of the form inr(?), then P cannot hold, for if we had p : P , then the map
e : X ? P ? Y + 1 defined by e(x) = inr(?) (where x is the isolated point) and
e(y) = inl((p, y)) for y 6= x would be an equivalence, and hence e(fX (x)) = fP ?Y +1(e(x)),
and so inl((p, fX (x))) = e(fX (x)) = fP ?Y +1(e(x)) = fP ?Y +1(inr(?)) = inr(?), which is
a contradiction.
Therefore either P or not P holds. The converse is proven exactly as in Theorem 1. J
Finally, if our type theory includes propositional truncations, we can dispense with
isolatedness.
I Theorem 4. In a type theory with propositional truncations, there is an equivalencenatural
function f : QX:U X ? X and a type X : U with a point x : X such that fX (x) 6= x if and
only if excluded middle holds.
Proof. For the ?if? direction, note that propositional truncation implies function
extensionality [9], so the converse direction of Theorem 1 applies. For the ?only if? direction, assume
that we are given f : QX:U X ? X, a type X : U and a point x : X with fX (x) 6= x. Let P
be any proposition, and define
Z = X kx = yk ? P,
y:X
z = (x, inl( reflx )) : Z,
y = pr1(fZ (z)) : X.
Recall that A ? B denotes the truncated disjunction kA + Bk. This binds more tightly than
?, so Z = Py:X (kx = yk ? P ). We write a : kAk for the witness induced by a point a : A.
Now the second projection pr2(fZ (z)) tells us that kx = yk ? P . However, if P holds,
then pr1 : Z ? X is an equivalence that maps z to x. Thus fZ (z) 6= z and hence x 6= y.
In other words, P ? (x 6= y), hence (x = y) ? ?P and so also kx = yk ? ?P . But since
kx = yk ? P , we have ?P ? P , which (in the presence of function extensionality) is equivalent
to excluded middle. J
I Remark.
1. If x : X happens to be isolated, then the type Z defined in the proof of Theorem 4 is
equivalent to the type P ? Y + 1 used in the proof of Theorem 3.
2. Since propositional truncation implies function extensionality [9], it makes excluded
middle into a proposition. Thus, the existence hypothesis of Theorem 4 can be truncated
or untruncated without change of meaning.
3. The hypothesis can also be formulated as ?there is a type X such that fX is apart from
the identity of X?, where two functions g, h : A ? B of types A and B are apart if there
is a : A with g(a) 6= h(a). We don?t know whether it is possible to derive excluded middle
from the weaker assumption that fX is simply unequal to the identity function of X, or
even that f is unequal to the polymorphic identity function.
The above can be applied to obtain classical axioms from other kinds of violations of
parametricity. As a simple example, consider f : QX:U (X ? X) ? (X ? X). Parametric
elements of this type are Church numerals. Given f , we can define a polymorphic endomap
g : QX:U X ? X by gX = fX (idX ), where idX is the identity function. If f is natural under
equivalence, then so is g, and hence the assumption that f2(id2) is not the identity function
gives excluded middle, assuming function extensionality.
2.2
Maps of the universe into the booleans
A function f : U ? 2 is invariant under equivalence, or extensional, if we have f (X) = f (Y )
for any two equivalent types X and Y . We say that it is strongly nonconstant if we have
X, Y : U with f (X) 6= f (Y ). Assuming function extensionality, Escard? and Streicher [5,
Thm. 2.2] showed that if f : U ? 2 is extensional and strongly nonconstant, then the weak
limited principle of omniscience holds (any function N ? 2 is constant or not). Alex Simpson
strengthened this as follows (also reported in [5, Thm. 2.8]):
I Theorem 5 (Simpson). Assuming function extensionality for 0valued functions, there is
an extensional, strongly nonconstant function f : U ? 2 if and only if weak excluded middle
holds (meaning that ?A + ??A for all A : U ).
Proof. In one direction, suppose weak excluded middle, and define f : U ? 2 by f (A) = ff
if ?A and f (A) = tt if ??A. Then f (0) = ff and f (1) = tt, so f is strongly nonconstant.
Extensionality follows from the observation that if A ' B then ?A ? ?B and ??A ? ??B.
In the other direction, suppose f : U ? 2 is extensional, and strongly nonconstant
witnessed by types X, Y : U with f (X) 6= f (Y ). Suppose without loss of generality that
f (X) = tt and f (Y ) = ff. For any A : U , define Z = ?A ? X + ??A ? Y . If A, then ?A ' 0
and ??A ' 1 (using function extensionality), so Z ' Y and f (Z) = ff. Similarly, if ?A,
then Z ' X and so f (Z) = tt. On the other hand, f (Z) must be either tt or ff and not both.
If it is tt, then it is not ff, and so ?A; while if it is ff, then it is not tt, and so ??A. J
In Theorem 6 below we reuse Simpson?s argument to establish a similar conclusion for
polymorphic functions into the booleans.
2.3
Polymorphic maps into the booleans
A function f : QX:U X ? 2 is invariant under equivalence if we have fY (e(x)) = fX (x) for
any equivalence e : X ? Y and point x : X. Such a function ?violates parametricity? if it is
nonconstant. Equivalence invariance means that some such violations are literally impossible:
for instance, there cannot be a type X with points x, y : X such that fX (x) 6= fX (y) if there
is an automorphism of X that maps x to y.
A violation of constancy across types, rather than at a specific type, is equivalent to weak
excluded middle.
I Theorem 6. Assuming function extensionality for 0valued functions, weak excluded middle
holds if and only if there is an f : QX:U X ? 2 that is invariant under equivalence, together
with X, Y : U with isolated points x : X and y : Y such that fX (x) 6= fY (y).
Proof. Assuming weak excluded middle, to show the existence of such an f , let X : U and
x : X. Then use weak excluded middle to decide ?(Px0:X x 6= x0) + ??(Px0:X x 6= x0). In
the left case, expressing that there are no other elements in X than x, define fX (x) = ff, and
in the right case define fX (x) = tt. So, for example, f1(?) = ff and f2(tt) = tt, showing that
we constructed a nonconstant f as required.
For the other direction, without loss of generality, fX (x) = tt and fY (y) = ff. By
assumption, X is equivalent to 1 + X0 via an equivalence that sends x to inl(?), and similarly
Y is equivalent to 1 + Y 0 via an equivalence that sends y to inl(?). Let A : U and define
Z = (1 + ?A ? X0) ? (1 + ??A ? Y 0),
z = (inl(?), inl(?)).
By the invariance under equivalence of f ,
1. if ?A then Z ' X via an equivalence that sends z to x, thus fZ (z) = tt,
2. if A then Z ' Y via an equivalence that sends z to y, thus fZ (z) = ff.
The contrapositives of these two implications are respectively
Hence we can decide ?A by case analysis on the value of fZ (z).
J
Provided our type theory includes propositional truncations, we can dispense with
isolatedness as in Theorem 4, assuming the types x = x and y = y are propositions.
I Theorem 7. In a type theory with propositional truncations, weak excluded middle holds
if and only if there is an f : QX:U X ? 2 that is invariant under equivalence, together with
X, Y : U with x : X and y : Y such that fX (x) 6= fY (y), where the types x = x and y = y
are propositions.
Proof. Assuming weak excluded middle, the existence of such an f is shown as in the proof
of Theorem 6.
For the other direction, without loss of generality, fX (x) = tt and fY (y) = ff. Note that
since x = x and y = y are propositions, so are x = x0 and y = y0 for any x0 : X and y0 : Y ,
since as soon as they have a point they are equivalent to x = x and y = y respectively. Let
A : U and define
Z =
! ? ?
X (x = x0) ? ?A ? ?X (y = y0) ? ??A? ,
x0:X y0:Y
z = ((x, inl(refl)), (y, inl(refl))).
By invariance under equivalence of f , we have the following.
1. If ?A then Z ' X via an equivalence that sends z to x, thus fZ (z) = tt. This works
because the left factor of Z becomes equivalent to X, and the right factor equivalent to 1
by the assumptions that y = y is a proposition and ?A.
2. Similarly, if A then Z ' Y via an equivalence that sends z to y, thus fZ (z) = ff, now
using the fact that x = x is a proposition.
The contrapositives of these two implications are respectively
Hence we can decide ?A by case analysis on the value of fZ (z).
J
I Remark. In a type theory with pushouts, the assumptions that x = x and y = y are
propositions can be removed by using the join (x = x0) ? ?A instead of the disjunction
(x = x0) ? ?A in the left factor of Z, and similarly for the right factor of Z. (The join B ? C
of types B and C is the pushout of B and C under B ? C.) This works since joining with an
empty type is the identity, while joining with a contractible type gives a contractible result;
see Theorem 9 below for details. Indeed, the join of two propositions is their disjunction,
by [13, Lemma 2.4]; but the version using joins does not quite subsume the one using
disjunctions, since if joins are not already assumed to exist, we do not know how to show
that the disjunction of two propositions is their join.
2.4
Decompositions of the universe
Theorem 5 can be interpreted as saying that the universe U cannot be decomposed into two
disjoint inhabited parts without weak excluded middle. In fact, disjointness of the parts is
not necessary. All that is needed is that both parts be proper, i.e. not the whole of U :
I Theorem 8. In a type theory with propositional truncation and function extensionality
for 0valued functions, suppose we have equivalenceinvariant P, Q : U ? U such that for all
Z : U we have P (Z) ? Q(Z), and that we have types X and Y such that ?P (X) and ?Q(Y ).
Then weak excluded middle holds.
Proof. For any A : U , let Z = ?A ? X + ??A ? Y as in Simpson?s proof. If A, then Z ' Y ,
and so ?Q(Z); thus Q(Z) ? ?A. But if ?A, then Z ' X, and so ?P (Z); thus P (Z) ? ??A.
Hence the assumed P (Z) ? Q(Z) implies ?A ? ??A, which is equivalent to ?A + ??A since
?A and ??A are (by function extensionality) disjoint propositions. J
The proof of Theorem 7 can be similarly adapted.
I Theorem 9. In a type theory with propositional truncation and 0valued function
extensionality, suppose we have P, Q : QX:U X ? U that are invariant under equivalence, i.e. if
X ' Y by an equivalence sending x : X to y : Y , then PX (x) ' PY (y), and likewise for Q.
Suppose also that for all Z : U and z : Z we have PZ (z) ? QZ (z), and types X, Y with points
x : X and y : Y such that ?PX (x) and ?QY (y). Finally, suppose either that our type theory
has pushouts or that the types x = x and y = y are propositions. Then weak excluded middle
holds.
Proof. For variety in contrast to Theorem 7, suppose we have pushouts; we leave the other
case to the reader. Let A : U and define
Z
=
X (x = x0) ? ?A
x0:X
? ?X(y = y0) ? ??A? ,
y0:Y
!
?
?
z =
((x, inl(refl)), (y, inl(refl))).
Then if A, ?A ' 0, so (x = x0) ? ?A ' (x = x0), and thus the first factor of Z is equivalent
to Px0:X (x = x0), which is a ?singleton? or ?based path space? and hence equivalent to
1. On the other hand (still assuming A), ??A ' 1, so (y = y0) ? ??A ' 1, and thus the
right factor of Z is equivalent to Py0:Y 1 and hence to Y . Thus, A implies Z ' Y , and it is
easy to check that this equivalence sends z to y. Hence A ? ?QZ (z), and so QZ (z) ? ?A.
A dual argument shows that ?A ? ?PZ (z) and thus PZ (z) ? ??A, so the assumption
PZ (z) ? QZ (z) gives weak excluded middle. J
Since a function QX:U X ? B, for any fixed B, is the same as a function (PX:U X) ? B,
we can interpret Theorem 9 as saying that the universe PX:U X of pointed types also cannot
be decomposed into two proper parts without weak excluded middle.
The results discussed so far illustrate that different violations of parametricity have
different prooftheoretic strength: some violations are impossible, while others imply varying
amounts of excluded middle.
3
Classical axioms from automorphisms of the universe
There have been attempts to apply parametricity to show that the only automorphism of
a universe of types is the identity. Nicolai Kraus observed in the HoTT mailing list [8]
that, assuming univalence, automorphisms of a universe U living in a universe V correspond
to elements of the loop space2 ?(V, U ), while elements of the higher loop space ?2(V, U )
correspond to ?polymorphic automorphisms? QX:U X ' X, which are at least as strong
as polymorphic endomaps. In particular, nontrivial elements of ?2(V, U ) imply violations
of parametricity for QX:U X ? X. This suggests that parametricity may play a role in
automorphisms of the universe.
We are not aware of a proof that parametricity implies that the only automorphism of the
universe is the identity. However, in the spirit of the above development, we can show that
automorphisms with specific properties imply excluded middle. First, however, we observe
that if we do have excluded middle then we can construct various nontrivial automorphisms
of the universe.
3.1
Automorphisms from excluded middle
The simplest automorphism of the universe is defined as follows. By propositional
extensionality we mean that any two logically equivalent propositions are equal. (This follows
from propositional univalence, i.e. univalence asserted only for propositions. The converse
holds at least assuming function extensionality; we do not know whether this assumption is
necessary.)
2 The loop space ?(X, x) of a type X at a point x : X is the identity type x = x; see [14, ?2.1].
I Theorem 10. Assuming excluded middle, function extensionality, and propositional
extensionality, there is an automorphism f : U ' U such that f (1) ' 0.
Proof. Given a type X, we use excluded middle to decide if it is a proposition (this works
because under function extensionality, being a proposition is itself a proposition). If it is, we
define f (X) = ?X, and otherwise we define f (X) = X. Assuming propositional extensionality
and excluded middle, we have ??X = X for any proposition; thus f (f (X)) = X whether X
is a proposition or not, and hence f is a selfinverse equivalence. J
UA + UB + U6=A,B, where
We can try to construct other automorphisms of the universe by permuting some other
subclass of types. For instance, if we have propositional truncation, then given any two
nonequivalent types A and B, excluded middle implies that for any type X we have
kX = Ak + kX = Bk + (X =6 A ? X 6= B), so that the universe U decomposes as a sum
UA = X kX = Ak ,
X:U
UB = X kX = Bk ,
X:U
U6=(A,B) = X(X 6= A ? X 6= B).
X:U
(This requires function extensionality for X 6= A and X 6= B to be propositions, but
not univalence.) Thus, if UA ' UB we can switch those two summands to produce an
automorphism of U :
I Theorem 11. Assuming function extensionality and excluded middle, if A 6' B and
UA ' UB, then there is an automorphism f : U ' U such that kf (A) = Bk, hence f 6= id.
Proof. We use the above decomposition and the given equivalence UA ' UB to produce f .
And since f maps UA to UB, by definition of UB we have kf (A) = Bk. J
This leads to the question, when can we have UA ' UB but A 6' B? Theorem 10 is
the simplest example of this: assuming propositional extensionality, both U0 and U1 are
contractible, hence equivalent to 1. More generally, let us call a type X rigid if UX is
contractible; then we have:
I Theorem 12. Assuming function extensionality and excluded middle, if A and B are rigid
types with A 6' B, then there is an automorphism f : U ' U such that f (A) ' B.
Proof. This follows from Theorem 11. In the rigid case we get the stronger conclusion that
f (A) ' B, since UB is contractible. J
More generally, under excluded middle any permutation of the rigid types yields an
automorphism of the universe.
If we assume UIP, then every type is rigid, so that with UIP and excluded middle there
are plenty of automorphisms of the universe. If we instead assume univalence ? as we will do
for the rest of this subsection ? most types are not rigid. For instance, any type with two
distinct isolated points, such as N, is not rigid, since we can swap the isolated points to give
a nontrivial automorphism and hence a nontrivial equality in UX . In particular, if excluded
middle holds and X is a set (i.e. its identity types are all propositions), then all points of X
are isolated. Thus, with excluded middle and univalence, no set with more than one element
(i.e. with points x, y : X such that x 6= y) is rigid.
However, there exist types that are connected (i.e. kXk and Qx,y:X kx = yk), but that
are not trivial; indeed, as remarked above, UA is such a type. Moreover, if we also assume
higher inductive types, then from any group G that is a set we can construct a connected
type BG such that ?(BG) ' G [10, ?3.2].
This leads us to ask, when is BG rigid for a setgroup G? Since BG is a 1type (i.e.
its identity types are all sets), UBG is a 2type (i.e. its identity types are all 1types).
Hence it is contractible as soon as its loop space is connected and its double loop space is
contractible. In general, the connected components of ?(UBG) are the outer automorphisms
of G (equivalence classes of automorphisms of G modulo conjugation), while ?2(UBG) is
the center of G (the subgroup of elements that commute with everything). A group with
trivial outer automorphism group and trivial center is sometimes known as a complete group
(though there is no apparent relation to any topological notion of completeness), and there
are plenty of examples.
For instance, the symmetric group Sn is complete in this sense except when n = 2 or 6.
Thus, BSn is rigid for n ?/ {2, 6}. (Note also that BSn can be constructed without higher
inductive types ? but with univalence ? as U[n], where [n] is a finite nelement type, although
of course this type only lives in a larger universe V.) In particular, assuming univalence and
excluded middle, there are countably infinitely many rigid types, and hence uncountably
many nontrivial automorphisms of U (one induced by every permutation of the types BSn
for n ?/ {2, 6}).
This does not exhaust the potential automorphisms of U . For instance, we have:
I Theorem 13. Let X be an ntype for some n ? ?1, and let A and B be nconnected rigid
types such that X ? A 6' X ? B. Then assuming univalence and excluded middle, there is an
automorphism f : U ' U such that kf (X ? A) = (X ? B)k.
Proof. We will show that UX?A ' UX?B, by showing that both are equivalent to UX . It
suffices to consider A. We have (Z 7? Z ? A) : UX ? UX?A, and since both types are
connected it suffices to show that it induces an equivalence of loop spaces ?UX ? ?UX?A, or
equivalently that the induced map L : (X ' X) ? (X ? A ' X ? A) is an equivalence. Since
A is nconnected for n ? ?1, we have kAk; so since being an equivalence is a proposition we
may assume given a0 : A.
We claim that for all a : A, x : X, and f : X ? A ? X ? A we have
pr1(f (x, a)) = pr1(f (x, a0)).
(1)
Since this goal is an equality in the ntype X, it is an (n?1)type. And since A is nconnected,
the map a0 : 1 ? A is (n ? 1)connected by [14, Lemma 7.5.11]. Thus, by [14, Lemma 7.5.7],
it suffices to assume that a = a0, in which case (1) is clear.
It follows from (1) that if we define M : (X ? A ? X ? A) ? (X ? X) by M (f )(x) =
pr1(f (x, a0)), then M preserves composition and identities. Thus it preserves equivalences,
inducing a map (X ? A ' X ? A) ? (X ' X). We easily have M ? L = id, so to prove
L ? M = id it suffices to show that M is leftcancellable, i.e. that (M f = M g) ? (f = g).
Since M preserves composition, for this it suffices to show that if M f = id then f = id. But
if M f = id, then by (1) we have pr1(f (x, a)) = x for all a : A. Thus f (x, a) = (x, gx(a)),
where gx : A ' A for each x : X. But A is rigid, so each gx = id, hence f = id. J
For instance, we could take n = 0 and X = 2, so that X ? A ' A + A. Thus if A and B
are any connected rigid types, an automorphism of U can swap A + A with B + B.
There might also be rigid types that are not of the form BG, or types A, B not built out
of rigid ones but such that A 6' B and UA ' UB. But now we will leave such questions and
turn to the converse: when does an automorphism of U imply excluded middle?
3.2
Excluded middle from automorphisms
In fact, without function extensionality, we can only derive a slightly weaker form of excluded
middle from a nontrivial automorphism of the universe. As defined in the introduction, the
law of excluded middle (LEM) is
Y isProp(P ) ? P + ?P.
P :U
Y isProp(P ) ? ??P ? P.
P :U
We will instead derive the law of doublenegation elimination (DNE), which is
Notice that if 0valued function extensionality holds, then ?P is a proposition (even if P is
not a proposition) and hence, if P is a proposition, P + ?P is a proposition equivalent to
P ? ?P . In firstorder or higherorder logic, the corresponding schemas or axioms of excluded
middle and doublenegation elimination are equivalent, but, in type theory, one direction
seems to require some amount of function extensionality:
I Lemma 14.
1. LEM implies DNE.
2. DNE implies LEM assuming 0valued function extensionality.
Proof. (1): Assume LEM and let P : U with isProp(P ) and assume ??P . By excluded
middle, either P or ?P . In the first case we are done, and the second contradicts ??P .
(2): Assume DNE and let P : U with isProp(P ). By 0valued function extensionality, P + ?P
is a proposition, and hence DNE gives P + ?P , because we always have ??(P + ?P ). J
I Lemma 15. DNE holds if and only if every proposition is logically equivalent to the
negation of some type.
Proof. (?): DNE gives that any proposition P is logically equivalent to the negation of
the type ?P . (?): For any two types A and B, we have that A ? B implies ?B ? ?A.
Hence A ? B also gives ??A ? ??B. And, because X ? ??X for any type X, we have
???X ? ?X. Therefore, if P is logically equivalent to the negation of X, we have the chain
of implications ??P ? ???X ? ?X ? P . J
Our first automorphism of the universe constructed from excluded middle swapped the
empty type with the unit type. We now show that conversely, any such automorphism
implies DNE and hence, assuming 0valued function extensionality, also LEM. In fact, not
even an embedding of U into itself that maps the unit type to the empty type is possible
without classical axioms:
I Theorem 16. Assuming propositional extensionality, if there is a leftcancellable map
f : U ? U with f (1) = 0, then DNE holds.
Proof. For an arbitrary proposition P , we have:
P ? P = 1
? f (P ) = f (1)
? f (P ) = 0
? ?f (P )
(by propositional extensionality)
(Note that if ?f (P ), then f (P ) ? 0, so f (P ) is a proposition and we can apply propositional
extensionality to get f (P ) = 0.) Hence P is logically equivalent to the negation of the type
f (P ), and therefore Lemma 15 gives DNE. J
I Corollary 17. Assuming propositional extensionality, if there is an automorphism of the
universe that maps the unit type to the empty type, then DNE holds.
Now let us further assume univalence and propositional truncations. This implies function
extensionality, so the difference between DNE and LEM disappears. Furthermore, we can
additionally generalize the result as follows. Say that a type A is inhabited if the unique
map A ? 1 is surjective. This is equivalent to giving an element of the propositional
truncation kAk.
I Lemma 18. Assuming univalence and propositional truncations, if A is an inhabited type,
then any proposition P is logically equivalent to the identity type (P ? A) = A.
Proof. If P then P ' 1, so (P ? A) ' A, and hence by univalence (P ? A) = A. Conversely,
assume (P ? A) = A. Then kP ? Ak = kAk = 1 by univalence, as A is inhabited. So
kP k ? kAk = 1, and hence P = 1. J
Using this, we can weaken the hypothesis of Lemma 16 to the requirement that f maps some
inhabited type to the empty type, and get the same conclusion, at the expense of requiring
univalence rather than just propositional extensionality:
I Lemma 19. Assuming univalence and propositional truncations, if there is a leftcancellable
map f : U ? U with f (A) = 0 for some inhabited type A, then excluded middle holds.
Proof. For an arbitrary proposition P , we have:
P ? (P ? A) = A
? f (P ? A) = f (A)
? f (P ? A) = 0
? ?f (P ? A)
(by Lemma 18)
(because f is leftcancellable)
(by the assumption that f (A) = 0)
(by propositional extensionality).
Hence P is logically equivalent to the negation of the type f (P ? A), and therefore Lemma 15
gives DNE. But univalence gives function extensionality, and hence Lemma 14 gives LEM. J
I Theorem 20. Assuming univalence and propositional truncations, if there is an
automorphism of the universe that maps some inhabited type to the empty type, then excluded
middle holds.
I Corollary 21. Assuming univalence and propositional truncations, if there is an
automorphism g : U ? U of the universe with g(0) 6= 0, then the double negation
?? Y isProp(P ) ? P + ?P
P :U
of the law of excluded middle holds.
(Note that this is not the same as
Y isProp(P ) ? ??(P + ?P ),
P :U
which is of course constructively valid without extra assumptions.)
Proof. Let f be the inverse of g. If g(0) then kg(0)k, and because f maps g(0) to 0, we
conclude that excluded middle holds by Theorem 20. But the assumption g(0) 6= 0 is
equivalent to ??g(0) by propositional extensionality, and so it implies the double negation
of excluded middle. J
It is in general an open question for which X the existence of an automorphism f : U ? U
with f (X) 6= X implies a nonprovable consequence of excluded middle [4]. Not even for
X = 1 do we know whether this is the case. However, the following two cases for X follow
from the case X = 0 discussed above:
I Corollary 22. Assuming univalence and propositional truncations, for universes U : V, if
there is an automorphism f : V ? V with f (X) 6= X for X = LEMU or X = ?? LEMU ,
then ?? LEMU holds.
Proof. Suppose that ? LEM , and hence X = 0. By Corollary 21, we obtain ?? LEM ,
U V
which implies ?? LEMU , contradicting the assumption. J
1
2
3
4
5
6
7
8
9
10
11
13
14
Robert Atkey , Neil Ghani, and Patricia Johann . A relationally parametric model of dependent type theory . In The 41st Annual ACM SIGPLANSIGACT Symposium on Principles of Programming Languages , POPL , San Diego, CA, USA, January 20  21 , 2014 , pages 503  516 , 2014 . doi: 10 .1145/2535838.2535852.
JeanPhilippe Bernardy , Patrik Jansson, and Ross Paterson . Proofs for free: Parametricity for dependent types . J. Funct. Program. , 22 ( 2 ): 107  152 , 2012 . doi: 10 .1017/ S0956796812000056.
Auke Booij . Agda development for ?parametricity, automorphisms of the universe, and excluded middle? , June 2017 . URL: https://github.com/abooij/ parametricityandlemagda.
Mart?n H?tzel Escard? . Automorphisms of U. Homotopy Type Theory mailing list , August 2014 . URL: https://groups.google.com/d/msg/homotopytypetheory/8CV0S2DuOI8/ blCo7x B7aoJ .
Mart?n H?tzel Escard? and Thomas Streicher . The intrinsic topology of MartinL?f universes . Ann. Pure Appl. Logic , 167 ( 9 ): 794  805 , 2016 . doi: 10 .1016/j.apal. 2016 . 04 .010.
HoTT Project . The homotopy type theory Coq library . http://github.com/HoTT/HoTT/, 2015 .
Chantal Keller and Marc Lasson . Parametricity in an impredicative sort . In Computer Science Logic (CSL'12)  26th International Workshop/21st Annual Conference of the EACSL, CSL 2012, September 36 , 2012 , Fontainebleau, France, pages 381  395 , 2012 .
doi:10 .4230/LIPIcs.CSL. 2012 . 381 .
Nicolai Kraus . Automorphisms of U. Homotopy Type Theory mailing list , August 2014 . URL: https://groups.google.com/d/msg/homotopytypetheory/8CV0S2DuOI8/ Phqpk7aMR7cJ.
Nicolai Kraus , Mart?n Escard?, Thierry Coquand, and Thorsten Altenkirch . Notions of Anonymous Existence in MartinL?f Type Theory . Logical Methods in Computer Science , 13 ( 1 ), 2017 . doi: 10 .23638/LMCS 13 ( 1 :15) 2017 .
Dan Licata and Eric Finster . EilenbergMacLane spaces in homotopy type theory . Logic in Computer Science (LICS) , 2014 . URL: http://dlicata.web.wesleyan.edu/pubs/ lf14em/lf14em.pdf.
Per MartinL?f . Intuitionistic type theory , volume 1 of Studies in Proof Theory. Lecture Notes . Bibliopolis, Naples, 1984 .
John C. Reynolds . Types, abstraction and parametric polymorphism . In IFIP Congress , pages 513  523 , 1983 .
Egbert Rijke . The join construction . arXiv:1701.07538 , 2017 .
The Univalent Foundations Program. Homotopy Type Theory: Univalent Foundations of Mathematics. The Univalent Foundations Program, Institute for Advanced Study , 2013 .