All Lectures [01HX]
- September 13, 2025
- Jon Sterling
Lecture Dependent types I [01CO]
- August 11, 2025
- Jon Sterling
We aim to get familiar with the basic structure of dependent types. We will not treat dependent type theory as a formal system, but instead as a system of notations for a particular style of informal mathematics built up from a few basic forms of judgement.
Forms of judgement describe kinds of construction [01CP]
- August 11, 2025
- Jon Sterling
In a programming language like OCaml or Haskell, there are places in the grammar where you need to place a type, and there are other places where you need to place an element of a particular type. For example, when you write
let square : int -> int = fun x -> x * xin OCaml, you are asserting two things:
- You are asserting that the code
int -> intdescribes a type. A theoretician might write this as \mathsf {int}\to \mathsf {int}~\mathit {type}. - Moreover, you are asserting that the code
fun x -> x * xdescribes an element of the type described byint -> int. A theoretician might write this as \lambda x\mathpunct {.}x*x:\mathsf {int}\to \mathsf {int}.
The second assertion only makes sense when the first assertion obtains. Indeed, if I had changed int -> int to a bogus piece of code that does not describe a type, then it would not be meaningful to ask whether some other code describes an “element” of this non-type! That’s because only types can have elements.
Per Martin-Löf came up with some terminology that keeps all of this straight. Inspired by him, we define the following:
Informal definition Judgements and their assertion [01CQ]
- August 11, 2025
- Jon Sterling
A judgement is a specific thing that you can assert. For example “int -> int describes a type” is a judgement in OCaml.
Informal definition Forms of judgement [01CR]
- August 11, 2025
- Jon Sterling
A form of judgement is the general concept of which a specific judgement is an instance. For example, “describing a type” is a form of judgement whose instances include \mathsf {int}\to \mathsf {int}~\mathit {type} and \mathsf {int}~\mathit {type}, and many more. Theoreticians will write “A~\mathit {type}” to indicate the form of judgement, where A is understood schematically.
Informal definition Presuppositions [01CS]
- August 11, 2025
- Jon Sterling
Sometimes a form of judgement involves a parameter that is described by a different judgement; the latter is called its presupposition (of which there can be several). For example, the form of judgement for describing elements of a given type presupposes the given type. A theoretician may say something like “The form of judgement ‘a:A’ presupposes ‘A~\mathit {type}’.”.
Formal vs. informal mathematics [01CT]
- August 11, 2025
- Jon Sterling
In a formal language like OCaml or Java, the forms of judgement concern the description of various entities by means of code. The same holds for dependently typed systems like Agda, Lean, and Rocq. It is important to distinguish the code from the thing that it describes; to put it crudely, code is text whereas a function is a process that exists in the intellect of a human being.
Everyday mathematicians describe and communicate about mathematical objects not usually in terms of code in a formal language, but rather using an everyday language (like English or French or Chinese). Unlike with code, this kind of informal communication is not automatically precise or unambiguous; instead, mathematicians use empathy (their awareness of a conversation partner’s point of view or shared frame of reference) to tailor their description of ideas that so that they may successfully denote a definite entity in the shared intellectual context of the conversation.
The same ideas of mathematical judgement that we encountered above in the formal context also apply in the world of informal mathematics. In the formal setting, it is usually a computer who evaluates a claim like “fun x -> x * x describes an element of int -> int” by first checking that int -> int describes a definite type and then checking that fun x -> x * x describes an element of that type. In an informal mathematical interaction, code is replaced by speech or conventional written mathematical notations, and it is the human participants who are carrying out the denoted processes collectively—only proceeding forward after everyone has been convinced that they have described by means of these assertions a definite and agreed-upon entity.
Some of you may be more comfortable with code, and others may be more comfortable with informal mathematics. It will be OK for you to come from whichever perspective you prefer, keeping in mind the common principles that underlie both kinds of mathematical reasoning.
Judgemental structure of dependent types [01CV]
- August 11, 2025
- Jon Sterling
Dependent type theory has two main forms of judgement: describing types and describing elements of a given type.
Form of judgement Describing a type [01CW]
- August 11, 2025
- Jon Sterling
We will write A~\mathit {type} for the judgement that A describes a type.
When we have assumed or presupposed A~\mathit {type}, we will also write A for the type so-described, so we may avoid the wordy phrase “the type described by A”.
Form of judgement Describing an element of a type [01CX]
- August 11, 2025
- Jon Sterling
Presupposing A~\mathit {type}, we will write u:A for the judgement that u describes an element of the type A.
Judgemental equality [01CY]
- August 11, 2025
- Jon Sterling
For both basic forms of judgement, there is an auxiliary form of judgement governing equality.
- Presupposing A~\mathit {type} and B~\mathit {type}, we will write A\equiv B~\mathit {type} for the judgement that A and B are the same description of a type.
- Presupposing A~\mathit {type} and u:A and v:A, we will write u\equiv v:A for the judgement that u and v are the same description of an element of type A.
(Look at the presuppositions carefully: it does not make sense to speak of two elements being equal unless they are elements of the same type!)
Judgemental equality has the following property: if two things are equal, then we are justified in replacing one by the other at any time.
Parameterised and hypothetical judgements [01D3]
- August 11, 2025
- Jon Sterling
Sometimes we will describe a family of judgements by writing a judgement with a placeholder or a parameter in it. In this case we may wish to speak of the judgement holding for all instantiations of this parameter; for example, to describe the body of a function \mathsf {int}\to \mathsf {string} in OCaml we must parameterise a term u[x]:\mathsf {string} in a variable x:\mathsf {int} to obtain the function \lambda {x}\mathpunct {.}u[x]:\mathsf {int}\to \mathsf {string}. The judgement that u[x] describes a string assuming x describes an integer is called a hypothetical judgement, and it is written x:\mathsf {int}\vdash u[x]:\mathsf {string}.
Many formal presentations of type theory make explicit the context \Gamma of parameters that are in scope. This is a perfectly valid, but one of the overarching principles of type theory is that all constructs are arranged so as to be invariant under substitution of paramters; the up-shot is that we can allow the ambient parameters to be implicit, explicitly introducing scopes only when we wish to bind a new parameter.
Rules of inference [01CZ]
- August 11, 2025
- Jon Sterling
In § [01CV] we have outlined the “parts of speech” of dependent type theory in terms of forms of judgement governing types and elements, but we have not yet actually described what the types and elements actually “are”—in other words, we lack vocabulary. Instead of giving a definition of what the types and elements are, type theorists instead describe them indirectly by means of rules of inference—which specify valid processes by which one may describe types and terms. For the programmers in the room, these rules of inference constitute an abstract Application Programming Interface or API against which type theorists agree to work. This API is organised into two main classes of rules: structural rules and rules governing type formers; the former are required to make the judgemental structure behave correctly, whereas the latter give us actual concrete types to work with.
Structural rules [01D0]
- August 11, 2025
- Jon Sterling
In type theory, the structural rules mainly ensure that judgemental equality behaves correctly. From a certain point of view, these rules are redundant (because without them, judgemental “equality” it wouldn’t be equality, etc.!), but we include them for the sake of explicitness. Recalling our warning, note and do not fear the fact that different presentations of type theory will organise these rules differently or may even choose different sets of rules. There are many roads to Rome.
Judgemental equality is an equivalence relation [01D1]
- August 11, 2025
- Jon Sterling
We have the following rules of inference witnessing that judgemental equality is an equivalence relation:
- Reflexivity.
- Given A~\mathit {type} we may assert A\equiv A~\mathit {type}.
- Given A~\mathit {type} and u:A, we may assert u\equiv u:A.
- Transitivity.
- Given A,B,C~\mathit {type} such that A\equiv B~\mathit {type} and B\equiv C~\mathit {type}, we may assert A\equiv C~\mathit {type}.
- Given A~\mathit {type} and u,v,w:A such that u\equiv v:A and v\equiv w:A, we may assert u\equiv w:A.
- Symmetry.
- Given A,B~\mathit {type} such that A\equiv B~\mathit {type}, we may assert B\equiv A~\mathit {type}.
- Given A~\mathit {type} and u,v:A such that u\equiv v:A, we may assert v\equiv u:A.
Typing respects equality [01D2]
- August 11, 2025
- Jon Sterling
Another important rule of equality is that equal types have the same elements; this is sometimes called the “conversion rule”. In particular:
- Given A,B~\mathit {type} and u:A such that A\equiv B~\mathit {type}, we may assert u:B.
- Given A,B~\mathit {type} and u,v:A such that A\equiv B~\mathit {type} and u\equiv v:A, we may assert u\equiv v:B.
This is rendered like so in short-hand:
\frac { A\equiv B~\mathit {type} \quad u:A }{ u:B } \qquad \frac { A\equiv B~\mathit {type} \quad u\equiv v:A }{ u\equiv v:B }Substitutivity of judgemental equality [01D6]
- August 11, 2025
- Jon Sterling
The following rules express the sense in which hypothetical judgments respect judgemental equality.
- Given A~\mathit {type} and x:A\vdash B[x]~\mathit {type} and u,v:A such that u\equiv v:A, we may assert B[u]\equiv B[v]~\mathit {type}.
- Given A~\mathit {type} and x:A\vdash B[x]~\mathit {type} and x:A\vdash w[x]:B[x] and u,v:A such that u\equiv v:A, we may assert w[u]\equiv w[v]:B[u].
We have written the rules “long-hand”, but a theoretician may write these in the following short-hand notation:
\frac { x:A\vdash B[x]~\mathit {type} \quad u\equiv v:A }{ B[u]\equiv B[v]~\mathit {type} } \frac { x:A\vdash B[x]~\mathit {type} \quad x:A\vdash w[x]:B[x] \quad u\equiv v:A }{ w[u]\equiv w[v]:B[u] }As you can see, it is common when in a hurry to leave out all some of the obvious premises (for example, the premises A~\mathit {type} and u,v:A in the first rule). From the perspective of this course, these premises are “actually” secretly present; when someone writes a rule like this, they are relying on a shared expectation of good faith—that they would never intentionally write down a judgement that is meaningless, and so if the necessary presuppositions are omitted, these are intended to be filled in by the reader.
Note: we could have added a rule coverning hypothetical judgements of the form X~\mathit {type}\vdash B[x]~\mathit {type}, etc., such judgements do not usually arise in dependent type theory, so we ignore it.
Exercise Rule golf [01D7]
- August 11, 2025
- Jon Sterling
Imagine that we had omitted the transitivity and symmetry rules for judgemental equality. Devise a single rule that handles both transitivity and symmetry simultaneously.
The usual schema for type formers [01D8]
- August 11, 2025
- Jon Sterling
A type former is something like “the booleans” or “the function space”; type formers are described by rules of inference that govern how they and their elements can be formed and used.
The rules of a type former \mathbf {T} to be arranged into a few groups:
- The formation rules specify how to describe an instance of the type former \mathbf {T}.
- The introduction rules specify how to describe elements of instances of \mathbf {T}.
- The elimination rules specify how to describe elements of other types that depend on elements of instances of \mathbf {T}.
- The large elimination rule specifies how to define a type that depends on an element of an instance of \mathbf {T}.
- The computation rules describe what happens when an elimination rule is applied to the result of an introduction rule.
- The uniqueness rules describe either a strategy to equate the result of the introduction rule to other elements, or (more rarely) a strategy to equate the result of the elimination rule to other elements.
Large elimination rules are often omitted (or redundant). We won’t take a position either way, but some examples might involve them.
Not all type formers come with uniqueness rules; there are both practical and semantic reasons to omit them at times, but we will not get into that. We will not consider any types that have uniqueness rules on the elimination side, but many of the type formers that we look at will have uniqueness rules on the introduction side.
The unit type [01DA]
- August 11, 2025
- Jon Sterling
One of the simplest types is the unit type, which has exactly one element.
Rule Formation [01DK]
- August 11, 2025
- Jon Sterling
The formation rule states that we may assert \mathsf {unit}~\mathit {type}.
\frac {}{\mathsf {unit}~\mathit {type}}Rule Introduction [01DL]
- August 11, 2025
- Jon Sterling
The introduction rule states that we may assert ():\mathsf {unit}.
\frac {}{():\mathsf {unit}}No elimination rule is needed, and therefore no computation rule either.
Rule Uniqueness [01DM]
- August 11, 2025
- Jon Sterling
The uniqueness rule states that every element of the unit type is equal to the distinguished element:
\frac {u:\mathsf {unit}}{u\equiv ():\mathsf {unit}}Exercise Extensionality [01DN]
- August 11, 2025
- Jon Sterling
Show that the uniqueness rule is equivalent to the following extensionality rule that equates any two elements:
\frac {u,v:\mathsf {unit}}{u\equiv v:\mathsf {unit}}The empty type [01D9]
- August 11, 2025
- Jon Sterling
Another very simple type is the empty type, which has no elements at all.
Rule Formation [01DP]
- August 11, 2025
- Jon Sterling
The formation rule states that we may assert \mathsf {empty}~\mathit {type}.
\frac {}{\mathsf {empty}~\mathit {type}}Because there are no elements, there is naturally no introduction rule.
Rule Elimination [01DO]
- August 11, 2025
- Jon Sterling
We do include an elimination rule: this should allow us to construct, by contradiction, an element of any type whatsoever when we have an element of the empty type. The elimination rule states that when we have C~\mathit {type} and u:\mathsf {empty}, we may deduce \mathsf {abort}_C(u):C.
\frac { C~\mathit {type} \quad u:\mathsf {empty} }{ \mathsf {abort}_C(u):C }Because there is no introduction rule, there can be no computation rule. We could include a uniqueness rule on the elimination side, but this is usually omitted.
Exercise Dependent elimination [01DC]
- August 11, 2025
- Jon Sterling
We can also consider a dependent elimination rule for the empty type, where we allow C to depend on an element of the empty type; show that the following can be derived from the simple elimination rule, filling in the question marks:
\frac { x:\mathsf {empty}\vdash C[x]~\mathit {type} \quad u:\mathsf {empty} }{ ???:C[u] }The boolean type [01D5]
- August 11, 2025
- Jon Sterling
Rule Formation [01DQ]
- August 11, 2025
- Jon Sterling
The formation rule for the booleans states that we may assert \mathsf {bool}~\mathit {type}:
\frac {}{\mathsf {bool}~\mathit {type}}Rule Introduction [01DR]
- August 11, 2025
- Jon Sterling
We have two introduction rules; one states that we may assert \mathsf {true}:\mathsf {bool} and the other states that we may assert \mathsf {false}:\mathsf {bool}.
\frac {}{\mathsf {true}:\mathsf {bool}} \qquad \frac {}{\mathsf {false}:\mathsf {bool}}Rule Elimination [01DS]
- August 11, 2025
- Jon Sterling
The elimination rule is where things start to get interesting; this will be a dependently typed version of the classical if-expression. Given a family of types x:\mathsf {bool}\vdash C[x]~\mathit {type} and elements u:\mathsf {bool} and v:C[\mathsf {true}] and w:C[\mathsf {false}], we may assert \mathsf {if}_{x\mathpunct {.}C[x]}(u;v;w):C[u].
Rule Computation [01DT]
- August 11, 2025
- Jon Sterling
The computation rules corresponding to the above elimination rule correspond to the way that when an if-expression is applied to a concrete boolean (i.e. true or false) the whole expression reduces to the corresponding branch.
- Given x:\mathsf {bool}\vdash C[x]~\mathit {type} and u:C[\mathsf {true}] and v:C[\mathsf {false}], we may assert \mathsf {if}_{x\mathpunct {.}C[x]}(\mathsf {true};v;w)\equiv v:C[\mathsf {true}]. \frac { x:\mathsf {bool}\vdash C[x]~\mathit {type} \quad v:C[\mathsf {true}] \quad w:C[\mathsf {false}] }{ \mathsf {if}_{x\mathpunct {.}C[x]}(\mathsf {true};v;w)\equiv v:C[\mathsf {true}] }
- Given x:\mathsf {bool}\vdash C[x]~\mathit {type} and u:C[\mathsf {true}] and v:C[\mathsf {false}], we may assert \mathsf {if}_{x\mathpunct {.}C[x]}(\mathsf {false};v;w)\equiv w:C[\mathsf {false}]. \frac { x:\mathsf {bool}\vdash C[x]~\mathit {type} \quad v:C[\mathsf {true}] \quad w:C[\mathsf {false}] }{ \mathsf {if}_{x\mathpunct {.}C[x]}(\mathsf {false};v;w)\equiv w:C[\mathsf {false}] }
We could include a uniqueness rule on the elimination side, but this is typically omitted.
Aside Type-level if-expressions [01DB]
- August 11, 2025
- Jon Sterling
This is all well and good, but how can we get an actually interesting dependent type x:\mathsf {bool}\vdash C[x]~\mathit {type}? Later on we will introduce type formers that will readily provide examples, but to get an idea of what is possible, we consider the optional large elimination rule with its corresponding computation rules:
- Given A,B~\mathit {type} and u:\mathsf {bool} we may assert \mathsf {If}(u;A;B)~\mathit {type}. \frac { A,B~\mathit {type} \quad u:\mathsf {bool} }{ \mathsf {If}(u;A;B)~\mathit {type} }
- Given A,B~\mathit {type}, we may assert \mathsf {If}(\mathsf {true};A;B)\equiv A~\mathit {type}. \frac { A,B~\mathit {type} }{ \mathsf {If}(\mathsf {true};A;B)\equiv A~\mathit {type} }
- Given A,B~\mathit {type}, we may assert \mathsf {If}(\mathsf {false};A;B)\equiv B~\mathit {type}. \frac { A,B~\mathit {type} }{ \mathsf {If}(\mathsf {true};A;B)\equiv B~\mathit {type} }
With the above it is therefore possible to define types like \mathsf {If}(u;\mathsf {unit};\mathsf {empty}) whose behaviour differs wildly depending on the value of u. Once we introduce universes (types whose elements describe types), we will be able to construct examples like this without using the large elimination.
Aside Products and dependent functions in set theory [01DE]
- August 11, 2025
- Jon Sterling
In set theory, the set of functions A\to B can be alternatively described as the product of A-many copies of B. This would be written as follows:
\prod _{x\in A} BSo we might say that the product of A-many copies of B is the set of functions from A to B, because we must assign an element of B to each x\in A. It is also possible to consider products where instead of having a bunch of copies of the same set, we can match a different set to each element of A. For example, if we have a family of sets (B_x)_{(x\in A)}, then we may consider the product of this family:
\prod _{x\in A} B_xThe above product \prod _{x\in A}B_x of the family (B_x)_{(x\in A)} is then the set of dependent functions from A to the family B. The same set theoretic ideas work in type theory, as we shall see.
We shall now see how to describe the product of a family of types by means of inference rules.
The product of a family of types [01DD]
- August 11, 2025
- Jon Sterling
Rule Formation [01DU]
- August 11, 2025
- Jon Sterling
The formation rule states that given A~\mathit {type} and a family x:A\vdash B[x]~\mathit {type}, then we may form {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]}~\mathit {type}.
\frac { A~\mathit {type}\quad x:A\vdash B[x]~\mathit {type} }{ {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}B[x]~\mathit {type} }Rule Introduction [01DV]
- August 11, 2025
- Jon Sterling
The introduction rule states that given A and B as above and x:A\vdash u[x]:B[x], we may form \lambda x\mathpunct {.}{u[x]}:{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]}:
\frac { x:A\vdash u[x]:B[x] }{ \lambda x\mathpunct {.}{u[x]}:{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]} }Recall that the premises concerning A and B are implicitly part of the rule above, and omitted only by convention. A further notational convention that we are already employing is to omit A and B from the \lambda -term itself; the most explicit notation for the rule above, which is how you should read it(!), would be something like the following:
\frac { A~\mathit {type}\quad x:A\vdash B[x]~\mathit {type}\quad x:A\vdash u[x]:B[x] }{ \mathsf {lam}(A; x\mathpunct {.}B[x]; x\mathpunct {.}u[x]) :{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]} }Rule Elimination [01DW]
- August 11, 2025
- Jon Sterling
The elimination rule states that given A and B as above and u:{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]} and v:A, we may form the application uv:B[v].
\frac { u:{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]}\quad v:A }{ uv:B[v] }Rule Computation [01DX]
- August 11, 2025
- Jon Sterling
The computation rule says that applying a \lambda -expression to an element is equal to the corresponding instantiation of its body:
\frac { x:A\vdash u[x]:B[x]\quad v:A }{ (\lambda x\mathpunct {.}{u[x]})v \equiv u[v]:B[v] }Rule Uniqueness [01DY]
- August 11, 2025
- Jon Sterling
The uniqueness rule says that every element of the product {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]} is equal to a \lambda -abstraction obtained from it by application to the bound variable.
\frac { u:{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]} }{ u\equiv \lambda x\mathpunct {.}{ux}:{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]} }Exercise Extensionality [01DJ]
- August 11, 2025
- Jon Sterling
Show that the uniqueness rule for the product {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]} is equivalent to the following extensionality rule:
\frac { u,v:{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]} \quad x:A\vdash ux\equiv vx:B[x] }{ u\equiv v:{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]} }Notation Non-dependent function types [01EG]
- August 11, 2025
- Jon Sterling
We can of course talk about non-dependent functions from a type A to a type B; these the elements of the product {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B} of A many copies of B. For clarity, we introduce the following notation:
A\to B :\equiv {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B}Aside Sums and dependent pairs in set theory [01DZ]
- August 11, 2025
- Jon Sterling
In set theory, the set of pairs A\times B can alternatively be described as the sum or disjoint union of A-many copies of B:
\sum _{x\in A} B= \coprod _{x\in A} BSo an element of the sum of A-many copies of B would be a pair (u,v) with u\in A and v\in B. If we instead have a different set B_x associated to each x\in A, we can consider the sum of the family (B_x)_{(x\in A)}:
\sum _{x\in A} B_x = \coprod _{x\in A} B_xThen an element of the sum is a dependent pair (u,v) with u\in A and v\in B_u. In this sense, the sum of a family of sets is the set of dependent pairs in that family.
The sum of a family of types [01E0]
- August 11, 2025
- Jon Sterling
Rule Formation [01E1]
- August 11, 2025
- Jon Sterling
The formation rule states that given A~\mathit {type} and a family x:A\vdash B[x]~\mathit {type}, we may form {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]}~\mathit {type}.
\frac { A~\mathit {type}\quad x:A\vdash B[x]~\mathit {type} }{{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]}~\mathit {type}}Rule Introduction [01E2]
- August 11, 2025
- Jon Sterling
The introduction rule states that given A and B as above and u:A and v:B[u] we may form \left \langle u,v\right \rangle :{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]}.
\frac { u:A \quad v:B[u] }{ \left \langle u,v\right \rangle :{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]} }Rule Elimination [01E3]
- August 11, 2025
- Jon Sterling
Given A and B as above, there two elimination rules for {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]} corresponding to the two components of a pair.
- Given u:{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]}, we may form u.1:A. \frac { u:{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]} }{ u.1:A }
- Given u:{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]}, we may form u.2:B[u.1]. \frac { u:{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]} }{ u.2:B[u.1] }
Rule Computation [01E4]
- August 11, 2025
- Jon Sterling
The computation rules express what happens when you project the first and second components of a pair.
\frac { u:A\quad v:B[u] }{ \left \langle u,v\right \rangle .1 \equiv u:A } \qquad \frac { u:A\quad v:B[u] }{ \left \langle u,v\right \rangle .2 \equiv v:B[u] }Rule Uniqueness [01E5]
- August 11, 2025
- Jon Sterling
The uniqueness rule states that any element of the sum {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]} is equal to a dependent pair whose components are obtained by projection.
\frac { u:{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]} }{ u\equiv \left \langle u.1,u.2\right \rangle :{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]} }Exercise Extensionality [01E6]
- August 11, 2025
- Jon Sterling
Show that the uniqueness rule for the sum {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]} is equivalent to the following extensionality rule:
\frac { u,v:{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]} \quad u.1\equiv v.1:A \quad u.2\equiv v.2:B[u.1] }{ u\equiv v:{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]} }Binary products [01FS]
- August 11, 2025
- Jon Sterling
There is a bit of a terminological snafu here, if we consider the binary product A\times B of types A,B~\mathit {type} which ought to consist of pairs of an element of A with an element of B. We have seen already that the binary product A\times B can be decribed by a special case of a sum:
A\times B :\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B}This is confusing (if you don’t think about it!) because products and sums are supposed to be different. But it really does make sense, because the product A\times B is indeed the sum of A-many copies of B. So why is it called a (binary) product? Because it is the product of the family x:\mathsf {bool} \vdash \mathsf {If}(x;A;B) that we may form using large elimination. A dependent function f: {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:\mathsf {bool})}} \mathsf {If}(x;A;B) must assign values to the two booleans \mathsf {true} and \mathsf {false}. So a dependent function like f could consist of an element f~\mathsf {true}:\mathsf {If}(\mathsf {true};A;B) \equiv A and an element f~\mathsf {false}:\mathsf {If}(\mathsf {false};A;B)\equiv B\text {.}
It is in practice easier to work with the definition of A\times B in terms of the sum, because this representation satisfies a judgemental extensionality law that is not enjoyed by the version defined using the booleans. Nonetheless, once we learn to say what it means for two types to be mathematically equivalent, the two repressentations will indeed be equivalent.
Some philosophy about equality [01E9]
- August 11, 2025
- Jon Sterling
So far we have seen just one way to say that two things are the same: judgemental equality. Judgemental equality pertains to the expressions of the language; when two expressions are judgemental equally, then they unavoidably describe the same mathematical object, but we might consider the converse: if two expressions describe the “same” mathematical object, are the expressions themselves judgementally equal?
One way to test this proposition is to consider the extension of our type theory with identification types u=_A v for u,v:A whose elements represent evidence that u and v describe the same mathematical object. This is subtly different from the equality judgement u\equiv v:A in an important way, putting aside the fact that one is a judgement and other is a type:
- The equality judgement u\equiv v:A asserts that u and v are the same description of an element of A.
- An element w:u=_Av witnesses that u and v describe the same mathematical object, rather than that they are the same description.
In real life, it can happen that two different expressions describe the same thing; for example, it is often pointed out that the “morning star” and the “evening star” both describe the planet Venus—although examples like this can be troublesome since one can always force the referents to be distinct again by arguing that (e.g.) one expression describes Venus in the morning, and the other describes Venus in the evening, etc.
In much of mathematics, it was considered that the converse proposition (that any two descriptions of the same object are themselves the same) was perfectly natural and could therefore be included as a formal rule of dependent type theory that relates judgmental equality with identification types. This rule was called equality reflection. But in the final two decades of the 20th Century, three different objections to equality reflection emerged:
- A philosophical objection. Around 1986, Per Martin-Löf re-analysed the philosophical foundations of dependent type theory and came to the conclusion that equality reflection was not justified in a philosophical sense. Martin-Löf’s philosophical objection to equality reflection did not rise to the level of a mathematical objection: indeed, equality reflection is consistent with traditional mathematics.
- A practical objection. During the 1980s and 1990s, efficient algorithms for automatically checking the judgements of dependent type theory were developed (including those underlying Rocq, Agda, and Lean), but these algorithms rely on the omission of equality reflection; indeed, the judgements of type theory with equality reflection are known to be undecidable.
- A mathematical objection. Toward the end of the 1990s, the late Martin Hofmann and Thomas Streicher discovered a mathematical objection to equality reflection: a model of type theory based on groupoids in which there can be multiple mathematically distinct ways to identify two objects as “the same”, which contradicts equality reflection; moreover, the notion of sameness that interpreted the identification type in this model was closer to everyday mathematical usage than that of the standard model in set theory. Although equality reflection remains consistent, there was finally compelling evidence that equality reflection was warping our perception of mathematics in a harmful way.
The three objections above are not insurmountable, but they are strong enough together that intensional type theory (which is type theory without equality reflection) has become a leading point of view. Intensional type theory alone does not, however, take advantage of the possibilities suggested by Hofmann and Streicher’s groupoid interpretation; in this module, we consider an extension of intensional type theory called homotopy type theory that solves these problems and more.
Identification types [01E8]
- August 11, 2025
- Jon Sterling
Rule Formation [01EA]
- August 11, 2025
- Jon Sterling
Given A~\mathit {type} and u,v:A we may form the identification type u=_Av~\mathit {type}.
\frac { A~\mathit {type}\quad u,v:A }{ u=_Av~\mathit {type} }Rule Introduction [01EB]
- August 11, 2025
- Jon Sterling
Given A~\mathit {type} and u:A, we may form \mathsf {refl}_u:u=_Au.
\frac { A~\mathit {type}\quad u:A }{ \mathsf {refl}_u:u=_Au }The idea of the identity type on A is that for each u:A, the family x:A\vdash u=x~\mathit {type} is the smallest family of types equipped with an element \mathsf {refl}_u:u=_Au. We witness this by means of an elimination rule below.
Rule Elimination [01EC]
- August 11, 2025
- Jon Sterling
Fix A~\mathit {type} and u,v:A and w:u=_Av. Given a family y:A,z:u=_Ay\vdash C[y,z]~\mathit {type} and an element c:C[u,\mathsf {refl}_u], we may form \mathsf {J}_{y,z\mathpunct {.} C[y,z]}(w; c) :C[v,w].
\frac { w:u=_Av\quad y:A,z:u=_Ay\vdash C[y,z]~\mathit {type}\quad c:C[u,\mathsf {refl}_u] }{ \mathsf {J}_{y,z\mathpunct {.} C[y,z]}(w; c) :C[v,w] }The elimination rule provides an induction principle for identifications whose left end-point is u. It says that if you want to prove something for all such identifications starting with u, it suffices to prove it for the trivial one given by \mathsf {refl}_u:u=_Au.
Formally, the \mathsf {J} term secretly must mention u,v; we omit these because they can always be deduced from context. We may even write \mathsf {J}_C rather than \mathsf {J}_{y,z\mathpunct {.} C[y,z]} when our meaning is clear.
Rule Computation [01ED]
- August 11, 2025
- Jon Sterling
The computation rule for the identification type explains what the elimination rule does when applied to the trivial identification.
\frac { u:A\quad y:A,z:u=_Ay\vdash C[y,z]~\mathit {type}\quad c:C[u,\mathsf {refl}_u] }{ \mathsf {J}_{y,z\mathpunct {.} C[y,z]}(\mathsf {refl}_u; c) \equiv c :C[u,\mathsf {refl}_u] }Exercise Unicity of self-identifications [01EQ]
- August 11, 2025
- Jon Sterling
Using the elimination rule above, try to construct elements of the following types:
{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(u:A)}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(p:u=_Au)}} p=_{u=_Au}\mathsf {refl}_u {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(u,v:A)}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(p,q:u=_Av)}} p=_{u=_Av}qWhat goes wrong? What do you think this implies about the notion of “sameness” that we get from identification types?
Definition Transport [01EO]
- August 11, 2025
- Jon Sterling
A special case of the identification elimination rule is transport. Where the elimination rule allows the family C to depend on the identification being eliminated, sometimes we only need to depend on one of its endpoints.
Given x:A\vdash B[x]~\mathit {type}, p:u=_Av, and b:B[u] we may define \begin {aligned} & \mathsf {transport}_{x\mathpunct {.}{B[x]}}(p;b) : B[v] \end {aligned} satisfying \mathsf {transport}_{x\mathpunct {.}{B[x]}}(\mathsf {refl}_u;b) \equiv b :B[u] using identification elimination: \mathsf {transport}_{x\mathpunct {.}B[x]}(p;b) :\equiv \mathsf {J}_{y,z\mathpunct {.}B[y]}(p; b)
We may write p_*^Bb for \mathsf {transport}_{x\mathpunct {.}{B[x]}}(p;b) or even p_*b when B is understood in context.
Warning A warning about transport [01EP]
- August 11, 2025
- Jon Sterling
If you find yourself using transport a lot, you are in for a world of trouble later. It is often a good sign that a different or more streamlined approach to the problem is needed. We will learn some methods for avoiding transports in later lectures.
The action of a function on identifications [01GN]
- August 11, 2025
- Jon Sterling
Given a function f:A\to B and an identification p:u=_Av we should be able to obtain an identification \mathsf {act}_fp:fu=_B fv. This should satisfy the judgemental equation \mathsf {act}_f(\mathsf {refl}_u)\equiv \mathsf {refl}_{fu}\text {.}
We can define the action using transport, where the family is a function space:
\mathsf {act}_fp :\equiv \bigl (\mathsf {transport}_{z\mathpunct {.} fz=_Bfx \to fz=_Bfy} (p; \lambda q\mathpunct {.}q)\bigr ) (\mathsf {refl}_{fu})Make sure you understand why the definition above work!
In many texts, this operation may be written \mathsf {ap}_fp; this stands for “action on paths”. In this course we prefer the word “identification” to “path”, but we might slip up sometimes. It is important to be flexible and find peace with a variety of different terminologies that may appear in different books and papers.
Exercise Unbiased elimination rule (extremely hard!) [01EE]
- August 11, 2025
- Jon Sterling
Prove that the elimination and computation rules for the identification type are equivalent to the following “unbiased” ones that do not fix u outside of the family C:
\frac { w:u=_A v\quad x:A,y:A,z:x=_Ay\vdash C[x,y,z]~\mathit {type}\quad x:A\vdash c[x]:C[x,x,\mathsf {refl}_u] \quad }{ \mathsf {J}'_{x,y,z\mathpunct {.}C[x,y,z]}(w; x\mathpunct {.} c[x]) : C[u,v,w] } \frac { u:A\quad x:A,y:A,z:x=_Ay\vdash C[x,y,z]~\mathit {type}\quad x:A\vdash c[x]:C[x,x,\mathsf {refl}_x] \quad }{ \mathsf {J}'_{x,y,z\mathpunct {.}C[x,y,z]}(\mathsf {refl}_u; x\mathpunct {.}{c[x]}) \equiv c[u] :C[u,u,\mathsf {refl}_u] }Explicitly, you are being asked to use \mathsf {J} to define \mathsf {J}' and vice versa. This exercise is extremely difficult, so don’t waste too much time on it.
Explicit vs. implicit definitions of functions [01EF]
- August 11, 2025
- Jon Sterling
Suppose we wanted to define a function like \mathsf {not}:\mathsf {bool}\to \mathsf {bool} that swaps the two booleans. Using the rules of function types and booleans, we would write:
\begin {aligned} &\mathsf {not} : \mathsf {bool}\to \mathsf {bool}\\ &\mathsf {not} :\equiv \lambda x\mathpunct {.} \mathsf {if}_{\_\mathpunct {.}\mathsf {bool}}( x; \mathsf {false}; \mathsf {true} ) \end {aligned}We can use the computation rules to see that the following equations hold judgementally:
- \mathsf {not}~\mathsf {true} \equiv \mathsf {false}:\mathsf {bool}
- \mathsf {not}~\mathsf {false}\equiv \mathsf {true}:\mathsf {bool}
These equations uniquely determine the value of \mathsf {not}~x for any x:\mathsf {bool} in the sense that if we have f:\mathsf {bool}\to \mathsf {bool} such that f~\mathsf {true}\equiv \mathsf {false}:\mathsf {bool} and f~\mathsf {false}\equiv \mathsf {true}:\mathsf {bool}\text {,} then we may construct some H_f:{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:\mathsf {bool})}} fx =_{\mathsf {bool}} \mathsf {not}~x\text {.}
Indeed, we define H_f using a dependent if-statement:
Note that we do not have x:\mathsf {bool}\vdash fx \equiv _{\mathsf {bool}}\mathsf {not}~x:\mathsf {bool}; based on our previous explanation of the difference between judgemental equality and the identification type, this reflects that we know fx describes the same boolean as \mathsf {not}~x, but we don’t know that it is the same description of this boolean.
Because of the uniqueness of the values of \mathsf {not} that we have seen, it is very common to define such a function implicitly by just stating the equations that it is meant to satisfy. For example, you might see a definition like the following:
\begin {aligned} &\mathsf {not}:\mathsf {bool}\to \mathsf {bool} \\ &\mathsf {not}~\mathsf {true} :\equiv \mathsf {false} \\ &\mathsf {not}~\mathsf {false} :\equiv \mathsf {true} \end {aligned}Part of interpreting (reading) such a definition is convincing yourself that there really is a unique function that satisfies these equations, where uniqueness is taken as above in the sense of the identification type. If you can’t prove this to yourself when you see such a definition, then you must conclude that either you have not understood the definition or that the author of the definition has made a mistake.
Many computerised proof assistants, including Agda and Lean, support implicit definitions like the one above directly. Lean attempts to “understand” such a definition by converting it into an explicit one in terms of the elimination rules, and if it cannot do that, it reports an error. Agda, on the other hand, has implicit definitions primitively and does not deal with explicit definitions at all; Agda includes complicated heuristics to check whether an implicit definition is meaningful (e.g. terminating), but these heuristics have repeatedly been shown to be unsound over the years, leading to many small tweaks to the algorithm. Although there are practical trade-offs when deciding between designing a system around explicit vs. implicit definitions, we will take the position that the explicit definitions are the “real” ones and that a given implicit definition is always intended to carry an assertion that the reader may construct an explicit definition satisfying the same equations.
By the way, now that we have fixed the convention of implicit definitions, we could have written H_f implicitly too:
\begin {aligned} &H_f:{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:\mathsf {bool})}} fx=_{\mathsf {bool}} \mathsf {not}~x\\ &H_f~\mathsf {true} :\equiv \mathsf {refl}_{\mathsf {false}}\\ &H_f~\mathsf {false} :\equiv \mathsf {refl}_{\mathsf {true}}\\ \end {aligned}Exercises [01E7]
- August 11, 2025
- Jon Sterling
Exercise. Dependent types I › Rules of inference › Structural rules › Rule golf [01D7]
- August 11, 2025
- Jon Sterling
Imagine that we had omitted the transitivity and symmetry rules for judgemental equality. Devise a single rule that handles both transitivity and symmetry simultaneously.
Exercise. Dependent types I › The unit type › Extensionality [01DN]
- August 11, 2025
- Jon Sterling
Show that the uniqueness rule is equivalent to the following extensionality rule that equates any two elements:
\frac {u,v:\mathsf {unit}}{u\equiv v:\mathsf {unit}}Exercise. Dependent types I › The empty type › Dependent elimination [01DC]
- August 11, 2025
- Jon Sterling
We can also consider a dependent elimination rule for the empty type, where we allow C to depend on an element of the empty type; show that the following can be derived from the simple elimination rule, filling in the question marks:
\frac { x:\mathsf {empty}\vdash C[x]~\mathit {type} \quad u:\mathsf {empty} }{ ???:C[u] }Exercise. Dependent types I › The product of a family of types › Extensionality [01DJ]
- August 11, 2025
- Jon Sterling
Show that the uniqueness rule for the product {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]} is equivalent to the following extensionality rule:
\frac { u,v:{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]} \quad x:A\vdash ux\equiv vx:B[x] }{ u\equiv v:{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]} }Exercise. Dependent types I › The sum of a family of types › Extensionality [01E6]
- August 11, 2025
- Jon Sterling
Show that the uniqueness rule for the sum {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]} is equivalent to the following extensionality rule:
\frac { u,v:{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]} \quad u.1\equiv v.1:A \quad u.2\equiv v.2:B[u.1] }{ u\equiv v:{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]} }Exercise. Dependent types I › Identification types › Unicity of self-identifications [01EQ]
- August 11, 2025
- Jon Sterling
Using the elimination rule above, try to construct elements of the following types:
{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(u:A)}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(p:u=_Au)}} p=_{u=_Au}\mathsf {refl}_u {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(u,v:A)}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(p,q:u=_Av)}} p=_{u=_Av}qWhat goes wrong? What do you think this implies about the notion of “sameness” that we get from identification types?
Exercise. Dependent types I › Identification types › Unbiased elimination rule (extremely hard!) [01EE]
- August 11, 2025
- Jon Sterling
Prove that the elimination and computation rules for the identification type are equivalent to the following “unbiased” ones that do not fix u outside of the family C:
\frac { w:u=_A v\quad x:A,y:A,z:x=_Ay\vdash C[x,y,z]~\mathit {type}\quad x:A\vdash c[x]:C[x,x,\mathsf {refl}_u] \quad }{ \mathsf {J}'_{x,y,z\mathpunct {.}C[x,y,z]}(w; x\mathpunct {.} c[x]) : C[u,v,w] } \frac { u:A\quad x:A,y:A,z:x=_Ay\vdash C[x,y,z]~\mathit {type}\quad x:A\vdash c[x]:C[x,x,\mathsf {refl}_x] \quad }{ \mathsf {J}'_{x,y,z\mathpunct {.}C[x,y,z]}(\mathsf {refl}_u; x\mathpunct {.}{c[x]}) \equiv c[u] :C[u,u,\mathsf {refl}_u] }Explicitly, you are being asked to use \mathsf {J} to define \mathsf {J}' and vice versa. This exercise is extremely difficult, so don’t waste too much time on it.
Lecture Dependent types II [01FF]
- August 27, 2025
- Jon Sterling
This lecture includes live-coding in the Agda proof assistant. It is recommended to install Agda on your own machine beforehand so that you can follow along; I use Emacs to edit Agda, but it is also possible to use Visual Studio Code. If you have difficulty installing Agda, you can also use an online Emacs session in your browser with Agda pre-loaded. We will start from scratch and not make use of any standard library. But first, we continue on with some basic non-Agda material.
More on identifications [01J9]
- August 27, 2025
- Jon Sterling
Flipping identifications [01EJ]
- October 15, 2025
- Jon Sterling
Fix A~\mathit {type} and u,v:A. Given an identification p:u=_Av we should be able to define a “flipped” identification \bar {p}:v=_Au. We will do so by means of an implicit definition:
\begin {aligned} & \mathsf {flip}: {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(u,v:A)}}\; u=_Av\to v=_Au \\ & \mathsf {flip}~u~u~\mathsf {refl}_u :\equiv \mathsf {refl}_u \end {aligned}Then we define \bar {p}:\equiv \mathsf {flip}\,u\,v\,p when u,v are understood.
Above we were allowed to collapse the pair (v,p) to (u,\mathsf {refl}_u) by virtue of the identification elimination rule. The corresponding explicit definition is as follows:
\mathsf {flip} :\equiv \lambda u,v,p\mathpunct {.} \mathsf {J}_{y,z\mathpunct {.}y=u}(p; \mathsf {refl}_u)Lemma Flipping is involutive [01EK]
- October 15, 2025
- Jon Sterling
Given p:u=_Av, we may identify p with \overline {\overline {p}}. In particular, we may construct the following witness of involution:
\begin {aligned} & \mathsf {flipInv} : {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(u,v:A)}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(p:u=_Av)}} \overline {\overline {p}}=_{u=_Av} p \\ & \mathsf {flipInv}~u~u~\mathsf {refl}_u :\equiv \mathsf {refl}_{\mathsf {refl}_u} \end {aligned}The implicit definition above is justified by the following closed form:
\mathsf {flipInv} :\equiv \lambda u,v,p\mathpunct {.} \mathsf {J}_{y,q\mathpunct {.} \overline {\overline {q}} =_{u=_Ay} q}(p; \mathsf {refl}_{\mathsf {refl}_u})Definition Fibres [01ES]
By combining function types, dependent pair types, and identification types, we can finally define something useful. Given a function f:A\to B and an element b:B, we define the fibre of f over b to by the type of elements of A whose image in B is identified with b:
\mathsf {fib}_f(b) :\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}} fx=_B bWe could have defined fibres with an equation in the opposite direction. The two versions are going to be equivalent; but if it matters, we’ll write the following notations:
\begin {aligned} \mathsf {fib}^-_f(b) &:\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{fx=_Bb} \\ \mathsf {fib}^+_f(b) &:\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{b=_B fx} \end {aligned}Singletons and singleton induction [01J6]
- October 15, 2025
- Jon Sterling
A special case of fibres is the singleton types.
Definition Inward and outward singleton types [01J7]
- October 15, 2025
- Jon Sterling
Given an element u:A, we may define the “inward” and “outward” singleton types respectively as follows:
\begin {aligned} \left \{u\right \}^-_{A} &:\equiv \mathsf {fib}^-_{1_A}(u) \equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}} x=_Au \\ \left \{u\right \}^+_{A} &:\equiv \mathsf {fib}^+_{1_A}(u) \equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}} u=_Ax \end {aligned}Both the inward and outward singletons at u are inhabited by the pair \left \langle u,\mathsf {refl}_u\right \rangle .
Singleton induction [01J8]
- October 15, 2025
- Jon Sterling
We will now see how to reformulate the identification elimination rule into an “induction principle” for singletons. The idea is the following:
If you want to prove something about all \left \{u\right \}^\pm _{A} it suffices to consider just the trivial element \left \langle u,\mathsf {refl}_u\right \rangle .
In other words, \left \langle u,\mathsf {refl}_u\right \rangle is the “base case” for an induction on \left \{u\right \}^\pm _{A}, in the same way that 0 is the base case for mathematical induction; the induction here is simpler than mathematical induction, because there is only a base case and no inductive step.
We will derive singleton induction using the \mathsf {J} elimination rule, which we recall below:
\frac { w:u=_Av\quad y:A,z:u=_Ay\vdash C[y,z]~\mathit {type}\quad c:C[u,\mathsf {refl}_u] }{ \mathsf {J}_{y,z\mathpunct {.} C[y,z]}(w; c) :C[v,w] }We wish to define the following derived forms:
\frac { z:\left \{u\right \}^-_{A}\vdash C[z]~\mathit {type} \quad p:\left \{u\right \}^\pm _{A} \quad c:C[\left \langle u,\mathsf {refl}_u\right \rangle ] }{ \mathsf {J}^\pm _{z\mathpunct {.}{C[z]}}(p; c): C[p] }We can specify the following implicit definitions for the derived induction principles:
\begin {aligned} \mathsf {J}^+_{z\mathpunct {.}C[z]}(\left \langle u,\mathsf {refl}_u\right \rangle ; c) &:\equiv c\\ \mathsf {J}^-_{z\mathpunct {.}C[z]}(\left \langle u,\mathsf {refl}_u\right \rangle ; c) &:\equiv c \end {aligned}The first one above is easy to justify:
\begin {aligned} \mathsf {J}^+_{z\mathpunct {.}{C[z]}}(p; c) &:\equiv \mathsf {J}_{y,z\mathpunct {.}{C[\left \langle y,z\right \rangle ]}}( p.2 ; c) \end {aligned}The second one is harder to justify. It turns out that the simplest way to proceed is to first define a “defective” version of \mathsf {J}^- in terms of \mathsf {J}^- that has the wrong type, and then use transport to correct the type. In particular, we define:
\begin {aligned} & \tilde {\mathsf {J}}^-_{z\mathpunct {.}C[z]}(p;c) : C \left \langle p.1, \overline {\overline {p.2}}\right \rangle \\ &\tilde {\mathsf {J}}^-_{z\mathpunct {.}C[z]}(p;c) :\equiv \mathsf {J}^+_{z\mathpunct {.}{C\left [\left \langle z.1,\overline {z.2}\right \rangle \right ]}}\left (\left \langle p.1,\overline {p.2}\right \rangle ; c\right ) \end {aligned}Then we define:
\mathsf {J}^-_{z\mathpunct {.}{C[z]}}(p; c) :\equiv \mathsf {transport}_{q\mathpunct {.} C[\left \langle p.1,q\right \rangle ]}(\mathsf {flipInv}~(p.1)~u~(p.2); \tilde {\mathsf {J}}^-_{z\mathpunct {.}C[z]}(p;c) )You need to convince yourself that all of the above is well-typed.
The benefit of singleton induction is that it provides a (perhaps) less noisy way to think about the identification elimination rule, and gives a schema for defining correct implicit definitions by “matching” on identifications no matter which side of the identification the “fixed” variable is located.
The three operations \mathsf {J}, \mathsf {J}^+, and \mathsf {J}^- are all equivalent, in the sense that you can derive any two from the remaining one. There is a further option seen in Exercise [01EE], which is also equivalent to all of these. In the end, we work mainly with implicit definitions which we know to be justified by any one of these principles.
Contractibility of singletons [01ER]
Using singleton induction, we can easily prove that any singleton \left \{u\right \}^\pm _{A} is “really” a singleton, in the sense that all its elements are equal to the trivial element \left \langle u,\mathsf {refl}_u\right \rangle . This property is called contractibility, which we will learn about in generality later. In particular, singleton elimination justifies the following implicit definition:
\begin {aligned} &\mathsf {singlContr}_A^\pm : {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(u:A)}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(s:\left \{u\right \}^\pm _{A})}} s=_{\left \{u\right \}^\pm _{A}} \left \langle u,\mathsf {refl}_u\right \rangle \\ &\mathsf {singlContr}_A^\pm ~u~\left \langle u,\mathsf {refl}_u\right \rangle :\equiv \mathsf {refl}_{\left \langle u,\mathsf {refl}_u\right \rangle } \end {aligned}Before we justify this with an explicit definition, we will first explain the “idea” of the definition in English.
- We have u:A and s:\left \{u\right \}^\pm _{A} and we are trying to construct \mathsf {singlContr}_A^\pm ~u~s : s =_{\left \{u\right \}^\pm _{A}} \left \langle u,\mathsf {refl}_u\right \rangle .
- By singleton induction it suffices to consider just the case where s \equiv \left \langle u,\mathsf {refl}_u\right \rangle ; in this case, then, we are trying to construct \mathsf {singlContr}_A^\pm ~\left \langle u,\mathsf {refl}_u\right \rangle : \left \langle u,\mathsf {refl}_u\right \rangle =_{\left \{u\right \}^\pm _{A}} \left \langle u,\mathsf {refl}_u\right \rangle .
- We finish off with the reflexive identification.
The explicit definition is as follows:
\mathsf {singlContr}^\pm _A :\equiv \lambda u,s\mathpunct {.} \mathsf {J}^\pm _{z\mathpunct {.} z=_{\left \{u\right \}^\pm _{A}} \left \langle u,\mathsf {refl}_u\right \rangle }(s; \mathsf {refl}_{\left \langle u,\mathsf {refl}_u\right \rangle })Pasting identifications [01EH]
- October 15, 2025
- Jon Sterling
Fix A~\mathit {type} and u,v,w:A. Given p:u=_Av and q:v=_Aw we may define an identification p\cdot q:u=_Aw. The idea of the pasting operation is to use identification elimination to consider just the case where (v,p) \equiv (u,\mathsf {refl}_u); in that case we would have q:u=_Aw and so we may just return that. We first give an implicit definition of the pasting operation, and then we will show that it is well-defined by constructing an explicit definition:
\begin {aligned} & \mathsf {paste}: {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(u,v,w:A)}} \; u=_Av\to v=_Aw\to u=_Aw \\ & \mathsf {paste}~u~u~w~\mathsf {refl}_{u}~q :\equiv q \end {aligned}Then we would define p\cdot q :\equiv \mathsf {paste}~u~v~w~p~q when u,v,w are understood.
In our implicit definition above, we have given an equation just for the case where the first two vertices are exactly the same and the first edge is the trivial one. The informal rule of thumb is that when you are binding a pair (v,p) of an identification p:u=_Av with one of its endpoints, you are free to collapse this data to (u,\mathsf {refl}_u); when both endpoints are fixed, you can’t do this. The collapsing move used above is justified by the identification elimination rule, which we can show by instantiating the above with an explicit definition.
\begin {aligned} & \mathsf {paste}: {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(u,v,w:A)}} \; u=_Av\to v=_Aw\to u=_Aw \\ & \mathsf {paste} :\equiv \lambda u,v,w,p\mathpunct {.} \mathsf {J}_{ y,z\mathpunct {.} y=_Aw\to u=_Aw }(p; \lambda q\mathpunct {.}{q}) \end {aligned}We verify that the defining equation holds:
\begin {aligned} &\mathsf {paste}~u~u~w~\mathsf {refl}_u~q \\ &\quad \equiv \mathsf {J}_{y,z\mathpunct {.}y=_Aw\to u=_Aw}(\mathsf {refl}_u; \lambda q\mathpunct {.}{q}) ~q \\ &\quad \equiv (\lambda q\mathpunct {.}{q})~q \\ &\quad \equiv q \end {aligned}If you are not yet confident in the use of implicit definitions, you should verify that this equation uniquely defines \mathsf {paste}. In particular, we might check for any f:{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(u,v,w:A)}}u=_Av\to v=_Aw\to u=_Aw satisfying f~u~u~w~\mathsf {refl}_u~q \equiv q we may find some family of identifications H_f: {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(u,v,w:A)}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(p:u=_Av)}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(q:v=_Aw)}} fuvwpq =_{u=_Aw} \mathsf {paste}~u~v~w~p~q \text {.}
For clarity, we give an implicit definition of H_f:
H_f~u~u~w~\mathsf {refl}_u~q :\equiv \mathsf {refl}_qThe corresponding explicit definition would be a more complicated instance of \mathsf {J}:
H_f :\equiv \lambda u,v,w,p\mathpunct {.} \mathsf {J}_{ y,z\mathpunct {.} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(q:y=_Aw)}} fuywzq =_{u=_Aw} \mathsf {paste}~u~y~w~z~q }(p; \lambda q\mathpunct {.} \mathsf {refl}_q )Basic results [01EL]
- October 15, 2025
- Jon Sterling
Exercise Pasting is associative [01EM]
- October 15, 2025
- Jon Sterling
Construct an element of the following type witnessing that pasting is associative:
{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(u,v,w,x:A)}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(p:u=_Av)}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(q:v=_Aw)}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(r:w=_Ax)}} u\cdot (v\cdot w) =_{u=_Aw} (u\cdot v) \cdot wExercise Flipping inverts identifications [01EN]
- October 15, 2025
- Jon Sterling
Construct an element of the following type witnessing that the result of composing an identification with its flipping is trivial:
{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(u,v:A)}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(p:u=_Av)}} p\cdot \bar p =_{u=_Au} \mathsf {refl}_uUniverses, or types of types [01ET]
- October 15, 2025
- Jon Sterling
As we have presented it, dependent type theory has two kinds of entity: types and their elements. In many cases, it is useful to have a type whose elements are themselves types!
- Even though we have not been shy about writing phrases like “Let A be a type”, we do not currently have the ability to say something like “Let f be a polymorphic function on lists”. If we had a type of types like \mathsf {type}~\mathit {type}, we would give f a precise typing like f:{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(A:\mathsf {type})}}\;\mathsf {List}~A\to \mathsf {List}~A.
- If we had a type of types, we would be able to define more examples of dependent types that do something different depending on some value. For example, we would be able to define a type-level
ifexpression without relying on large elimination. In fact, we will see that either large elimination or a universe is required to prove that \mathsf {true} is not equal to \mathsf {false}!
We do need to be careful, for two reasons:
- Syntactic objection. A type of types doesn’t make sense, because types are syntactically different kinds of entities from elements. We will solve this by distinguishing between the “code” of a type, which is an element, and the type that it encodes.
- Semantic objection. Even if we address the syntactic objection, a type of all types leads to contradiction via the Burali-Forti/Russell “paradox”, because such a type would include itself. Sidenote: the term “paradox” comes from a time when people were far more confused than we are today; we should think of these as no-go theorems instead. We will solve this by considering only types of some types.
Although there are many ways to handle these things in a technical sense, we will adopt a particular approach described by Rijke. The idea is to have a type \mathcal {U}~\mathit {type} together with a family X:\mathcal {U}\vdash \mathcal {T}[X]~\mathit {type}; then an element X:\mathcal {U} is thought of as encoding the type \mathcal {T}[X]~\mathit {type}.
Definition Universe [01F6]
- October 15, 2025
- Jon Sterling
A universe is defined to be a type \mathcal {U}~\mathit {type} together with a family X:\mathcal {U}\vdash \mathcal {T}[X]~\mathit {type} that is closed under all the type constructors in the sense that we have the following operations and laws:
\frac {}{ \overline {\mathsf {empty}}:\mathcal {U} \qquad \mathcal {T}[\overline {\mathsf {empty}}]\equiv \mathsf {empty} ~\mathit {type} } \frac {}{ \overline {\mathsf {unit}}:\mathcal {U} \qquad \mathcal {T}[\overline {\mathsf {unit}}]\equiv \mathsf {unit} ~\mathit {type} } \frac {}{ \overline {\mathsf {bool}}:\mathcal {U} \qquad \mathcal {T}[\overline {\mathsf {bool}}]\equiv \mathsf {bool} ~\mathit {type} } \frac { X:\mathcal {U}\quad x:\mathcal {T}[X]\vdash Y[x]:\mathcal {U} }{ {\mathop {\mathchoice {\textstyle \overline \prod }{\textstyle \overline \prod }{\scriptstyle \overline \prod }{\scriptscriptstyle \overline \prod } }_{(x:X)}}Y[x]:\mathcal {U} \qquad \mathcal {T}\bigl [ {\mathop {\mathchoice {\textstyle \overline \prod }{\textstyle \overline \prod }{\scriptstyle \overline \prod }{\scriptscriptstyle \overline \prod } }_{(x:X)}}Y[x] \bigr ] \equiv {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:\mathcal {T}[X])}} \mathcal {T}[Y[x]] ~\mathit {type} } \frac { X:\mathcal {U}\quad x:\mathcal {T}[X]\vdash Y[x]:\mathcal {U} }{ {\mathop {\mathchoice {\textstyle \overline \sum }{\textstyle \overline \sum }{\scriptstyle \overline \sum }{\scriptscriptstyle \overline \sum } }_{(x:X)}}Y[x]:\mathcal {U} \qquad \mathcal {T}\bigl [ {\mathop {\mathchoice {\textstyle \overline \sum }{\textstyle \overline \sum }{\scriptstyle \overline \sum }{\scriptscriptstyle \overline \sum } }_{(x:X)}}Y[x] \bigr ] \equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:\mathcal {T}[X])}} \mathcal {T}[Y[x]] ~\mathit {type} } \frac { X:\mathcal {U}\quad u,v:\mathcal {T}[X] }{ \overline {\mathsf {Id}}(X,u,v):\mathcal {U} \qquad \mathcal {T}[ \overline {\mathsf {Id}}(X,u,v) ]\equiv (u =_{\mathcal {T}[X]} v) ~\mathit {type} }Conflating elements of universes and types [01F7]
- October 15, 2025
- Jon Sterling
Now, because we have avoided syntactically conflating elements with types, we are free to conflate them notationally:
- When we have X:\mathcal {U}, we may simply write X~\mathit {type} to mean \mathcal {T}[X]~\mathit {type}.
- When we have A~\mathit {type} such that we know of some evident \bar {A}:\mathcal {U} such that A\equiv \mathcal {T}[\bar {A}]~\mathit {type}, we may simply write A:\mathcal {U} rather than \bar {A}:\mathcal {U}.
The above are only notation: we are not changing the syntactic status of types and elements, but instead describing a convention by which readers and writers agree to understand expressions involving universes.
The axiom of universes [01F8]
- October 15, 2025
- Jon Sterling
We have not assumed that any universes actually exist; we have just described the rules of universes. There are many ways to axiomatise universes, but one particularly clean approach (due to Grothendieck and adapted to the type theoretic setting by Rijke) is to declare that for any finite sequence of families \mathbf {A} \equiv (A_i~\mathit {type})_{(i<n)} \qquad \mathbf {B} \equiv (x:A_i\vdash B_i[x]~\mathit {type})_{(i<n)} we have a universe (\mathcal {U}_{\mathbf {A},\mathbf {B}}, \mathcal {T}_{\mathcal {A},\mathcal {B}}) closed additionally under the following rules for each k<n: \frac { u:A_k }{ \overline {B_k[u]}:\mathcal {U}_{\mathbf {A},\mathbf {B}} \qquad \mathcal {T}\bigl [ \overline {B_k[u]} \bigr ] \equiv B_k[u] ~\mathit {type} }
It can be difficult to understand what is going on in the axiom of universes. It is simplest to understand in the case of n=1, so that we are looking at a single family x:A\vdash B[x]~\mathit {type}. In this case, the universe \mathcal {U}_{A,B} contains each type B[u] for u:A; so the role of the family here is to close the universe under all the components of a family at once. Multiple families are allowed for further expressivity; to see why this is needed, consider the following example of a universe hierarchy:
Example A hierarchy of universes [01FA]
- October 15, 2025
- Jon Sterling
We let (\mathcal {U}_0,\mathcal {T}_0) be the universe associated to the empty set of families. Then for each n, we define (\mathcal {U}_{n+1},\mathcal {T}_{n+1}) to be universe associated to the following two families:
\_:\mathsf {unit}\vdash \mathcal {U}_n~\mathit {type} \qquad X:\mathcal {U}_n\vdash \mathcal {T}_n[X]~\mathit {type}Thus \mathcal {U}_1 contains \mathcal {U}_0 and also any type that \mathcal {U}_0 contains, and so on
Many presentations of type theory (including those used in Agda, Rocq, and Lean) impose universe hierarchies at the start. We’ll take an agnostic approach, and just assume a universe where it is needed. We won’t assume that this universe necessarily comes from the hierarchy described above.
Non-triviality of the booleans, cooked two ways [01FB]
When we say that the booleans are non-trivial, we mean that \mathsf {true} is not equal to \mathsf {false}. This kind of statement can be expressed in type theory by the following type:
\mathsf {true} =_{\mathsf {bool}} \mathsf {false} \to \mathsf {empty}An element of the type above would witness that \mathsf {true} =_{\mathsf {bool}} \mathsf {false} is contradictory, since if the antecedent would be witnessed, then we would be able to form an element of the empty type. Without either large elimination or a universe, we cannot construct a witness of this type; I don’t just mean that it is not easy to see how to construct such a witness, but rather that type theory without these facilities is consistent with there being a witness of \mathsf {true} =_{\mathsf {bool}} \mathsf {false} or even with the judgemental assertion \mathsf {true} \equiv \mathsf {false}:\mathsf {bool} holding. (Consistency can be seen using a very simple model where every type is interpreted by a subsingleton set.) So large eliminations and universes add a lot of power!
Via large elimination [01FC]
Let us see how to witness \mathsf {true} =_{\mathsf {bool}}\mathsf {false}\to \mathsf {empty} using a large elimination. First define a family x:\mathsf {bool}\vdash T[x]~\mathit {type} using the large elimination: T[x] :\equiv \mathsf {If}(x, \mathsf {unit}, \mathsf {empty})
Then we define a witness f:\mathsf {true} =_{\mathsf {bool}}\mathsf {false}\to \mathsf {empty} using transport:
fp :\equiv p_*^T()To see that the above makes sense, we note that p_*^T is a function from T[\mathsf {true}] to T[\mathsf {false}] because we have p:\mathsf {true}=_{\mathsf {bool}}\mathsf {false}. But T[\mathsf {true}]\equiv \mathsf {unit} and T[\mathsf {false}]\equiv \mathsf {empty}! So we have p_*^T():\mathsf {empty}.
Via a universe [01FD]
Let (\mathcal {U},\mathcal {T}) be a universe. Then we define the famiy x:\mathsf {bool}\vdash T[x]~\mathit {type} using the universe and the ordinary elimination rule of the booleans:
T[x] :\equiv \mathcal {T}\bigl [ \mathsf {if}_{\_\mathpunct {.}\mathcal {U}}(x, \overline {\mathsf {unit}}, \overline {\mathsf {empty}}) \bigr ]The witness f:\mathsf {true}=_{\mathsf {bool}}\mathsf {false}\to \mathsf {empty} is then defined as in § [01FC]:
fp :\equiv p_*^T()This works because T[\mathsf {true}] \equiv \mathcal {T}[\overline {\mathsf {unit}}]\equiv \mathsf {unit} and T[\mathsf {false}]\equiv \mathcal {T}[\overline {\mathsf {empty}}]\equiv \mathsf {empty}.
Exercises [01J5]
- August 27, 2025
- Jon Sterling
Exercise. Pasting identifications › Basic results › Pasting is associative [01EM]
- October 15, 2025
- Jon Sterling
Construct an element of the following type witnessing that pasting is associative:
{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(u,v,w,x:A)}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(p:u=_Av)}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(q:v=_Aw)}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(r:w=_Ax)}} u\cdot (v\cdot w) =_{u=_Aw} (u\cdot v) \cdot wExercise. Pasting identifications › Basic results › Flipping inverts identifications [01EN]
- October 15, 2025
- Jon Sterling
Construct an element of the following type witnessing that the result of composing an identification with its flipping is trivial:
{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(u,v:A)}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(p:u=_Av)}} p\cdot \bar p =_{u=_Au} \mathsf {refl}_uLecture Univalent foundations I [01FG]
- August 27, 2025
- Jon Sterling
Truncation levels [01FV]
The most important idea of univalent foundations is the hierarchy of truncation levels due to Vladimir Voevodsky. The beginning of the truncation hierarchy maps directly onto classical notions like “exists uniquely” and “is unique if it exists”. Ascending higher in the hierarchy, we discover new notions that are not accounted directly for by traditional foundations.
Definition Contractible types [01FJ]
We say that a type A is contractible when we have a unique element of that type. To formalise this statement in type theory, we combine sums, products, and identification types:
\mathsf {isContr}(A) :\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(y:A)}} x=_A yRemark Revisiting the contractibility of singletons [01FW]
We previously saw the contractibility of singletons in our discussion of the identification elimination rule. Indeed, we can show that for any u:A the singleton type \{u\}_A is contractible in this sense, with the witness \left \langle \left \langle u,\mathsf {refl}_u\right \rangle , h\right \rangle : \mathsf {isContr}(\{u\}_A) where h: {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(v:\{u\}_A)}} \left \langle u,\mathsf {refl}_u\right \rangle =_{\{u\}_A}v is defined by the following equation: h~\left \langle u,\mathsf {refl}_u\right \rangle :\equiv \mathsf {refl}_{\left \langle u, \mathsf {refl}_u\right \rangle }
Example The unit type is contractible [01FX]
The uniqueness rule states that every element of the unit type is judgementally equal to (). So we may witness \mathsf {isContr}(\mathsf {unit}) by \left \langle (), \lambda y\mathpunct {.} \mathsf {refl}_{()}\right \rangle .
Definition Propositions [01FK]
A proposition is defined to be a type in which any two elements may be identified. (But it could be empty!) This is formalised in type theory as follows:
\mathsf {isProp}(A) :\equiv {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y:A)}} x=_A yIn traditional mathematics, one more often uses the phrase “truth value” for what we call a “proposition”. This usage is OK, but will not take it to mean that we assume every truth value is either “true” (the unit type) or “false” (the empty type).
Exercise The empty type is a proposition [01FZ]
Show that \mathsf {empty} is a proposition.
Exercise Contractible types vs. propositions [01G1]
Show that any contractible type is a proposition; give an example of a proposition that is not contractible, with proof.
Definition Sets [01FY]
In univalent foundations, we define a set to be a type whose identification types are all propositions. This is formalised in type theory as follows:
\mathsf {isSet}(A) :\equiv {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y:A)}} \mathsf {isProp}(x=_Ay)Discussion Why are they called “sets”? [01G2]
Why do we call a type whose identification types are all propositions a “set”? In ordinary set-theoretic mathematics, two things being equal is always a proposition in the sense that there is always at most one way for two things to be equal. In type theory, we can call a type a “set” when it behaves like a traditional set in precisely this sense.
Sets in traditional foundations are also associated with the well-ordering of the \in -relation, which isn’t something we can talk about directly for types, and we don’t intend to invoke it when we speak of sets in univalent foundations. Type theorists capture this aspect of set theory by developing theories of trees and ordinals.
Voevodsky saw that contractible types, propositions, and sets form the beginning of a hierarchy that measures how “complicated” a type is (in a certain sense). We can define the rest of that hierarchy by induction, starting (conventionally) at -2.
Definition n-truncated types [01FL]
A type is -2-truncated when it is contractible. A type is k+1-truncated when all of its identification types are k-truncated.
\begin {aligned} \mathsf {isTrunc}_{-2}(A) &:\equiv \mathsf {isContr}(A) \\ \mathsf {isTrunc}_{k+1}(A) &:\equiv {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y:A)}} \mathsf {isTrunc}_k(x=_Ay) \end {aligned}Lemma Propositions are (some) sets [01G4]
Any proposition A is also a set. Assuming h_A: {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y:A)}} x=_A y we must fill in the following hole: \begin {aligned} & \mathsf {propsAreSets}_A : {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y:A)}} \mathsf {isProp}(x=_Ay) \\ &\mathsf {propsAreSets}_A~x~y :\equiv \{{?}[x,y]:\mathsf {isProp}(x=_Ay)\} \end {aligned}
Because contractible types are propositions, we can refine the goal further (this is a bit of a leap!):
\begin {aligned} & \mathsf {propsAreSets}_A : {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y:A)}} \mathsf {isProp}(x=_Ay) \\ &\mathsf {propsAreSets}_A~x~y :\equiv \mathsf {contrTypesAreProps}~ \{{?}[x,y]:\mathsf {isContr}(x=_Ay)\} \end {aligned}To fill in the hole, we start making an auxiliary definition:
\begin {aligned} & \mathsf {propsAreSetsAux}_A : {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y:A)}} \mathsf {isContr}(x=_Ay) \\ &\mathsf {propsAreSetsAux}_A~x~y = \{{?}[x,y]:\mathsf {isContr}(x=_Ay)\} \\\\ & \mathsf {propsAreSets}_A : {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y:A)}} \mathsf {isProp}(x=_Ay) \\ &\mathsf {propsAreSets}_A~x~y :\equiv \mathsf {contrTypesAreProps}~(\mathsf {propsAreSetsAux}_A~x~y) \end {aligned}We start refining our auxiliary definition.
\begin {aligned} & \mathsf {propsAreSetsAux}_A : {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y:A)}} \mathsf {isContr}(x=_Ay) \\ &\mathsf {propsAreSetsAux}_A~x~y~.1:\equiv \{{?_1}[x,y]:x=_Ay\} \\ &\mathsf {propsAreSetsAux}_A~x~y~.2~p:\equiv \{ {?_2}[x,y,p]: {?_1}[x,y] =_{x=_Ay} p \} \end {aligned}It is at this point where an idea is required, as there are several possibilities for how we might fill in ?_1. If we try defining {?_1}[x,y] :\equiv h_Axy, we will get stuck trying to fill in ?_2[x,y,p]. On the other hand, let's consider how we might eventually fill in the second hole regardless of how the first one gets filled in. It seems natural that we would use identification elimination to get rid of (y,p):
\begin {aligned} & \mathsf {propsAreSetsAux}_A : {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y:A)}} \mathsf {isContr}(x=_Ay) \\ &\mathsf {propsAreSetsAux}_A~x~y~.1:\equiv \{{?_1}[x,y]:x=_Ay\} \\ &\mathsf {propsAreSetsAux}_A~x~x~.2~\mathsf {refl}_x:\equiv \{ {?_2}[x]: {?_1}[x,x] =_{x=_Ax} \mathsf {refl}_x \} \end {aligned}This is very interesting. What we know is that howsoever we fill in ?_1[x,y], we need to identify the “diagonal” case ?_1[x,x] with \mathsf {refl}_x. If we filled in {?_1}[x,y] :\equiv h_Axy we would be stuck when we try to fill in {?_2}[x]:h_Axx =_{x=_Ax}\mathsf {refl}_x. What we know is that whatever we do is going to have to involve h_Axy because that is the only way to identify x and y that we have in scope; but we need to do something that will vanish when x\equiv y. In this diagonal case, we will have some expression involving h_Axx and we want the rest of that expression to cancel this out so that we get \mathsf {refl}_x. One way to ensure this would be to find a way to define {?_1}[x,y] such that {?_1}[x,x] \equiv \overline {h_Axx}\cdot h_Axx, since this would cancel out due to the laws of identification flipping (see Exercise [01EN]). Thinking about this, we can come up with two good ideas for instantiating the hole:
- We could set {?_1}[x,y] :\equiv h_Axy\cdot \overline {h_Ayy}.
- Or we could set {?_1}[x,y] :\equiv \overline {h_Axx}\cdot h_Axy.
Both ideas will work, because we shall have h_Axx\cdot \overline {h_Axx} =_{x=_Ax} \mathsf {refl}_x =_{x=_Ax} \overline {h_Axx}\cdot h_Axx! Let’s do the second one:
\begin {aligned} & \mathsf {propsAreSetsAux}_A : {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y:A)}} \mathsf {isContr}(x=_Ay) \\ &\mathsf {propsAreSetsAux}_A~x~y~.1:\equiv \overline {h_Axx}\cdot h_Axy \\ &\mathsf {propsAreSetsAux}_A~x~x~.2~\mathsf {refl}_x:\equiv \mathsf {flipPasteFlipLaw}~(h_Axx) \end {aligned}Above, we wrote \mathsf {flipPasteFlipLaw} for the witness constructed in Exercise [01EN].
Lemma Truncation levels for propositions [01G3]
A type is a proposition if and only if it is -1-truncated
We compute out the formal definition of -1-truncation for a type A:
\mathsf {isTrunc}_{-1}(A) \equiv {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y:A)}} \mathsf {isTrunc}_{-2}(x=_Ay) \equiv {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y:A)}} \mathsf {isContr}(x=_Ay)If A is -1-truncated, then it is clearly a proposition, as we have the projection function \mathsf {isContr}(x=_Ay) \to x=_Ay. Conversely, suppose that A is a proposition. Fixing x,y:A we must show that the identification type x=_Ay is contractible by giving an element of the following type:
{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(p:x=_Ay)}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(q:x=_Ay)}} p=_{x=_Ay}qFor the first component, we use our assumption that A is a proposition so any two of its elements may be identified. For the second component, it would suffice to show that for any x,y:A and p,q:x=_Ay we may witness p=_{x=_Ay} q. This is the same as showing that A is a set, which follows from the fact that propositions are sets.
Lemma Truncation levels for sets [01GB]
A type is a set if and only if it is 0-truncated.
We compute out the formal definition of 0-truncation for a type A:
\mathsf {isTrunc}_0(A) \equiv {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y:A)}} \mathsf {isTrunc}_{-1}(x=_Ay)By our previous lemma characterising propositions, this is equivalent to being a set. (We haven’t yet formalised the appropriate notion of “equivalence”, but for now it suffices that we can pass from set-hood to 0-truncation and vice versa.)
Lemma Upward closure of n-truncated types [01FM]
For n\geq -2, any n-truncated type is n+1-truncated.
When n\equiv -2, we must check that any contractible type is also -1-truncated; we have seen that propositions are precisely the -1-truncated types, and we have also seen that contractible types are propositions.
In the inductive step, suppose that every n-truncated type is n+1-truncated. We must show that every n+1-truncated type is n+2-truncated. Fixing n+1-truncated A, so that we have h: {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y:A)}} \mathsf {isTrunc}_n(x=_Ay) we must construct verify that A is n+2-truncated by constructing a witness of: {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y:A)}} \mathsf {isTrunc}_{n+1}(x=_Ay)
Fixing x,y:A, we must find an element of \mathsf {isTrunc}_{n+1}(x=_Ay). Our inductive hypothesis says that all n-truncated types n+1-truncated. Instantiating our assumption, we have hxy:\mathsf {isTrunc}_n(x=_Ay) and so we conclude \mathsf {isTrunc}_{n+1}(x=_Ay) by our induction hypothesis.
Remark External vs. internal induction [01GC]
Our statement of the upward closure of n-truncation should be understood, at this point, to be schematic in truncation levels; and so the induction on truncation levels is external. In the future, once we have a type of natural numbers, we would be able to state and prove this property entirely inside of type theory using the elimination rule of the natural numbers. Note that the induction hypothesis involves a quantification over “all” types, so we would need to use a universe in that case.
(If this remark mystifies you, don’t get hung up on it; it can safely be ignored until we have achieved the needed sensitivity.)
Decidable equality and Hedberg’s theorem [01FN]
A famous result of type theory says that any type whose identification types are decidable (“has decidable equality” for short) is a set. This is not easy to prove directly, and in fact there are a number of proofs that work using different assumptions. We haven’t assumed much yet, so some of those proofs are not yet accessible to us. But there is one proof that we can do based on the idea of a “weakly constant function”. First we define decidable equality formally:
Definition Decidability [01GR]
A type A is said to be decidable when we have either an element of A or a proof that there can be no such element. This is formalised in the following type:
\mathsf {isDec}(A) :\equiv A + (A\to \mathsf {empty})Definition Decidable equality [01GG]
A type A is said to have decidable equality when all of its identification types are decidable:
\mathsf {hasDecEq}(A) :\equiv {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y:A)}} \mathsf {isDec}(A) x=_Ay + (x=_Ay\to \mathsf {empty})Warm-up How shall we proceed? [01GO]
We assume that some type A has decidable equality, so that we have d_A:\mathsf {hasDecEq}(A) in our pocket. Fixing x,y:A and p,q:x=_Ay we need to show that p=_{x=_Ay}q.
We can’t just use identification elimination
First of all, we note that using identification elimination here gets us nowhere: if we contract (y,p) to (x,\mathsf {refl}_x) then we are trying to show that q=_{x=_Ax}\mathsf {refl}_x for all x and q and that is not any easier than what we started with. (The symmetric thing will happen if we instead contract (y,q).)
Idea: a weakly constant identity function
Another idea would be to try to find some further identifications r,s:x=_Ay where it is easy to show that p=_{x=_Ay}r and and r=_{x=_Ay}s and s=_{x=_Ay}q and thus p=_{x=_Ay}q. It doesn’t seem like at first like this would help, but one rule of thumb is that adding extra “flex” into the problem can really help in univalent foundations. If we make just one leap and decide that we shall obtain r from p and s from q respectively by means of some function, then we can get a good idea of what properties that function needs to have:
- In order to make p=r and q=s, our function needs to behave like the identity function.
- In order to make r=s our function needs to give equal outputs regardless of the inputs (i.e., it should be “constant” in a certain sense).
Of course, this is all a little magical and you might not have any reason as-yet to believe that we can carry out the idea above. But it will happen that it is possible and not too difficult. First we must make a few preliminary definitions:
Definition Weakly constant function [01GP]
A function f:A\to B is called weakly constant when any two of its values can be identified. In other words, we have an element of the following type:
\mathsf {isWeaklyConstant}(f) :\equiv {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y:A)}} fx=_A fyDefinition Identity function [01GQ]
A function f:A\to A is called an identity function when we its value on #x:A can be identified with x; in other words, when we have an element of the following type:
\mathsf {isIdentity}(f) :\equiv {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}} fx=_AxTheorem Hedberg’s theorem [01GM]
Any type A that has decidable equality is a set. Assuming H_A:\mathsf {hasDecEq(A)}, we must check that for all x,y:A and p,q:x=_Ay we have p=_{x=_Ay}q. Putting that aside for now, we first consider that when an individual identification type x=_Ay is decidable, we can “replace” any specific identification p:x=_Ay with the result of the decision procedure.
\begin {aligned} &\mathsf {repl}_{x,y}:\mathsf {isDec}(x=_Ay)\to x=_Ay\to x=_Ay \\ &\mathsf {repl}_{x,y}~(\mathsf {inl}~q)~p :\equiv q \\ &\mathsf {repl}_{x,y}~(\mathsf {inr}~h)~p :\equiv \mathsf {abort}~(hp) \end {aligned}We can show that for each d:\mathsf {isDec}(x=_Ay), the function \mathsf {repl}_{x,y}~d is weakly constant without much difficulty by cases on d:
\begin {aligned} &\mathsf {replIsWeaklyConstant}_{x,y}: {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(d:\mathsf {isDec}(x=_Ay))}} \mathsf {isWeaklyConstant}~(\mathsf {repl}_{x,y}~d) \\ &\mathsf {replIsWeaklyConstant}_{x,y}~(\mathsf {inl}~r)~p~q :\equiv \mathsf {refl}_{r} \\ &\mathsf {replIsWeaklyConstant}_{x,y}~(\mathsf {inr}~h)~p~q :\equiv \mathsf {abort}~(hp) \end {aligned}Unfortunately, we cannot seem to show that \mathsf {repl}_{x,y}~d is the identity function. Indeed, to define the case for d\equiv \mathsf {inl}~r we would need to show that any identification p:x=_Ay is equal to r, which is just as hard as our main goal. We can wriggle out of this tough spot using a trick we’ve seen before: we can “pad” \mathsf {repl}_{x,y} with a flipped instance of \mathsf {refl}_{x,x} on either the left-hand or the right-hand side. Then later on, the two will cancel out. Using our witness h_A:\mathsf {hasDecEq}(A), let us define a new function to “clean” an identification:
\begin {aligned} &\mathsf {clean}^{h_A}_{x,y}:x=_Ay\to x=_Ay \\ &\mathsf {clean}^{h_A}_{x,y}~p :\equiv \overline { \mathsf {repl}_{x,x}~(h_Axx)~\mathsf {refl}_x } \cdot \mathsf {repl}_{x,y}~p \end {aligned}First we check that \mathsf {clean}_{x,y} is the identity function:
\begin {aligned} & \mathsf {cleanIsIdentity}_{h_A}: {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y:A)}} \mathsf {isIdentity}(\mathsf {clean}^{h_A}_{x,y}) \\ & \mathsf {cleanIsIdentity}_{h_A}~x~y~p :\equiv \bigl \{ ?: \mathsf {clean}^{h_A}_{x,y}~p =_{x=_Ay} p \bigr \} \end {aligned}We proceed by identification elimination on (y,p) and unravel the definition of \mathsf {clean}:
\begin {aligned} & \mathsf {cleanIsIdentity}_{h_A}: {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y:A)}} \mathsf {isIdentity}(\mathsf {clean}^{h_A}_{x,y}) \\ & \mathsf {cleanIsIdentity}_{h_Axx}~\mathsf {refl}_x :\equiv \bigl \{ ?: \overline { \mathsf {repl}_{x,x}~(h_Axx)~\mathsf {refl}_x } \cdot \mathsf {repl}_{x,x}~(h_Axx)~\mathsf {refl}_x =_{x=_Ax} \mathsf {refl}_x \bigr \} \end {aligned}But that is just the left unit law for flipping:
\begin {aligned} & \mathsf {cleanIsIdentity}_{h_A}: {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y:A)}} \mathsf {isIdentity}(\mathsf {clean}^{h_A}_{x,y}) \\ & \mathsf {cleanIsIdentity}_{h_A}~x~x~\mathsf {refl}_x :\equiv \mathsf {flipLeftUnit}(\mathsf {repl}_{x,x}~(h_Axx)~\mathsf {refl}_{x}) \end {aligned}We still need to check that \mathsf {clean}^{h_A}_{x,y} is weakly constant; luckily, we can reuse our proof that \mathsf {repl}_{x,y} is weakly constant:
\begin {aligned} & \mathsf {cleanIsWeaklyConstant}^{h_A}_{x,y} : \mathsf {isWeaklyConstant}(\mathsf {clean}^{h_A}_{x,y}) \\ & \mathsf {cleanIsWeaklyConstant}^{h_A}_{x,y}~p~q :\equiv \\ &\quad \bigl \{ ?: \overline {\mathsf {repl}_{x,x}~(h_Axx)~\mathsf {refl}_x} \cdot \mathsf {repl}_{x,y}~(h_Axy)~p =_{x=_Ay} \overline {\mathsf {repl}_{x,x}~(h_Axx)~\mathsf {refl}_x} \cdot \mathsf {repl}_{x,y}~(h_Axy)~q \bigr \} \end {aligned}We already know that \mathsf {repl}_{x,y}~(h_Axy)~p=_{x=_Ay}\mathsf {repl}_{x,y}~(h_Axy)~q because we have shown that \mathsf {repl}_{x,y} is weakly constant. So we use the action on identifications:
\begin {aligned} & \mathsf {cleanIsWeaklyConstant}_{x,y} : \mathsf {isWeaklyConstant}(\mathsf {clean}^{h_A}_{x,y}) \\ & \mathsf {cleanIsWeaklyConstant}_{x,y}~p~q :\equiv \mathsf {act}_{\lambda r\mathpunct {.} \overline {\mathsf {repl}_{x,x}~\mathsf {refl}_x}\cdot r} \bigl (\mathsf {replIsWeaklyConstant}_{x,y}~(h_Axy)\bigr ) \end {aligned}Finally we can combine all this to verify Hedberg’s theorem:
\begin {aligned} & \mathsf {hedberg}:\mathsf {hasDecEq}(A)\to \mathsf {isSet}(A) \\ & \mathsf {hedberg}~h_A~x~y~p~q :\equiv \\ &\begin {array}{l} \overline {\mathsf {cleanIsIdentity}_{h_A}~x~y~p} \\ {}\cdot \mathsf {cleanIsWeaklyConstant}^{h_A}_{x,y}~p~q \\ {}\cdot \mathsf {cleanIsIdentity}_{h_A}~x~y~q \end {array} \end {aligned}n-truncated functions and equivalences [01HA]
- September 12, 2025
- Jon Sterling
We recall the definition of fibres:
Definition Fibres [01ES]
By combining function types, dependent pair types, and identification types, we can finally define something useful. Given a function f:A\to B and an element b:B, we define the fibre of f over b to by the type of elements of A whose image in B is identified with b:
\mathsf {fib}_f(b) :\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}} fx=_B bWe could have defined fibres with an equation in the opposite direction. The two versions are going to be equivalent; but if it matters, we’ll write the following notations:
\begin {aligned} \mathsf {fib}^-_f(b) &:\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{fx=_Bb} \\ \mathsf {fib}^+_f(b) &:\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{b=_B fx} \end {aligned}In mathematics, a property that is defined for sets (or spaces, algebras, etc.) is often generalised to pertain to functions (or homomorphisms, etc.) by imposing the original property on the fibres of the function; then the original notion is recovered for a given set X by consider the universal map X\to \mathsf {unit}. Generalising the idea of n-truncation from types to functions gives rise to one of the most important concepts in univalent foundations: the equivalence.
Definition n-truncated function [01HB]
- September 12, 2025
- Jon Sterling
A function f:A\to B is said to be n-truncated when all of its fibres \mathsf {fib}_{f}(x) for x:B are n-truncated.
In particular, a function is called contractible (resp. propositional) when all of its fibres are contractible (resp. propositions). The notion of a contractible function will be our first (of many) equivalent formalisations of the concept of “equivalence” between types. Each time we introduce a new notion of equivalence, we will that it is equivalent to the prior notions and thenceforth treat them interchangeably.
Definition Equivalence (I) [01HC]
- September 12, 2025
- Jon Sterling
A function f:A\to B is called an equivalence when it is contractible.
Homotopies, sections, retractions, (bi-)inverses [01FH]
So far we have encountered three possible kinds of sameness for dependent functions f,g:{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]}:
- They could be judgementally equal in the sense that f\equiv g:{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]} holds. We have seen that this is equivalent to the values of the function being equal in the sense that x:A\vdash fx\equiv gx:B[x] holds.
- They could be identified by an element p:f=_{{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}B[x]}g of the identification type.
- Their values could be identified by a family x:A\vdash h[x]:fx=_{B[x]}gx of identifications, or (equivalent) by a dependent function h:{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}fx=_{B[x]}gx assigning identifications to elements of A.
The third notion is above is called a homotopy from f to g. With the foundations that we have set up so far, homotopies are the most correct way to express the mathematical sameness of two functions. Later on, we will see how univalent foundations ensures that identifications of functions (the second notion) are equivalent to homotopies between functions.
Definition Homotopy [01FO]
Let f,g:{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]} be two dependent functions. A homotopy from f to g is defined to be a dependent function h:{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{fx=_{B[x]}gx} sending each element of A to an identification between its respective values in f and g. We will sometimes write f\sim g for the type of homotopies from f to g.
Definition Sections and retractions [01FQ]
A section-retraction pair is defined to be a pair of functions s:B\to A and r:A\to B equipped with a homotopy r\circ s\sim 1_B. In this context, s is called a section of r and r is called a retraction of s. The idea is that r “undoes” or “retracts” whatever s does. B is called a retract of A in the presence of such a section-retraction pair.
Given a function r:A\to B, the type of sections of r can be defined by a sum:
\mathsf {sectionOf}(r) :\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(s:B\to A)}} r\circ s \sim 1_BLikewise, for a function s:B\to A, the type of retractions of s can be defined similarly:
\mathsf {retractionOf}(s) :\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(r:A\to B)}} r\circ s\sim 1_BIn both scenarios, such a section-retraction pair is said to witness that B is a retract of A.
Lemma Propositions are closed under retracts [01H5]
Any retract of a proposition is a proposition.
Proof.
Let A be a proposition and let B a retract of A as witnessed by a section-retraction pair as follows:
\begin {aligned} &s:B\to A \\ &r:A\to B \\ &h:r\circ s\sim 1_B \end {aligned}We fix any two elements x,y:B, and we need to witness x=_By. Because A is a proposition, we have some identification p:sx=_Asy\text {,} upon which the action on identifications of the retraction r:A\to B yiels \mathsf {act}_{r}p:rsx=_Brsy\text {.}
Conjugating with the homotopy h:r\circ s\sim 1_B we obtain:
hx \cdot \mathsf {act}_rp \cdot \overline {hy}: x=_ByLemma Contractible types are closed under retracts [01H4]
As propositions are closed under retracts, it suffices to observe that inhabited types are also closed under retracts.
Construction Sums of retracts [01H3]
Fix types A,A'~\mathit {type} and families x:A\vdash B[x]~\mathit {type} and x:A'\vdash B'[x]~\mathit {type}. Suppose that A be a retract of A' as witnessed by \begin {aligned} &s_A:A\to A' \\ &r_A:A'\to A \\ &h_A:r_A\circ s_A\sim 1_{A} \end {aligned} and for each x:A' the component B[r_Ax] is a retract of B'[x] as witnessed by \begin {aligned} &s_B^x: B[r_Ax]\to B'[x] \\ &r_B^x: B'[x]\to B[r_Ax] \\ &h_B^x: r_B^x\circ s_B^x \sim 1_{B[r_Ax]} \text {.} \end {aligned}
Then we may exhibit {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]} as a retract of {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A')}}{B'[x]} as follows. We define the retraction first:
\begin {aligned} &r: {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A')}}{B'[x]} \to {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]} \\ & (r\left \langle x,y\right \rangle ).1 :\equiv r_Ax \\ & (r\left \langle x,y\right \rangle ).2 :\equiv r_B^{x}y \end {aligned}The section is more difficult. We start as follows:
\begin {aligned} &s:{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}B[x] \to {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A')}}{B'[x]} \\ &(s \left \langle x,y\right \rangle ).1:A' \\ &(s\left \langle x,y\right \rangle ).2: B'[ (s\left \langle x,y\right \rangle ).1 ] \end {aligned}In the first component, we have only one choice: to use section s_A.
\begin {aligned} &s:{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}B[x] \to {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A')}}{B'[x]} \\ & (s \left \langle x,y\right \rangle ).1 :\equiv s_Ax \\ &(s\left \langle x,y\right \rangle ).2: B'[ s_Ax ] \end {aligned}In the second component, we have no choice but to the section s_B^{s_Ax}, which requires as input an element of B[r_A(s_Ax)]. As r_A is a section of s_A, we have an identification h_Ax:r_A(s_Ax)=_Ax, along which we must transport.
\begin {aligned} &s:{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}B[x] \to {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A')}}{B'[x]} \\ & (s \left \langle x,y\right \rangle ).1 :\equiv s_Ax \\ & (s\left \langle x,y\right \rangle ).2 :\equiv s_B^{s_Ax}\left ( \overline {h_Ax}_*^B y \right ) \end {aligned}Next we must construct the homotopy witnessing the section-retraction pair.
x:A, y:B[x] \vdash h\left \langle x,y\right \rangle : r(s\left \langle x,y\right \rangle ) =_{{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}B[x]} \left \langle x,y\right \rangleUnravelling definitions, this is:
x:A, y:B[x] \vdash h\left \langle x,y\right \rangle : \left \langle r_A(s_Ax), r_B^{s_Ax} \left ( s_B^{s_Ax}\left ( \overline {h_Ax}_*^By \right ) \right ) \right \rangle =_{{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}B[x]} \left \langle x,y\right \rangleAt this point, we must “generalise” the goal in order to replace the complicated parts by variables that we can then contract using identification elimination. In this case, we will generalise over the pair \left \langle s_A x, h_Ax\right \rangle : {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x':A')}}{r_Ax'=x} so that our generalised goal becomes \begin {aligned} &x:A, x':A', p:r_Ax'=_Ax, y:B[x] \vdash \\ &\quad h'~\left \langle x,y\right \rangle ~\left \langle x',p\right \rangle : \left \langle r_Ax', r_B^{x'} \left ( s_B^{x'}\left ( \bar {p}_*^By \right ) \right ) \right \rangle =_{{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}B[x]} \left \langle x,y\right \rangle \end {aligned} so that we may define h\left \langle x,y\right \rangle :\equiv h'~\left \langle x,y\right \rangle ~\left \langle s_Ax,h_Ax\right \rangle
To fill in the generalised term h', we proceed by identification elimination on (x,p):
\begin {aligned} & x':A', y:B[r_Ax'] \vdash \\ &\quad h'~\left \langle r_Ax',y\right \rangle ~\left \langle x',\mathsf {refl}_{r_Ax}\right \rangle : \left \langle r_Ax', r_B^{x'} \left ( s_B^{x'}\left ( \overline {\mathsf {refl}_{r_Ax'}}_*^By \right ) \right ) \right \rangle =_{{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}B[x]} \left \langle r_Ax',y\right \rangle \end {aligned}Recalling that flipping and transport are both defined so as to compute definitionally on the reflexivity term, our goal gets simpler:
x':A', y:B[r_Ax'] \vdash h'~\left \langle r_Ax',y\right \rangle ~\left \langle x',\mathsf {refl}_{r_Ax}\right \rangle : \left \langle r_Ax', r_B^{x'} ( s_B^{x'}y ) \right \rangle =_{{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}B[x]} \left \langle r_Ax',y\right \rangleWe can now use the action on identifications of the pairing function \left \langle r_Ax',-\right \rangle \colon B[r_Ax'] \to {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]} on the identification h_B^{x'}y:r_B^{x'}(s_B^{x'}y) =_{B[r_Ax']} y as follows:
x':A', y:B[r_Ax'] \vdash h'~\left \langle r_Ax',y\right \rangle ~\left \langle x',\mathsf {refl}_{r_Ax'}\right \rangle :\equiv \mathsf {act}_{\left \langle r_Ax',-\right \rangle } (h_B^{x'}y)Definition Quasi-inverse [01H7]
A quasi-inverse to a function f:A\to B is given by another function \bar {f}:B\to A that is simultaneously a section and a retraction of f:
\begin {aligned} &\bar {f}:B\to A\\ &\epsilon :f\circ \bar {f} \sim 1_B\\ &\eta :\bar {f}\circ f \sim 1_A\\ \end {aligned}A function is called quasi-invertible when it is equipped with a quasi-inverse.
Definition Bi-inverse [01FI]
A bi-inverse to a function f:A\to B is defined to be a pair of a section and a retraction of f. This amounts to the following data:
- The section s:B\to A with its witnesssing homotopy \sigma :f\circ s\sim 1_B.
- The retraction r:B\to A with its witnessing homotopy \rho :r\circ f\sim 1_A.
A function is called bi-invertible when it is equipped with a bi-inverse.
Remark Why a separate section and retraction? [01FT]
In ordinary mathematics when working with sets, we would define an isomorphism from A to B to be a function f:A\to B together with a function g\colon B\to A that is simultaneously a section and a retraction of f. In set theoretic foundations, the set of isomorphisms from A to B is isomorphic to the set of equivalences (in our sense) from A to B. But in univalent foundations, although we can convert in either direction, the round trips do not line up.
The problem is that in univalent foundations, it is not a mere property of a function that it be simultaneously a section and a retraction of another function. The data of the homotopy matters. We will see later on that a function being bi-invertible is actually a proposition, whereas being quasi-invertible.
Lemma From bi-inverses to quasi-inverses [01HG]
- September 12, 2025
- Jon Sterling
Evidently a quasi-invertible function is bi-invertible, as we can simply take both the section and retraction to have the same underlying map. In the other direction, we can show that the underlying map of the section (resp. retraction) of a bi-inverse is simultaneously a retraction (resp. section). This gives us two ways to construct a quasi-inverse from a bi-inverse: you take either the section or the retraction.
In particular, let f:A\to B be a function with a bi-inverse as follows:
\begin {aligned} &s:B\to A \\ &h_s: f\circ s \sim 1_B \\ & r:B\to A \\ &h_r:r\circ f\sim 1_A \end {aligned}Now we may construct a quasi-inverse, setting \bar {f}:\equiv s. We need to construct the following homotopies:
\begin {aligned} &\epsilon : f\circ \bar {f} \sim 1_B \\ &\eta : \bar {f}\circ f \sim 1_A \end {aligned}We may trivially define \epsilon :\equiv h_s. For the retraction datum, we fix x:A and observe that we have h_s(fx) : f(s(fx)) =_A fx and thus \mathsf {act}_{r}(h_s(fx)) : r(f(s(fx))) =_A r(fx) which we may conjugate by h_r to obtain:
\overline {h_r(s(fx))} \cdot \mathsf {act}_r(h_s(fx)) \cdot h_r x : s(fx) =_A xBe careful! Although we have shown above that we can convert between bi-inverses and quasi-inverses, the two notions are not equivalence in the sense of univalent foundations: indeed, it is not the case that function sending a quasi-inverse to a bi-inverse is contractible.
Lemma Quasi-invertible maps are contractible [01H9]
Let f:A\to B be a map equipped with a quasi-inverse:
\begin {aligned} &\bar {f}:B\to A \\ &\epsilon :f\circ \bar {f}\sim 1_A \\ &\eta :\bar {f}\circ f\sim 1_B \end {aligned}Then f is contractible.
Proof.
We want to show that for each b:B, the fibre \mathsf {fib}_fb \equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(a:A)}}fa=_Bb is contractible. We will show that this type is a retract of the singleton \{b\}_B, recalling that contractible types are closed under retracts.
We recall the construction of sums of retracts; to show that \mathsf {fib}_fb is a retract of \{b\}_B, we can start by exhibiting A as a retract of B. For this, we use the section-retraction pair (f,\bar {f},\eta ). Then we need to show that for each x:B the identification type f (\bar {f}x)=_B b is a retract of x=b. We first define the section component:
\begin {aligned} b,x:B; p:f(\bar {f}x)=_Bb &\vdash s_{b,x}p: x=_B b \end {aligned}We proceed by identification elimination.
\begin {aligned} x:B &\vdash s_{f(\bar {f}x),x}\mathsf {refl}_{f(\bar {f}x)}: x=_B f(\bar {f}x) \\ x:B &\vdash s_{f(\bar {f}x),x}\mathsf {refl}_{f(\bar {f}x)} :\equiv \overline {\epsilon x} \end {aligned}Now we need to define the retraction:
\begin {aligned} x,b:B; p:x=_Bb &\vdash r_{x,b}p: f(\bar {f}x)=_Bb \\ x,b:B; p:x=_Bb &\vdash r_{x,b}p:\equiv \epsilon x \cdot p \end {aligned}Finally, the homotopy witnessing the section-retraction pair:
\begin {aligned} x,b:B; p:f(\bar {f}x)=_Bb &\vdash h_{x,b}p: \epsilon x\cdot s_{x,b} p =_{f(\bar {f}x)=_Bb} p \\ x:B &\vdash h_{x,f(\bar {f}x)}~\mathsf {refl}_{f(\bar {f}x)} : \epsilon x \cdot \overline {\epsilon x} =_{f(\bar {f}x)=_Bf(\bar {f}x)} \mathsf {refl}_{f(\bar {f}x)} \end {aligned}We finish up recalling the laws of flipping.
Lemma Contractible maps are quasi-invertible [01HH]
- September 12, 2025
- Jon Sterling
Any contractible map f:A\to B is quasi-invertible.
Proof.
- September 12, 2025
- Jon Sterling
Let us have the following witness of contractibility:
\gamma : {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(b:B)}} \mathsf {isContr}( \mathsf {fib}_fb )This means that for each b:B we have:
\begin {aligned} &\gamma (b).1 : \mathsf {fib}_fb \\ &\gamma (b).2 : {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(u:\mathsf {fib}_f(b))}} \gamma (b).1 =_{\mathsf {fib}_fb} u \end {aligned}Unravelling further, this is \begin {aligned} &\gamma (b).1.1 : A\\ &\gamma (b).1.2 : f(\gamma (b).1.1) =_B b\\ \end {aligned} and for each a:A and p:fa=_Bb we have \begin {aligned} \gamma (b).2\left \langle a,p\right \rangle : \gamma (b).1 =_{\mathsf {fib}_fb} \left \langle a,p\right \rangle \end {aligned} and in particular \mathsf {act}_{-.1}(\gamma (b).2\left \langle a,p\right \rangle ) : \gamma (b).1.1 =_A a \text {.}
We now assign names to some of the above.
\begin {aligned} &\bar {f}:B\to A \\ &\bar {f}b :\equiv \gamma (b).1.1 \\[12pt] &\epsilon : f\circ \bar {f} \sim 1_B \\ &\epsilon b :\equiv \gamma (b).1.2 \\[12pt] &\eta : \bar {f}\circ f\sim 1_A \\ &\eta a :\equiv \mathsf {act}_{-.1}(\gamma (b).2\left \langle a,\mathsf {refl}_{fa}\right \rangle ) \end {aligned}Exercises [01G0]
- August 27, 2025
- Jon Sterling
Exercise. Truncation levels › The empty type is a proposition [01FZ]
Show that \mathsf {empty} is a proposition.
Exercise. Truncation levels › Contractible types vs. propositions [01G1]
Show that any contractible type is a proposition; give an example of a proposition that is not contractible, with proof.
Lecture Univalent foundations II [01GU]
- September 8, 2025
- Jon Sterling
This lecture can be supplemented by the manuscript Reflexive graph lenses in univalent foundations, but it is not required.
It is often not easy to work directly with identification types: instead, we want to decompose identifications in some structure into smaller more intuitive notions that are related to the substructures. For example, we will today impose axioms to the effect that “an identification of functions given by a homotopy” and “an identification of types in a universe is given by an equivalence”. With these axioms, we will be able to deduce things like “an identification of monoids is given by a monoid isomorphism”. The mathematical construct needed to state all these properties is that of a reflexive graph, which we define below.
Definition Reflexive graph [01GW]
A reflexive graph A is given by a type \left \lvert {A}\right \rvert ~\mathit {type} of “vertices” and a family of types x,y:\left \lvert {A}\right \rvert \vdash x\approx _{A} y~\mathit {type} denoting “edges”, and a distinguished “reflexive edge” for every vertex: x:\left \lvert {A}\right \rvert \vdash \mathsf {rx}_{A}{x}:x\approx _{A} x
In the world of univalent foundations, we use the term reflexive graph to mean what classical mathematicians might call (reflexive) “pseudo-graphs” or “multi-graphs” or “quivers”.
Example The discrete reflexive graph [01GX]
For any type A, we may form a “discrete” reflexive graph \Delta A using the identification type:
\begin {aligned} &\left \lvert {\Delta A}\right \rvert :\equiv A \\ &x\approx _{\Delta A}y :\equiv x=_Ay \\ &\mathsf {rx}_{\Delta A}{x} :\equiv \mathsf {refl}_x \end {aligned}Most interesting reflexive graphs will not be defined in terms of the identification type, unlike the discrete reflexive graph. However, it will be a very important property that a given reflexive graph be equivalent to a discrete reflexive graph; in order to state this property later on, we define a function to compare the two:
Construction From identifications to edges [01H0]
Let A be a reflexive graph; we can define a canonical function from identifications of points in A to edges in A using identification elimination:
\begin {aligned} x,y:\left \lvert {A}\right \rvert ; p:x=_{\left \lvert {A}\right \rvert }y &\vdash \iota ^{A}_{x,y}~p: x\approx _{A}y \\ x:\left \lvert {A}\right \rvert &\vdash \iota ^{A}_{x,x}~\mathsf {refl}_x :\equiv \mathsf {rx}_{A}{x} \end {aligned}Definition Outward and inward fans [01GY]
Let A be a reflexive graph. For any vertex x:\left \lvert {A}\right \rvert , we define the outward fan of x to be the type \left \{x\right \}^+_{A} :\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(y:\left \lvert {A}\right \rvert )}} x\approx _{A} y consisting of all edges out of x; similarly, we define the inward fan of x to be the type \left \{x\right \}^-_{A}:\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(y:\left \lvert {A}\right \rvert )}} y\approx _{A} x consisting of all edges into x.
Observation Fans of the discrete reflexive graph [01GZ]
Discrete reflexive graphs \Delta A are special, in that all their inward and outward fans are contractible. This is a straightforward consequence of the contractibility of singletons, because the inward and outward fans in \Delta A are singletons:
\begin {aligned} \left \{x\right \}^+_{\Delta A} &\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(y:A)}}{x=_Ay} \\ \left \{x\right \}^-_{\Delta A} &\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(y:A)}}{y=_Ax} \end {aligned}Each of the above is evidently contractible onto the pair (x, \mathsf {refl}_x). Since the fans are all inhabited by this point, it is equivalent to observe that the fans are propositions.
The property of discrete reflexive graphs that their fans are contractible comes directly from the fact that their edges are identifications.
Construction The coproduct of a family of reflexive graphs [01HI]
- September 12, 2025
- Jon Sterling
Let A be a type and for each x:A let B[x] be a reflexive graph. The coproduct of the family B[x] is defined to be the reflexive graph {\mathop {\mathchoice {\textstyle \coprod }{\textstyle \coprod }{\scriptstyle \coprod }{\scriptscriptstyle \coprod } }_{(x:A)}}{B[x]} specified below:
\begin {aligned} \left \lvert {{\mathop {\mathchoice {\textstyle \coprod }{\textstyle \coprod }{\scriptstyle \coprod }{\scriptscriptstyle \coprod } }_{(x:A)}}{B[x]}}\right \rvert &:\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}\left \lvert {B[x]}\right \rvert \\ \left ( \left \langle a,b\right \rangle \approx _{{\mathop {\mathchoice {\textstyle \coprod }{\textstyle \coprod }{\scriptstyle \coprod }{\scriptscriptstyle \coprod } }_{(x:A)}}{B[x]}} \left \langle a',b'\right \rangle \right ) &:\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(p:a=_Aa')}} \; p_*^{\left \lvert {B[-]}\right \rvert } b \approx _{B[a']} b' \\ \mathsf {rx}_{{\mathop {\mathchoice {\textstyle \coprod }{\textstyle \coprod }{\scriptstyle \coprod }{\scriptscriptstyle \coprod } }_{(x:A)}}{B[x]}}{\left \langle a,b\right \rangle } &:\equiv \left \langle \mathsf {refl}_a, \mathsf {rx}_{B[a]}{b} \right \rangle \end {aligned}Lemma The coproduct of a family of discrete reflexive graphs [01HJ]
- September 12, 2025
- Jon Sterling
Suppose that x:A\vdash B[x]~\mathit {type} is a family of types. Then we may consider the coproduct \widetilde {\Delta B} :\equiv {\mathop {\mathchoice {\textstyle \coprod }{\textstyle \coprod }{\scriptstyle \coprod }{\scriptscriptstyle \coprod } }_{(x:A)}}{\Delta B[x]} of the corresponding family of discrete reflexive graphs, whose type of vertices is precisely the sum \widetilde {B}:\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]} and whose edges from \left \langle a,b\right \rangle to \left \langle a',b'\right \rangle are given by pairs of identifications as follows: \begin {aligned} &p:a=_Aa' \\ &q: p_*^B b =_{B[a']} b' \end {aligned}
Then for each u,v:\widetilde {B}, the comparison function \iota ^{\widetilde {\Delta B}}_{u,v} : u=_{\widetilde {B}}v \to u\approx _{\widetilde {\Delta B}} v is an equivalence.
Proof.
- September 12, 2025
- Jon Sterling
It suffices to show that each \iota ^{\widetilde {\Delta B}}_{u,v} is quasi-invertible. For the underlying function of the quasi-inverse, we begin to define:
\begin {aligned} &a,a':A; p:a=_Aa'; b:B[a], b':B'[a'], q:p_*^Bb=_{B[a']}b' \\ &\vdash \bar \iota _{\left \langle a,b\right \rangle ,\left \langle a',b'\right \rangle }\left \langle p,q\right \rangle : \left \langle a,b\right \rangle =_{\widetilde {B}} \left \langle a',b'\right \rangle \end {aligned}We first proceed by identification elimination on (a',p):
\begin {aligned} &a:A, b:B[a], b':B'[a'], q:({\mathsf {refl}_{a}})_*^Bb=_{B[a]}b' \\ &\vdash \bar \iota _{\left \langle a,b\right \rangle ,\left \langle a,b'\right \rangle }\left \langle \mathsf {refl}_a,q\right \rangle : \left \langle a,b\right \rangle =_{\widetilde {B}} \left \langle a,b'\right \rangle \end {aligned}Noting that transport computes away under reflexivity, the above is simplified:
\begin {aligned} &a:A, b:B[a], b':B'[a'], q:b=_{B[a]}b' \\ &\vdash \bar \iota _{\left \langle a,b\right \rangle ,\left \langle a,b'\right \rangle }\left \langle \mathsf {refl}_a,q\right \rangle : \left \langle a,b\right \rangle =_{\widetilde {B}} \left \langle a,b'\right \rangle \end {aligned}Then we use identification elimination once more on (b,q):
\begin {aligned} &a:A, b:B[a] \\ &\vdash \bar \iota _{\left \langle a,b\right \rangle ,\left \langle a,b\right \rangle }\left \langle \mathsf {refl}_a,\mathsf {refl}_b\right \rangle :\equiv \mathsf {refl}_{\left \langle a,b\right \rangle } \end {aligned}Next, we must construct the two homotopies witnessing \bar \iota _{u,v} as a section and a retraction of \iota _{u,v} respectively.
\begin {aligned} &a,a':A; p:a=_Aa'; b:B[a], b':B'[a'], q:p_*^Bb=_{B[a']}b' \\ &\vdash \epsilon _{\left \langle a,b\right \rangle ,\left \langle a',b'\right \rangle } \left \langle p,q\right \rangle : \iota ^{\widetilde {\Delta B}}_{\left \langle a,b\right \rangle ,\left \langle a',b'\right \rangle } \left ( \bar \iota _{\left \langle a,b\right \rangle ,\left \langle a',b'\right \rangle } \left \langle p,q\right \rangle \right ) =_{{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(p:a=_Aa')}}p_*^Bb=_{B[a']}b'} \left \langle p,q\right \rangle \\[12pt] &u,v:\widetilde {B}; p : u=_{\widetilde {B}}v \\ &\vdash \eta _{u,v}p : \bar \iota _{u,v}\left ( \iota ^{\widetilde {\Delta B}}_{u,v}(p) \right ) =_{u=_{\widetilde {B}}v} p \end {aligned}We use identification elimination three times:
\begin {aligned} &a:A, b:B[a] \\ &\vdash \epsilon _{\left \langle a,b\right \rangle ,\left \langle a,b\right \rangle } \left \langle \mathsf {refl}_a,\mathsf {refl}_b\right \rangle :\equiv \mathsf {refl}_{ \left \langle \mathsf {refl}_a, \mathsf {refl}_b \right \rangle } \\[12pt] &u:\widetilde {B} \\ &\vdash \eta _{u,u}~\mathsf {refl}_u :\equiv \mathsf {refl}_{\mathsf {refl}_u} \end {aligned}The significance of our lemma concerning the coproduct of discrete reflexive graphs is that it allows us to decompose identifications in sums to their constituent parts. Because of the presence of the transport, this decomposition is still a little crude; but it is a first step toward more sophisticated decompositions that we will develop using the machinery of reflexive graphs. A first application of our lemma is to develop the theory of fibrewise equivalences, which we will need.
Fibrewise equivalences [01HE]
- September 12, 2025
- Jon Sterling
Construction The sum of a family of functions [01HD]
- September 12, 2025
- Jon Sterling
Let A be a type, and let x:A\vdash B[x],C[x]~\mathit {type} be two families of types. Given a family of functions x:A \vdash f_x: B[x]\to C[x] we will refer to \begin {aligned} &\tilde {f} : {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]}\to {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{C[x]} \\ &\tilde {f}\left \langle x,b\right \rangle :\equiv \left \langle x, f_xb\right \rangle \end {aligned} as its sum.
Lemma Characterisation of fibrewise equivalence [01HF]
- September 12, 2025
- Jon Sterling
Let x:A\vdash f_x:B[x]\to C[x] be a family of functions. The sum \tilde {f}:{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]}\to {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{C[x]} is an equivalence if and only if each f_x:B[x]\to C[x] is an equivalence.
Proof.
- September 12, 2025
- Jon Sterling
If each f_x is contractible, it is not difficult at all to see that \tilde {f} is also contractible. Going the other direction requires a bit more sophistication.
In particular, we consider fibres of \tilde {f}:{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]}\to {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{C[x]}. Given a:A and c:C[a], we have the following sequence of equivalences:
\begin {aligned} &\mathsf {fib}_{\tilde {f}}\left \langle a,c\right \rangle \\ & \xrightarrow {(1)} {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(w: {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]} )}} \tilde {f}w =_{{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{C[x]}} \left \langle a,c\right \rangle \\ & \xrightarrow {(2)} {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(a':A)}} {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(b:B[a'])}} \left \langle a',f_{a'}b\right \rangle =_{{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{C[x]}} \left \langle a,c\right \rangle \\ & \xrightarrow {(3)} {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(a':A)}} {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(b:B[a'])}} {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(p:a'=_Aa)}} p_*^C(f_{a'}b) =_{C[a]} c \\ & \xrightarrow {(4)} {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(b:B[a])}} f_{a}b =_{C[a]}c \\ & \xrightarrow {(5)} \mathsf {fib}_{f_a}c \end {aligned}Above:
- (1) is the identity equivalence.
- (2) is the re-association equivalence.
- (3) is the equivalence induced by our lemma on coproducts of discrete reflexive graphs.
- (4) is the equivalence induced by contracting the data (a',p) to (a,\mathsf {refl}_a).
- (5) is the identity equivalence.
Therefore, it follows that the fibres of \bar {f} are equivalent to fibres of some f_a; as the latter are contractible, so are the former.
Theorem Fundamental theorem of identification types [01H1]
Let A be a reflexive graph. The following are equivalent:
- Every fan of A is a proposition.
- Every fan of A is contractible.
- For each x,y:\left \lvert {A}\right \rvert the function \iota ^{A}_{x,y} : x=_{\left \lvert {A}\right \rvert }y \to x\approx _{A} y is an retraction.
- For each x,y:A the function \iota ^{A}_{x,y} : x=_{\left \lvert {A}\right \rvert }y \to x\approx _{A} y is an equivalence.
Proof.
(1) and (2) are clearly equivalent because fans are always inhabited.
(3) implies (1). Suppose that each \iota ^{A}_{x,y} is a retraction. This means that for each x:A we have a family of sections \begin {aligned} & s_{y}: x\approx _{A}y\to x=_{\left \lvert {A}\right \rvert }y \\ &h_y: \iota ^{A}_{x,y}\circ s_y \sim 1_{x\approx _{\left \lvert {A}\right \rvert }y} \end {aligned} exhibiting x\approx _{A}y as a retract of x=_{\left \lvert {A}\right \rvert }y. Combined with the identity retraction on A, we obtain by the sum of retracts a section {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{x\approx _{A}y} \to {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{x=_{\left \lvert {A}\right \rvert }y} to the evident function {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{x=_{\left \lvert {A}\right \rvert }y} \to {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{x\approx _{A}y} exhibiting the fan \left \{x\right \}^+_{A} as a retract of a proposition. Propositions are closed under retracts, so we are done.(2) implies (3) Conversely, we suppose that every fan of A is contractible (onto the reflexive edges). We need to define:
\begin {aligned} x,y:\left \lvert {A}\right \rvert ; e:x\approx _{A}y &\vdash s_{x,y}e: x=_{\left \lvert {A}\right \rvert }y \\ x,y:\left \lvert {A}\right \rvert e:x\approx _{A}y &\vdash h_{x,y}e: \iota ^{A}_{x,y}(s_{x,y}e) =_{x\approx _{A} y} e \end {aligned}The above can be equivalently expressed in one term:
x,y:\left \lvert {A}\right \rvert ; e:x\approx _{A}y \vdash \sigma _{x,y}e : {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(s:x=_{\left \lvert {A}\right \rvert }y)}} \iota ^{A}_{x,y}s =_{x\approx _{A} y} eWe note that the pair \left \langle y,e\right \rangle is an element of the contractible fan \left \{x\right \}^+_{A}. In particular, we have some identification c_{x,\left \langle y,e\right \rangle } : \left \langle x,\mathsf {rx}_{A}{x}\right \rangle =_{\left \{x\right \}^+_{A}} \left \langle y,e\right \rangle \text {.}
We can now transport in the family u:\left \{x\right \}^+_{A} \vdash S[u]:\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(s:x=_{\left \lvert {A}\right \rvert } u.1)}} \iota ^{A}_{x,u.1}s =_{x=_Ay}u.2 ~\mathit {type} along this identification to obtain:
\sigma _{x,y}e :\equiv (c_{x,\left \langle y,e\right \rangle })_*^S \left \langle x,\mathsf {refl}_x\right \rangle(2) implies (4) It remains to show that if every fan of A is contractible, then each \iota ^{A}_{x,y} is an equivalence. We first note that the functions \iota ^{A}_{x,y} can be rearranged into the following form:
\begin {aligned} &\iota _x: \{x\}_{\left \lvert {A}\right \rvert }\to \left \{x\right \}^-_{A} \\ &\iota _x\left \langle y,p\right \rangle :\equiv \left \langle y, \iota ^{A}_{x,y}p\right \rangle \end {aligned}Moreover, each \iota _x above is an equivalence if and only if each \iota ^{A}_{x,y} is an equivalence, as we recall from our lemma on fibrewise equivalences.
Definition Univalent reflexive graph [01HK]
- September 13, 2025
- Jon Sterling
A reflexive graph A is called univalent when it satisfies any of the equivalent conditions of the fundemantal theorem of identification types.
Although we did not yet have the terminology, we have already shown that the coproduct of discrete reflexive graphs is univalent. In fact, the same holds for the coproduct of univalent reflexive graphs!
Exercise The coproduct of a family of univalent reflexive graphs [01HN]
- September 13, 2025
- Jon Sterling
Given a type A and a family x:A\vdash B[x] of univalent reflexive graphs, show that the coproduct {\mathop {\mathchoice {\textstyle \coprod }{\textstyle \coprod }{\scriptstyle \coprod }{\scriptscriptstyle \coprod } }_{(x:A)}}B[x] is univalent.
Function extensionality in terms of reflexive graphs [01HQ]
- September 13, 2025
- Jon Sterling
Construction The product of a family of reflexive graphs [01HL]
- September 13, 2025
- Jon Sterling
Let A be a type and let B[x] be a reflexive graph varying in x:A. We define the product {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]} of the reflexive graphs B[x] as follows:
\begin {aligned} \left \lvert {{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}B[x]}\right \rvert &:\equiv {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{\left \lvert {B[x]}\right \rvert } \\ \left ( f \approx _{{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]}} g \right ) &:\equiv {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{ fx \approx _{B[x]} gx } \\ \mathsf {rx}_{{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]}}{f} &:\equiv \lambda x\mathpunct {.} \mathsf {rx}_{B[x]}{fx} \end {aligned}Construction The product of a family of discrete reflexive graphs [01HM]
- September 13, 2025
- Jon Sterling
Let x:A\vdash B[x]~\mathit {type} be a family of types. We can consider the product {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{\Delta B[x]} of the corresponding family of discrete reflexive graphs. Inspecting its definition, we see that an edge f\approx _{{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{\Delta B[x]}}g is precisely a homotopy f\sim g.
Unlike in the case for coproducts, the basic dependent type theory that we have presented cannot prove that the product discrete reflexive graphs is univalent. Instead, this property must be added as an axiom (a constant that we assume without imposing any computation rules). This axiom is equivalent to the one commonly known as function extensionality.
Axiom The univalence principle for products of discrete reflexive graphs [01HP]
- September 13, 2025
- Jon Sterling
We assume that for any family of types x:A\vdash B[x]~\mathit {type}, the product {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{\Delta B[x]} of discrete reflexive graphs is univalent.
Exercise The product of a family of contractible types [01I0]
- September 13, 2025
- Jon Sterling
Show that the product of a family of contractible types is contractible.
Exercise The product of a family of n-truncated types [01HZ]
- September 13, 2025
- Jon Sterling
Show that the product of a family of n-truncated types is n-truncated.
Lemma The product of a family of univalent reflexive graphs [01HY]
- September 13, 2025
- Jon Sterling
Let A be a type and let x:A\vdash B[x] be a family of univalent reflexive graphs. Then the product reflexive graph {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]} is univalent.
Proof.
- September 13, 2025
- Jon Sterling
We will show that for each dependent function f:{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{\left \lvert {B[x]}\right \rvert } the fan \left \{f\right \}^+_{{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]}} is a proposition. Our goal is therefore to construct \phi as specified below:
We have the following sequence of equivalences:
\begin {aligned} &\left \{f\right \}^+_{{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]}} \\ &\xrightarrow {(1)} {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(g: {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{\left \lvert {B[x]}\right \rvert } )}}{ {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}} fx\approx _{B[x]} gx } \\ &\xrightarrow {(2)} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}} {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(y:\left \lvert {B[x]}\right \rvert )}} fx \approx _{B[x]} y \\ &\xrightarrow {(3)} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}} \left \{fx\right \}^+_{B[x]} \end {aligned}Above, (1) and (3) are the identity equivalences. (2) is the distributivity of products over sums.
Any type that is equivalent to a proposition must be a proposition (in fact, any retract of a proposition is a proposition). Therefore it suffices to observe that the product {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}\left \{fx\right \}^+_{B[x]} of all the fans in B is a proposition, because the product of a family of propositions is a proposition and each B[x] is univalent.
Univalent universes [01HR]
- September 13, 2025
- Jon Sterling
We recall that we have defined a universe to be a type \mathcal {U} together with a family x:\mathcal {U}\vdash \mathcal {T}[X]~\mathit {type} satisfying various closure conditions. We will henceforth describe a further condition on universes that causes their identification types A=_{\mathcal {U}}B be canonically equivalent to the type of equivalences from A to B.
The following notion of reflexive graph image is derived from my 2024 manuscript Reflexive graph lenses in univalent foundations.
Construction Reflexive graph image [01HS]
- September 13, 2025
- Jon Sterling
The reflexive graph image of a type A under a family x:A\vdash B[x]~\mathit {type} is defined to be the following reflexive graph denoted A/B:
\begin {aligned} \left \lvert {A/B}\right \rvert &:\equiv A \\ \left ( x\approx _{A/B} y \right ) &:\equiv \mathsf {Equiv}(B[x],B[y]) \\ \mathsf {rx}_{A/B}{x} &:\equiv \mathsf {id}_{B[x]} \end {aligned}In other words, the points of A/B are the elements of A, but the edges are equivalences between the corresponding components of B. The reflexivity edges are, naturally, given by identity equivalences.
Definition Univalent family [01HT]
- September 13, 2025
- Jon Sterling
A family of types x:A\vdash B[x]~\mathit {type} is called univalent when the reflexive graph image A/B is univalent.
Definition Univalent universe [01HU]
- September 13, 2025
- Jon Sterling
Early on we assumed the axiom of universes, which ensures that every (parameterised) family of types lies in a universe. The main idea of univalent foundations is to further require that these universes be univalent. We therefore switch to the following axiom of univalent universes:
Axiom The axiom of univalent universes [01HW]
- September 13, 2025
- Jon Sterling
We declare that for any finite sequence of families \mathbf {A} \equiv (A_i~\mathit {type})_{(i<n)} \qquad \mathbf {B} \equiv (x:A_i\vdash B_i[x]~\mathit {type})_{(i<n)} we have a univalent universe (\mathcal {U}_{\mathbf {A},\mathbf {B}}, \mathcal {T}_{\mathcal {A},\mathcal {B}}) closed additionally under the following rules for each k<n: \frac { u:A_k }{ \overline {B_k[u]}:\mathcal {U}_{\mathbf {A},\mathbf {B}} \qquad \mathcal {T}\bigl [ \overline {B_k[u]} \bigr ] \equiv B_k[u] ~\mathit {type} }
Univalence principles for algebraic structures [01I1]
- September 13, 2025
- Jon Sterling
When we have a univalent universe \mathcal {U}, the identification types of \mathcal {U} classify equivalences of types. Combining this with identification elimination, we obtain several very useful reasoning principles that are unique to univalent foundations:
To prove something about all types equipped with an equivalence onto A:\mathcal {U}, it suffices to prove that thing just about the identity equivalence on A.
This gives us a simpler way to prove many basic theorems. For example, we can prove that the composition of equivalences is associative and unital by reducing to the case of composing the identity equivalence with itself. That is a kind of reasoning that is impossible in traditional foundations, but completely natural in univalent foundations.
We can use the same principle to transfer properties and structure between equivalent types. For example, we previously observed that any type that is equivalent to a proposition is a proposition; that can be proved directly, but univalence provides a particularly simple proof in which we consider just the case of the identity equivalence.
The universe being univalent is, however, just the start. At many times we want to transfer properties and structures along not an equivalence of types, but rather an equivalence of (e.g.) monoids or categories, or something else. To give a simple example, let’s consider the exampe of the fixed points of a unary algebra; this is just an example, so do not worry if you haven’t heard of such things.
Definition Unary algebra [01I2]
- September 13, 2025
- Jon Sterling
A unary algebra A is given by a type \left \lvert {A}\right \rvert together with an endo-function \mathsf {f}_{A}:\left \lvert {A}\right \rvert \to \left \lvert {A}\right \rvert .
Definition Fixed points of a unary algebra [01I3]
- September 13, 2025
- Jon Sterling
A fixed point of a unary algebra A is an element a:\left \lvert {A}\right \rvert together with an identification \phi : fa=_{\left \lvert {A}\right \rvert }a. So the type of fixed points in A is the following sum:
\mathsf {FP}(A) :\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(a:\left \lvert {A}\right \rvert )}}{ fa=_{\left \lvert {A}\right \rvert }a }Now, we can also speak of equivalences of unary algebras; these ought to be equivalences of the underlying types that preserve the associated endo-function.
Definition Equivalences of unary algebras [01I4]
- September 13, 2025
- Jon Sterling
Given two unary algebras A and B, an equivalence of unary algebras h from A to B is given by an equivalence \left \lvert {h}\right \rvert :\left \lvert {A}\right \rvert \xrightarrow {\sim }\left \lvert {B}\right \rvert together with a family of homotopies \mathsf {f}_{h} : \left \lvert {h}\right \rvert \circ \mathsf {f}_{A} \sim \mathsf {f}_{B}\circ \left \lvert {h}\right \rvert \text {.}
False Start Univalent universes can’t do it all alone! [01I5]
- September 13, 2025
- Jon Sterling
Now let A and B be unary algebras which we freely assume to lie within some univalent universe \mathcal {U}, and suppose that we have an equivalence of unary algebras h:A\to B. We might wish to find a way to transfer a fixed point of A to obtain a fixed point of B. It seems at first that univalence should help with this, as (indeed) the underyling function \left \lvert {h}\right \rvert :\left \lvert {A}\right \rvert \to \left \lvert {B}\right \rvert is an equivalence and so we may consider just the case that it is the identity equivalence. We are trying to construct the following transfer function:
\begin {aligned} &A,B:\mathsf {UnaryAlg}_{\mathcal {U}}, h:\mathsf {UnaryAlgEquiv}(A,B), a:\mathsf {FP}(A) \vdash \mathsf {FP}(B) \end {aligned}We first destructure all of our assumptions:
\begin {aligned} &A,B:\mathcal {U}; f_A:A\to A, f_B:B\to B,\\ &h:\mathsf {Equiv}(A,B), f_h: h\circ f_A\sim f_B\circ h, \\ &a : \mathsf {FP}\left \langle A,f_A\right \rangle \\ &\vdash \mathsf {FP}\left \langle B,f_B\right \rangle \end {aligned}What the univalence of \mathcal {U} allows us to do is reduce to just the case that (B,h) are the identity equivalence on the type A. So it would suffice to exhibit:
\begin {aligned} &A:\mathcal {U}; f_A:A\to A, f_A':A\to A,\\ &f_h: f_A\sim f_A', \\ &a : \mathsf {FP}\left \langle A,f_A\right \rangle \\ &\vdash \mathsf {FP}\left \langle A,f_A'\right \rangle \end {aligned}This was not quite as magical as we had hoped! We are still going to need to use the homotopy above to convert a fixed point of f_A to a fixed point of f_A'. This is obviously possible, but there is nothing automatic about it; if we had many more operations and laws than are present in the theory of unary algebras, doing so would quickly become unwieldy.
Some eminent mathematicians, whom one might view as unscrupulous if judging only from their misleading and inaccurate public statements on univalent foundations, have concluded for this reason that univalence is a bit of hype and cannot actually achieve what is claimed. Our goal today is to see how univalence, wielded in a cultured and educated manner, really can solve this kind of problem elegantly and simply.
Our lesson from the false start above is that we instead need to characterise the identification type of the type of unary algebras, building on the univalence principle of the universe. We can do so directly, but it will be most useful to develop some general-purpose machinery that can be re-used.
Definition Displayed reflexive graph [01I6]
- September 13, 2025
- Jon Sterling
Let A be a reflexive graph. A displayed reflexive graph B over A is given by the following data:
\begin {aligned} x:\left \lvert {A}\right \rvert &\vdash \left \lvert {B}\right \rvert [x]~\mathit {type} \\ x,y:\left \lvert {A}\right \rvert ; e:x\approx _{A}y, u:\left \lvert {B}\right \rvert [x], v:\left \lvert {B}\right \rvert [y] &\vdash u \approx ^{B}_{e} v ~\mathit {type} \\ x:\left \lvert {A}\right \rvert ,u:\left \lvert {B}\right \rvert [x] &\vdash \mathsf {rx}^{A}_{x}u : u\approx ^{B}_{\mathsf {rx}_{A}{x}}u \end {aligned}An element of \left \lvert {B}\right \rvert [x] is called a vertex displayed over x. Given an edge p:x\approx _{A}y in A and displayed vertices u,v over x,y respectively, an element of u\approx ^{B}_{p}v is called a displayed edge over p. Finally, \mathsf {rx}^{A}_{x}u is called the displayed reflexivity edge on u over x.
Displayed reflexive graphs over A give rise to ordinary reflexive graphs in two major ways: by taking their component over a vertex x:A, and by computing the total reflexive graph.
Construction Components of a displayed reflexive graph [01I7]
- September 13, 2025
- Jon Sterling
Let B be a displayed reflexive graph over a reflexive graph A. The component of B over a vertex x:\left \lvert {A}\right \rvert is the reflexive graph B[x] specified below:
\begin {aligned} \left \lvert {B[x]}\right \rvert &:\equiv \left \lvert {B}\right \rvert [x] \\ \left ( u \approx _{B[x]} v \right ) &:\equiv u \approx ^{B}_{\mathsf {rx}_{A}{x}} v \\ \mathsf {rx}_{B[x]}{u} &:\equiv \mathsf {rx}^{B}_{x}{u} \end {aligned}Construction The total reflexive graph of a displayed reflexive graph [01I8]
- September 13, 2025
- Jon Sterling
Let B be a displayed reflexive graph over a reflexive graph A. The total reflexive graph of B is defined to be the reflexive graph A.B specified below:
\begin {aligned} \left \lvert {A.B}\right \rvert &:\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:\left \lvert {A}\right \rvert )}}{\left \lvert {B}\right \rvert [x]} \\ \left ( \left \langle x,u\right \rangle \approx _{A.B} \left \langle y,v\right \rangle \right ) &:\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(e:x\approx _{A}y)}} u\approx ^{B}_{e} v \\ \mathsf {rx}_{A.B}{\left \langle x,u\right \rangle } &:\equiv \left \langle \mathsf {rx}_{A}{x}, \mathsf {rx}^{B}_{x}{u} \right \rangle \end {aligned}Definition Univalent displayed reflexive graph [01I9]
- September 13, 2025
- Jon Sterling
A displayed reflexive graph is called univalent when all of its components are univalent.
Lemma Univalent total reflexive graphs [01IA]
- September 13, 2025
- Jon Sterling
Let B be a displayed reflexive graph over a reflexive graph A. If A is univalent and B is univalent, then the total reflexive graph A.B is univalent.
Proof.
- September 13, 2025
- Jon Sterling
We will show that for every a:\left \lvert {A}\right \rvert and b:\left \lvert {B}\right \rvert the fan \left \{\left \langle a,b\right \rangle \right \}^+_{A.B} is a proposition. We consider the following sequence of equivalences:
\begin {aligned} &\left \{\left \langle a,b\right \rangle \right \}^+_{A.B} \\ &\xrightarrow {(1)} {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(p:{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:\left \lvert {A}\right \rvert )}}\left \lvert {B}\right \rvert [x])}} {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(e:a\approx _{A} p.1)}} b\approx ^{B}_{e} p.2 \\ &\xrightarrow {(2)} {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:\left \lvert {A}\right \rvert )}} {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(e:a\approx _{A} x)}} {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(u:\left \lvert {B}\right \rvert [x])}} b\approx ^{B}_{e} u \\ &\xrightarrow {(3)} {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(\phi :\left \{a\right \}^+_{A})}} {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(u:\left \lvert {B}\right \rvert [\phi .1])}} b\approx ^{B}_{\phi .2} u \\ &\xleftarrow {(4)} {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(u:\left \lvert {B}\right \rvert [a])}} b\approx ^{B}_{\mathsf {rx}_{A}{a}}u \\ &\xrightarrow {(5)} \left \{b\right \}^+_{B[a]} \end {aligned}Above:
- (1) and (5) are the identity equivalences.
- (2) and (3) is just re-associating the data.
- (4) is given by our assumption that A is univalent.
Because each fan of A.B is equivalent to a fan of some component of B, and B is univalent, we conclude that A.B is univalent.
Example A displayed reflexive graph for endofunctions [01IB]
- September 13, 2025
- Jon Sterling
We recall our definition of unary algebra in a universe \mathcal {U}, which we do not necessarily assume univalent here.
\mathsf {UnaryAlg}_{\mathcal {U}} :\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(A:\mathcal {U})}} A\to AWe will construct a displayed reflexive graph whose total reflexive graph \mathsf {Endofun}_{\mathcal {U}} will be exactly the desired notion of equivalence of unary algebras, i.e.:
\mathsf {UnaryAlgEquiv}(A,B) :\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(h:\mathsf {Equiv}(A,B))}} h\circ \mathsf {f}_{A}\sim \mathsf {f}_{B}\circ hBecause the first component above needs to be an equivalence of types, we know what the base reflexive graph needs to be: the reflexive graph image \mathcal {U} / \mathcal {T}! To construct the displayed reflexive graph \mathsf {Endofun}_{\mathcal {U}} over \mathcal {U} / \mathcal {T}, we proceed as follows:
\begin {aligned} &A:\mathcal {U} \\ &\vdash \left \lvert {\mathsf {Endofun}_{\mathcal {U}}}\right \rvert [A] :\equiv A\to A \\[12pt] & A,B:\mathcal {U}; e:\mathsf {Equiv}(A,B), f_A:A\to A, f_B:B\to B \\ &\vdash \left (f_A\approx ^{\mathsf {EndoFun}_{\mathcal {U}}}_{e} f_B\right ) :\equiv e\circ f_A \sim f_B\circ e \\[12pt] &A:\mathcal {U}, f_A:A\to A \\ &\vdash \mathsf {rx}^{\mathsf {EndoFun}_{\mathcal {U}}}_{A}{f_A} :\equiv \lambda x\mathpunct {.} \mathsf {refl}_{f_Ax} \end {aligned}Computation Total reflexive graph for endofunctions [01IF]
- September 13, 2025
- Jon Sterling
The total reflexive graph of the displayed reflexive graph for endofunctions \mathsf {Endofun}_{\mathcal {U}} is precisely the following:
\begin {aligned} \left \lvert {(\mathcal {U} / \mathcal {T}).\mathsf {Endofun}_{\mathcal {U}}}\right \rvert &\equiv \mathsf {UnaryAlg}_{\mathcal {U}} \\ \left (A\approx _{(\mathcal {U} / \mathcal {T}).\mathsf {Endofun}_{\mathcal {U}}}B\right ) &\equiv \mathsf {UnaryAlgEquiv}(A,B) \\ \mathsf {rx}_{(\mathcal {U} / \mathcal {T}).\mathsf {Endofun}_{\mathcal {U}}}{A} &\equiv \left \langle 1_A, \lambda x\mathpunct {.}\mathsf {refl}_{\mathsf {f}_{A}x}\right \rangle \end {aligned}Computation Components of the displayed reflexive graph for endofunctions [01IC]
- September 13, 2025
- Jon Sterling
Given a type A:\mathcal {U}, the component of \mathsf {Endofun}_{\mathcal {U}} over A is computed as follows:
\begin {aligned} \left \lvert {\mathsf {Endofun}_{\mathcal {U}}}\right \rvert [A] &\equiv A\to A \\ \left (f\approx _{\mathsf {Endofun}_{\mathcal {U}}[A]} g\right ) &\equiv f\sim g \\ \mathsf {rx}_{\mathsf {Endofun}_{\mathcal {U}}[A]}{f} &\equiv \lambda x\mathpunct {.}{\mathsf {refl}_{fx}} \end {aligned}Inspecting the above, we see that we have the following judgemental equality of reflexive graphs:
\mathsf {Endofun}_{\mathcal {U}}[A] \equiv {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}} \Delta ACorollary Displayed univalence for endfunctions [01ID]
- September 13, 2025
- Jon Sterling
It follows immediately that the displayed reflexive graph for endofunctions \mathsf {Endofun}_{\mathcal {U}} is univalent (regardless of whether \mathcal {U} is univalent).
Proof.
- September 13, 2025
- Jon Sterling
We need only verify that each component \mathsf {Endofun}_{\mathcal {U}}[A] is univalent; but we already computed that this component is precisely the product {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}\Delta A\text {,} which is univalent by the univalence principle for products of discrete reflexive graphs, i.e. function extensionality.
Corollary The univalence principle for unary algebras [01IE]
- September 13, 2025
- Jon Sterling
If \mathcal {U} is a univalent universe, then the total reflexive graph (\mathcal {U} / \mathcal {T}).\mathsf {Endofun}_{\mathcal {U}} is univalent.
Proof.
- September 13, 2025
- Jon Sterling
This follows from our lemma for univalent total reflexive graphs via our assumption that \mathcal {U} is a univalent universe and our displayed univalence lemma for endofunctions.
Univalence principles such as the one above for algebraic structures are often called structure identity principles, a name (to my knowledge) chosen by the late Peter Aczel. These can be derived for pretty any algebraic structure whatsoever in the way that we have shown above.
Example Univalent transfer of fixed points along equivalences of unary algebras [01IG]
- September 13, 2025
- Jon Sterling
With the univalence principle for unary algebras in hand, it is now trivial to transfer fixed points along an equivalence of unary algebras, as we have the following equivalences:
\begin {aligned} & {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(A,B:\mathsf {UnaryAlg}_{\mathcal {U}})}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(e:\mathsf {UnaryAlgEquiv}(A,B))}}\; \mathsf {FP}(A)\to \mathsf {FP}(B) \\ &\xrightarrow {(1)} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(A:\mathsf {UnaryAlg}_{\mathcal {U}})}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(\phi : \left \{A\right \}^+_{(\mathcal {U} / \mathcal {T}).\mathsf {Endofun}_{\mathcal {U}}} )}} \; \mathsf {FP}(A)\to \mathsf {FP}(\phi .1) \\ &\xrightarrow {(2)} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(A:\mathsf {UnaryAlg}_{\mathcal {U}})}} \mathsf {FP}(A)\to \mathsf {FP}(A) \end {aligned}Above, (1) is just reassociating data and (2) is the univalence princile for unary algebras, as we contract the fan \phi onto (A,1_A) where 1_A is the identity equivalence of unary algebras.
Exercises [01HO]
- September 8, 2025
- Jon Sterling
Exercise. The coproduct of a family of univalent reflexive graphs [01HN]
- September 13, 2025
- Jon Sterling
Given a type A and a family x:A\vdash B[x] of univalent reflexive graphs, show that the coproduct {\mathop {\mathchoice {\textstyle \coprod }{\textstyle \coprod }{\scriptstyle \coprod }{\scriptscriptstyle \coprod } }_{(x:A)}}B[x] is univalent.
Exercise. The product of a family of contractible types [01I0]
- September 13, 2025
- Jon Sterling
Show that the product of a family of contractible types is contractible.
Exercise. The product of a family of n-truncated types [01HZ]
- September 13, 2025
- Jon Sterling
Show that the product of a family of n-truncated types is n-truncated.
Lecture Univalent foundations III [01IH]
- September 22, 2025
- Jon Sterling
Lemma Sums of families of contractible types indexed in a contractible type [01IJ]
- September 22, 2025
- Jon Sterling
Let A be contractible and let x:A\vdash B[x]~\mathit {type} be a family of contractible types. Then the sum {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]} is contractible.
Proof.
- September 22, 2025
- Jon Sterling
We have the following sequence of equivalences:
\begin {aligned} &{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]} \\ &\quad \xrightarrow {(1)}{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}\mathsf {unit} \\ &\quad \xrightarrow {(2)}{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:\mathsf {unit})}}\mathsf {unit} \end {aligned}Contractible types are closed under retracts, so it suffices to observe that \mathsf {unit}\times \mathsf {unit} is contractible.
Exercise Closure of truncated types under internal sums [01IK]
- September 22, 2025
- Jon Sterling
Let A be an n-truncated type and let x:A\vdash B[x]~\mathit {type} be a family of n-truncated types. Verify that the sum {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]} is n-truncated.
Lemma Being a proposition is a proposition [01IL]
- September 22, 2025
- Jon Sterling
For any type A, the type \mathsf {isProp}(A) :\equiv {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y:A)}} x=_Ay is a proposition. In other words, being a proposition is a proposition.
Proof.
- September 22, 2025
- Jon Sterling
We consider the following reflexive graph whose vertices are precisely the witnesses of \mathsf {isProp}(A):
{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(y:A)}} \Delta (x=_Ay)The above is univalent because the univalent reflexive graphs are closed under products and each discrete reflexive graph is univalent by definition.
To show that \mathsf {isProp}(A) is a proposition, we fix any two witnesses \phi ,\psi :\mathsf {isProp}(A) to check that \phi =_{\mathsf {isProp}(A)}\psi . By the above, it suffices to exhibit an edge \phi \approx _{{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(y:A)}}\Delta (x=_Ay)}\psi which amounts to the following data: {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(y:A)}} \phi xy =_{x=_Ay} \psi xy
This holds immediately because propositions are sets, and \phi (or \psi ) witnesses A as a proposition.
Lemma Being contractible is a proposition [01IM]
- September 24, 2025
- Jon Sterling
For any type A, the type \mathsf {isContr}(A) :\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(y:A)}} x=_Ay is a proposition.
Proof.
- September 24, 2025
- Jon Sterling
We consider the following displayed reflexive graph C over \Delta A:
\begin {aligned} \left \lvert {C}\right \rvert [x] &:\equiv {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(y:A)}} x=_A y \\ h\approx ^{C}_{p:x=x'}h' &:\equiv {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(y:A)}} hy=_{x=y} p\cdot h'y \\ \mathsf {rx}^{C}_{x}h &:\equiv \lambda y\mathpunct {.}{\mathsf {refl}_{hy}} \end {aligned}The component of C at x:A can be seen to be precisely C[x] \equiv {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(y:A)}}\Delta (x=y) \text {.}
As C[x] is univalent, C is a univalent displayed reflexive graph, and the total reflexive graph \Delta A.C is univalent too. The reason we have done this is:
\left \lvert {\Delta A.C}\right \rvert \equiv \mathsf {isContr}(A)Therefore to see that being contractible is a proposition, we may fix any two \phi ,\psi :\mathsf {isContr}(A) and construct an edge of the following kind:
\left ( \phi \approx _{\Delta A.C}\psi \right ) \equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(p:\phi .1 =_A \psi .1)}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(y:A)}} (\phi .2\,y)=_{\phi .1=y} p\cdot (\psi .2\,y)To start, we define p :\equiv \phi .2(\psi .1) and it remains to construct a family of identifications {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(y:A)}} (\phi .2\,y)=_{\phi .1=_Ay} p\cdot (\psi .2\,y)\text {.}
But we can construct the latter immediately, because \phi (or \psi ) witnesses A as a contractible type and contractible types are sets.
Exercise Coherence for equivalences / contractible maps [01IR]
- September 24, 2025
- Jon Sterling
Let f:A\to B be a function. Show that the type \mathsf {isEquiv}(f) \equiv {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:B)}} \mathsf {isContr}(\mathsf {fib}_f(x)) of witnesses that f is an equivalence is a proposition
(Hint: you will need to use lemmas that we have proved so far! Don’t try to prove it directly.)Exercise Postcomposition with a bi-invertible function [01IO]
- September 24, 2025
- Jon Sterling
Let f:A\to B be equipped with a bi-inverse. Show that for each type C, the postcomposition function \begin {aligned} &f_!:(C\to A)\to (C\to B)\\ &f_!g :\equiv f\circ g \end {aligned} is bi-invertible.
Lemma Coherence for sections [01IN]
- September 24, 2025
- Jon Sterling
Let f:A\to B be a function equipped with a retraction r_f:B\to A. Then the type \mathsf {sectionOf}(f) \equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(s:B\to A)}} f\circ s \sim 1_B of sections of f is a proposition.
Proof.
- September 24, 2025
- Jon Sterling
We consider the postcomposition function \begin {aligned} &f_!: (B\to A) \to (B\to B)\\ &f_!g :\equiv f\circ g\text {.} \end {aligned}
In particular, we can see that \mathsf {sectionOf}(f) is equivalent to the fibre \mathsf {fib}_{f_!}(1_B) \equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(s:B\to A)}} f\circ s =_{B\to B} 1_B of f_! at the identity function on B. The equivalence is a consequence of the function extensionality.
We now fix any two sections \sigma ,\sigma ':\mathsf {sectionOf}(f). Using either of these sections, we know that f is bi-invertible. We have seen that postcomposition with a bi-invertible function is bi-invertible, so we know that f_! is bi-invertible. We can choose a quasi-inverse to f_!, from which we deduce that f_! is contractible, and so (in particular) the fibre \mathsf {fib}_{f_!}(1_B) is contractible.
Thefore, \mathsf {sectionOf}(f) is contractible from which we deduce that \sigma =\sigma '.
Exercise Coherence for retractions [01IP]
- September 24, 2025
- Jon Sterling
Let f:A\to B be a function equipped with a retraction s_f:B\to A. Show that the type \mathsf {retractionOf}(f) \equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(r:B\to A)}} r\circ f \sim 1_B of retractions of f is a proposition.
Corollary Coherence for bi-inverses [01IQ]
- September 24, 2025
- Jon Sterling
Let f:A\to B be a function. Then the type \mathsf {biinverseOf}(f) \equiv \mathsf {sectionOf}(f)\times \mathsf {retractionOf}(f) of bi-inverses of f is a proposition.
Proof.
- September 24, 2025
- Jon Sterling
Fix any two pairs \left \langle \sigma ,\rho \right \rangle , \left \langle \sigma ',\rho '\right \rangle : \mathsf {biinverseOf}(f). By the coherence theorem for sections via \rho :\mathsf {retractionOf}(f), we know that \mathsf {sectionOf}(f) is a proposition and thus we have \sigma =\sigma '. By the coherence theorem for retractions via \sigma :\mathsf {sectionOf}(f), we know that \mathsf {retractionOf}(f) is a proposition and so \rho =rho'.
Lemma Characterising the type of quasi-inverses [01IT]
- September 24, 2025
- Jon Sterling
Let f:A\to B be a quasi-invertible function. Then we have an equivalence \mathsf {qinverseOf}(f)\to {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}x=_Ax where \mathsf {qinverseOf}(f) \equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(\bar {f}:B\to A)}} f\circ \bar {f}\sim 1_B \times \bar {f}\circ f\sim 1_A is the type of quasi-inverses to f.
Proof.
- September 24, 2025
- Jon Sterling
To be more precise, we are constructing an element of the following type where \mathcal {U} is a big enough univalent universe:
{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(A,B:\mathcal {U})}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(f:A\to B)}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(q_f:\mathsf {qinverseOf}(f))}} \left ( \mathsf {qinverseOf}(f)\cong {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{x=_Ax} \right )Because a quasi-invertible function is an equivalence, it suffices to construct an element of the following type:
{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(A,B:\mathcal {U})}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(f:A\approx _{\mathcal {U} / \mathcal {T}} B)}} \left ( \mathsf {qinverseOf}(f)\cong {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{x=_Ax} \right )We have the following sequence of equivalences:
\begin {aligned} & {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(A,B:\mathcal {U})}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(f:A\approx _{\mathcal {U} / \mathcal {T}} B)}} \left ( \mathsf {qinverseOf}(f)\cong {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{x=_Ax} \right ) \\ &\quad \xrightarrow {(1)} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(A:\mathcal {U})}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(\left \langle B,f\right \rangle :\left \{A\right \}^+_{\mathcal {U} / \mathcal {T}})}} \left ( \mathsf {qinverseOf}(f)\cong {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{x=_Ax} \right ) \\ &\quad \xrightarrow {(2)} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(A:\mathcal {U})}} \left ( \mathsf {qinverseOf}(1_A)\cong {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{x=_Ax} \right ) \end {aligned}The second equivalence is precisely the univalence of \mathcal {U}. Now, fixing A:\mathcal {U}, we have the following sequence of equivalences:
\begin {aligned} &\mathsf {qinverseOf}(1_A) \\ &\quad \xrightarrow {\equiv } {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(f:A\to A)}} f\sim 1_A \times f\sim 1_A \\ &\quad \xrightarrow {(1)} {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(\left \langle f,h\right \rangle : \left \{1_A\right \}^+_{{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}\Delta A} )}} f\sim 1_A \\ &\quad \xrightarrow {(2)} 1_A\sim 1_A \\ &\quad \xrightarrow {\equiv } {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}} x=_Ax \end {aligned}Above, (1) is just reshuffling and (2) is the function extensionality / univalence for products of families of discrete reflexive graphs.
Remark Non-coherence of quasi-inverses [01IS]
- September 24, 2025
- Jon Sterling
Let f:A\to B be a function. Although we do not yet have the tools to see that this is the case, it need not be the case that the type \mathsf {qinverseOf}(f) \equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(\bar {f}:B\to A)}} (f\circ \bar {f} \sim 1_B) \times (\bar {f}\circ f\sim 1_A) quasi-inverses of f is a proposition, except in special cases (like when A is a set). The reason is, in essence, that there will be types A for which {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}x=_Ax is not a proposition, whereas we have shown that when f does have a quasi-inverse, the type of quasi-inverses to f is equivalent to {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}x=_Ax.
By similar reasoning, it also happens that it would not have been consistent to assert that the reflexive graph structure on \mathcal {U} whose edges are given by quasi-invertible functions is univalent.
For these reasons, although quasi-inverses are nice and familiar and useful, they do not give the “correct” notion of inverse in univalent foundations.
We have seen that quasi-invertible functions, bi-invertible functions, and contractible functions are all interchangeable:
- Contractible maps are quasi-invertible
- Quasi-invertible maps are contractible
- From bi-inverses to quasi-inverses
A priori this does not mean that the types of quasi-invertible, bi-invertible, and contractible functions are all equivalent. Indeed, the type of quasi-invertible functions is not equivalent to the type of bi-invertible functions nor to the type of contractible functions. On the other hand, our coherence theorems will ensure that the types of bi-invertible maps and contractible maps are equivalent, meaning that we may redefine “equivalence” to mean either one of these. To see that this is the case, we first develop a few more useful constructions on reflexive graphs.
Univalent reflexive graphs and propositions [01IV]
- September 26, 2025
- Jon Sterling
Definition The co-discrete reflexive graph [01IW]
- September 26, 2025
- Jon Sterling
For any type A, the co-discrete reflexive graph \nabla {A} on A is defined as follows:
\begin {aligned} \left \lvert {\nabla {A}}\right \rvert &:\equiv A \\ x\approx _{\nabla {A}}y &:\equiv \mathsf {unit} \\ \mathsf {rx}_{\nabla {A}}{x} &:\equiv () \end {aligned}Lemma Univalent co-discrete reflexive graphs [01IX]
- September 26, 2025
- Jon Sterling
A co-discrete reflexive graph \nabla {A} is univalent if and only if A is a proposition.
Proof.
- September 26, 2025
- Jon Sterling
For x:A, the fan \left \{x\right \}^+_{A} is canonically equivalent to A as follows:
\left \{x\right \}^+_{A} \xrightarrow {\equiv } {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(y:A)}}{\mathsf {unit}} \xrightarrow {\cong } {A}Therefore \left \{x\right \}^+_{A} is a proposition if and only if A is.
Definition The co-discrete displayed reflexive graph [01IY]
- September 26, 2025
- Jon Sterling
Let A be a reflexive graph and let x:\left \lvert {A}\right \rvert \vdash B[x]~\mathit {type} be a family of types indexed in the points of A. We define the forgetful displayed reflexive graph \nabla {B} over A as follows:
\begin {aligned} \left \lvert {\nabla B}\right \rvert [x] &:\equiv B[x] \\ \left (u \approx ^{\nabla B}_{p:x\approx _{A} y} v\right ) &:\equiv \mathsf {unit} \\ \mathsf {rx}^{\nabla B}_{x}u &:\equiv () \end {aligned}Lemma Univalent co-discrete displayed reflexive graph [01IZ]
- September 26, 2025
- Jon Sterling
Let A be an arbitrary reflexive graph. A co-discrete displayed reflexive graph \nabla {B} over A is univalent if and only if each type B[x] is a proposition.
Proof.
- September 26, 2025
- Jon Sterling
The component (\nabla B)[x] is precisely the co-discrete reflexive graph \nabla (B[x]), which we have seen is univalent if and only if B[x] is a proposition.
Definition The forgetful reflexive graph on dependent pairs [01J0]
- September 26, 2025
- Jon Sterling
Let A be reflexive graph and let x:\left \lvert {A}\right \rvert \vdash B[x]~\mathit {type} be a family of types indexed in the points of A. We define the forgetful reflexive graph \{x:A\mid B[x] as follows:
\begin {aligned} \left \lvert {\{x:A\mid B[x]\}}\right \rvert &:\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:\left \lvert {A}\right \rvert )}}{B[x]} \\ \left (\left \langle x,u\right \rangle \approx _{\{x:A\mid B[x]\}} \left \langle y,v\right \rangle \right ) &:\equiv x\approx _{A}y \\ \mathsf {rx}_{\{x:A\mid B[x]\}}{\left \langle x,u\right \rangle } &:\equiv \mathsf {rx}_{A}{x} \end {aligned}Evidently this is equivalent to the total reflexive graph A.\nabla {B} of the co-discrete displayed reflexive graph \nabla B.
Corollary The univalent reflexive graph structure for subtypes [01J1]
- September 26, 2025
- Jon Sterling
Let A be a univalent reflexive graph and let x:\left \lvert {A}\right \rvert \vdash B[x]~\mathit {type} be a family of propositions. Then the forgetful reflexive graph \{x:A\mid B[x] is univalent.
Corollary Equivalence between contractible and bi-invertible maps [01J2]
- September 26, 2025
- Jon Sterling
The map from contractible maps to biinvertible maps induced by Lemma [01H9] is an equivalence.
Proof.
- September 26, 2025
- Jon Sterling
We consider the following univalent reflexive graphs obtained via the subtype construction, using coherence for bi-inverses and coherence for contractible maps:
\begin {align} \mathsf {BiinvMap}(A,B) &:\equiv \left \{ f:{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}} \Delta B \;\middle \vert \; \mathsf {biinverseOf}(f) \right \} \\ \mathsf {ContrMap}(A,B) &:\equiv \left \{ f:{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}\Delta B \;\middle \vert \; \mathsf {isContr}(f) \right \} \end {align}We will construct a quasi-inverse to the canonical map \Phi :\left \lvert {\mathsf {ContrMap}(A,B)}\right \rvert \to \left \lvert {\mathsf {BiinvMap}}\right \rvert \text {.} First we define \bar \Phi using Lemma [01HG] and Lemma [01H9]. To construct the homotopies \epsilon ,\eta we note that by the univalence of the two reflexive graphs above, it suffices find the following edges:
\begin {aligned} \Phi \circ \bar \Phi &\approx _{{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(\_:\left \lvert {\mathsf {BiinvMap}(A,B)}\right \rvert )}}\mathsf {BiinvMap}(A,B)} 1_{\left \lvert {\mathsf {BiinvMap}(A,B)}\right \rvert }\\ \bar \Phi \circ \Phi &\approx _{{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(\_:\left \lvert {\mathsf {ContrMap}(A,B)}\right \rvert )}}\mathsf {ContrMapMap}(A,B)} 1_{\left \lvert {\mathsf {ContrMapMap}(A,B)}\right \rvert } \end {aligned}By definition, these amount to finding two homotopies 1_{A\to B}\sim 1_{A\to B}.
Because of Corollary [01J2] above, we are justified in revising our definition of equivalences.
Definition Equivalence (II) [01J3]
- September 26, 2025
- Jon Sterling
A function f:A\to B is called an equivalence when it satisfies either of the following equivalent properties:
- f is contractible.
- f is biinvertible.
From now on, we will not worry too much about what notions of equivalence we are using, as we can freely convert between them as needed.
Exercises
- September 22, 2025
- Jon Sterling
Exercise. Closure of truncated types under internal sums [01IK]
- September 22, 2025
- Jon Sterling
Let A be an n-truncated type and let x:A\vdash B[x]~\mathit {type} be a family of n-truncated types. Verify that the sum {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}}{B[x]} is n-truncated.
Exercise. Coherence for equivalences / contractible maps [01IR]
- September 24, 2025
- Jon Sterling
Let f:A\to B be a function. Show that the type \mathsf {isEquiv}(f) \equiv {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:B)}} \mathsf {isContr}(\mathsf {fib}_f(x)) of witnesses that f is an equivalence is a proposition
(Hint: you will need to use lemmas that we have proved so far! Don’t try to prove it directly.)Exercise. Postcomposition with a bi-invertible function [01IO]
- September 24, 2025
- Jon Sterling
Let f:A\to B be equipped with a bi-inverse. Show that for each type C, the postcomposition function \begin {aligned} &f_!:(C\to A)\to (C\to B)\\ &f_!g :\equiv f\circ g \end {aligned} is bi-invertible.
Exercise. Coherence for retractions [01IP]
- September 24, 2025
- Jon Sterling
Let f:A\to B be a function equipped with a retraction s_f:B\to A. Show that the type \mathsf {retractionOf}(f) \equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(r:B\to A)}} r\circ f \sim 1_B of retractions of f is a proposition.
Lecture Univalent foundations IV [01J4]
- September 26, 2025
- Jon Sterling
Fibrations vs. families of types [01JU]
- November 1, 2025
- Jon Sterling
After defining n-truncated types, we derived the notion of n-truncated function by considering the fibres of the function. Zooming out, the idea is that every function f:E\to B corresponds to a family of types b:B\vdash \mathsf {fib}_f(b)~\mathit {type}, and the way to generalise a property of types to a property of functions is to apply that property to the corresponding family of types.
Conversely, if we have a family of types b:B\vdash E[b]~\mathit {type}, we can get a function into B by considering the first projection of the sum of the types E[b] over b:B. Today we will study the round-trips induced by this process, showing that (assuming univalent universes), the operation of taking fibres is an equivalence.
Definition Fibration [01JT]
- November 1, 2025
- Jon Sterling
A fibration over a type B is defined to be a pair of a type E with a mapping p:E\to B.
When B:\mathcal {U} lies inside a universe, we can relativise the notion of a fibration over B. In particular, a \mathcal {U}-fibration over B is defined to be a type E:\mathcal {U} together with a mapping p\colon E\to B. We will write \mathsf {Fib}_{\mathcal {U}}(B) for the type of \mathcal {U}-fibrations over B:
\mathsf {Fib}_{\mathcal {U}}(B) :\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(E:\mathcal {U})}}(E\to B)Definition Straightening a fibration to a family [01JQ]
- November 1, 2025
- Jon Sterling
The straightening of a fibration p:E\to B is defined to be the family b:B\vdash \mathsf {fib}_p(b)~\mathit {type} of types associating to each element of B the corresponding fibre of p.
In the case of \mathcal {U}-fibrations, the above amounts to a function:
\mathsf {str}_{B}\colon \mathsf {Fib}_{\mathcal {U}}(B)\to \mathcal {U}^BDefinition Unstraightening a family to a fibration [01JR]
- November 1, 2025
- Jon Sterling
The unstraightening of a family of types b:B\vdash E[b]~\mathit {type} is defined to be the fibration \begin {aligned} &\pi _E\colon {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(b:B)}}{E[b]}\to B \\ &\pi _E\left \langle b,e\right \rangle :\equiv b \end {aligned} that projects the index from the sum of E[b] over b:B.
In the case of \mathcal {U}-fibrations, the above amounts to a function:
\mathsf {unstr}_{B}\colon \mathcal {U}^B\to \mathsf {Fib}_{\mathcal {U}}(B)Remark “Fibrations” are functions with an attitude [01JS]
- November 1, 2025
- Jon Sterling
The operations of straightening and unstraightening suggest that functions f:A\to B can be thought of in two different ways. Sometimes a function is just a function: a way to turn elements of A into elements of B. But other times, a function is (contextually) meant to be thought of as defining some kind of structure over its codomain, which can be extracted by straightening. In this case, we like to call it a “fibration”. At this level, there is no technical distinction between a fibration and a function: the terms are rather hints to suggest how we are intending to think about it. At times, it is useful to think of a given function as both a function and a fibration: for example, an equivalence is a function that transforms elements of one type into another type, but we define the property of being an equivalence in terms of the function’s straightening (which indicates we are thinking of it as a fibration).
We will show that within a univalent universe, unstraightening and straightening are quasi-inverse to each other. This is a very important result of univalent foundations that you can only state state indirectly in ordinary type theory or traditional set theory. In order to prove this, we must first characterise the identification types of \mathcal {U}^B and \mathsf {Fib}_{\mathcal {U}}(B) using the theory of univalent reflexive graphs.
Lemma The univalence principle for families [01JA]
- November 1, 2025
- Jon Sterling
Let (\mathcal {U},\mathcal {T}) be a univalent universe. Then the reflexive graph (\mathcal {U} / \mathcal {T})^B :\equiv {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(b:B)}} \mathcal {U} / \mathcal {T} is univalent.
Proof.
- November 1, 2025
- Jon Sterling
Lemma The univalence principle for fibrations [01JB]
- November 1, 2025
- Jon Sterling
Let (\mathcal {U}, \mathcal {T}) be a universe (not yet assumed univalent). For any B:\mathcal {U}, we may define the following displayed reflexive graph structure B^\square over the reflexive graph image \mathcal {U} / \mathcal {T}.
\begin {aligned} \left \lvert {B^\square }\right \rvert [E] &:\equiv (E\to B) \\ \left (p\approx ^{B^\square }_{f\colon \mathsf {Equiv}(E,E')} p'\right ) &:\equiv p \sim p'\circ f \\ \mathsf {rx}^{B^\square }_{E}(p) &:\equiv \lambda e\mathpunct {.}\mathsf {refl}_{p(e)} \end {aligned}First we observe that B^\square is univalent as a displayed reflexive graph.
Proof.
- November 1, 2025
- Jon Sterling
For any E:\mathcal {U}, the component B^\square [E] is precisely the product (\Delta {B})^E :\equiv {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(e:E)}}\Delta B of discrete reflexive graphs, which we know to be univalent.
We now consider the total reflexive graph (\mathcal {U} / \mathcal {T}).B^\square .
\begin {aligned} \left \lvert {(\mathcal {U} / \mathcal {T}).B^\square }\right \rvert &\equiv \mathsf {Fib}_{\mathcal {U}}(B) \\ \left (\left \langle E,p\right \rangle \approx _{(\mathcal {U} / \mathcal {T}).B^\square }\left \langle E',p'\right \rangle \right ) &\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(f:\mathsf {Equiv}(E,E'))}} p \sim p'\circ f \\ \mathsf {rx}_{(\mathcal {U} / \mathcal {T}).B^\square } \left \langle E,p\right \rangle &\equiv \left \langle 1_E,\lambda e\mathpunct {.}{\mathsf {refl}_{p(e)}}\right \rangle \end {aligned}If we further assume that (\mathcal {U}, \mathcal {T}) is a univalent universe, then we may conclude that the total reflexive graph (\mathcal {U} / \mathcal {T}).B^\square is univalent.
Lemma Unstraightening followed by straightening [01JC]
- November 1, 2025
- Jon Sterling
Let B:\mathcal {U} for some universe (\mathcal {U}, \mathcal {T}), and let E:B\to \mathcal {U} be an arbitrary family. We can construct an edge \mathsf {str}_B(\mathsf {unstr}_B E) \approx _{(\mathcal {U} / \mathcal {T})^B} E as follows.
First of all, such an edge is given by a family of equivalences {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(b:B)}} \mathsf {Equiv}\left ( \mathsf {fib}_{\pi _E}(b),E(b) \right ) where \pi _E\colon \left ({\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(b:B)}}E(b)\right )\to B is the evident projection. For each b:B we consider the following sequence of equivalences:
\begin {aligned} &\mathsf {fib}_{\pi _E}(b) \\ &\quad \xrightarrow {\equiv } {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(u:{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:B)}}E(x))}}u.1=_Bb \\ &\quad \xrightarrow {(1)} {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:B)}}{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(e:E(x))}}x=_Bb \\ &\quad \xrightarrow {(2)} {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(u:\left \{b\right \}^-_{\Delta B})}} E(u.1) \\ &\quad \xrightarrow {(3)} E(b) \end {aligned}If (\mathcal {U}, \mathcal {T}) is univalent, then so is (\mathcal {U} / \mathcal {T})^B and thus we have exhibited \mathsf {str}_B as a retraction of \mathsf {unstr}_B.
Lemma Straightening followed by unstraightening [01JD]
- November 1, 2025
- Jon Sterling
Let B:\mathcal {U} for some universe (\mathcal {U}, \mathcal {T}), and let \left \langle E,p\right \rangle :\mathsf {Fib}_{\mathcal {U}} B be a fibration over B in \mathcal {U}. We can construct an edge \mathsf {unstr}_B(\mathsf {str}_B\left \langle E,p\right \rangle ) \approx _{ (\mathcal {U} / \mathcal {T}).B^\square } \left \langle E,p\right \rangle as follows.
First of all, such an edge is given by an equivalence f : \left ({\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(b:B)}} \mathsf {fib}_{p}(b)\right )\to E together with a homotopy h: {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(u:{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(b:B)}}\mathsf {fib}_{p}(b))}} u.1 =_{B} {p}(fu) \text {.}
For the former, we define f like so:
\begin {aligned} &{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(b:B)}}\mathsf {fib}_p(b) \\ &\quad \xrightarrow {\equiv } {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(b:B)}}{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(e:E)}} pe=_Bb \\ &\quad \xrightarrow {(1)} {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(e:E)}}{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(b:B)}} pe=_Bb \\ &\quad \xrightarrow {\equiv } {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(e:E)}} \left \{pe\right \}^+_{\Delta B} \\ &\quad \xrightarrow {(2)} E \end {aligned}Explicitly, f\left \langle b,\left \langle e,q\right \rangle \right \rangle \equiv e is an equivalence because the fan \left \{pe\right \}^+_{\Delta B} is contractible. Now we must define the following homotopy:
{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(u:{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(b:B)}}{\mathsf {fib}_p(b)})}} u.1 =_B p(u.2.1)Given b:B, e:E and q:pe=_Bb, we must construct the following identification:
b =_B p(e)For this, we use \bar q.
Now, if (\mathcal {U}, \mathcal {T}) is univalent, we have just exhibited \mathsf {str}_B as a section of \mathsf {unstr}_B.
Corollary The straightening/unstraightening equivalence [01JE]
- November 1, 2025
- Jon Sterling
When (\mathcal {U}, \mathcal {T}) is a univalent universe, we have established \mathsf {str}_B and \mathsf {unstr}_B to be mutually inverse for any B:\mathcal {U}:
Reflections of types in subuniverses (e.g. truncation) [01JF]
- November 1, 2025
- Jon Sterling
A few lectures ago, we studied the classes of n-truncated types; for example, the -1-truncated types are the propositions. Now, not every type is a proposition, but it can be useful for a given type A to find a proposition that holds (i.e. is inhabited) if and only if A is inhabited. Such a proposition would be the “best approximation” of A by a proposition; in univalent foundations, we would refer to such a proposition as the “propositional truncation of A”.
Forgetting type theory for a minute, it is useful to remember that the idea of propositional truncation in this sense already occurs in classical set theory. When we have a set A, then the image of A under the canonical map A\to \{\star \} is a proposition (i.e. a set with at most one element) that is non-empty if and only if A is non-empty. Of course, classical set theory can only speak of n-truncated things for n \leq 0, whereas in univalent foundations we want to talk about higher levels of truncation. For example, a “cardinal” in the sense of classical mathematics will turn out to be an element of the 0-truncation of a universe \mathcal {U}.
Definition Reflections [01JG]
- November 1, 2025
- Jon Sterling
Let X:\mathcal {U} \vdash \Phi [X]~\mathit {type} be a family of propositions, to be thought of as describing a “property” of types. (For example, \Phi [X] might be “X is a set”).
Now let A by a type, and let \eta \colon A\to A' be a function such that \Phi [A'] holds. We say that \eta \colon A\to A' is the reflection of A in \Phi when any of the following equivalent conditions hold for all C such that \Phi [C] holds:
- The precomposition function C^\eta : (A'\to C)\to (A\to C) is an equivalence.
- To any function f\colon A\to C, we may assign a unique pairing of a function \hat {f}\colon A'\to C with a homotopy h_f\colon \hat {f}\circ \eta \sim f. (In this case, we refer to the pair (\hat {f},h_f) as the unique extension of f along \eta .)
Proof.
- November 1, 2025
- Jon Sterling
That the two conditions are equivalent follows from (1) the definition of equivalences as contractible maps, and (2) the function extensionality principle.
Here is how to understand reflections \eta :A\to A' of a type A in a class \Phi : although \eta :A\to A' is not an equivalence (if it were, A would already lie in \Phi ), it looks like an equivalence from the perspective of types C for which \Phi holds.
Lemma Uniqueness of reflections [01JH]
- November 1, 2025
- Jon Sterling
Let X:\mathcal {U}\vdash \Phi [X]~\mathit {type} be a family of propositions, and write \mathcal {U}_\Phi :\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(X:\mathcal {U})}}{\Phi [X]}; we will implicitly include \mathcal {U}_\Phi into \mathcal {U} in our notation. We can define the type of reflections of A:\mathcal {U} in \Phi as follows:
\mathsf {HasReflection}_{\mathcal {U}}(A,\Phi ) :\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(A':\mathcal {U}_\Phi )}} {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(\eta :A\to A')}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(C:\mathcal {U}_\Phi )}} \mathsf {isEquiv}(C^\eta )If \mathcal {U} is a univalent universe, then for any A:\mathcal {U} the type \mathsf {HasReflection}_{\mathcal {U}}(A,\Phi ) is a proposition.
Proof.
- November 1, 2025
- Jon Sterling
Recall the forgetful reflexive graph \{X:\mathcal {U} / \mathcal {T}\mid \Phi [X]\} whose vertices are given by \mathcal {U}_\Phi and whose edges are equivalences of the underlying types. We can define an auxiliary displayed reflexive graph A_{\square \mid \Phi } over \{X:\mathcal {U} / \mathcal {T}\mid \Phi [X]\} as follows:
\begin {aligned} \left \lvert {A_{\square \mid \Phi }}\right \rvert [A'] &:\equiv A\to A' \\ \left (\eta _0 \approx ^{A_{\square \mid \Phi }}_{f:\mathsf {Equiv}(A'_0, A'_1)} \eta _1\right ) &:\equiv f\circ \eta _0 \sim \eta _1 \\ \mathsf {rx}^{A_{\square \mid \Phi }}_{A'}(\eta ) &:\equiv \lambda x\mathpunct {.} \mathsf {refl}_{\eta (x)} \end {aligned}A_{\square \mid \Phi } is univalent because each component A_{\square \mid \Phi }[A'] is precisely the product {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}\Delta A', which we know to be univalent. On the other hand, the forgetful reflexive graph \{X:\mathcal {U} / \mathcal {T} \mid \Phi [X]\} is univalent because \mathcal {U} is univalent and \Phi [X] is a proposition. Therefore, it follows that the total reflexive graph \{X:\mathcal {U} / \mathcal {T} \mid \Phi [X]\}.A_{\square \mid \Phi } is univalent. Now, inspecting the vertices of the above, we have: \left \lvert {\{X:\mathcal {U} / \mathcal {T} \mid \Phi [X]\}.A_{\square \mid \Phi }}\right \rvert \equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(A':\mathcal {U}_\Phi )}}(A\to A')
On the other hand, we know that for any (A',\eta ) as above, the type {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(C:\mathcal {U}_\Phi )}} \mathsf {isEquiv}(C^\eta ) is a proposition because (1) propositions are closed under products and (2) being an equivalence is a proposition. Therefore, the following forgetful reflexive graph structure on \mathsf {HasReflection}_\mathcal {U}(A,\Phi ) is univalent:
\mathcal {R} :\equiv \left \{ \left \langle A',\eta \right \rangle : \{X:\mathcal {U} / \mathcal {T} \mid \Phi [X]\}.A_{\square \mid \Phi } \;\middle \vert \; {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(C:\mathcal {U}_\Phi )}}\mathsf {isEquiv}(C^\eta ) \right \}Now we return to showing that \mathsf {HasReflection}_{\mathcal {U}}(A,\Phi ) is a proposition. Fixing any two reflections \left \langle A'_0,\eta _0,\chi _0\right \rangle and \left \langle A'_1,\eta _1,\chi _1\right \rangle it suffices by the above to construct an edge \left \langle A'_0,\eta _0,\chi _0\right \rangle \approx _{\mathcal {R}} \left \langle A'_1,\eta _1,\chi _1\right \rangle \text {.}
By definition, this is a given by an equivalence f: A'_0\to A'_1 together with a homotopy h: f\circ \eta _0\sim \eta _1\text {.}
For both of these, we use \chi _0 to obtain a unique extension of \eta _1:A\to A'_1 along \eta _0: A\to A'_0; this gives us precisely such a pair (f,h). That f is an equivalence can be established by constructing a quasi-inverse using \chi _1 and appealing to the uniqueness of extensions.
Definition Closure of subuniverse under internal sums [01JO]
- November 1, 2025
- Jon Sterling
A family of propositions X:\mathcal {U}\vdash \Phi [X]~\mathit {type} specifies a subunivers of \mathcal {U}. This subuniverse is said to be closed under internal sums when for any A:\mathcal {U}_\Phi and x:A\vdash B[x]:\mathcal {U}_\Phi , the sum {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A)}} B[x] lies in \mathcal {U}_\Phi .
Lemma Dependent induction for reflections in \Sigma -closed subuniverses [01JP]
- November 1, 2025
- Jon Sterling
Suppose that \Phi determines a subuniverse of \mathcal {U} that is closed under internal sums. Then given a function \eta :A\to A' in \mathcal {U}, the following are equivalent:
- \eta :A\to A' exhibits A' as the reflection of A in \Phi .
- For any family of types x:A'\vdash C[x]:\mathcal {U}_\Phi , the dependent precomposition map C[\eta ] : \left ( {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A')}}C[x] \right ) \to \left ( {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{C[\eta x]} \right ) is an equivalence.
This can be thought of as an induction principle in which the base case is A.
Proof.
- November 1, 2025
- Jon Sterling
We consider the following diagram which commutes up to judgemental equality, writing \pi _C\colon \tilde {C}\to A' for -.1\colon {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:A')}}{C[x]}\to A':
The auxiliary maps above are defined as follows:
\begin {aligned} h_1 f &:\equiv \left \langle \lambda x\mathpunct {.}\left \langle x,fx\right \rangle , \lambda x\mathpunct {.}{\mathsf {refl}_{x}}\right \rangle \\ h_2\left \langle f,\alpha \right \rangle &:\equiv \left \langle f, \lambda x\mathpunct {.} \alpha (\eta x)\right \rangle \\ h_3\left \langle f,\alpha \right \rangle &:\equiv \left \langle f\circ \eta , \alpha \right \rangle \\ h_4f &:\equiv \left \langle \lambda x\mathpunct {.}{\left \langle \eta x,f x\right \rangle }, \lambda x\mathpunct {.}{\mathsf {refl}_{\eta x}}\right \rangle \end {aligned}To see that the diagram commutes judgementally, we fix f:{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A')}}C[x] and compute:
\begin {aligned} h_3(h_2(h_1 f)) &\equiv h_3(h_2\left \langle \lambda x\mathpunct {.}\left \langle x,fx\right \rangle ,\lambda x\mathpunct {.}\mathsf {refl}_{x}\right \rangle ) \\ &\equiv h_3\left \langle \lambda x\mathpunct {.}\left \langle x,fx\right \rangle ,\lambda x\mathpunct {.}\mathsf {refl}_{\eta x}\right \rangle \\ &\equiv \left \langle \lambda x\mathpunct {.}\left \langle \eta x,f(\eta x)\right \rangle ,\lambda x\mathpunct {.}\mathsf {refl}_{\eta x}\right \rangle \\ &\equiv h_4(\lambda x\mathpunct {.}f(\eta x)) \\ &\equiv h_4(C[\eta ]f) \end {aligned}Now we will argue that all the arrows except C[\eta ] are equivalences; because the diagram commutes, C[\eta ] must also be an equivalence.
- h_1 and h_4 are evidently equivalences.
- h_2 is the equivalence because we have assumed that A'^\eta \colon (A'\to A')\to (A\to A') is an equivalence.
- h_3 is an equivalence because \tilde {C}^\eta (f) \equiv f\circ \eta is an equivalence, recalling that the sum \tilde {C} lies in \Phi by assumption of closure under internal sums.
Hence C[\eta ] is an equivalence.
Definition Reflective subuniverse [01JL]
- November 1, 2025
- Jon Sterling
A family of propositions X:\mathcal {U}\vdash \Phi [X]~\mathit {type} is said to describe a reflective subuniverse when for any A:\mathcal {U} the reflection of A in \Phi exists. We will sometimes write \mathcal {U}_{\Phi } for the subtype {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(A:\mathcal {U})}}\Phi [x]; we will write \lvert A\rvert _\Phi \colon A\to \lVert A\rVert _\Phi for the required reflections.
Example The n-truncation of a type [01JI]
- November 1, 2025
- Jon Sterling
An n-truncation of a type A is defined to be a reflection \eta :A\to A' in the class of n-truncated types. In particular, the -1- and 0-truncations of a type are called the propositional and set truncations respectively.
Axiom The axiom of n-truncations [01JJ]
- November 1, 2025
- Jon Sterling
In univalent foundations, it is extremely common to assume that n-truncations exist, i.e. that the subuniverses of n-truncated types are reflective. Assumptions like this can at times be substantiated with more refined assumption, such as the existence of pushouts, etc., but we will not concern ourselves with that.
When an n-truncation of a type A is assumed to exist, it is necessarily unique; in that case, we will write it as follows:
\lvert - \rvert _n : A\to \lVert A \rVert _nSurjective functions and the existential quantifier [01K1]
- November 9, 2025
- Jon Sterling
In ordinary mathematics, a function p\colon E\to B is said to be surjective when for every b:B there exists some e such that pe=b. This will be the correct definition of surjectivity in univalent foundations too, but we need to be careful to correctly interpret the English phrase “there exists”. For example, translating the statement above to the following type would be far too strong and would lead to incorrect results:
{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(b:B)}} {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(e:E)}} pe=bThe first problem is that the above is not a proposition; but even supposing we did not care about that, using this definition would lead to incorrect results unless we assumed the axiom of choice. This would be an extremist version of the “propositions as types” principle that mathematical experience has shown to be scientifically invalid.
The axiom of n-truncations gives us the language in which to express the correct general notion of existence (though there are other variations that are worthy of study in their own right). In particular, we give the meaning of “there exists” in terms of propositional truncation.
Definition “There exists” [01K2]
- November 9, 2025
- Jon Sterling
For a type A, we say “there exists an element of A” to mean that we can choose an element of the propositional truncation \lVert A\rVert _{-1}.
Definition Surjective function [01K3]
- November 9, 2025
- Jon Sterling
A function f:A\to B is called surjective when for all b:B there exists an element of the fibre of f over b, i.e. there exists an element a:A such that fa=_Bb.
Symbolically, the above is interpeted as the following proposition:
\mathsf {isSurjective}(f) :\equiv {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(b:B)}} \lVert \mathsf {fib}_f(b) \rVert _{-1} \equiv {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(b:B)}} \bigl \lVert {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(a:A)}}{fa=_Bb} \bigr \rVert _{-1}One way to think about the reflection of a type A in a subuniverse \Phi is that it is the result of “killing off” or “quotienting away” all the distinctions made by A that cannot be seen by types in \Phi . We are used to thinking of n-truncated types as those that don’t have any non-trivial data above a certain level in the hierarchy of n-dimensional identifications, etc. But equally often, it can happen that a type only has non-trivial data above a certain level: for example, we will later study a type called “the circle” that has only one point, but infinitely many distinct identifications between that point and itself. A type like the circle is called 0-connected, which is defined to say that the 0-truncated reflection of the circle is contractible. We define the notion of connectedness in generality now.
Definition \Phi -connected types and functions [01JK]
- November 1, 2025
- Jon Sterling
Let X:\mathcal {U} \vdash \Phi [X] be a family of propositions. A type A is said to be \Phi -connected when either of the following equivalent conditions hold:
- There exists a reflection \eta \colon A\to A' of A in \Phi such that A' is contractible.
- The canonical map !_A\colon A\to \mathsf {unit} is a reflection of A in \Phi .
As usual, the notion of connected type extends to functions (viewed as fibrations): a function A\to B is \Phi -connected when all of its fibres are \Phi -connected.
Example -1-connected functions and surjections [01K0]
- November 9, 2025
- Jon Sterling
A function p\colon E\to B is -1-connected, i.e. connected for the class of propositions, if and only if it is surjective.
Proof.
- November 9, 2025
- Jon Sterling
We recall the p\colon E\to B is -1-connected if and only if the propositional truncation of each of its fibres is contractible: \mathsf {isConnected}_{-1}(p) \equiv {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(b:B)}} \mathsf {isContr} \lVert \mathsf {fib}_{p}(b) \rVert _{-1}
But a proposition is contractible if and only if it is inhabited, so the above is equivalent to:
{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(b:B)}} \lVert \mathsf {fib}_p(b)\rVert _{-1} \equiv \mathsf {isSurjective}(p)Lemma Characterising 0-connectedness [01KT]
- November 18, 2025
- Jon Sterling
A type X is 0-connected if and only if there exists an element of X and, moreover, for any two elements x,y:X there exists an identification between them. In other words, we have:
\mathsf {isConnected}_{0}(X) \Leftrightarrow \lVert X\rVert _{-1}\times {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y:X)}} \lVert x=_X y \rVert _{-1}Proof.
- November 18, 2025
- Jon Sterling
Only one direction is non-trivial. We must prove the following: \lVert X \rVert _{-1} \times \bigl ({\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y:X)}}\lVert x=_Xy\rVert _{-1}\bigr ) \to \mathsf {isContr} \lVert X\rVert _0 Noting that being contractible is a proposition, it suffices to prove the following, fixing x_0:X and assuming {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y:X)}} \lVert x=_X y\rVert _{-1}: {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(u:\lVert X \rVert _0)}} \lvert x_0\rvert _0 =_{\lVert X \rVert _0} u
Becuase \lVert X\rVert _0 is a set, the identification type \lvert x_0\rvert _0=_{\lVert X \rVert _0}u is a proposition. Therefore, it suffices to fix y:X and prove:
\lvert x_0\rvert _0 =_{\lVert X \rVert _0} \lvert y\rvert _0By our assumption, we have \lVert x_0=_Xy\rVert _{-1}, but we are trying to prove a proposition, so we may assume x_0=_X y. Then we are done.
Definition \Phi -modal types and functions [01JW]
- November 9, 2025
- Jon Sterling
Let \Phi determine a reflective subuniverse of \mathcal {U}. A type A:\mathcal {U} is called \Phi -modal when the reflection \lvert -\rvert _\Phi : A\to \lVert A\rvert _\Phi is an equivalence. A function f:A\to B is called \Phi -modal when all of its fibres are.
Lemma Closure of reflective subuniverses under retracts [01JZ]
- November 9, 2025
- Jon Sterling
Let B be a retract of E in a univalent universe \mathcal {U} such that E lies in a reflective subuniverse \mathcal {U}_\Phi . Then B lies in \mathcal {U}_\Phi too.
Proof.
- November 9, 2025
- Jon Sterling
We will show that the reflection \lvert -\rvert _\Phi \colon B\to \lVert B\rVert _\Phi is an equivalence. We first suppose that s\colon B\to E and r\colon E\to B comprise a section-retraction pair. Then we construct a putative inverse to the reflection \lvert -\rvert _\Phi \colon B\to \lVert B\rVert _\Phi as follows:
\lVert B\rVert _\Phi \xrightarrow {\hat {s}} E \xrightarrow {r} BTo show that the r\circ \hat {s} is a section of the reflection, we must check that the following is homotopic to the identity map on \lVert B\rVert _\Phi :
\lVert B\rVert _\Phi \xrightarrow {\hat {s}} E \xrightarrow {r} B \xrightarrow {\lvert -\rvert _\Phi } \lVert B\rVert _\PhiBy the uniqueness part of the unique extension property, it suffices to check that the composite map is homotopic to the reflection:
B \xrightarrow {\lvert -\rvert _\Phi } \lVert B\rVert _\Phi \xrightarrow {\hat {s}} E \xrightarrow {r} B \xrightarrow {\lvert -\rvert _\Phi } \lVert B\rVert _\PhiThis obtains by the extension property of \hat {s} and the fact that s is a section of r.
Conversely, to show that r\circ \hat {s} is a retraction of the reflection, we likewise use the extension property of \hat {s} and the fact that s is a section of r.
Lemma Closure of reflective subuniverses under contractible types [01JX]
- November 9, 2025
- Jon Sterling
Any reflective subuniverse of a univalent universe \mathcal {U} contains the unit type and thus any other contractible type in \mathcal {U}.
Proof.
- November 9, 2025
- Jon Sterling
By closure under retracts it suffices to show that \mathsf {unit} is a retract of \lVert \mathsf {unit}\rVert _\Phi . We consider the reflection \lvert -\rvert _\Phi \colon \mathsf {unit}\to \lVert \mathsf {unit}\rVert _\Phi , which is evidently a section of the universal map \lambda \_\mathpunct {.}{()}\colon \lVert \mathsf {unit}\rVert _\Phi \to \mathsf {unit}.
Lemma Closure of reflective subuniverses under products [01JY]
- November 9, 2025
- Jon Sterling
Let A:\mathcal {U} be a type in a univalent universe \mathcal {U}, and let x:A\vdash B[x]:\mathcal {U}_\Phi be a family of types lying in a reflective subuniverse \Phi of \mathcal {U}. Then the product {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]} lies in \mathcal {U}_\Phi .
Proof.
- November 9, 2025
- Jon Sterling
Reflective subuniverses are closed under retracts. We will therefore show that {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]} is a retract of \bigl \lVert {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]}\bigr \rVert . In particular, we construct a retraction of the reflection \lvert -\rvert _\Phi \colon {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]} \to \bigl \lVert {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]}\bigr \rVert _\Phi as follows: \begin {aligned} &r \colon \bigl \lVert {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]}\bigr \rVert _\Phi \to {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}}{B[x]} \\ & rux :\equiv \widehat {\lambda f\mathpunct {.} f x}(u) \end {aligned}
Definition The \Phi -image of a function [01JM]
- November 1, 2025
- Jon Sterling
Let \Phi determine a reflective subuniverse of \mathcal {U}, and let f:A\to B be a function in \mathcal {U}. We can then consider the following factorisation of f through the fibrewise \Phi -reflection:
A \xrightarrow {\cong } {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:B)}} \mathsf {fib}_f(x) \xrightarrow {{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:B)}} \lvert -\rvert _{\Phi }} {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:B)}}{\lVert \mathsf {fib}_f(x)\rVert _\Phi } \xrightarrow {\pi _1}{B}In the above, the right-most factor is called the \Phi -image of f. Conceptually, the factorisation views f as a fibration over B, straightens it, and then applies the reflection to the resulting family, and then unstraightens it again.
Theorem \Phi -images as a connected/modal factorisation [01JN]
- November 1, 2025
- Jon Sterling
When \Phi is a reflective subuniverse that is closed uner internal sums, the \Phi -image factorisation always factors f:A\to B through an \Phi -connected map followed by an \Phi -modal map.
Proof.
- November 1, 2025
- Jon Sterling
By the univalence principle for fibrations, it suffices to consider the case that f is the unstraightening of a family x:B\vdash E[x]~\mathit {type}. In that case, we are looking at the following factorisation:
{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:B)}}{E[x]} \xrightarrow {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_B\lvert -\rvert _\Phi } {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:B)}}{\lVert E[x] \rVert _\Phi } \xrightarrow {\pi } BThat the second factor is \Phi -modal holds by definition: indeed, the fibre of \pi \colon {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(b:B)}}{\lVert E[x]\rVert _\Phi }\to B at b:B is precisely \lVert E[b]\rVert _\Phi . On the other hand, we need to show that \mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_B\lvert -\rvert _\Phi \colon {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:B)}}E[x]\to {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(x:B)}}\lVert E[x]\rVert _\Phi is n-connected. Given b:B and u:\lVert E[x]\rVert _\Phi , the corresponding fibre is computed as follows:
\mathsf {fib}_{\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_B\lvert -\rvert _\Phi }\left \langle b,u\right \rangle \cong {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(e:E[b])}} \lvert e \rvert _\Phi = uTo show that the above is \Phi -connected, it suffices to exhibit a \Phi -reflection \bigl ({\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(e:E[b])}}\lvert e\rvert _\Phi = u\bigr ) \to D where D is contractible. We choose the following map, whose codomain is a singleton and hence contractible and therefore \Phi -modal.
\begin {aligned} &r: \bigl ({\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(e:E[b])}}{\lvert e\rvert _\Phi = u}\bigr ) \to \bigl ({\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(v:\lVert E[b]\rVert _\Phi )}}{v = u}\bigr ) \\ &r\left \langle e,p\right \rangle :\equiv \left \langle \lvert e\rvert _\Phi , p\right \rangle \end {aligned}To see that r above is a \Phi -reflection, we fix some C:\mathcal {U}_\Phi to check that the precomposition map C^{r}\colon \Bigl ( \bigl ({\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(v:\lVert E[b]\rVert _\Phi )}}{v=u}\bigr ) \to C \Bigr ) \to \Bigl ( \bigl ({\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(e:E[b])}}{\lvert e\rvert _\Phi =u}\bigr ) \to C \Bigr ) is an equivalence. We can factor the above through the following equivalences
\begin {aligned} &\Bigl ( \bigl ({\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(v:\lVert E[b]\rVert _\Phi )}}{v=u}\bigr ) \to C \Bigr ) \\ &\quad \xrightarrow {(1)} \Bigl ( {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(v:\lVert E[b]\rVert _\Phi )}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(p:v=u)}}C \Bigr ) \\ &\quad \xrightarrow {(2)} \Bigl ( {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(e:E[b])}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(p:\lvert e\rvert _\Phi =u)}}C \Bigr ) \\ &\quad \xrightarrow {(3)} \Bigl ( \bigl ({\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(e:E[b])}}{\lvert {e}\rvert _\Phi =u}\bigr ) \to C \Bigr ) \end {aligned}Each of the above is an equivalence:
- (1,3) are the dependent “currying” equivalences.
- (2) is an equivalence because the product of a family of modal types is modal and we have assumed \Phi is closed under internal sums and therefore satisfies the dependent induction principle.
Corollary Surjection-embedding factorisation [01K4]
- November 9, 2025
- Jon Sterling
Corresponding to our analysis of -1-connected maps as surjections, a -1-truncated map behaves like an embedding or an injection. Although we will not study these in detail in this module, a function is an embedding when each of its pre-images contains at most one element, i.e. is a proposition. In light of this, the general \Phi -image factorisation for reflective subuniverses that are closed under internal sums amounts in the case of -1-truncation to the standard factorisation of any function as a surjection followed by an embedding.
Classical mathematics in univalent foundations [01K5]
- November 9, 2025
- Jon Sterling
So far we have focused on a constructive version of univalent foundations. Although we prefer to set up the foundations in this way because it increases the generality of the results that we prove without further assumptions, we can also consistently assume the axioms of classical logic—so long as we state them in a way that is not accidentally far stronger than they are in classical mathematics.
In particular, we have to be careful to restrict the law of the excluded middle to propositions and to restrict the axiom of choice to apply only to sets.
Axiom Law of the Excluded Middle [01K6]
- November 9, 2025
- Jon Sterling
For any proposition P, we have an element of P+\lnot P, where \lnot P:\equiv (P\to \mathsf {empty}).
Axiom The Axiom of Choice [01K7]
- November 9, 2025
- Jon Sterling
The axiom of choice is any of the following equivalent propositions:
- Given a set X and a family of sets x:X\vdash A[x] and a family of propositions x:X,y:A\vdash P[x,y], if for all x:X there exists some y:A[x] such that P[x,a], then there exists a dependent function g:{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:X)}}A[x] such that for all x:X we have P[x,gx].
- Given a set X and a family of sets x:X\vdash Y[x], if for all x:X there exists an element of Y[x], then there exists a dependent function assigning to each x:X an element of Y[x].
As stated, choice implies excluded middle by a famous argument of Diaconescu that we will not repeat here.
Univalence is very strong! [01K8]
- November 9, 2025
- Jon Sterling
Some mathematicians use the law of the excluded middle while avoiding the axiom of choice; other mathematicians go further and avoid both axioms. This can be motivated by the fact that toposes are extremely abundant, boolean toposes are pretty abundant, and toposes satisfying the axiom of choice are extremely rare.
One very interesting observation is that in the presence of univalence, many things that were not propositions in traditional foundations become propositions (for example, all the fans of \mathcal {U} / \mathcal {T}). Given a family of sets x:X\vdash Y[x] indexed in a set X, we note that if Y[x] is moreover a proposition, then the following implication holds automatically without the axiom of choice:
\bigl ( {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:X)}}\lVert Y[x]\rVert _{-1} \bigr ) \to {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:X)}} Y[x]In many cases, classical non-univalent mathematics cannot “see” that Y[x] is a proposition and so classical mathematicians must resort to the following inferior implication that holds by virtue of the axiom of choice:
\bigl ( {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:X)}}\lVert Y[x]\rVert _{-1} \bigr ) \to \bigl \lVert {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:X)}} Y[x]\bigr \rVert _{-1}Examples of things looks like non-propositional sets from the perspective of non-univalent foundations, but are actually propositions in the presence of univalence, include the following:
- For a pair of objects x,y:\mathcal {C} in a category \mathcal {C}, the type of product cones x\gets x\times y\to y.
- For a functor F:\mathcal {C}\to \mathcal {D}, the type of left adjoints L\dashv F or a right adjoints F\dashv R.
- For a ring A and a multiplicative subset S, the type of localisations (A[S^{-1}], A\to A[S^{-1}]) of A at S.
Many standard results begin by using the axiom of choice to obtain a function that assigns things like the above to an infinite collection of objects. In univalent foundations, those assignment functions already exist without needing choice at all.
Lecture Symmetry [01K9]
- November 14, 2025
- Jon Sterling
Identifications of algebraic structures [01KF]
- November 16, 2025
- Jon Sterling
Using the technology of univalent reflexive graphs, we can rapidly characterise identifications of all kinds of algebraic structures. This provides new induction principles, like “To prove something about all groups equipped with a group isomorphism onto G, it suffices to consider just the identity isomorphism G\cong G.”
Example Semigroups [01KA]
- November 15, 2025
- Jon Sterling
A semigroup A is a set \left \lvert {A}\right \rvert together with an associative binary operation \bullet _A on \left \lvert {A}\right \rvert . We can internalise semigroups into a universe (\mathcal {U}, \mathcal {T}) like so:
\mathsf {Semigroup}_{\mathcal {U}} :\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(A:\mathsf {Set}_{\mathcal {U}})}} {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(\bullet :A\times A\to A)}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y,z:A)}} (x \bullet y) \bullet z =_A x\bullet (y\bullet z)To characterise identifications of semigroups, we will construct an appropriate reflexive graph. First of all, consider the following forgetful reflexive graph obtained from the reflexive graph image of the universe:
\underline {\mathsf {Set}}_{\mathcal {U}} :\equiv \{ X:\mathcal {U} / \mathcal {T} \mid \mathsf {isSet}(X) \}Evidently we have \left \lvert {\underline {\mathsf {Set}}_{\mathcal {U}}}\right \rvert \equiv \mathsf {Set}_{\mathcal {U}}. When \mathcal {U} is univalent, then \underline {\mathsf {Set}}_{\mathcal {U}} is univalent too.
Next, we define a displayed reflexive graph over \underline {\mathsf {Set}}_{\mathcal {U}} to classify associative binary operations on a given set.
\begin {aligned} \left \lvert {\underline {\mathsf {AssocBinop}}_{\mathcal {U}}}\right \rvert [A] &:\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(\bullet :A\times A\to A)}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y,z:A)}} (x \bullet y) \bullet z =_A x\bullet (y\bullet z) \\ \Bigl ( {\bullet } \approx ^{\underline {\mathsf {AssocBinop}}_{\mathcal {U}}}_{f:A\approx _{\underline {\mathsf {Set}}_{\mathcal {U}}} B} {\circ } \Bigr ) &:\equiv {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y:A)}} f (x \bullet y) =_B fx \circ fy \\ \mathsf {rx}^{\underline {\mathsf {AssocBinop}}_{\mathcal {U}}}_{A} (\bullet ) &:\equiv \lambda x,y\mathpunct {.} \mathsf {refl}_{x\bullet y} \end {aligned}For a set A, the corresponding component of \underline {\mathsf {AssocBinop}}_{\mathcal {U}} is precisely the following forgetful reflexive graph:
\underline {\mathsf {AssocBinop}}_{\mathcal {U}}[A] \equiv \bigl \{ {\bullet } \colon {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y:A)}} \Delta A \mathrel {\bigm \vert } {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y,z:A)}} (x\bullet y)\bullet z =_A x\bullet (y\bullet z) \bigr \}Because A is assumed to be a set and propositions are closed under products, it follows that \underline {\mathsf {AssocBinop}}_{\mathcal {U}} is univalent.
Now, we define consider total reflexive graph:
\underline {\mathsf {Semigroup}}_{\mathcal {U}} :\equiv \underline {\mathsf {Set}}_{\mathcal {U}}.\underline {\mathsf {AssocBinop}}_{\mathcal {U}}We evidently have \left \lvert {\underline {\mathsf {Semigroup}}_{\mathcal {U}}}\right \rvert \equiv \mathsf {Semigroup}_{\mathcal {U}}. If \mathcal {U} is univalent, then so is \underline {\mathsf {Semigroup}}_{\mathcal {U}}.
Example Semigroup homomorphisms [01KU]
- November 20, 2025
- Jon Sterling
Let A and B be semigroups. A homomorphism of semigroups from A to B is just a function on the underlying sets that commutes with the binary operation.
\hom _{\mathsf {Semigroup}}(A,B) :\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(f:\left \lvert {A}\right \rvert \to \left \lvert {B}\right \rvert )}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y:\left \lvert {A}\right \rvert )}} f(x\bullet _A y) =_{\left \lvert {B}\right \rvert } fx\bullet _A fyWe can exhibit a univalent reflexive graph structure on semigroup homomorphisms as follows:
\underline {\hom }_{\mathsf {Semigroup}}(A,B) :\equiv \bigl \lbrace f : {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:\left \lvert {A}\right \rvert )}}\Delta \left \lvert {B}\right \rvert \mathrel {\bigm \vert } {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y:\left \lvert {A}\right \rvert )}} f(x\bullet _A y) =_{\left \lvert {B}\right \rvert } fx\bullet _A fy \bigr \rbraceExample Identity elements in semigroups [01KB]
- November 15, 2025
- Jon Sterling
Let A be a semigroup. An identity element for A is defined to be an element \epsilon :\left \lvert {A}\right \rvert satisfying the following condition:
\mathsf {isIdentity}_A(\epsilon ) :\equiv {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:\left \lvert {A}\right \rvert )}} (x\bullet _A \epsilon =_{\left \lvert {A}\right \rvert } x) \times (\epsilon \bullet _A x =_{\left \lvert {A}\right \rvert } x)Of course, because \left \lvert {A}\right \rvert is a set, \mathsf {isIdentity_A(\epsilon )} is also a proposition. We will however that not only is the condition of being an identity element a proposition, but in fact the type of identity elements \mathsf {IdentityElt}(A) :\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(\epsilon :\left \lvert {A}\right \rvert )}}\mathsf {isIdentity}_A(\epsilon ) overall is a proposition. Fixing \epsilon ,\epsilon ':A and h_\epsilon :\mathsf {isIdentity}_A(\epsilon ) and h_{\epsilon '}:\mathsf {isIdentity}_A(\epsilon ) we must identify \left \langle \epsilon ,h_\epsilon \right \rangle with \left \langle \epsilon ',h_{\epsilon '}\right \rangle . By the above, it suffices to verify \epsilon =_{\left \lvert {A}\right \rvert }\epsilon '. We note that by h_\epsilon and h_{\epsilon '} we have:
\epsilon =_{\left \lvert {A}\right \rvert } \epsilon \bullet _A \epsilon ' =_{\left \lvert {A}\right \rvert } \epsilon 'Hence, \mathsf {IdentityElt}(A) is a proposition for any semigroup A.
Example Monoids [01KC]
- November 15, 2025
- Jon Sterling
A semigroup is called a monoid when it has an identity element. The type of monoids in a given universe \mathcal {U} is therefore defined like so:
\mathsf {Monoid}_{\mathcal {U}} :\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(A:\mathsf {Semigroup}_{\mathcal {U}})}} \mathsf {IdentityElt}(A)The appropriate reflexive graph structure for monoids is, then, the forgetful one:
\underline {\mathsf {Monoid}}_{\mathcal {U}} :\equiv \bigl \{ A:\underline {\mathsf {Semigroup}}_{\mathcal {U}} \bigm \vert \mathsf {IdentityElt}(A) \bigr \}When \mathcal {U} is univalent, so is \underline {\mathsf {Monoid}}_{\mathcal {U}}.
Example Monoid homomorphisms [01KV]
- November 20, 2025
- Jon Sterling
A homomorphism of monoids is given by a semigroup homomorphism that preserves identity elements.
\hom _{\mathsf {Monoid}}(A,B) :\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(f:\hom _{\mathsf {Semigroup}}(A,B))}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}} \mathsf {isIdentity}_A(x) \to \mathsf {isIdentity}_B(fx)Naturally, we have a univalent reflexive graph structure on monoid homomorphisms:
\underline {\hom }_{\mathsf {Monoid}}(A,B) :\equiv \bigl \lbrace f:\underline {\hom }_{\mathsf {Semigroup}}(A,B) \mathrel {\bigm \vert } {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:A)}} \mathsf {isIdentity}_A(x) \to \mathsf {isIdentity}_B(fx) \bigr \rbraceExample Inverse elements in semigroups [01KD]
- November 15, 2025
- Jon Sterling
Let A be a semigroup. An inverse to an element u:\left \lvert {A}\right \rvert is defined to be some element \bar {u}:\left \lvert {A}\right \rvert such that both u\bullet _A \bar {u} and \bar {u}\bullet _A u are identity elements.
(So, evidently, as soon as some element has an inverse, the A is a monoid).
Formally, we define the following, which is a family of proposition:
\mathsf {isInverse}_A(u,\bar {u}) :\equiv \mathsf {isIdentity}_A(u\bullet _A \bar {u}) \times \mathsf {isIdentity}_A(\bar {u}\bullet _A u)We can define the type of inverses of a specific element:
\mathsf {inverseOf}_A(u) :\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(\bar {u}:\left \lvert {A}\right \rvert )}} \mathsf {isInverse}_A(u,\bar {u})We will now show that \mathsf {inverseOf}_A(u) is a proposition. Fixing any two inverses \bar {u},\bar {u}' of u it suffices to check that \bar {u} =_{\left \lvert {A}\right \rvert } \bar {u}'. Because \bar {u}'\bullet _A u and \bar {u}\bullet _A u are both identity elements, they are equal:
\bar {u}'\bullet _A u =_{\left \lvert {A}\right \rvert } \bar {u}\bullet _A uBy the action on identifications, we may multiply either side with \bar {u}:
(\bar {u}'\bullet _A u)\bullet _A \bar {u} =_{\left \lvert {A}\right \rvert } (\bar {u}\bullet _A u)\bullet _A \bar {u}By associativity, we have:
\bar {u}'\bullet _A (u\bullet _A \bar {u}) =_{\left \lvert {A}\right \rvert } \bar {u}\bullet _A (u\bullet _A \bar {u})But u\bullet _A\bar {u} is an identity element so we have \bar {u}'=\bar {u}. Therefore, \mathsf {inverseOf}_A(u) is a proposition.
Example Groups [01KE]
- November 15, 2025
- Jon Sterling
A group is a monoid that has all inverses.
\mathsf {Group}_{\mathcal {U}} :\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(A:\mathsf {Monoid}_{\mathcal {U}})}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:\left \lvert {A}\right \rvert )}} \mathsf {inverseOf}_A(x)We consider the following forgetful reflexive graph structure for groups:
\underline {\mathsf {Group}}_{\mathcal {U}} :\equiv \bigl \{ A:\underline {\mathsf {Monoid}}_{\mathcal {U}} \mathrel {\bigm \vert } {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:\left \lvert {A}\right \rvert )}} \mathsf {inverseOf}_A(x) \bigr \}When \mathcal {U} is univalent, then so is \underline {\mathsf {Group}}_{\mathcal {U}}.
Example Group homomorphisms [01KW]
- November 20, 2025
- Jon Sterling
Any semigroup homomorphism that preserves identity elements preserves any inverses that exist.
Proof.
- November 20, 2025
- Jon Sterling
Let X,Y be semigroups, and suppose that f:X\to Y is a semigroup homomorphism that moreover preserves identity elements. Now let u,\bar {u} be mutually inverse in X. We must check that fu and f\bar u are mutually inverse in Y. We have fu \bullet _Y f\bar {u} = f(u\bullet _X \bar {u}) and f\bar {u}\bullet _Y f u = f(\bar {u}\bullet _X u)\text {.}
By assumption, all of the above are identity elements in Y.
It follows, therefore, that the correct notion of homomorphism between groups is the monoid homomorphism without any additional conditions.
\begin {aligned} \hom _{\mathsf {Group}}(X,Y) &:\equiv \hom _{\mathsf {Monoid}}(X,Y) \\ \underline {\hom }_{\mathsf {Group}}(X,Y) &:\equiv \underline {\hom }_{\mathsf {Monoid}}(X,Y) \end {aligned}Pointed types and homotopy groups [01KG]
- November 16, 2025
- Jon Sterling
These notes are roughly following Chapter 19 of Rijke’s Introduction to Homotopy Type Theory.
Definition Pointed types [01KH]
- November 16, 2025
- Jon Sterling
A pointed type X is a type \left \lvert {X}\right \rvert together with an element \mathsf {pt}_{X} called the base point. In a universe (\mathcal {U},\mathcal {T}), the type of pointed types is given as follows:
\mathcal {U}_* :\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(X:\mathcal {U})}} \mathcal {T}[X]Sometimes for a pointed type X, we will abuse notation and write X for the underlying type rather than \left \lvert {X}\right \rvert .
We can characterise identifications of pointed types as follows. We first define the following displayed reflexive graph \underline {\mathcal {T}} over the reflexive graph image \mathcal {U} / \mathcal {T} as follows:
\begin {aligned} \left \lvert {\underline {\mathcal {T}}}\right \rvert [X] &:\equiv \mathcal {T}[X] \\ \bigl \lparen x \approx ^{\underline {\mathcal {T}}}_{f:X\approx _{\mathcal {U} /\mathcal {T}} Y} y \bigr \rparen &:\equiv fx =_Y y \\ \mathsf {rx}^{\underline {\mathcal {T}}}_{X}x &:\equiv \mathsf {refl}_{x} \end {aligned}The above is univalent because all of its components are discrete reflexive graphs. When \mathcal {U} is univalent, the total reflexive graph \underline {\mathcal {U}}_* :\equiv (\mathcal {U} / \mathcal {T}).\underline {\mathcal {T}} is univalent. Thus we see that an identification of pointed types is an equivalence of the underlying types that preserves the base point:
X \approx _{\underline {\mathcal {U}}_*} Y \equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(f:\left \lvert {X}\right \rvert \approx _{\mathcal {U} / \mathcal {T}}\left \lvert {Y}\right \rvert )}} f \mathsf {pt}_{X}=_{\left \lvert {Y}\right \rvert } \mathsf {pt}_{Y}Definition Loop spaces [01KI]
- November 16, 2025
- Jon Sterling
Let X be a pointed type. The loop space of X, written \Omega {X} is the pointed type of self-identifications of the base point of X, with reflexivity as the base point:
\begin {aligned} \left \lvert {\Omega {X}}\right \rvert &:\equiv (\mathsf {pt}_{X}=_{\left \lvert {X}\right \rvert }\mathsf {pt}_{X}) \\ \mathsf {pt}_{\Omega {X}} &:\equiv \mathsf {refl}_{\mathsf {pt}_{X}} \end {aligned}In fact, we can define iterated loop spaces by mathematical induction:
\begin {aligned} \Omega ^0 X &:\equiv X \\ \Omega ^{n+1}X &:\equiv \Omega (\Omega ^n X) \end {aligned}Definition Homotopy groups of a pointed type [01KJ]
- November 16, 2025
- Jon Sterling
Let X be a pointed type. For n\geq 1, the nth homotopy group of X, written \pi _nX is defined as follows.
- The underlying set \left \lvert {\pi _nX}\right \rvert is the 0-truncation \lVert \Omega ^nX\rVert _0.
- The semigroup operation \bullet _{\pi _n X} is the unique function equipped with an identification of the following form: \lvert p \rvert _0 \bullet _{\pi _n X} \lvert q \rvert _0 =_{\left \lvert {\pi _n X}\right \rvert } \lvert p\bullet q \rvert _0 Above, we are using the universal property of the reflection \lvert -\rvert _0\colon \left \lvert {\Omega ^n X}\right \rvert \to \bigl \lVert \left \lvert {\Omega ^nX}\right \rvert \bigr \rVert _0 to extend the pasting operation of loops (self-identifications of the base point) to the 0-truncation. Associativity then follows from associativity of pasting.
Proof.
- November 16, 2025
- Jon Sterling
It remains to check that we have an identity element and all inverses. Because the semigroup is inhabited, as soon as we have inverses we shall have a unit. Therefore, we must construct:
{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(u:\left \lvert {\pi _nX}\right \rvert )}} \mathsf {inverseOf}_{\pi _nX}(u)Recalling that \left \lvert {\pi _n X}\right \rvert \equiv \bigl \lVert \left \lvert {\Omega ^n X}\right \rvert \bigr \rVert _0 and that \mathsf {inverseOf}_{\pi _nX}(u) is a proposition and thus a set, we can reduce the above by means of the dependent induction principle for 0-truncation, using the fact that sets are closed under internal sums. In particular, the above is equivalent to the following:
{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(p:\left \lvert {\Omega ^n X}\right \rvert )}} \mathsf {inverseOf}_{\pi _nX}\,\lvert p\rvert _0Fixing such a loop p on \mathsf {pt}_{\Omega ^{n-1}X}, we must choose some element v:\left \lvert {\pi _n X}\right \rvert such that \lvert p\rvert _0\bullet _{\pi _n X} v and v\bullet _{\pi _n X}\lvert p\rvert _0 are both identity elements. We choose v to be the image of the flipping of p under 0-truncation:
v :\equiv \lvert \bar {p}\rvert _0Now, we have the following identifications:
- v\bullet _{\pi _n X} \lvert p \rvert _0 = \lvert \bar p \bullet p \rvert _0 = \lvert \mathsf {refl}_{\mathsf {pt}_{\Omega ^{n-1}X}}\rvert _0
- \lvert p \rvert _0 \bullet _{\pi _n X} v= \lvert p \bullet \bar p \rvert _0 = \lvert \mathsf {refl}_{\mathsf {pt}_{\Omega ^{n-1}X}}\rvert _0
Therefore it remains only to check that \lvert \mathsf {refl}_{\mathsf {pt}_{\Omega ^{n-1}X}}\rvert _0 is an identity element. This is easily shown, again using the dependent induction principle of 0-truncation.
Example Group structure on the loop space of a pointed 1-truncated type [01KK]
- November 16, 2025
- Jon Sterling
Suppose that X is pointed type such that \left \lvert {X}\right \rvert is 1-truncated. Then \left \lvert {\Omega X}\right \rvert carries the structure of a group. In particular, the loop space \left \lvert {\Omega X}\right \rvert is already a set, so the reflection \left \lvert {\Omega X}\right \rvert \to \bigl \lVert \left \lvert {\Omega X}\right \rvert \bigr \rVert _0 is an equivalence. Re-casting the first homotopy group \pi _1 X under this equivalence, we see that the group structure is given precisely by concatenation of loops.
Examples of interesting homotopy groups from a univalent universe [01KM]
- November 16, 2025
- Jon Sterling
Given a univalent universe \mathcal {U}, any type X:\mathcal {U} gives rise to a pointed type \left \langle \mathcal {U}, X\right \rangle , whose loop space is given precisely by the automorphisms of X.
For example, the loop space \Omega \left \langle \mathcal {U},\mathsf {bool}\right \rangle of the universe based at the booleans can be seen (using univalence) to be the type of equivalences on the booleans, as the following canonical map is an equivalence:
\Omega \left \langle \mathcal {U},\mathsf {bool}\right \rangle \equiv (\mathsf {bool}=_{\mathcal {U}}\mathsf {bool}) \xrightarrow {\sim } (\mathsf {bool} \approx _{\mathcal {U} / \mathcal {T}} \mathsf {bool})We can therefore compute the first homotopy group of \left \langle \mathcal {U},\mathsf {bool}\right \rangle to be a group with exactly two elements (because there are exactly two automorphisms of \mathsf {bool}). Of course, all higher homotopy groups are trivial (i.e. contractible).
This is an example of how elementary combinatorics arises in the context of univalent foundations and homotopy theory.
Delooping [01KL]
- November 16, 2025
- Jon Sterling
In category theory, a group is the same thing as a groupoid with one object; the idea is that the elements of the group are the loops in the groupoid on the one object. Conversely, if we have a group, we can construct a groupoid with one object whose single hom set is the given by the elements of the group (with composition given by multiplication).
Univalent foundations treats groupoids synthetically, which means that they are not described by an algebraic structure but instead as a mere condition on types. In univalent foundations, groupoids are simply 1-truncated types. This suggests that, if only we could figure out how to properly rephrase “…with one object”, we could also have a synthetic notion of group that is equivalent to the usual algebraic one.
One translation of “…with one object” that is evidently too strong is to require that the type be constractible; as any contractible type is a proposition, this conditon would ensure that there are no non-trivial loops on the centre of contraction and therefore we would not be able to classify any interesting groups. A weaker notion that captures the right behaviour is 0-connectedness. Recall that a type is 0-connected exactly when its 0-truncation is set truncation is contractible; this says that when you ignore the differences between all the identifications (including loops), the result is contractible. In other words, the type has interesting structure only in its identifications, which is just what we want.
This suggests that the appropriate synthetic notion of group would be the pointed 0-connected types. In fact, you can develop all of group theory in this way, and if you are interested in that, you should look at the beautiful Symmetry book. Here we will just get a taste for how the theory works.
From here on, we will refer to ordinary groups as “analytic groups”.
Definition Synthetic group [01KN]
- November 18, 2025
- Jon Sterling
A synthetic group is defined to be a pointed, 0-connected 1-truncated type.
We have already seen how to convert a synthetic group to an analytic group: take its loop space.
Definition Actions for analytic groups [01KO]
- November 18, 2025
- Jon Sterling
Let G be an analytic group. A G-set is defined to be a set S together with a group homomorphism \alpha : \hom _{\mathsf {Group}}(G,\mathsf {Aut}(S)) where \mathsf {Aut}(S) is the automorphism group of S, i.e. the group of isomorphisms S\cong S with multiplication given by composition. In other words, a G-set represents every element of G as an automorphism of its underlying set S in a way that is compatible with the group operation.
Equivalently, the action \alpha can be described as a monoid homomorphism from G to the monoid of endofunctions S^S under composition; the image of this action will necessarily lie in \mathsf {Aut}(S)\subseteq S^S because inverse elements are automatically preserved by monoid homomorphisms.
The type of G-sets overall is then built as follows:
\mathsf {Set}_{\mathcal {U}}^G :\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(S:\mathsf {Set}_{\mathcal {U}})}} \hom _{\mathsf {Monoid}}(G,S^S)To characterise identifications of G-sets, we define a displayed reflexive graph \underline {\mathsf {Action}}_{\mathcal {U}}^{G} over \underline {\mathsf {Set}}_{\mathcal {U}} for actions of G, where \underline {\mathsf {Set}}_{\mathcal {U}} is \lbrace S : \mathcal {U} / \mathcal {T}\mid \mathsf {isSet}(S)\rbrace .
\begin {aligned} \left \lvert {\underline {\mathsf {Action}}_{\mathcal {U}}^{G}}\right \rvert [S] &:\equiv \hom _{\mathsf {Monoid}}(G,S^S) \\ \bigl ( \alpha \approx ^{\underline {\mathsf {Action}}_{\mathcal {U}}^{G}}_{f:S\approx _{\underline {\mathsf {Set}}_{\mathcal {U}}} T} \beta \bigr ) &:\equiv {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(g:\left \lvert {G}\right \rvert )}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(s:S)}} f(\alpha \,g\,s) =_{T} \beta \,g\,(f s) \\ \mathsf {rx}^{\underline {\mathsf {Action}}_{\mathcal {U}}^{G}}_{S}\alpha &:\equiv \lambda u,s\mathpunct {.} \mathsf {refl}_{\alpha \,g\,s} \end {aligned}We observe that the component of the above at a set S:
\underline {\mathsf {Action}}_{\mathcal {U}}^{G}[S] \equiv \Bigl \lbrace \alpha : \bigl \lbrace \alpha : {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x:\left \lvert {G}\right \rvert )}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(s:S)}} \Delta S \mathrel {\bigm \vert } \ldots \bigr \rbrace \mathrel {\Bigm \vert } \ldots \Big \rbraceThe ellided parts are propositional, so the component is univalent. Therfore, when \mathcal {U} is univalent, the following total reflexive graph is univalent:
\underline {\mathsf {Set}}_{\mathcal {U}}^G :\equiv \underline {\mathsf {Set}}_{\mathcal {U}}.\underline {\mathsf {Action}}_{\mathcal {U}}^{G}Example The principal G-set [01KP]
- November 18, 2025
- Jon Sterling
Let G be an analytic group. The principal G-set \mathbb {P}_G is defined to be the underlying set \left \lvert {G}\right \rvert equipped with the action \begin {aligned} G&\to \mathsf {Aut}\left \lvert {G}\right \rvert \\ x&\mapsto x\bullet _G - \end {aligned} induced by G’s group operation.
Definition Torsors for analytic groups [01KQ]
- November 18, 2025
- Jon Sterling
Let G be an analytic group. A G-torsor is defined to be a G-set X such that there exists an identification of G-sets from the principle G-set to X. In other words:
\begin {aligned} \mathsf {Tor}_{\mathcal {U}}^G &:\equiv {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(X:\mathsf {Set}_{\mathcal {U}}^G)}} \bigl \lVert \mathbb {P}_G =_{\mathsf {Set}_{\mathcal {U}}^G} X \bigr \rVert _{-1} \\ \underline {\mathsf {Tor}}_{\mathcal {U}}^G &:\equiv \Bigl \lbrace X:\underline {\mathsf {Set}}_{\mathcal {U}}^G \mathrel {\Bigm \vert } \bigl \lVert \mathbb {P}_G =_{\mathsf {Set}_{\mathcal {U}}^G} X \bigr \rVert _{-1} \Bigr \rbrace \end {aligned}Definition The principal G-torsor [01KS]
- November 18, 2025
- Jon Sterling
Let G be an analytic group. Then principal G-torsor is then the principal G-set \mathbb {P}, which forms a torsor by virtue of the reflexivity identification \mathbb {P}_G= \mathbb {P}_G. We will write \mathbb {P}_G also for the principal G-torsor.
Construction Delooping of an analytic group [01KR]
- November 18, 2025
- Jon Sterling
Let G be an analytic group. The type of G-torsors is evidently 1-truncated; it is also 0-connected.
Proof.
- November 18, 2025
- Jon Sterling
We recall our alternative characterisation of 0-connected types. We must show that there exists a G-torsor, and that for any two G-torsors, there exists an identification between them. For the former, we may use the principal G-torsor. It remains to exhibit the following:
{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(X,Y:\mathsf {Tor}_{\mathcal {U}}^G)}} \lVert X=_{\mathsf {Tor}_{\mathcal {U}}^G}Y \rVert _{-1}We consider the following sequence of equivalences
\begin {aligned} &{\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(X,Y:\mathsf {Tor}_{\mathcal {U}}^G)}} \lVert X=_{\mathsf {Tor}_{\mathcal {U}}^G}Y \rVert _{-1} \\ &\quad \xrightarrow {} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(X,Y:\mathsf {Set}_{\mathcal {U}}^G)}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(\phi _X:\lVert \mathbb {P}_G=_{\mathsf {Set}_{\mathcal {U}}^G} X \rVert _{-1})}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(\phi _Y:\lVert \mathbb {P}_G=_{\mathsf {Set}_{\mathcal {U}}^G} Y \rVert _{-1})}} \lVert \left \langle X,\phi _X\right \rangle =_{\mathsf {Tor}_{\mathcal {U}}^G}\left \langle Y,\phi _Y\right \rangle \\ &\quad \xrightarrow {} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(X,Y:\mathsf {Set}_{\mathcal {U}}^G)}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(\phi _X:\mathbb {P}_G=_{\mathsf {Set}_{\mathcal {U}}^G} X)}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(\phi _Y:\mathbb {P}_G=_{\mathsf {Set}_{\mathcal {U}}^G} Y)}} \lVert \left \langle X,\lvert \phi _X\rvert _{-1}\right \rangle =_{\mathsf {Tor}_{\mathcal {U}}^G}\left \langle Y,\lvert \phi _Y\rvert _{-1}\right \rangle \rVert _{-1} \\ &\quad \xrightarrow {} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(X,Y:\left \{\mathbb {P}_G\right \}^+_{\Delta \mathsf {Set}_{\mathcal {U}}^G})}} \lVert \left \langle X.1,\lvert X.2\rvert _{-1}\right \rangle =_{\mathsf {Tor}_{\mathcal {U}}^G}\left \langle Y.1,\lvert Y.2\rvert _{-1}\right \rangle \rVert _{-1} \\ &\quad \xrightarrow {} \lVert \mathbb {P}_G=_{\mathsf {Tor}_{\mathcal {U}}^G}\mathbb {P}_G\rVert _{-1} \end {aligned}We can finish up with the reflexivity identification.
So the type of G-torsors is 1-truncated and 0-connected; we can view it as a pointed type by defining \mathsf {pt}_{\mathsf {Tor}_{\mathcal {U}}^G}:\equiv \mathbb {P}_G. We refer to the pointed type of G-torsors as the delooping of G; this will be the synthetic group corresponding to the analytic group G.
Computation The loop space of a delooping [01KX]
- November 20, 2025
- Jon Sterling
Let G be an analytic group in a univalent universe \mathcal {U}; we will identify G with \Omega \mathsf {Tor}^G_{\mathcal {U}}, i.e. the group of loops in the pointed type of G-torsors.
We first examine the loop space \Omega \mathsf {Tor}^G_{\mathcal {U}}, which is the space of loops on the principal G-torsor \mathbb {P}_G by constructing the following sequence of equivalences:
\begin {aligned} &\left \lvert {\Omega \mathsf {Tor}^G_{\mathcal {U}}}\right \rvert \\ &\xrightarrow {\equiv } \mathbb {P}_G =_{ \mathsf {Tor}_{\mathcal {U}}^G } \mathbb {P}_G \\ &\xrightarrow {\sim } \mathbb {P}_G\approx _{\underline {\mathsf {Tor}}_{\mathcal {U}}^G} \mathbb {P}_G \\ &\xrightarrow {\equiv } \mathbb {P}_G\approx _{\underline {\mathsf {Set}}_{\mathcal {U}}^G} \mathbb {P}_G \\ &\xrightarrow {\equiv } {\mathop {\mathchoice {\textstyle \sum }{\textstyle \sum }{\scriptstyle \sum }{\scriptscriptstyle \sum } }_{(\pi :\left \lvert {G}\right \rvert \approx _{\underline {\mathsf {Set}}_{\mathcal {U}}} \left \lvert {G}\right \rvert )}} {\mathop {\mathchoice {\textstyle \prod }{\textstyle \prod }{\scriptstyle \prod }{\scriptscriptstyle \prod } }_{(x,y:\left \lvert {G}\right \rvert )}} \pi (x\bullet _G y) =_{\left \lvert {G}\right \rvert } x\bullet _G \pi y \\ &\xleftarrow {(*)} \left \lvert {G}\right \rvert \end {aligned}The final equivalence is the map that takes an element x:\left \lvert {G}\right \rvert to the automorphism -\bullet _G x, which does indeed sastisfy the condition by the associative law. The inverse function sends an automorphism \pi to its value on the identity element of G; indeed, the value \pi (\epsilon _G) determines all of \pi as we have \pi x = \pi (x\bullet _G \epsilon _G) = x\bullet _G \pi (\epsilon _G).
That this equivalence of carrier sets amounts to an identification of analytic groups via our characterisation amounts to showing that the map \begin {aligned} \left \lvert {G}\right \rvert &\to \mathsf {Aut}\left \lvert {G}\right \rvert \\ x&\mapsto -\bullet _G x \end {aligned} preserves the semigroup operation and identities; but this is immediately deduced from the unit and associativity laws of the group G.
\begin {aligned} - \bullet _G \epsilon _g &\sim 1_{\left \lvert {G}\right \rvert } \\ &\sim \epsilon _{\mathsf {Aut}\left \lvert {G}\right \rvert } \\ -\bullet _G (u\bullet _G v) &\sim (-\bullet _G u)\bullet _G v \\ &\sim (-\bullet _G u) \bullet _{\mathsf {Aut}\left \lvert {G}\right \rvert } (-\bullet _G v) \end {aligned}