41 Lean and Cubical Agda Verifications— Checked

RT0 (the root is the diagonal). There is one statement, \(a=a\). It writes one \(a\) and reads it on two sides. That passage, one thing to its two sides, is the diagonal \(\Delta \), \(a\mapsto \langle a,a\rangle \); the two sides are read off by the projections \(\pi _1,\pi _2\), and exchanging them is the swap \(\sigma \). As a reading, the root is \(\mathrm {id}\): \(\mathrm {id}\,a=a\). Words in italics are names for what is already there; nothing else is laid down.

The swap of RT0–RT1 is obtained here: \(\sigma =\langle \pi _2,\pi _1\rangle \), the passage back applied to \((\pi _2,\pi _1)\). Then \(\pi _1\sigma =\pi _2\) and \(\pi _2\sigma =\pi _1\) by the triangle, so \(\pi _i\sigma \Delta =\mathrm {id}=\pi _i\Delta \) and \(\sigma \Delta =\Delta \); and \(\pi _i\sigma \sigma =\pi _i\), so \(\sigma \sigma =\langle \pi _1,\pi _2\rangle =\mathrm {id}\) by the dual triangle.

RT1 (one exchange, and duality). Reading \(a=a\) from the right gives \(a=a\): \(\sigma \Delta =\Delta \). The same exchange applies to anything with two ends:

exchange of

name

twice

the two sides of a pair

swap \(\sigma \)

\(\sigma \sigma =\mathrm {id}\)

placed and read, the two ends of an arrow

reversing arrows (dual)

the dual of the dual is the original

the two values of \(\mathbf 2\) (RT8)

complement \(\neg \)

\(\neg \neg p=p\)

Hence every statement proved below has a dual, proved by the same argument read the other way, and the dual of the dual is the statement itself.

RT2 (round trips: one triangle and its dual). A round trip is a passage there and a passage back. Its unit and counit are the two passages at \(\mathrm {id}\). Its law is the root for passages: going there and back is not moving, read at \(\mathrm {id}\). The dual of a round trip (arrows reversed) is again a round trip, with there and back exchanged; its law is the other triangle. So:

\begin{equation} \text {triangle (ii) of a round trip}\ =\ \text {triangle (i) of its dual}. \tag{829}\end{equation}
The diagonal gives the first round trip, and its dual gives the second:

round trip unit counit triangle dual triangle
\(\Delta \dashv \times \) (pairs) \(\Delta \) \(\pi _1,\pi _2\) \(\pi _i(\Delta a)=a\) \(\langle \pi _1p,\pi _2p\rangle =p\)
\(\sqcup \dashv \Delta \) (sums) \(\mathrm {inl},\mathrm {inr}\) \([\mathrm {id},\mathrm {id}]\) \([f,g]\,\mathrm {inl}=f\), \([f,g]\,\mathrm {inr}=g\) \([\mathrm {inl},\mathrm {inr}]=\mathrm {id}\)

The second row is the first with arrows reversed: a sum is the dual of a pair. Likewise \(1\) (one arrow into it from anywhere) and its dual \(0\) (one arrow out of it). Put \(\mathbf 2=1\sqcup 1\), with values \(\ell =\mathrm {inl}\), \(r=\mathrm {inr}\).

RT3 (the open place: \(\beta \) and its dual \(\eta \)). An expression \(t\) with an open place of kind \(B\) reads a pair \(\langle x,b\rangle \). Placing leaves the place open, reading fills it; this is a round trip, and its counit, reading at \(\mathrm {id}\), is evaluation. Write \(\lambda x.\,t\) for \(t\) placed, \(f\,a\) for \(f\) read at \(a\), and \(t[a/x]\) for \(t\) read at \(\langle x,a\rangle \) (RT2). Then

\begin{equation} (\lambda x.\,t)\,a=t[a/x]\quad (\beta ,\ \text {the triangle}),\qquad \qquad \lambda x.\,f\,x=f\quad (\eta ,\ \text {its dual}). \tag{830}\end{equation}
For \(t=x\): \(\mathrm {id}=\lambda x.\,x\) and \(\mathrm {id}\,a=a\), the root. The expressions written with these marks are terms.

RT4 (every rule of the \(\lambda \)-calculus).

rule

from

\(s=s\); \(s=t\Rightarrow t=s\)

the root; its dual (\(\sigma \))

\(s=t,\ t=u\Rightarrow s=u\)

read “\(s=-\)” at \(t\); what is read of \(t\) is read of \(u\)

\(s=t\Rightarrow s\,a=t\,a,\ \lambda x.s=\lambda x.t\);
\(a=b\Rightarrow s\,a=s\,b\)

a passage given the same gives the same

\(\beta \); \(\eta \)

the triangle; its dual

\(\lambda x.\,t=\lambda y.\,t[y/x]\) (\(\alpha \))

\(\lambda x.t\overset {\eta }{=}\lambda y.(\lambda x.t)\,y\overset {\beta }{=}\lambda y.\,t[y/x]\)

RT5 (composition, its laws, Yoneda). Reading the right side of one reading as the left side of the next is \(g\circ f=\lambda x.\,g(f\,x)\).

\begin{align} \mathrm {id}\circ f&\overset {\beta }{=}\lambda x.\,f\,x\overset {\eta }{=}f,\qquad f\circ \mathrm {id}\overset {\beta }{=}\lambda x.\,f\,x\overset {\eta }{=}f, \tag{831}\\ (h\circ g)\circ f&\overset {\beta }{=}\lambda x.\,h(g(f\,x))\overset {\beta }{=}h\circ (g\circ f). \tag{832}\end{align}

Composition is transitivity read as an arrow, and \(\mathrm {id}\) is reflexivity. Yoneda: if \(\Phi \) is compatible with composition, \(\Phi (f\circ u)=\Phi (f)\cdot u\), then \(\Phi (f)=\Phi (\mathrm {id}\circ f)=\Phi (\mathrm {id})\cdot f\); so \(\Phi \) is fixed by its value at \(\mathrm {id}\). Read backwards, \(\beta \) and \(\eta \) are the two halves of Yoneda’s passage \(f\mapsto \varepsilon \circ (f\times \mathrm {id})\) being a round trip.

RT6 (elements are their readings). An element is what it does to every reader, \(\hat a=\lambda k.\,k\,a\), and \(\hat a\,\mathrm {id}=a\). With the reader split by shape:

item term
pair; projections \(\langle a,b\rangle =\lambda s.\,s\,a\,b\); \(\pi _1=\lambda p.\,p\,\ell \), \(\pi _2=\lambda p.\,p\,r\)
diagonal; swap \(\Delta =\lambda a.\langle a,a\rangle \); \(\sigma =\lambda p.\langle \pi _2p,\pi _1p\rangle \)
tags; case split (dual of pair) \(\mathrm {inl}\,a=\lambda fg.\,f\,a\), \(\mathrm {inr}\,b=\lambda fg.\,g\,b\); \([f,g]=\lambda s.\,s\,f\,g\)
\(\mathbf 2\); \(\wedge \), \(\vee \), \(\neg \) \(\ell =\lambda xy.x\), \(r=\lambda xy.y\); \(x\,y\,r\), \(x\,\ell \,y\), \(x\,r\,\ell \)
numbers; \(+\), \(\cdot \) \(n=\lambda sx.\,s^nx\); \(\lambda sx.\,m\,s(n\,s\,x)\), \(\lambda s.\,m(n\,s)\)
placing, reading; unit, counit \(\lambda fxy.\,f\langle x,y\rangle \), \(\lambda gp.\,g(\pi _1p)(\pi _2p)\); \(\lambda xy.\langle x,y\rangle \), \(\lambda p.(\pi _1p)(\pi _2p)\)

In each row the constructors are \(\mathrm {id}\) of that kind, so reading at them is reading at \(\mathrm {id}\). Every equation of RT0–RT3 is now a computation by \(\beta \) and \(\eta \).

RT6a (multiplication and addition, at every level). At each level the product is the right adjoint of the diagonal and the sum is its dual:

level

multiplication

addition

where

kinds

\(A\times B\) (\(\Delta \dashv \times \))

\(A\sqcup B\)
(\(\sqcup \dashv \Delta \), the dual)

RT2

numbers, as readings

\(m\cdot n=\lambda s.\,m\,(n\,s)\)

\(m+n=\lambda sx.\,m\,s\,(n\,s\,x)\)

RT6

numbers, as kinds

the name of \(\mathrm {El}\,m\times \mathrm {El}\,n\)

the name of \(\mathrm {El}\,m\sqcup \mathrm {El}\,n\)

LF3

\(\mathbf 2\)

\(x\wedge y=x\,y\,r\) (\(x\,x=x\))

\(x\vee y=x\,\ell \,y\);
ring sum \(x\oplus y=x\,(\neg y)\,y\)

RT6, RT10

games, dyadics, reals

SU5, LD6

LD1, LD5, LD6

Branch AA

rings, Lie algebras

branch E

branch E

OS16–

The laws come from the same place:

law

on kinds

on numbers

units

\(A\times 1\cong A\),
\(A\sqcup 0\cong A\)

\(m\cdot 1=m\),
\(m+0=0+m=m\)

zero

\(A\times 0\cong 0\)

\(m\cdot 0=0\)

commutative

\(\sigma \) on \(\times \) and on \(\sqcup \)

\(m+n=n+m\),
\(m\cdot n=n\cdot m\)

associative

re-grouping of \(\times \) and of \(\sqcup \)

\((m+n)+k=m+(n+k)\),
\((mn)k=m(nk)\)

distributive

\(A\times (B\sqcup C)\cong A\times B\sqcup A\times C\)

\(m(n+k)=mn+mk\)

successor

\(A\times (B\sqcup 1)\cong A\times B\sqcup A\)

\(m\cdot \mathrm s\,n=m\cdot n+m\)

Distributivity holds because \(A\times -\) is a left adjoint (of \(A\to -\), RT3), and a left adjoint keeps sums. The two forms of the numbers agree: both are the least kind with \(0\) and a successor, so each maps onto the other (LF3, LF6), \(n\mapsto \lambda sx.\,s^nx\), and \(+\), \(\cdot \) correspond under this map. (Checked on the numbers \(0\) to \(3\): all \(252\) instances of the laws in the right column hold.)

RT7 (kinds). A kind says which terms count and when two count as the same. \(A\times B\), \(A\sqcup B\), \(\mathbf 2\), \(\mathbb N\) are the terms of the forms of RT6, and their laws hold for every element; \(\langle \pi _1q,\pi _2q\rangle =q\) holds for every \(q\) of \(A\times B\), not for every term. Arrows are the same when they agree at every element.

RT8 (\(\mathbf 2\): \(\neg \neg =\mathrm {id}\) and \(\ell \neq r\)). \(\neg \) is the exchange of RT1 on \(\mathbf 2\): \(\neg \ell =r\), \(\neg r=\ell \), and \(\neg \neg p=p\) is \(\sigma \sigma =\mathrm {id}\). If \(\ell =r\), then \(M=\ell MN=rMN=N\) for all \(M,N\). This does not happen: \(\beta \)-steps taken several at once satisfy \(M\Rightarrow N\Rightarrow M^*\); \(\eta \)-steps shorten terms and meet in one step; a \(\beta \)-step and an \(\eta \)-step meet again. So equal terms have a common result, distinct terms with no step left are not equal, and \(\ell \neq r\). (Two orders of reduction agreed on \(2942\) random terms.)

RT9 (parts and order). A cut of \(A\) is \(p:A\to \mathbf 2\); \(A_p\) is the kind of \((a,w)\) with \(w\) a witness of \(p(a)=\ell \), and \(i_p:A_p\to A\) forgets \(w\) (injective). Write \(p\leq q\) when there is \(f:A_p\to A_q\) with \(i_q\circ f=i_p\).

property from
reflexive; transitive \(\mathrm {id}\); composition (RT5)
antisymmetric arrows both ways compose to \(\mathrm {id}\); values in \(\{\ell ,r\}\), \(\ell \neq r\) (RT8)
\(\neg \) reverses \(\leq \) \(q(a)=r\) and \(p(a)=\ell \) would give \(q(a)=\ell \)

RT10 (meet, and join as its dual). Meet. Pairs \((x,y)\) of \(A_p\times A_q\) with \(i_px=i_qy\) form the part of a cut \(pq\), and by \(\Delta \dashv \times \)

\begin{equation} s\leq p\ \text {and}\ s\leq q\iff s\leq pq . \tag{833}\end{equation}

law of \(\wedge \) arrows both ways by dual law of \(\vee \)
\(pq=qp\) \(\sigma \) \(p\vee q=q\vee p\)
\(pp=p\) \(\Delta \), \(\pi _1\) \(p\vee p=p\)
\((pq)s=p(qs)\) re-grouping pairs \((p\vee q)\vee s=p\vee (q\vee s)\)
\(p\top =p\), \(p\bot =\bot \) \(\pi _1\), \(\langle \mathrm {id},i_p\rangle \); empty kind \(p\vee \bot =p\), \(p\vee \top =\top \)
\(p\,\neg p=\bot \) a pair would witness \(\ell =r\) \(p\vee \neg p=\top \)
\(p(p\vee q)=p\) \(p\leq p\vee q\) \(p\vee pq=p\)
\(p(q\vee s)=pq\vee ps\) a pair with a tagged side is a tagged pair \(p\vee qs=(p\vee q)(p\vee s)\)

Join. Reversing arrows turns \(\Delta \dashv \times \) into \(\sqcup \dashv \Delta \) (RT2), so the least cut above \(p\) and \(q\) is the part of values of \([i_p,i_q]\). Inside the cuts this reversal is \(\neg \) (RT9, RT8), hence

\begin{equation} p\leq s\ \text {and}\ q\leq s\iff p\vee q\leq s,\qquad p\vee q=\neg (\neg p\,\neg q), \tag{834}\end{equation}
and each law in the right column is \(\neg \) applied to the law on its left. Among parts, \(\vee \dashv \Delta \dashv \wedge \): the diagonal and its dual.

RT10a (second route: relations). A relation from \(A\) to \(B\) is a cut \(R:A\times B\to \mathbf 2\), a part of \(A\times B\) (RT10). Its opposite is \(R^\circ =R\circ \sigma \). The relations are ordered by \(\leq \) (RT10).

relation definition from
equality \(E_A\) the part of \(A\times A\) placed by \(\Delta \): \(E_A(a,a')\) iff \(a=a'\) RT1
graph \(\Gamma _f\) \(E_B\) read along \(f\times \mathrm {id}\): \(\Gamma _f(a,b)\) iff \(f\,a=b\) the diagonal pulled back

So \(\Gamma _{\mathrm {id}}=E\), and \(E^\circ =E\) because \(\sigma \Delta =\Delta \).

RT10b (some, and its three rules). Reading along the projection \(\pi :A\times B\to A\) (weakening) sends a cut \(\psi \) of \(A\) to \(\pi ^*\psi =\psi \circ \pi \). Its left adjoint is some:

\begin{equation} \exists _b\,\varphi \leq \psi \iff \varphi \leq \pi ^*\psi . \tag{835}\end{equation}
\(\exists _b\varphi \) is the part of values of \(\pi \) on the part of \(\varphi \), as for the join in RT10; it is a part of \(A\) in a world with \(\Omega =\mathbf 2\) (RL2). All connectives on cuts are computed pointwise on \(\mathbf 2\), so reading along \(\pi \) commutes with them: \(\pi ^*(\psi \Rightarrow \chi )=\pi ^*\psi \Rightarrow \pi ^*\chi \), where \(\psi \Rightarrow \chi =\neg \psi \vee \chi \). This is an adjunction: \(\exists _b\varphi \leq \psi \) says every value \(a\) of \(\pi \) on the part of \(\varphi \) lies in \(\psi \), which is \(\varphi (a,b)\leq \psi (a)\) for all \((a,b)\), that is \(\varphi \leq \pi ^*\psi \). Its unit \(\varphi \leq \pi ^*\exists _b\varphi \) and counit \(\exists _b\pi ^*\psi \leq \psi \) are the two sides of this equivalence at \(\psi =\exists _b\varphi \) and at \(\varphi =\pi ^*\psi \); between parts there is at most one arrow, so the triangles hold.

rule statement proof
one point \(\exists _b\bigl (E(a,b)\wedge \varphi (b)\bigr )=\varphi (a)\) below
Frobenius \(\exists _b\bigl (\psi (a)\wedge \varphi (a,b)\bigr )=\psi (a)\wedge \exists _b\varphi (a,b)\) below
exchange \(\exists _b\exists _c=\exists _c\exists _b\) both are left adjoint to one weakening

One point. \(\geq \): take \(b=a\), with witness \(\mathrm {id}\) of \(E(a,a)\). \(\leq \): by the adjunction it suffices that \(E(a,b)\wedge \varphi (b)\leq \varphi (a)\), and what is read of \(b\) is read of \(a\) when \(a=b\) (RT4).

Frobenius. \(\leq \): \(\psi \wedge \varphi \leq \varphi \) and \(\psi \wedge \varphi \leq \pi ^*\psi \), then apply \(\exists _b\) and its counit. \(\geq \): write \(\chi =\exists _b(\pi ^*\psi \wedge \varphi )\). The unit gives \(\pi ^*\psi \wedge \varphi \leq \pi ^*\chi \), so \(\varphi \leq \pi ^*\psi \Rightarrow \pi ^*\chi =\pi ^*(\psi \Rightarrow \chi )\), so \(\exists _b\varphi \leq \psi \Rightarrow \chi \), so \(\psi \wedge \exists _b\varphi \leq \chi \).

It is the right adjoint of \(\psi \wedge -\):

\begin{equation} \psi \varphi \leq \chi \iff \varphi \leq \psi \Rightarrow \chi . \tag{836}\end{equation}
If \(\varphi \leq \neg \psi \vee \chi \), then \(\psi \varphi \leq \psi \neg \psi \vee \psi \chi =\psi \chi \leq \chi \). If \(\psi \varphi \leq \chi \), then \(\varphi =\varphi (\psi \vee \neg \psi )=\varphi \psi \vee \varphi \neg \psi \leq \chi \vee \neg \psi \). Both use only the laws of RT10.

Exchange. Weakening by \(b\) then \(c\) and by \(c\) then \(b\) are the same reading up to \(\sigma \); left adjoints of the same passage are the same (RT10, antisymmetry).

RT10c (composition of relations and its laws). For \(R\) from \(A\) to \(B\) and \(S\) from \(B\) to \(C\):

\begin{equation} (S\circ R)(a,c)=\exists _b\bigl (R(a,b)\wedge S(b,c)\bigr ). \tag{837}\end{equation}

law statement from
unit \(E\circ R=R=R\circ E\) one point
associativity \((T\circ S)\circ R=T\circ (S\circ R)\) below
opposite \((S\circ R)^\circ =R^\circ \circ S^\circ \) \(\sigma \) inside the meet
monotone \(R\leq R'\) gives \(S\circ R\leq S\circ R'\) \(\wedge \) and \(\exists \) are monotone

Associativity. By Frobenius each side moves its inner \(\exists \) outward past the factor that does not mention it:

\begin{align} \bigl ((T\circ S)\circ R\bigr )(a,d)&=\exists _b\bigl (R(a,b)\wedge \exists _c(S(b,c)\wedge T(c,d))\bigr )=\exists _b\exists _c\bigl (R\wedge S\wedge T\bigr ), \tag{838}\\ \bigl (T\circ (S\circ R)\bigr )(a,d)&=\exists _c\bigl (\exists _b(R(a,b)\wedge S(b,c))\wedge T(c,d)\bigr )=\exists _c\exists _b\bigl (R\wedge S\wedge T\bigr ). \tag{839}\end{align}

The right sides agree by exchange and by associativity of \(\wedge \) (RT10).

RT10d (transitivity, and the properties of equality, again).

property of \(R\) on \(A\) as an inequality of relations for \(R=E\)
reflexive \(E\leq R\) \(E\leq E\)
symmetric \(R^\circ \leq R\) \(E^\circ =E\) (\(\sigma \Delta =\Delta \))
transitive \(R\circ R\leq R\) \(E\circ E=E\) (unit law at \(R=E\))
antisymmetric \(R\wedge R^\circ \leq E\) —

So the three properties of equality in RT4 come out a second time, now from the diagonal and the rules of "some". Transitivity is composition of a relation with itself.

RT10e (functions are graphs; their composition follows).

statement proof rule used
\(\Gamma _f\) is total: \(E_A\leq \Gamma _f^\circ \circ \Gamma _f\) \(b=f\,a\) is a witness unit of \(\exists \)
\(\Gamma _f\) is single-valued: \(\Gamma _f\circ \Gamma _f^\circ \leq E_B\) \(f\,a=b\) and \(f\,a=b'\) give \(b=b'\) RT4
\(\Gamma _{g\circ f}=\Gamma _g\circ \Gamma _f\) \(\exists _b\bigl (f\,a=b\wedge g\,b=c\bigr )=\bigl (g(f\,a)=c\bigr )\) one point
\(\Gamma _{\mathrm {id}}=E\) \(\mathrm {id}\,a=b\) iff \(a=b\) RT0
\(\Gamma _f=\Gamma _g\Rightarrow f=g\) read at \((a,f\,a)\): \(g\,a=f\,a\) for all \(a\) RT9

Since \(\Gamma \) turns composition of functions into composition of relations and tells functions apart, the laws of RT10c carry over:

\begin{equation} \Gamma _{(h\circ g)\circ f}=(\Gamma _h\circ \Gamma _g)\circ \Gamma _f=\Gamma _h\circ (\Gamma _g\circ \Gamma _f)=\Gamma _{h\circ (g\circ f)},\qquad \Gamma _{\mathrm {id}\circ f}=E\circ \Gamma _f=\Gamma _f . \tag{840}\end{equation}
This is the associativity and unit law of RT5, obtained without \(\beta \) or \(\eta \). Conversely, a relation that is total and single-valued is the graph of the reading that sends \(a\) to its one value, wherever a part with exactly one element is the value of an arrow from \(1\) (as in RT10).

RT10f (the two routes).

item route 1: placing and reading route 2: relations and graphs
equality, its three properties RT4 \(E=\) part placed by \(\Delta \); RT10d
composition \(\lambda x.\,g(f\,x)\) (RT5) \(\exists _b(R\wedge S)\); graphs (RT10c, RT10e)
unit law \(\beta \), then \(\eta \) one point
associativity \(\beta \) twice Frobenius, exchange, \(\wedge \)
transitivity composition \(R\circ R\leq R\)

Both routes start at \(\Delta \): the first through the triangles of the round trip, the second through the part that \(\Delta \) places and the adjoint of weakening. They agree because \(\Gamma \) sends the first composition to the second.

RT10g (third route: composition from the diagonal used twice). This route uses no \(\beta \), no \(\eta \) and no composition of arrows. It uses the diagonal, “some” (RT10b), and reading a statement at an element (the root, RT4).

1. Two uses of \(\Delta \).

use

what it gives

from

\(\Delta \) placing a part

equality \(E_B\subseteq B\times B\): \(E(b,b')\) iff \(b=b'\)

RT0

\(\Delta \) on cuts

meet: \((R\wedge S)\) holds where both hold

\(\Delta \dashv \times \) (RT2, RT10)

2. Composition is gluing by \(E\), then forgetting. For \(R\) from \(A\) to \(B\) and \(S\) from \(B\) to \(C\), glue the right side of \(R\) to the left side of \(S\) with the diagonal, and forget the middle:

\begin{equation} \begin {aligned} (S\circ R)(a,c) &=\exists _{b,b'}\bigl (R(a,b)\wedge E(b,b')\wedge S(b',c)\bigr )\\ &=\exists _b\bigl (R(a,b)\wedge S(b,c)\bigr ), \end {aligned} \tag{841}\end{equation}
the second form by the one-point rule (RT10b). The first use of \(\Delta \) makes the joint, the second makes the meet, and \(\exists \) forgets the joint.

3. Transitivity is composing with itself. A relation \(R\) on \(A\) is transitive when \(R\circ R\leq R\). Equality is transitive, and more:

\begin{equation} E\circ E=\exists _{b}\bigl (E(a,b)\wedge E(b,c)\bigr )=E(a,c)\qquad (\text {one point}). \tag{842}\end{equation}
The least transitive relation above any \(Q\) exists: it is \(\mu R.\,(Q\vee R\circ R)\) (LF1).

4. Units. \(E\circ R=R=R\circ E\), by the one-point rule on either side.

5. Associativity is one triple meet. Both bracketings forget the two joints of one glued chain:

\begin{align} \bigl ((T\circ S)\circ R\bigr )(a,d)&=\exists _b\bigl (R(a,b)\wedge \exists _c(S(b,c)\wedge T(c,d))\bigr ), \tag{843}\\ \bigl (T\circ (S\circ R)\bigr )(a,d)&=\exists _c\bigl (\exists _b(R(a,b)\wedge S(b,c))\wedge T(c,d)\bigr ), \tag{844}\end{align}

and by Frobenius (an \(\exists \) passes a factor that does not mention its variable), exchange (\(\exists _b\exists _c=\exists _c\exists _b\)) and associativity of \(\wedge \), each equals

\begin{equation} \exists _{b,c}\bigl (R(a,b)\wedge S(b,c)\wedge T(c,d)\bigr ). \tag{845}\end{equation}
There is one chain \(a\to b\to c\to d\); the brackets only record which joint is forgotten first.

6. Functions are relations, and inherit everything. The graph \(\Gamma _f=(f\times \mathrm {id})^*E\) is \(\Delta \) read along \(f\) (RT10a). Then \(\Gamma _{g\circ f}=\Gamma _g\circ \Gamma _f\) by the one-point rule, \(\Gamma _{\mathrm {id}}=E\), and graphs tell functions apart (RT10e). So composition of functions, its unit laws, its associativity and the transitivity of arrows are those of relations, obtained in steps 2–5.

7. What this route uses.

step

obtained

uses

1

\(E\), \(\wedge \)

\(\Delta \) twice

2

composition

\(E\), \(\wedge \), \(\exists \)

3

transitivity

composition with itself; one point

4

units

one point

5

associativity

Frobenius, exchange, \(\wedge \) associative

6

functions

graphs: \(\Delta \) read along \(f\)

(Checked on \(3000\) random families of finite relations: gluing then forgetting equals \(\exists _b(R\wedge S)\), both units hold, both bracketings equal the triple meet, and the least transitive relation above a random \(Q\) is transitive; \(12001\) instances.)

RT10h (fourth route: paths; path induction derived). 1. Equality of elements, as a family. For a kind \(A\), take the diagonal \(\Delta :A\to A\times A\) itself as a family over \(A\times A\): its elements over \((a,b)\) are the \(c\) with \(\Delta c=(a,b)\). Write \(a=b\) for it, and \(\mathrm {refl}_c\) for \(c\) seen over \(\Delta c=(c,c)\). This is \(\mathrm {Id}_A=\Sigma _\Delta 1\) (RT17) and the part \(E\) of RT10a, now keeping its elements. Nothing is added: the family is the map \(\Delta \), and \(\mathrm {refl}\) is its value.

2. Path induction at level \(0\): the total space is \(A\). An element of the total space of \(\mathrm {Id}_A\) is a triple \((a,b,p)\) with \(p:a=b\); by step 1 it is \(\Delta c=(c,c)\) with \(p=\mathrm {refl}_c\) for one \(c\), since the first projection after \(\Delta \) is \(\mathrm {id}\) (RT2). Hence, for any statement \(P(a,b,p)\),

\begin{equation} \begin {aligned} &\bigl (\forall c.\ P(c,c,\mathrm {refl}_c)\bigr )\\ &\quad \Longrightarrow \ \forall a,b,\ \forall p:a=b.\ P(a,b,p)\qquad (J), \end {aligned} \tag{846}\end{equation}
with computation rule \(J(d)(c,c,\mathrm {refl}_c)=d(c)\), which is \(\pi \circ \Delta =\mathrm {id}\), and uniqueness, which is the dual triangle \(\langle \pi _1,\pi _2\rangle =\mathrm {id}\). So \(J\) is the round trip of the diagonal read on families:
\begin{equation} \begin {aligned} &\text {maps out of }\Sigma _\Delta 1\text { over }A\times A\\ &\quad \cong \ \text {sections along }\Delta \qquad (\Sigma _\Delta \dashv \Delta ^*,\ \text {RT2}). \end {aligned} \tag{847}\end{equation}

3. Leastness. If \(R\) is a relation on \(A\) containing the diagonal (\(R(c,c)\) for all \(c\)), then by \(J\) with \(P(a,b,p)=R(a,b)\), \(E\leq R\). So equality is the least reflexive relation, the \(\mu \) of LF1 for “contains \(\Delta \)”. Leastness is not assumed; it is step 2.

4. Path induction at higher levels: contraction by the meet. When paths are kept as data, a path is a map \(p:\mathbb I\to A\) from the interval (HI3), \(\mathrm {refl}_a=\lambda i.\,a\). The based path space \(\Sigma _b\,(a=b)\) is contractible to \((a,\mathrm {refl}_a)\):

\begin{equation} \begin {gathered} j\ \longmapsto \ \bigl (p(j),\ \lambda i.\,p(i\wedge j)\bigr ),\\ j=0:\ (a,\mathrm {refl}_a),\qquad j=1:\ (b,p). \end {gathered} \tag{848}\end{equation}
Transport along this path (HI6) carries any \(d:P(a,\mathrm {refl}_a)\) to \(P(b,p)\): that is \(J\). The contraction uses only the meet \(\wedge \) of the interval, which is \(\Delta \dashv \times \) on \(\mathbb I\) (RT10), and its end points.

5. Composition, which is transitivity. By \(J\) on \(q\), for \(p:a=b\) and \(q:b=c\) put

\begin{equation} p\cdot \mathrm {refl}_b=p . \tag{849}\end{equation}
So every \(a=b\), \(b=c\) gives \(a=c\): transitivity is composition of paths, from the diagonal alone.

6. Units, inverse, associativity.

law

statement

by \(J\) on

right unit

\(p\cdot \mathrm {refl}=p\)

definition

left unit

\(\mathrm {refl}\cdot p=p\)

\(p\)

inverse

\(p\cdot p^{-1}=\mathrm {refl}\), with \(\mathrm {refl}^{-1}=\mathrm {refl}\)

\(p\)

associativity

\((p\cdot q)\cdot r=p\cdot (q\cdot r)\)

\(r\): at \(r=\mathrm {refl}\) both sides are \(p\cdot q\)

functions respect it

\(f(p\cdot q)=f(p)\cdot f(q)\)

\(q\)

Each law is reduced by \(J\) to the case where a path is \(\mathrm {refl}\), that is, to the diagonal. At level \(0\) the laws hold outright; at higher levels they hold up to a path one level up (RT19).

7. Read as relations: equality is the idempotent unit. Forgetting which path, \(E(a,b)\) says there is one. Then

\begin{equation} E\circ E=E,\qquad E\circ R=R=R\circ E : \tag{850}\end{equation}
\(E\) is idempotent under composition (reflexive and transitive at once) and is its unit; the idempotence is the diagonal again, \(p\wedge p=p\). Composition of relations, transitivity and associativity then follow as in RT10g.

8. The chain of this route.

\begin{equation} \begin {aligned} \Delta \ (\mathrm {refl}) &\to J\ (\text {total space }A;\ \text {or contraction by }\wedge )\\ &\to \text {leastness}\\ &\to p\cdot q\ (\text {transitivity})\\ &\to \text {units, inverse, associativity}\\ &\to E\circ E=E . \end {aligned} \tag{851}\end{equation}

PIC

Figure 1: Check of RT10h in Cubical Agda, using only Agda’s built-in cubical primitives (the interval, its meet and reversal, and transp) with the option –safe, which rejects every postulate. The file is accepted. Path induction \(J\) is not assumed: it is defined as transport along the contraction \(j\mapsto (p\,j,\ \lambda i.\,p(i\wedge j))\) of the based path space, and from it are obtained leastness of equality, composition of paths (transitivity), both unit laws, the inverse law, associativity, compatibility with functions, and function extensionality as the term \(\lambda i\,x.\,h\,x\,i\).

PIC

PIC

what Cubical Agda trusts. Its type checker, the built-in interval with \(\wedge \), \(\vee \), reversal and the laws of a De Morgan algebra (HI3), and the primitive transp. With –safe no postulate can occur, so the file uses no axiom; in particular \(J\) is a definition, and its leastness is derived rather than supplied by the kernel as in Lean.

RT11 (what remains at the bottom).

item status
terms are finite; induction on how they are built the way the root is written
"for all \(n\)" as a value in \(\mathbf 2\) the choice of world (RL2)

RT12 (the ladder).

step

obtained

from

RT0, RT1

\(\Delta \), \(\pi _i\), \(\sigma \), \(\mathrm {id}\); duality

\(a=a\), its two sides

RT2

round trips; unit, counit; triangle and dual; sums; \(1,0,\mathbf 2\)

the root for passages

RT3, RT4

\(\lambda \); \(\beta \) and dual \(\eta \); \(\alpha \), \(\xi \), congruence, \(=\)

the open place

RT5

composition, unit and associativity laws; Yoneda

\(\beta \), \(\eta \)

RT6, RT7

elements as readings; kinds

Yoneda

RT8

\(\neg \neg =\mathrm {id}\); \(\ell \neq r\)

exchange on \(\mathbf 2\); confluence

RT9, RT10

parts, \(\leq \), meet; join as dual

RT5, \(\Delta \dashv \times \), \(\neg \)

RT10a–f

relations; composition, unit, associativity, transitivity again

\(\Delta \); \(\exists \dashv \) weakening

RT13–RT15

\(Y\); halting; \(S\), \(K\)

\(\varepsilon \Delta \); with \(\neg \); \(\Delta \) and \(\pi _1\) placed

RT16–RT19

categories; type theory; toposes; \(\infty \)-groupoids, \(\infty \)-categories

RT2–RT5; Yoneda; \(\mathrm {Id}=\Sigma _\Delta 1\)

RT20–RT22

\((\infty ,1)\)-toposes model HoTT; sizes; HITs

RT18 one level up

From here: RL2 (\(\Omega =\mathbf 2\)), then \(\mathbb N\to \mathbb Z\to \mathbb D\to \mathbb R\), opens and finite covers, the calculus, and the Schrödinger equation.

RT13 (fixed points: the diagonal read at itself). Put \(Y=\lambda f.\,(\lambda x.\,f(x\,x))(\lambda x.\,f(x\,x))\). Then \(Y\,f\overset {\beta }{=}f\bigl ((\lambda x.f(xx))(\lambda x.f(xx))\bigr )\), which \(f(Y\,f)\) also reaches, so

\begin{equation} Y\,f=f\,(Y\,f). \tag{852}\end{equation}
The piece \(x\,x\) is evaluation after the diagonal, \(\varepsilon \circ \Delta \). In arrows: if \(e:A\to (A\to B)\) reaches every reading, put \(g=f\circ \varepsilon \circ (e\times \mathrm {id})\circ \Delta =e(a_0)\); then \(e(a_0)(a_0)\) is a fixed point of \(f\) (Lawvere).

RT14 (the diagonal with \(\neg \): what is not decided). \(\neg \) has no fixed point (\(\ell \neq r\), RT8), so by RT13 no \(e:A\to (A\to \mathbf 2)\) reaches every cut. Halting: with \(\Omega =(\lambda x.xx)(\lambda x.xx)\) (no result), suppose \(H\,M=\ell \) exactly when \(M\) has a result, and \(r\) otherwise. For \(N=Y(\lambda n.\,H\,n\,\Omega \,\mathrm {id})\) we get \(N=H\,N\,\Omega \,\mathrm {id}\): if \(H\,N=\ell \) then \(N=\Omega \) has no result; if \(H\,N=r\) then \(N=\mathrm {id}\) has one. So no term decides "has a result".

instance \(A\) not existing
Cantor a kind onto \(A\to (A\to \mathbf 2)\) (TS4)
Russell sets \(\{x\mid x\notin x\}\) as an element (TS3)
halting terms a term deciding "has a result"
Gödel, Löb sentences provability deciding truth at its own level (LR)

RT15 (\(S\) and \(K\) are the diagonal and the projection, placed).

combinator

what it is

term

\(K\)

the first projection, placed: \(\mathrm {curry}\,\pi _1\) (counit of \(\Delta \dashv \times \), RT2)

\(\lambda xy.\,x=\ell \)

\(S\)

read \(x\) at \(z\) and \(y\) at \(z\), then evaluate; \(z\) copied by \(\Delta \); placed twice (RT3)

\(\lambda xyz.\,x\,z\,(y\,z)\)

So \(K\) discards and \(S\) copies: the structural maps of RT0 under the open-place round trip. \(S\,K\,K\,a=K\,a\,(K\,a)=a\), so \(SKK=\mathrm {id}\). Conversely every term is \(S\), \(K\) and reading: remove a place by \([x]x=SKK\), \([x]M=K\,M\) (\(x\) not in \(M\)), \([x](M\,N)=S([x]M)([x]N)\); then \(([x]M)\,a=M[a/x]\) by \(\beta \), by induction on \(M\). Placing is copying and discarding.

RT16 (categories). Kinds and arrows with \(\mathrm {id}\), composition, unit laws and associativity (RT5) form a category.

notion in the chain
functor; natural transformation passage respecting \(\mathrm {id}\), \(\circ \); the \(\Phi \) of Yoneda (RT5)
adjunction; opposite category round trip (RT2); reversing arrows (RT1)
limit; colimit right; left adjoint of \(\Delta :C\to C^J\) (\(J\) two points: \(\times \), \(\sqcup \))
Yoneda embedding \(c\mapsto \mathrm {Hom}(-,c)\), full and faithful (RT5)

RT17 (type theory is the same, written in judgements).

type theory category
\(\Gamma \vdash a:A\); substitution arrow \(\Gamma \to A\); composition
weakening, contraction, exchange \(\pi \) (\(K\)), \(\Delta \) (\(S\)), \(\sigma \)
\(\times \), \(+\), \(\to \) \(\Delta \dashv \times \), \(\sqcup \dashv \Delta \), \(-\times B\dashv B\to -\)
\(\Sigma \), \(\Pi \) \(\Sigma _f\dashv f^*\dashv \Pi _f\) (RT10b on both sides)
\(\mathrm {Id}_A\); \(\mathrm {refl}\); \(J\) \(\Sigma _\Delta 1\), the diagonal pushed forward; unit at \(\mathrm {id}\); the triangle
introduction / elimination; \(\beta \) / \(\eta \) there / back; triangle / dual
\(\Gamma \vdash a:A\); substitution arrow \(\Gamma \to A\); composition (RT17a)
weakening, contraction, exchange \(\pi \) (\(K\)), \(\Delta \) (\(S\)), \(\sigma \): one rule along three maps (RT17a)

RT17a (judgements, substitution, and the three structural rules are one rule). Contexts and judgements. A context \(\Gamma =x_1{:}A_1,\dots ,x_n{:}A_n\) is the product \(A_1\times \dots \times A_n\) (RT2), and the empty context is \(1\). A judgement \(\Gamma \vdash a:A\) is an arrow \(a:\Gamma \to A\) (RT5). The variable rule \(\Gamma \vdash x_i:A_i\) is the projection \(\pi _i\); with one variable it is \(\mathrm {id}\), the root.

Substitution is composition. Given \(\Delta \vdash b_i:A_i\) for each \(i\), the round trip \(\Delta \dashv \times \) gives one arrow \(\langle b_1,\dots ,b_n\rangle :\Delta \to \Gamma \), and

\begin{equation} a[b_1/x_1,\dots ,b_n/x_n]=a\circ \langle b_1,\dots ,b_n\rangle . \tag{853}\end{equation}
The cut rule is the case \(n=1\). The substitution lemma, \(a[b/x][c/y]=a[b[c/y]/x]\), is associativity; substituting each variable for itself, \(a\circ \langle \pi _1,\dots ,\pi _n\rangle =a\), is the dual triangle with the unit law (RT2, RT5).

One rule. For any arrow of contexts \(\rho :\Delta \to \Gamma \),

\begin{equation} \Gamma \vdash a:A\quad \Longrightarrow \quad \Delta \vdash a\circ \rho :A\qquad \text {(reading along }\rho \text {)}. \tag{854}\end{equation}
The structural rules are this rule along the three structural maps of the root:

rule from \(\to \) to \(\rho \) placed (RT15)
weakening \(\Gamma \vdash a\)  \(\Rightarrow \)  \(\Gamma ,y{:}B\vdash a\) \(\pi :\Gamma \times B\to \Gamma \) (counit of \(\Delta \dashv \times \)) \(K\)
contraction \(\Gamma ,x{:}A,x'{:}A\vdash a\)  \(\Rightarrow \)  \(\Gamma ,x{:}A\vdash a[x/x']\) \(\mathrm {id}\times \Delta \) (unit of \(\Delta \dashv \times \)) \(S\)
exchange \(\Gamma ,x{:}A,y{:}B\vdash a\)  \(\Rightarrow \)  \(\Gamma ,y{:}B,x{:}A\vdash a\) \(\mathrm {id}\times \sigma \) (the swap) —

They are the sides, the diagonal and the exchange of \(a=a\) (RT0, RT1), acting on contexts.

They generate every renaming. A renaming sends each variable of \(\Gamma \) to some variable of \(\Delta \), equivalently an arrow \(\Delta \to \Gamma \) built from projections. Every such arrow is a composite of the three: discard (\(\pi \)) each variable of \(\Delta \) that is not used, copy (\(\Delta \)) each one used \(k>1\) times \(k-1\) times, then put the list in order by adjacent exchanges (\(\sigma \)). (Checked for all \(158\) renamings with at most three variables and four places.)

Coherence. Two composites of structural maps that send the variables to the same places are equal: both are arrows into a product, and an arrow into a product is fixed by its components (dual triangle of RT2). Hence the familiar relations hold without being laid down:

\begin{equation} \pi _i\circ \Delta =\mathrm {id},\qquad \sigma \circ \Delta =\Delta ,\qquad \sigma \circ \sigma =\mathrm {id},\qquad (\mathrm {id}\times \sigma )(\sigma \times \mathrm {id})(\mathrm {id}\times \sigma )=(\sigma \times \mathrm {id})(\mathrm {id}\times \sigma )(\sigma \times \mathrm {id}). \tag{855}\end{equation}

Without them. Leaving a structural map out of the available \(\rho \) gives the other logics of branch Q, with \(\otimes \) in place of \(\times \):

structural maps available logic
\(\pi \), \(\Delta \), \(\sigma \) intuitionistic (this chain)
\(\Delta \), \(\sigma \) relevant
\(\pi \), \(\sigma \) affine
\(\sigma \) linear
none ordered (Lambek)

RT18 (toposes). A topos has the round trips of RT2–RT3 and an \(\Omega \) with parts of \(A\) \(=\) arrows \(A\to \Omega \). For kinds, \(\Omega =\mathbf 2\) (RT9). Every category \(C\) gives one: in presheaves Yoneda forces \(G^F(c)=\mathrm {Nat}(y(c)\times F,G)\) and \(\Omega (c)=\mathrm {Sub}(y(c))\), the sieves (GS2a). Sheaf toposes are the parts fixed by a local operator (LT4).

RT19 (paths: the identity type iterated). \(\mathrm {Id}_A(a,b)\) is a kind, with its own \(\mathrm {Id}\), and so on. By \(J\) the laws of path composition hold up to a path one level up, so each kind is an \(\infty \)-groupoid; the triangle at each level is witnessed at the next. Level \(-1\): propositions (\(\Omega \)); \(0\): sets; \(1\): groupoids; \(\infty \): no bound. Rows with faces (OS14) with contractible inner fillings are \(\infty \)-categories (Segal); paths \(=\) isomorphisms is completeness (Rezk) \(=\) univalence (HC); \((\infty ,n)\) by enrichment (EN1), \((\infty ,\infty )\) as \(\nu \) (LF8).

RT20 (the \((\infty ,1)\)-topos theorem as a corollary). Each step is RT18 one level up.

step statement from
1 an \((\infty ,1)\)-topos is the part of presheaves of \(\infty \)-groupoids on a small \(C\) fixed by a RT18, RT19, LT4
local operator that keeps finite limits
2 presheaves have a universe, its value forced by Yoneda: \(U(c)=\) families over \(y(c)\), GS2a one level up
as \(\Omega (c)=\) parts of \(y(c)\); one universe per level \(U_k\) of names OS5
3 it is univalent: a family given on a part, with an equivalence to the restriction HI7, HI8
of a family, extends to the whole (\(\mathrm {Glue}\)); this is contractible filling for \((T,e)\) HC
4 the local operator keeps it: sheaves are closed under \(\Sigma \), \(\Pi \), \(\mathrm {Id}\), and the families LT4
with sheaf fibres form a universe that is itself a sheaf, since "is a sheaf" is a
proposition stable under reading along arrows

Corollary. Every \((\infty ,1)\)-topos has univalent universes closed under \(\Sigma \), \(\Pi \), \(\mathrm {Id}\), one per level: it is a model of homotopy type theory. This is the content of Shulman’s theorem. What is not written here is its bookkeeping: presenting the steps by a model category, and making substitution strict. In the chain substitution is composition (RT5), strict from the start, and a compatible family is fixed by its value at \(\mathrm {id}\) (Yoneda), which is why strictification succeeds.

RT21 (sizes and higher inductive types: the ladder again).

item

place in the chain

one universe per level \(U_k\)

the levels of names (OS5); each is the rung “inaccessible” of RH4

higher inductive types

\(\mu \Phi \) with paths (HI1, LF5); constructed in cube presheaves (HI9)

universes closed under them in every model

a further closure condition; open

As with \(L\) and the ladder of RH4, the universes are built from below, level by level, and each further closure is one more rung. None of them changes what the chain derives; each asks for more room.

RT22 (one picture).

the diagonal as

gives

in

dual or partner

\(\Delta \dashv \times \)

pairs, meet, \(\Sigma \)

RT2, RT10, RT17

\(\sqcup \dashv \Delta \): sums, join

\(\varepsilon \circ \Delta \)

fixed points \(Y\)

RT13

with \(\neg \): undecidability (RT14)

\(\Delta \) and \(\pi _1\), placed

\(S\) and \(K\), hence all terms

RT15

—

\(\mathrm {Id}_A=\Sigma _\Delta 1\)

equality, paths, \(\infty \)-groupoids

RT17, RT19

—

\(\Delta :C\to C^J\)

limits

RT16

colimits

parts read into \(\Omega \); families read into \(U\)

topos; \((\infty ,1)\)-topos

RT18, RT20

—

PIC

Figure 2: Check of the path part of the chain in Cubical Agda (Agda 2.8.0.2, agda/cubical at commit c37782bb), under –safe: no postulates. Function extensionality is the term \(\lambda i\,x.\,p\,x\,i\) (HI4); univalence is built from \(\mathrm {Glue}\), and transport along the path obtained from negation on \(\mathbf 2\) computes, \(\mathrm {true}\mapsto \mathrm {false}\), by refl (HI7, HI8); propositional extensionality follows from univalence (V4a); the winding number of \(\mathrm {loop}\cdot \mathrm {loop}\) computes to \(2\) and that of the inverse loop to \(-1\), by refl, and \(\Omega S^1\simeq \mathbb Z\) is the library’s encode–decode theorem (HI10).

Listing 1: RootChainCubical.agda, checked in Fig. 2 (line breaks and comments shortened for print).
{-# OPTIONS --cubical --guardedness --safe #-}
module RootChainCubical where

open import Cubical.Foundations.Prelude
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.Univalence
open import Cubical.Foundations.Equiv
open import Cubical.Data.Bool
open import Cubical.Data.Int
open import Cubical.HITs.S1

-- HI3: a path is a map out of the interval I.
myRefl : {A : Type} (a : A) (*$\to$*) a (*$\equiv$*) a
myRefl a = (*$\lambda$*) i (*$\to$*) a

mySym : {A : Type} {a b : A} (*$\to$*) a (*$\equiv$*) b (*$\to$*) b (*$\equiv$*) a
mySym p = (*$\lambda$*) i (*$\to$*) p (~ i)

-- HI4: function extensionality is one term.
myFunExt : {A B : Type} {f g : A (*$\to$*) B}
         (*$\to$*) ((x : A) (*$\to$*) f x (*$\equiv$*) g x) (*$\to$*) f (*$\equiv$*) g
myFunExt p = (*$\lambda$*) i x (*$\to$*) p x i

-- HI7, HI8: ua is built by Glue; transport along it computes.
notIso' : Iso Bool Bool
notIso' = iso not not ((*$\lambda$*) { false (*$\to$*) refl ; true (*$\to$*) refl })
                      ((*$\lambda$*) { false (*$\to$*) refl ; true (*$\to$*) refl })

notPath : Bool (*$\equiv$*) Bool
notPath = ua (isoToEquiv notIso')

transport-true : transport notPath true (*$\equiv$*) false
transport-true = refl

transport-false : transport notPath false (*$\equiv$*) true
transport-false = refl

uaComputes : {A B : Type} (e : A (*$\simeq$*) B) (x : A)
           (*$\to$*) transport (ua e) x (*$\equiv$*) equivFun e x
uaComputes = ua(*$\beta$*)

-- V4a: propositional extensionality from univalence.
myPropExt : {A B : Type} (*$\to$*) isProp A (*$\to$*) isProp B
          (*$\to$*) (A (*$\to$*) B) (*$\to$*) (B (*$\to$*) A) (*$\to$*) A (*$\equiv$*) B
myPropExt pA pB f g =
  isoToPath (iso f g ((*$\lambda$*) b (*$\to$*) pB (f (g b)) b) ((*$\lambda$*) a (*$\to$*) pA (g (f a)) a))

-- HI10: the loops of the circle are the integers.
two-loops : winding (loop (*$\cdot$*) loop) (*$\equiv$*) pos 2
two-loops = refl

back-loop : winding (sym loop) (*$\equiv$*) negsuc 0
back-loop = refl

five-loops : winding (intLoop (pos 5)) (*$\equiv$*) pos 5
five-loops = refl

loopsOfCircle : (*$\Omega$*)S(*$^{1}$*) (*$\equiv$*) (*$\mathbb{Z}$*)
loopsOfCircle = (*$\Omega$*)S(*$^{1}$*)(*$\equiv$*)(*$\mathbb{Z}$*)

V4 (what Lean trusts).

trusted

content

kernel

checks every proof term; the elaborator and tactics are not trusted, their output is re-checked

type theory

universes, \(\Pi \)-types, inductive types

definitional equality

\(\beta \), \(\eta \) for functions and pairs, unfolding of definitions, reduction of recursors, proof irrelevance

decide

evaluated by the kernel; native_decide was not used

axioms

none: the report was printed for \(34\) results, each “does not depend on any axioms”; no propext, Quot.sound, Classical.choice or sorry

below the kernel

the compiled kernel, the operating system, the hardware

PIC
Figure 3: Kernel check of RT0–RT17a in Lean 4 (v4.36.0-rc2; the file imports nothing). All theorems are accepted, and the axiom report for the \(34\) listed results reads "does not depend on any axioms" in every case: no propext, Quot.sound, Classical.choice or sorry. Function and propositional extensionality are proved inside the file, from kinds that carry their own sameness (RT7). The untyped parts (the term \(Y\), halting, confluence) are represented by their typed counterparts (Lawvere’s fixed point theorem, Cantor’s theorem); the untyped statements themselves were checked by direct computation.

PIC

PIC

PIC

PIC

PIC

PIC

PIC

V4a (extensionality: an axiom in Lean, a theorem in the chain). Lean’s own equality is the inductive type Eq: two terms are equal when they compute to the same. From its core rules alone neither function nor propositional extensionality follows, and Lean supplies them by the axioms Quot.sound and propext. The chain reads sameness as agreement under every reading (RT4, RT7). The file does the same: a kind carries its own sameness (Kind), arrows are the same when they agree at every element, and propositions are the same when each gives the other. With this sameness both extensionality principles are theorems (funext_in_kinds, propext_in_kinds), and no result of the file uses any axiom.

Remark 41.1 (Extensionality in Lean and in Cubical Agda). What was done in Lean. Lean’s own equality Eq identifies terms that compute to the same; function and propositional extensionality are not consequences of its rules and are supplied by the axioms Quot.sound and propext. The file does not use them. Following RT7, each kind carries its own sameness (Kind), an arrow respects it (Arrow.resp), and two arrows are the same when they agree at every element. With this reading both extensionality principles are theorems (funext_in_kinds, propext_in_kinds), and the four statements that had used = between functions or propositions were restated pointwise or with \(\leftrightarrow \). The whole file then depends on no axiom.

The cost of this route. Sameness has to be carried by hand: every kind comes with a relation and its three laws, every arrow with a proof that it respects them, and every construction must be checked to preserve them. For the results of this file the cost is small; for a large development it grows with every new construction.

What Cubical Agda does differently. In Cubical Agda the identity type is not an inductive family but the type of paths, maps out of a formal interval \(\mathbb I\) with end points \(0\), \(1\), meet, join and reversal: the interval of HI3, which is the lattice of OS9 without the law \(p\wedge \neg p=\bot \). Consequently:

statement in Cubical Agda
function extensionality a term: from \(p:\forall x.\,f\,x=g\,x\), the path \(\lambda i.\,\lambda x.\,p\,x\,i\) (HI4)
univalence a theorem: \(\mathrm {ua}\) is built by \(\mathrm {Glue}\) and transport along it computes (HI7, HI8)
propositional extensionality a consequence of univalence for propositions
higher inductive types primitive, with computing eliminators (HI9)
quotients a higher inductive type, with no axiom

So extensionality holds at the level of the language: no sameness needs to be carried by hand, and every term still computes to a value, since no axiom blocks reduction.

Why the file was not moved. The chain’s notion of sameness, agreement under every reading, is the one both systems end up with: Lean by the explicit kinds of RT7, Cubical Agda by paths. Since the Lean check already runs with no axiom, moving it would change the system that reads the chain, not what is checked. Cubical Agda would be the natural choice for extending the check to the parts that are about paths themselves: univalence, higher inductive types and \(\pi _1(S^1)=\mathbb Z\) (HI5–HI10), which in Lean would have to be modelled by hand.

Verification: what is checked, and what is trusted

(four readings of the same chain). The chain was checked in four independent ways. None of them stands outside the chain; each rests on rules of its own, listed in V3–V5.

check what it establishes range
hand derivation (RT0–RT22) each step from earlier ones all cases
Lean 4 kernel (Fig. 942) the typed statements, as proofs all cases, \(45\) theorems
Cubical Agda (Fig. 1) RT10h: path induction derived; composition, all cases, –safe
units, inverse, associativity
Python normaliser the untyped statements, by computation the instances listed in V2

(why there is no check from outside). To check a checker is to read it from one more place. That place has rules of its own, so the check is one level up and not outside (RT14, LR): a system does not settle its own consistency at its own level. What the three checks give is therefore not a verdict from outside but two things: the trusted part is made small and listed (V4, V5), and readings from different places agree.

Each check ends in the same act. The Lean kernel decides whether two terms are definitionally equal; the scripts compare two normal forms with ==; the hand derivation ends each step in an equation. The last step of every check is to compare two things for sameness, which is \(a=a\). The root is not among the things checked. It is what checking already uses, and that is why the chain lays down nothing else.

The checker checked: a regress that does not end outside

V7 (what each layer rests on).

layer rests on
the file of Fig. 942 the rules of Lean’s kernel (no axioms are used)
Lean’s kernel that the program implementing those rules is written correctly
that program the compiler, the operating system, the hardware
the last act of all of them to compare two terms for sameness

The last line is the root. The kernel’s central operation is a test of definitional equality; the Python scripts compare normal forms with ==; the hand derivation ends each step in an equation. A checker does not check \(a=a\). It uses it.

V7a (what the kernel does with our definitions). Most results of the file are closed by rfl. The kernel then unfolds the names we gave (diag, swap, place, read, \(S\), \(K\), …), computes both sides by \(\beta \), \(\eta \) and the reduction of recursors, and checks that the results are the same term. A proof by decide is computed to true and compared with true; a proof given as a term is type-checked by comparing its computed type with the stated one. In every case the single judgement of the kernel is definitional equality. Unfolding a name is the reading of RT0: a name stands for what is already there, and unfolded it is that thing. So the kernel does not trust our definitions; it unfolds them and compares, which is \(a=a\) carried out by a machine.

41.1 The kernel is the diagonal

V11 (the one judgement). The kernel has two judgements, \(t:A\) and \(s\equiv t\). The first is reduced to the second: \(t:A\) holds when the type computed for \(t\) is \(\equiv A\). So there is one judgement, definitional equality.

V12 (definitional equality is the diagonal pulled back). Let \(\mathrm {nf}\) send a term to its result: its normal form, with every proof of a proposition sent to that proposition (proof irrelevance, level \(-1\) of RT19). Then

\begin{equation} s\equiv t\iff \mathrm {nf}(s)=\mathrm {nf}(t),\qquad \text {that is}\qquad {\equiv }\;=\;(\mathrm {nf}\times \mathrm {nf})^*\Delta =\ker (\mathrm {nf}), \tag{856}\end{equation}
the diagonal of RT0 read along \(\mathrm {nf}\times \mathrm {nf}\), exactly as the graph of RT10a is the diagonal read along \(f\times \mathrm {id}\). Its properties are those of the diagonal:

property of \(\equiv \) reason from
reflexive \(\Delta \,a=\langle a,a\rangle \) lies on the diagonal: rfl RT0
symmetric \(\sigma \) fixes the diagonal RT1
transitive composition of the diagonal with itself RT10d
\(\mathrm {nf}\circ \mathrm {nf}=\mathrm {nf}\) a result has no step left RT8
\(\mathrm {nf}\) on results is \(\mathrm {id}\) the triangle of the retraction RT2

V13 (neither larger nor smaller: the same). Write \(=_{\mathrm {ch}}\) for sameness in the chain (RT4) and \(\equiv \) for the kernel’s.

direction statement reason
not larger \(s\equiv t\Rightarrow s=_{\mathrm {ch}}t\) each step of \(\mathrm {nf}\) is a triangle (RT3), an equation of the chain
not smaller \(s=_{\mathrm {ch}}t\Rightarrow s\equiv t\) equal terms have a common result (confluence, RT8)

for terms that have results. Hence

\begin{equation} {\equiv }\;=\;{=_{\mathrm {ch}}}: \tag{857}\end{equation}
the kernel adds no identification of its own and misses none. Its equality and the chain’s equality are the two sides of one equation. The checker is exactly as large as what it checks.

V14 (the root, accepted). Checking the root itself is the first line of the table: \((a,a)=\Delta a\), sent by \(\mathrm {nf}\times \mathrm {nf}\) to \(\langle \mathrm {nf}\,a,\mathrm {nf}\,a\rangle \), which lies on the diagonal. The kernel accepts \(a=a\) by rfl, without any rule beyond the diagonal it is made of. So the regress of V9 ends here: the chain starts from \(a=a\), the checker is the diagonal pulled back, and the act by which it accepts the chain is \(a=a\) once more.

V15 (scope). This describes the fragment used in the file. Lean’s actual algorithm decides \(\equiv \) lazily, without computing full normal forms, and in the presence of proof irrelevance with certain eliminations the decided relation can fail to be transitive in rare constructions; none of these occurs in the file, where every check terminates and agrees with the comparison of results.

It follows that Lean 4, and any other type checker, rests on \(a=a\): whatever its rules, its one judgement is a comparison of two sides for sameness, so it presupposes the root rather than establishing it.

41.2 Every checker is the diagonal, pulled back

V16 (one judgement, two forms). Every checker accepts a step by one comparison, in one of two forms.

form

accepts when

as a relation

comparison

produced and required expression have the same canonical form

\(\ker (c)=(c\times c)^*\Delta _T\)

refutation

the assumptions with the negated goal are derived to \(\bot \)

\((\Gamma \wedge \neg \varphi ,\ \bot )\in \Delta _\Omega \)

Here \(c:T\to T\) sends an expression to a canonical form, with \(c\circ c=c\). The first form is the diagonal of expressions, the second the diagonal of truth values. In both the relation is reflexive (\(\Delta \)), symmetric (\(\sigma \)) and transitive (the diagonal composed with itself, RT10d). An implementation need not compute \(c\) in full; it may compare lazily, as long as it decides the same relation.

V17 (the systems).

system

logic

what is identified before comparing

form

trusted

Metamath [1401]

none built in; given by the axioms of a database

nothing: \(c=\mathrm {id}\) on strings

comparison

one rule, substitution, with distinct-variable provisos

HOL Light [1400]

classical higher-order; equality the only primitive

renaming of bound variables

comparison

10 rules, 3 axioms; theorems an abstract type

Isabelle/Pure [1719]

higher-order framework with \(\bigwedge \), \(\Longrightarrow \), \(\equiv \)

renaming of bound variables (implicit in the representation); \(\alpha \beta \eta \) in unification

comparison

theorems an abstract type

Rocq [1720]

dependent types (CIC)

\(\alpha \), \(\beta \), \(\delta \), \(\iota \), \(\zeta \), \(\eta \)

comparison

kernel

Agda [1721]

dependent types

computation, with \(\eta \) for functions and for records

comparison

type checker

Idris 2 [1723]

quantitative type theory, multiplicities \(0,1,\omega \)

evaluation to head normal form; types compared by unification on values

comparison

type checker

Lean 4 [1724]

dependent types

unfolding, computation, \(\eta \) for functions and structures, one-element types, proofs of the same proposition, literals; decided lazily

comparison

kernel

Cubical Agda [1722]

cubical type theory

as Agda, with the laws of the interval (a De Morgan algebra) and of \(\mathrm {transp}\), \(\mathrm {hcomp}\), \(\mathrm {Glue}\)

comparison

type checker

Mizar [1417]

classical first-order, Tarski–Grothendieck sets

normal form, equivalence classes

refutation

checker

F\(^\star \) with Z3 [1418]

dependent and refinement types; obligations in classical first-order logic

the solver’s search

refutation

type checker and solver

V18 (the comparison checkers, rule by rule). Metamath. \(c=\mathrm {id}\): a step is accepted when, after substituting expressions for variables, the string obtained is the string required. The judgement is the diagonal itself.

HOL Light. A theorem can be made only by ten rules:

rule

statement

in the chain

REFL

\(\vdash t=t\)

the root (RT0)

TRANS

\(s=t,\ t=u\ \vdash \ s=u\)

composition (RT5)

MK_COMB

\(f=g,\ x=y\ \vdash \ f\,x=g\,y\)

reading respects \(=\) (RT4)

ABS

\(s=t\ \vdash \ \lambda x.s=\lambda x.t\)

placing respects \(=\) (RT4)

BETA

\((\lambda x.\,t)\,x=t\)

the triangle (RT3)

ASSUME

\(p\vdash p\)

\(\mathrm {id}\)

EQ_MP

\(p=q,\ p\ \vdash \ q\)

what is read of \(p\) is read of \(q\) (RT4)

DEDUCT_ANTISYM

\(p\vdash q\) and \(q\vdash p\) give \(p=q\)

antisymmetry (RT9)

INST, INST_TYPE

substitution of terms, of types

composition (RT17a)

Its three axioms are \(\eta \) (the dual triangle, RT3), choice (from which its classical logic follows; AC3, AC5) and infinity (IN1): theorems of the chain.

Isabelle/Pure. Equality \(\equiv \) is axiomatized by \(\beta \), reflexivity, substitution, extensionality, and “each implies the other gives \(\equiv \)”: RT3, RT0, RT4, RT7, RT9.

Rocq, Agda, Idris, Lean. The relation decided is \(\ker (c)\) for \(c\) the computation of results (V12). Each step is a triangle or the unfolding of a name; Agda’s rule for records, that every \(x\) is the record of its projections, is the dual triangle of RT2.

Cubical Agda. A path is a function out of the interval, so function extensionality is the term \(\lambda i.\,\lambda x.\,p\,x\,i\); \(\mathrm {ua}\) is defined from \(\mathrm {Glue}\) and transport along it computes; higher inductive types such as \(S^1\) have computing eliminators. These are HI3–HI10.

V19 (the refutation checkers, stage by stage). Accepting \(\varphi \) because \(\neg \varphi \) is refuted uses

\begin{equation} \begin {aligned} \Gamma \wedge \neg \varphi =\bot &\iff \Gamma \leq \neg \neg \varphi && (\text {RT10b}),\\ \neg \neg \varphi &= \varphi && (\text {RT8}), \end {aligned} \tag{858}\end{equation}
so refutation is comparison in the world with \(\Omega =\mathbf 2\) (RL2), not a third kind of check.

stage

what is done

in the chain

negate the goal

form \(\Gamma \wedge \neg \varphi \)

RT10, RT8

normal form (Mizar pre-checker)

new constants for existentials; disjunctive normal form; each clause to be refuted

a witness is a function (AC1); distributivity (RT10)

equivalence classes (Mizar equalizer; Z3 equality)

terms sorted into classes from equalities, registered identities, numeric evaluation

the least congruence, \(\mu \Phi \) (LF1); classes are \(\ker (q)\)

instantiation (Mizar unifier; Z3 patterns)

substitutions for quantified variables that produce a clash

reading at a term, \(\beta \) (RT3); \(\theta \,s=\theta \,t\) is an equalizer

case split (Z3)

the two values of a literal

\(1\sqcup 1\) (RT2)

conflict

something both asserted and denied

\(\ell \neq r\) (RT8)

accept

\(\bot \) has been derived; in F\(^\star \), Z3 answers unsat to \(\neg \mathrm {VC}\)

\((\Gamma \wedge \neg \varphi ,\bot )\in \Delta _\Omega \)

Neither procedure is complete: Mizar’s unifier may give up and Z3 may answer unknown. F\(^\star \) obtains \(\mathrm {VC}\) from a program by a predicate transformer (a monad, KE1); Z3 returns no proof certificate by default, only the facts used, kept as hints, so the solver is part of what is trusted.

V20 (what the underlying theories rest on).

item

rests on

in the chain

soundness of a calculus

induction on derivations

LF1

completeness of first-order logic

a metatheory with enough points (weak König’s lemma; the prime ideal theorem)

not used by any checker; points not asserted (DU4)

Tarski–Grothendieck set theory [1725]

a metatheory; ZF with “every set lies in a universe”, which gives infinity, power sets, choice and inaccessibles

universes are the levels \(U_k\) (OS5); first rung of RH4; own consistency not provable (LR)

first-order logic, many sorts

a metatheory

kinds (RT7); \(\exists \dashv \pi ^*\dashv \forall \) (RT10b); \(=\) is \(\Delta \)

equality with uninterpreted functions

a metatheory

trees (LF5) modulo the least congruence

arithmetic

a metatheory

\(\mathbb N\) (LF3), reals (LD6)

arrays

a metatheory

read after write is a triangle (RT2); another index is a case split with \(\ell \neq r\)

dependent and refinement types

the rules of the type theory

\(\Sigma \), \(\Pi \) (RT17); \(\{x:A\mid P\,x\}=A_p\) (RT9)

quantities \(0,1,\omega \) (Idris 2)

the rules of the type theory

which structural maps may be used (RT17a)

A checker needs soundness only: what it accepts is a derivation, and what is derived holds. Each theory is stated in a metatheory, which is stated in another (V9); read for its content, each is a piece of the chain.

V21 (all of them).

\begin{equation} \begin {aligned} \mathrm {id}\ (\text {Metamath}) &\subseteq \alpha \ (\text {HOL Light, Isabelle})\\ &\subseteq \beta \eta ,\dots \ (\text {Rocq, Agda, Idris, Lean})\\ &\subseteq \text {interval}\ (\text {Cubical});\\[2pt] \text {Mizar, F}^\star :\ &\ \Delta _\Omega . \end {aligned} \tag{859}\end{equation}
The more is identified before comparing, the shorter the proofs and the larger the part that must be implemented correctly: identity of strings, computation, a decision procedure. On the fragment each checks, its judgement is neither larger nor smaller than sameness in the chain (V13): every step of its computation is an equation of the chain, and what is the same reaches a common form, or what is refutable reaches \(\bot \). So every proof checker, type checker and refutation checker is the diagonal of RT0, of expressions or of truth values, read through more or less computation [1718]. Each rests on \(a=a\); none establishes it.

Lean and Cubical Agda were chosen here because neither builds classical logic, choice or extensionality into its rules, so a check with no axioms is possible in both; in HOL Light, Isabelle/HOL or Mizar, excluded middle, choice and extensionality are part of the system, and the results of the chain would hold there only on top of them.

V8 (the compiler compiles itself: a fixed point). Lean 4 is written mostly in Lean, and is compiled by an earlier Lean: a precompiled stage produces the next compiler, which produces the next. A compiler that reads its own source and yields itself is the shape of RT13:

in the chain

for a compiler

\(x\,x\): a term read at itself, \(\varepsilon \circ \Delta \)

the compiler given its own source

\(Y\,f=f\,(Y\,f)\): a fixed point

compiler \(C\) compiling the source of \(C\) yields \(C\)

RT14: the diagonal with \(\neg \) is not decided at its own level

a compiler cannot establish its own honesty

This is not only a formal point. Thompson showed that a compiler can carry a hidden behaviour that is absent from every source file and is copied again each time the compiler compiles itself [1396]. Reading the source, from inside that compiler, does not find it.

V9 (reading from another place, and why that is still not outside). The practical answer is to read the same thing from other places: re-check the proofs with independent implementations of the kernel written in other languages, and compare the results of different compilers. Each of these rests in turn on its own language, compiler and hardware, and checking those needs yet another place. The sequence can be continued as far as one likes,

\begin{equation} \text {check}_1,\ \text {check}_2,\ \text {check}_3,\ \dots , \tag{860}\end{equation}
and at every stage it is finite: some last checker is trusted, not checked. This is the ladder of the remark after RH5 once more. Each further check comes closer, in the sense that more independent readings agree, and none of them is the outside. The outside would be a check that needs nothing, and there is no such reading (RT14, LR).

V10 (where the regress stops). The regress does not stop at a checked foundation. It stops where every checker already stands: at the comparison of two things for sameness, which is \(a=a\). What the checks achieve is therefore not a verdict from outside but two things: the trusted part has been reduced towards the root (in Lean, to the kernel rules with no axiom at all), and readings from different places agree. The agreement itself is established by the same act, a test of sameness. So the chain lays down \(a=a\) and nothing else, and every check of the chain ends by using exactly that. V9b (the regress of proofs and of rules). To make \(C\) certain one proves it by \(A\), and to be sure again by an independent \(B\). Then \(B\) needs a proof, and so on. This is the trilemma of justification [1420]: an infinite regress, a circle, or a stop. The rules raise the same question. Carroll’s tortoise accepts \(A\) and "\(A\) implies \(B\)" but not \(B\); writing the rule of inference as one more premise only calls for a rule to apply that premise, without end [1419]. A rule is not established by premises; it is used.

The chain stops, but not at an arbitrary place. It stops at what the question "proved by what?" already uses: to accept an answer one compares what the answer gives with what was asked, and that comparison is \(a=a\). The tortoise’s regress is a regress of applications, and each application ends in finding that the result is the same as what was required. So \(a=a\) is not one more premise on the list; it is what reading the list uses. Everything else is derived from it in one direction, with no circle, and checked by computation and by a kernel with no axioms.

V9c (modus ponens, and the soundness of logic). That modus ponens is sound, or that first-order logic is, is proved in a metatheory, and the proof uses modus ponens in the metatheory; the metatheory’s own soundness is proved one level further up, again with it. Justifying the rule by the rule convinces only those who already use it [1397]. The proof-theoretic account justifies modus ponens by the meaning of \(\Rightarrow \), fixed by its introduction rule, so that eliminating undoes introducing; but the undoing is a computation that must itself be accepted.

In the chain modus ponens is not a rule laid down. Implication is the right adjoint of \(p\wedge -\) (RT10b), and \(p\wedge (p\Rightarrow q)\leq q\) is the counit of that adjunction, evaluation. On elements it is \((\lambda x.\,t)\,a=t[a/x]\), the triangle of RT2–RT3: what was placed, read, is what was placed. So the apparent circle, modus ponens justified by modus ponens, is the root used to read itself. Asking "by what is modus ponens proved?" and accepting an answer already applies a placed thing to its argument and compares the result with what was asked; that act is \(a=a\), and the regress of metatheories (LR, RT14) does not reach below it.

option form where it appears here
regress \(C\leftarrow A\leftarrow B\leftarrow B'\leftarrow \cdots \) checkers of checkers (V9), metatheories of metatheories (V9c)
circle \(C\leftarrow A\leftarrow C\) modus ponens justified by modus ponens (V9c)
stop a starting point accepted without proof axioms; in Lean, the kernel rules

The chain takes the third option, but its stop is not an axiom chosen among others. An axiom can be denied and the denial examined; \(a=a\) cannot be denied without comparing the denial with what it denies, which is \(a=a\) again. The regress and the circle are not avoided by it; they are shown to rest on it, since every step of a regress and every turn of a circle is an act of comparison.

RL2 (the world \(\Omega =\mathbf 2\)). In the world whose parts are cuts, the truth values are the elements of \(\mathbf 2\). Then

\begin{equation} p\vee \neg p=\top , \tag{861}\end{equation}
because each \(p(a)\) is \(\ell \) or \(r\) (every element of a sum has a tag), and in both cases the table gives \(\top \). For a family \(p_i\) of truth values, "all" is \(\top \) exactly when every \(p_i\) is, and "some" is its dual. For a finite family this is a finite case split. For an infinite family it is the one place where the choice of world is used: that this split is itself a truth value in \(\mathbf 2\) is what "\(\Omega =\mathbf 2\)" asserts. Everything below is in this world.

RL3 (the numbers). Kinds have names, and the names form a kind \(U\). Put \(z\) for the name of \(0\) and \(s(c)\) for the name of \(c\sqcup 1\). Let \(\mathbb N\) be the least part of \(U\) containing \(z\) and closed under \(s\): the meet of all such parts.

statement proof
induction \(\mathbb N\leq P\) for every part \(P\) containing \(z\) and closed under \(s\): \(\mathbb N\) is the meet
\(z\neq s(n)\) \(n\sqcup 1\) has a mark, \(0\) has none
\(s\) injective from \(A\sqcup 1\cong B\sqcup 1\), swap the two last marks if needed and restrict
\(m+n\), \(m\cdot n\) names of \(m\sqcup n\) and \(m\times n\)
laws of \(+,\cdot \) \(A\sqcup 0\cong A\), \(A\sqcup B\cong B\sqcup A\), \(A\times (B\sqcup C)\cong A\times B\sqcup A\times C\), …
cancellation \(m+k=n+k\Rightarrow m=n\), by induction on \(k\) from injectivity of \(s\)
order \(m\leq n\) iff \(m+k=n\) for some \(k\); total, by induction
least element every inhabited part of \(\mathbb N\) has a least element

For the last line: if \(P\) had no least element, the part \(\{n\mid \text {no }m\leq n\text { lies in }P\}\) would contain \(z\) and be closed under \(s\), hence be all of \(\mathbb N\) (using RL2 to decide membership), and \(P\) would be empty.

RL4 (integers). \(\mathbb Z\) is the pairs \((m,n)\) of numbers, read as \(m-n\), with \((m,n)\sim (m',n')\) iff \(m+n'=m'+n\). Cancellation (RL3) makes \(\sim \) transitive. With

\begin{equation} (m,n)+(m',n')=(m+m',n+n'),\quad -(m,n)=(n,m),\quad (m,n)(m',n')=(mm'+nn',\ mn'+nm'), \tag{862}\end{equation}
\(\mathbb Z\) is an ordered commutative ring; negation is the swap \(\sigma \) of the pair.

RL5 (dyadic fractions). \(\mathbb D\) is the pairs \((x,k)\), \(x\in \mathbb Z\), \(k\in \mathbb N\), read as \(x/2^k\), with \((x,k)\sim (2x,k+1)\). Bringing two fractions to a common \(k\), sums, products and order are those of \(\mathbb Z\). Then:

RL6 (real numbers). A real number is a part \(L\) of \(\mathbb D\) (its lower cut) with

condition statement
proper some dyadic is in \(L\) and some is not
down-closed \(a<b\in L\) gives \(a\in L\)
open above \(L\) has no greatest element

Its upper part \(U\) is the complement of \(L\) without its least element, if any. Then: \(L\) and \(U\) are inhabited, disjoint, and for \(a<b\) either \(a\in L\) or \(b\in U\) (by RL2). A dyadic \(d\) is the real \(\{a\mid a<d\}\). Order and arithmetic:

operation lower cut
\(x\leq y\) \(L_x\subseteq L_y\)
\(x+y\) \(\{a+b\mid a\in L_x,\ b\in L_y\}\)
\(-x\) \(\{-b\mid b\in U_x\}\)
\(xy\), for \(x,y>0\) \(\{c\mid c<ab\text { for some positive }a\in L_x,\ b\in L_y\}\)
\(1/x\), for \(x>0\) \(\{c\mid c\leq 0\}\cup \{c>0\mid cb<1\text { for some }b\in U_x\}\)

The order is total (RL2). The laws of an ordered field hold because they hold in \(\mathbb D\) and the operations are defined elementwise; signs are handled by \(-\). Call the result \(\mathbb R\).

RL7 (completeness). Let \(X\) be an inhabited family of reals with an upper bound \(y\). Put \(L=\bigcup _{x\in X}L_x\).

The same fact as an adjunction: for parts of \(\mathbb D\), \(A^u\) = upper bounds, \(B^l\) = lower bounds, and \(A\subseteq B^l\iff B\subseteq A^u\). The cuts are the fixed parts \(A=A^{ul}\), and a right adjoint turns unions into intersections, so the fixed parts are closed under intersection. Completeness is this.

Consequences, each in one line:

statement

proof

increasing bounded sequences converge

to their supremum

nested closed intervals \([a_n,b_n]\) with \(b_n-a_n\to 0\) have one common point

\(\sup a_n=\inf b_n\)

Cauchy sequences converge

\(\sup _n\inf _{m\geq n}x_m\)

dyadics are dense in \(\mathbb R\)

\(L_x\) has no greatest element, and RL5

each real is a limit of dyadics \(a_n\) with \(|x-a_n|\leq 2^{-n}\)

greatest multiple of \(2^{-n}\) in \(L_x\) (RL3, least element)

RL8 (the line is not a row and not countable). For \(e:\mathbb N\to \mathbf 2^{\mathbb N}\) put \(D(n)=\neg \,e(n)(n)\), that is \(D=\neg \circ \mathrm {ev}\circ \langle \mathrm {id},e\rangle \). If \(D=e(d)\) then \(D(d)=\neg D(d)\), against \(\ell \neq r\). So no \(e\) is onto. Sending a sequence of digits \(d_n\in \{0,2\}\) to \(\sum d_n3^{-n-1}\) (convergent by RL7) is injective, so no map \(\mathbb N\to \mathbb R\) is onto either. The diagonal \(\Delta \) of the source, composed with \(\neg \), is the whole argument.

RL9 (open sets and continuity). A dyadic interval is \((a,b)=\{x\mid a<x<b\}\) with \(a,b\in \mathbb D\). A part \(W\) of \(\mathbb R\) is open when it is a union of dyadic intervals; equivalently, each \(x\in W\) has some \(\epsilon >0\) with \((x-\epsilon ,x+\epsilon )\subseteq W\) (density, RL7).

RL10 (finite covers). Let \([a,b]\) be covered by opens \(W_i\). Then finitely many of them cover it.

Proof. Suppose not. Halve \([a,b]\) at its midpoint. If each half had a finite subcover, their union would be one for \([a,b]\); so some half has none. Take the left half if it has none, otherwise the right (a truth value, RL2). Repeating gives nested intervals \(I_n\) of length \(2^{-n}(b-a)\), none with a finite subcover. By RL7 they have a common point \(c\). It lies in some \(W_i\), which contains \((c-\epsilon ,c+\epsilon )\) for some \(\epsilon >0\) (RL9). For \(2^{-n}(b-a)<\epsilon \) (RL5), \(I_n\subseteq W_i\): one open covers \(I_n\). Contradiction.

RL11 (the ladder).

step

obtained

from

RL0

\(\Delta \), \(\sigma \), pairs, \(\mathbf 2\), \(\ell \neq r\)

S

RL1

cuts: \(\wedge \) with its five laws, order, \(\neg \), \(\vee \) as left adjoint of \(\Delta \)

case split on one tag; \(\sigma \)

RL2

\(p\vee \neg p\); all and some

tags of \(\mathbf 2\); choice of world for infinite families

RL3

\(\mathbb N\), induction, arithmetic, least elements

names; least part; RL2

RL4, RL5

\(\mathbb Z\), \(\mathbb D\); density; Archimedean

pairs and \(\sigma \); halving

RL6

\(\mathbb R\), an ordered field

cuts of \(\mathbb D\)

RL7

completeness and its consequences

unions of cuts; \((-)^u\dashv (-)^l\)

RL8

\(\mathbb R\) is not countable

\(\Delta \) with \(\neg \)

RL9

opens, continuity

dyadic intervals

RL10

finite covers

halving, RL7, RL2

The five facts used by the calculus are RL2, RL6, RL7, RL9, RL10.

41.3 Calculus, and the Schrödinger equation

CA0 (what is used). The reals (RL6), their completeness (RL7), opens and continuity (RL9), finite covers (RL10), in the world of RL2. All five are derived in the preceding section.

Limits and continuity

CA1 (limits). \(f(x)\to L\) as \(x\to c\) means: for every dyadic \(\epsilon >0\) there is \(\delta >0\) with \(|f(x)-L|<\epsilon \) whenever \(0<|x-c|<\delta \). Two limits \(L,L'\) satisfy \(|L-L'|<2\epsilon \) for all \(\epsilon \), so \(L=L'\) (two cuts with the same lower part). Sums and products of limits are limits of sums and products, from \(|ab-a'b'|\leq |a||b-b'|+|b'||a-a'|\).

CA2 (three theorems on continuous functions).

theorem

statement on \([a,b]\)

proof

intermediate value

\(f(a)<0<f(b)\) gives \(f(c)=0\)

halve the interval, keep the half with a sign change; the nested intervals are a cut \(c\) (LD6); \(f(c)\gtrless 0\) contradicts continuity

uniform continuity

one \(\delta \) serves all \(x\)

the intervals \((x-\delta _x,x+\delta _x)\) cover; take a finite subcover (LD9)

extreme value

\(f\) attains its supremum \(M\)

if not, \(1/(M-f)\) is continuous, hence bounded by uniform continuity; contradiction

Derivative

CA3 (definition and rules). \(f\) is differentiable at \(x\) with derivative \(f'(x)\) when

\begin{equation} f(x+h)=f(x)+f'(x)\,h+r(h),\qquad r(h)/h\to 0 . \tag{863}\end{equation}
This is SD3 with \(d^2=0\) replaced by "\(r\) is negligible against \(h\)". Multiplying and composing two such expansions:
\begin{equation} (fg)'=f'g+fg',\qquad (f\circ g)'=(f'\circ g)\,g',\qquad (x^n)'=nx^{n-1}, \tag{864}\end{equation}
the last by induction (LF1). The product rule is the statement that \(h\mapsto f'(x)h\) is the linear part; the chain rule is that linear parts compose (OS15).

CA4 (mean value). At an interior maximum, \(f(x+h)-f(x)\leq 0\) for both signs of \(h\), so \(f'(x)=0\). If \(f(a)=f(b)\), the extreme value theorem gives such a point (Rolle). Applying this to \(f(x)-\frac {f(b)-f(a)}{b-a}(x-a)\):

\begin{equation} f(b)-f(a)=f'(c)\,(b-a)\quad \text {for some }c\in (a,b). \tag{865}\end{equation}
Hence \(f'=0\) on an interval implies \(f\) constant, and \(f'\geq 0\) implies \(f\) increasing.

Integral

CA5 (definition). For continuous \(f\) on \([a,b]\) let \(S_n=\sum _k f(x_k)\,2^{-n}(b-a)\) over the \(2^n\) equal parts. By uniform continuity \(|S_n-S_m|\leq \epsilon (b-a)\) for \(n,m\) large, so \(S_n\) is a Cauchy sequence (LD7) and

\begin{equation} \int _a^bf=\lim _nS_n \tag{866}\end{equation}
exists (RE8). It is linear, monotone, and additive in the interval, because each \(S_n\) is. This is the measure of LD9 applied to \(f\).

CA6 (the fundamental theorem).

Differentiating and integrating are inverse, in the two orders. They are the reading and placing of S for functions on an interval: \(F\mapsto F'\) reads the increments, \(f\mapsto \int f\) places them.

CA7 (substitution; parts). Integrating the chain rule and the product rule (CA3) with CA6:

\begin{equation} \int _a^bf(g(x))g'(x)\,dx=\int _{g(a)}^{g(b)}f,\qquad \int _a^bfg'=[fg]_a^b-\int _a^bf'g . \tag{867}\end{equation}

CA8 (Taylor). Starting from \(f(x)=f(a)+\int _a^xf'\) and integrating by parts \(n\) times,

\begin{equation} f(x)=\sum _{k=0}^n\frac {f^{(k)}(a)}{k!}(x-a)^k+\frac 1{n!}\int _a^x(x-t)^nf^{(n+1)}(t)\,dt . \tag{868}\end{equation}

Series and the elementary functions

CA9 (power series; \(\exp \), \(\log \), \(\cos \), \(\sin \), \(\pi \)). If \(\sum |a_n|r^n\) converges, then \(\sum a_nx^n\) converges uniformly on \(|x|\leq r\) (compare with the tail), is continuous, and may be integrated term by term (CA5 is linear and monotone); hence also differentiated term by term (CA6).

function

definition

properties, with reason

\(\exp \)

\(\sum x^n/n!\)

\(\exp '=\exp \) (termwise); \(\exp (x+y)=\exp x\exp y\) (binomial, LF3)

\(\log \)

\(\int _1^x dt/t\)

inverse of \(\exp \): \((\log \exp x)'=1\); \(\log xy=\log x+\log y\) (IF3)

\(\cos ,\sin \)

real and imaginary parts of \(\exp (i\theta )\)

\(\cos '=-\sin \), \(\sin '=\cos \); \(\cos ^2+\sin ^2=|\exp i\theta |^2=1\)

\(\pi \)

\(\pi /2\) is the first zero of \(\cos \)

exists by CA2, since \(\cos 0=1\), \(\cos 2<0\) from the series

Then \(\exp (i(\theta +2\pi ))=\exp (i\theta )\), and \(\theta \mapsto \exp (i\theta )\) winds the line once around the circle (HI10).

Several variables

CA10 (partial derivatives commute). For \(f\) with continuous second derivatives, the double difference \(f(x+h,y+k)-f(x+h,y)-f(x,y+k)+f(x,y)\) is symmetric under exchanging the roles of \(x\) and \(y\) (\(\sigma \)). Applying CA4 twice in one order gives \(hk\,\partial _y\partial _xf\) at some point, in the other order \(hk\,\partial _x\partial _yf\) at another; letting \(h,k\to 0\),

\begin{equation} \partial _x\partial _yf=\partial _y\partial _xf . \tag{869}\end{equation}
The chain rule in several variables is CA3 with a linear map for \(f'\).

CA11 (iterated integrals). For continuous \(f\) on a rectangle, the double dyadic sums \(\sum _{j,k}f(x_j,y_k)\) may be added in either order (finite sums commute), and both orders converge by uniform continuity: \(\int \!\!\int f\,dx\,dy=\int \!\!\int f\,dy\,dx\). The Gaussian integral of HT0 uses this.

CA12 (\(d^2=0\) and Stokes). On forms, \(d(f\,dx^I)=\sum _i\partial _if\,dx^i\wedge dx^I\) with \(dx^i\wedge dx^j=-dx^j\wedge dx^i\). Then \(d^2=0\): the symmetric \(\partial _i\partial _j\) (CA10) meets the antisymmetric wedge. For a cube \(C\), applying CA6 in the \(i\)-th variable to each term and using CA11,

\begin{equation} \int _Cd\omega =\int _{\partial C}\omega ,\qquad \partial C=\sum _i(-1)^i(\text {front face}_i-\text {back face}_i), \tag{870}\end{equation}
with the signs of HO1. For regions cut into cubes the inner faces cancel. Special cases: the fundamental theorem (\(n=1\)), Green, the divergence theorem, the curl theorem. The identities \(d^2=0\) and \(\partial ^2=0\) are dual under this pairing.

CA13 (differential equations). For \(x'=F(x)\) with \(|F(x)-F(y)|\leq L|x-y|\), the map \(\Phi (x)(t)=x_0+\int _0^tF(x(s))ds\) satisfies \(\sup |\Phi x-\Phi y|\leq LT\sup |x-y|\) on \([0,T]\). For \(LT<1\) the iterates \(\Phi ^nx\) form a Cauchy sequence; the limit is the unique fixed point, and it solves the equation (CA6). So solutions exist and are unique. For linear \(x'=Ax\) the iterates are the partial sums of \(e^{tA}x_0\).

CA14 (waves and their inversion). \(\partial _xe^{ikx}=ik\,e^{ikx}\): the waves diagonalise differentiation. Put \(\hat f(k)=\int f(x)e^{-ikx}dx\). Completing the square, the heat kernel is \(K_t(x)=\frac 1{2\pi }\int e^{-tk^2}e^{ikx}dk\). Since \(K_t*f\to f\) as \(t\to 0\) (HT1),

\begin{equation} f(x)=\frac 1{2\pi }\int \hat f(k)\,e^{ikx}\,dk,\qquad \int |f|^2=\frac 1{2\pi }\int |\hat f|^2,\qquad \widehat {f'}=ik\hat f . \tag{871}\end{equation}

CA15 (variations). If \(S[q]=\int L(q,\dot q)\,dt\) is stationary under all \(\delta q\) vanishing at the ends, integrating by parts (CA7) gives \(\int \bigl (\partial _qL-\frac d{dt}\partial _{\dot q}L\bigr )\delta q=0\); a continuous function orthogonal to every such \(\delta q\) is zero (take \(\delta q\) a bump where it is not), so

\begin{equation} \frac d{dt}\frac {\partial L}{\partial \dot q}=\frac {\partial L}{\partial q}. \tag{872}\end{equation}

The Schrödinger equation

SC1 (the form is forced). A state is a rank-one projection \(\Pi =|\psi \rangle \langle \psi |\) (PJ1). By PJ3 any differentiable motion of it is

\begin{equation} i\,\dot \psi =H\psi ,\qquad H=H^\dagger , \tag{873}\end{equation}
up to a phase. If the motion over \(s\) and then \(t\) is the motion over \(s+t\), \(H\) is constant and \(\psi (t)=e^{-itH}\psi (0)\) (CA13).

SC2 (momentum is the generator of translations). Translation by \(a\) is \((T_a\psi )(x)=\psi (x-a)\). By Taylor (CA8), \(T_a=e^{-a\partial _x}\). It preserves \(\int |\psi |^2\), so by SC1 its generator is self-adjoint: write \(T_a=e^{-iap/\hbar }\),

\begin{equation} p=-i\hbar \,\partial _x,\qquad [x,p]=i\hbar , \tag{874}\end{equation}
the commutator being the product rule (CA3) applied to \(x\psi \). Self-adjointness of \(p\) is integration by parts (CA7). \(\hbar \) converts inverse length into the unit chosen for \(p\); its value is a matter of units.

SC3 (the free Hamiltonian).

requirement consequence reason
same law at every place \([H,p]=0\), so \(H=h(p)\) CA14: \(p\) is diagonal on waves
same law in every direction \(H=h(p^2)\) only \(p^2\) is rotation invariant
same law at every velocity \(h'(p)=p/m\) below

The velocity is \(\frac d{dt}\langle x\rangle =\langle i[H,x]\rangle /\hbar =\langle h'(p)\rangle \). A change to a frame moving at speed \(v\) multiplies \(\psi \) by \(e^{imvx/\hbar }\), which shifts \(p\) by \(mv\) (SC2 with \(x\) and \(p\) exchanged); it must shift the velocity by \(v\). So \(h'(p+mv)=h'(p)+v\) for all \(v\): \(h'\) is linear with slope \(1/m\), and

\begin{equation} H_0=\frac {p^2}{2m}=-\frac {\hbar ^2}{2m}\nabla ^2, \tag{875}\end{equation}
up to a constant. \(m\) labels how the state responds to a change of frame; it is a parameter.

SC4 (interaction). An influence that acts at each place separately commutes with \(x\), so it is multiplication by a real function \(V(x)\):

\begin{equation} i\hbar \,\partial _t\psi =-\frac {\hbar ^2}{2m}\nabla ^2\psi +V\psi . \tag{876}\end{equation}
With a connection (AF1), \(\nabla \mapsto \nabla -\tfrac {iq}\hbar A\).

SC5 (it is the averaging equation in imaginary time). HT0 gives \(\partial _tf=D\nabla ^2f+Ef\). With \(t\mapsto it\), \(D=\hbar /2m\), \(E=-V/\hbar \) this is SC4. Averaging with real weights spreads and loses memory; the same operator with \(i\) rotates and keeps \(\int |\psi |^2\). The kernel of HT1 continues to \(\sqrt {\tfrac m{2\pi i\hbar t}}\,e^{im x^2/2\hbar t}\), the short-time factor of DY4.

SC6 (consequences).

statement

formula

proof

probability is conserved

\(\partial _t|\psi |^2+\nabla \!\cdot \!j=0\),
\(j=\frac \hbar m\mathrm {Im}(\bar \psi \nabla \psi )\)

insert SC4; CA7

Newton’s law in the mean

\(m\frac {d^2}{dt^2}\langle x\rangle =-\langle \nabla V\rangle \)

\(\frac d{dt}\langle O\rangle =\langle i[H,O]\rangle /\hbar \) twice

classical limit

\(\partial _tS+\frac {(\nabla S)^2}{2m}+V+Q=0\),
\(Q=O(\hbar ^2)\)

\(\psi =\sqrt \rho \,e^{iS/\hbar }\) (DY3)

least action

\(\delta \!\int (\tfrac m2\dot x^2-V)=0\)

stationary phase in DY4; then CA15

uncertainty

\(\Delta x\,\Delta p\geq \hbar /2\)

DY5 with SC2

stationary states

\(H\psi =E\psi \), \(\psi (t)=e^{-iEt/\hbar }\psi \)

SC1

box of width \(L\)

\(E_n=\frac {\hbar ^2\pi ^2n^2}{2mL^2}\)

waves vanishing at both ends (CA14)

oscillator

\(E_n=\hbar \omega (n+\tfrac 12)\)

ladder operators, as in HT5

SC7 (the ladder, and what is input).

\begin{equation} \begin {aligned} \text {cuts} &\to \text {limits} \to f' \to \textstyle \int \to \text {fundamental theorem}\\ &\to \exp ,\ e^{i\theta } \to \text {waves}\\ &\to p=-i\hbar \partial \to H_0=\tfrac {p^2}{2m}\\ &\to i\hbar \partial _t\psi =H\psi . \end {aligned} \tag{877}\end{equation}

derived input
the form \(i\dot \psi =H\psi \) (SC1) the values of \(\hbar \) and \(m\)
\(p=-i\hbar \partial \), \([x,p]=i\hbar \) (SC2) the function \(V\)
\(H_0=p^2/2m\) from the three symmetries (SC3) that the three symmetries hold
all rows of SC6 —

41.4 Differentiation

Differentiation is built from the identity in four steps.

1.
The doubling construction has three signs. The sign \(e^2=0\) gives the dual numbers, the algebra of first-order change, and the derivative is the coefficient of \(\varepsilon \) in \(f(x+\varepsilon )\).
2.
Differentiation is a functor, the tangent functor \(T\). The chain rule is preservation of composition, and \((\mathrm {id})'=1\) is preservation of the identity.
3.
Analytic differentiation, through limits from the completion of \(\mathbb R\), has the same algebra in Carathéodory’s form; the rule \(\varepsilon ^2=0\) is the algebraic shadow of discarding \(o(h)\).
4.
In the univalent track, the action of functions on paths obeys the same functor laws, and in synthetic differential geometry the chain rule is associativity of composition.

41.5 The third sign: dual numbers

D1 (three signs of doubling). The doubling of \(\mathbb R\), \((a,b)(c,d)=(ac+\gamma \,db,\ ad+bc)\), has three cases:

\(\gamma \) Algebra Change it describes
\(-1\) \(\mathbb C\), \(i^2=-1\) rotation
\(+1\) split-complex, \(e^2=1\) boost
\(0\) dual numbers, \(\varepsilon ^2=0\) first-order change

D2 (dual numbers). With \(\gamma =0\),

\begin{equation} (a+b\varepsilon )(c+d\varepsilon )=ac+(ad+bc)\varepsilon , \qquad \varepsilon ^2=0 . \tag{878}\end{equation}
The element \(\varepsilon \) is a nonzero square root of zero [1232].

D3 (derivative of a polynomial). By the binomial expansion with \(\varepsilon ^2=0\),

\begin{equation} (x+\varepsilon )^n=x^n+n\,x^{n-1}\varepsilon . \tag{879}\end{equation}
Hence for every polynomial \(p\) there is a unique polynomial \(p'\) with
\begin{equation} p(x+\varepsilon )=p(x)+\varepsilon \,p'(x), \tag{880}\end{equation}
and \((x^n)'=nx^{n-1}\). The derivative is the coefficient of \(\varepsilon \).

D4 (identity and constants).

\begin{equation} \mathrm {id}(x+\varepsilon )=x+1\cdot \varepsilon , \qquad c(x+\varepsilon )=c+0\cdot \varepsilon . \tag{881}\end{equation}
The derivative of the identity is \(1\), and of a constant is \(0\).

41.6 The rules

D5 (sum). \((f+g)(x+\varepsilon )=f+g+\varepsilon (f'+g')\).

D6 (product).

\begin{equation} (fg)(x+\varepsilon )=(f+\varepsilon f')(g+\varepsilon g')=fg+\varepsilon (f'g+fg'), \tag{882}\end{equation}
since the \(\varepsilon ^2\) term vanishes. This is the Leibniz rule; with \(f=g=1\) it gives \(D(1)=0\).

D7 (chain). Since \((\varepsilon c)^2=0\) for any real \(c\), the element \(\varepsilon f'(x)\) behaves like \(\varepsilon \), and

\begin{equation} g\bigl (f(x+\varepsilon )\bigr )=g\bigl (f(x)+\varepsilon f'(x)\bigr )=g(f(x))+\varepsilon \,f'(x)\,g'(f(x)). \tag{883}\end{equation}
So \((g\circ f)'=(g'\circ f)\cdot f'\).

D8 (the tangent functor). Define on pairs

\begin{equation} Tf(x,v)=\bigl (f(x),\ f'(x)v\bigr ), \tag{884}\end{equation}
that is, \(x+\varepsilon v\mapsto f(x+\varepsilon v)\). Then D4 and D7 read
\begin{equation} T(\mathrm {id})=\mathrm {id}, \qquad T(g\circ f)=Tg\circ Tf . \tag{885}\end{equation}
Differentiation is a functor. The chain rule is preservation of composition, and \((\mathrm {id})'=1\) is preservation of the identity.

D9 (inverse). If \(f\) has an inverse, \(T(f^{-1})\circ Tf=T(\mathrm {id})=\mathrm {id}\), so

\begin{equation} (f^{-1})'(f(a))\,f'(a)=1 . \tag{886}\end{equation}

D10 (quotient). Applying D6 to \(f\cdot (1/f)=1\) gives \((1/f)'=-f'/f^2\).

41.7 Analytic differentiation

D11 (Carathéodory form). A function \(f\) on an interval is differentiable at \(a\) if there is a function \(\varphi \), continuous at \(a\), with

\begin{equation} f(x)-f(a)=\varphi (x)\,(x-a), \tag{887}\end{equation}
and then \(f'(a)=\varphi (a)\) [1244]. The value \(\varphi (a)\) is unique, since \(\varphi (x)=(f(x)-f(a))/(x-a)\) for \(x\neq a\) determines its limit, which exists by completeness of \(\mathbb R\).

D12 (agreement with the dual numbers). For a polynomial, \(p(x)-p(a)=\bigl (\sum _kc_k\sum _{j<k}x^ja^{k-1-j}\bigr )(x-a)\), and the bracket at \(x=a\) is \(p'(a)\) of D3. Truncating at first order, the analytic derivative and the coefficient of \(\varepsilon \) coincide: \(\varepsilon ^2=0\) discards exactly the \(o(h)\) terms.

D13 (the rules again). With \(f(x)-f(a)=\varphi (x)(x-a)\) and \(g(x)-g(a)=\psi (x)(x-a)\):

\begin{equation} f(x)g(x)-f(a)g(a)=\bigl (\varphi (x)g(x)+f(a)\psi (x)\bigr )(x-a), \tag{888}\end{equation}
and with \(g(y)-g(b)=\chi (y)(y-b)\) at \(b=f(a)\),
\begin{equation} g(f(x))-g(f(a))=\chi (f(x))\,\varphi (x)\,(x-a). \tag{889}\end{equation}
The brackets are continuous at \(a\), giving D6 and D7 without limits of quotients.

41.8 Standard derivatives

Function Derivative From
\(x^n\) \(nx^{n-1}\) binomial with \(\varepsilon ^2=0\)
\(\log x=\int _1^xdt/t\) \(1/x\) fundamental theorem of calculus
\(e^x=\log ^{-1}x\) \(e^x\) inverse rule: \(1/(1/e^x)\)
\(e^{x}\) via \(e^{x+h}=e^xe^h\) \(e^x\cdot e'(0)\) homomorphism, \(e'(0)=1\)
\(e^{i\theta }\) \(ie^{i\theta }\) chain rule
\(\cos \theta ,\ \sin \theta \) \(-\sin \theta ,\ \cos \theta \) real and imaginary parts of \(ie^{i\theta }\)

For \(\log \): \(\log (x(1+\varepsilon /x))=\log x+\log (1+\varepsilon /x)=\log x+\varepsilon /x\), using the homomorphism and \(\log '(1)=1\).

41.9 Higher order and several variables

D14 (Taylor). In \(\mathbb R[\varepsilon ]/(\varepsilon ^{n+1})\), for a polynomial,

\begin{equation} p(x+\varepsilon )=\sum _{k=0}^n\frac {p^{(k)}(x)}{k!}\,\varepsilon ^k . \tag{890}\end{equation}
Taylor’s theorem is the expansion with higher nilpotents.

D15 (several variables). With nilpotents \(\varepsilon _1,\ldots ,\varepsilon _n\), \(\varepsilon _i\varepsilon _j=0\),

\begin{equation} f(x+\textstyle \sum _iv_i\varepsilon _i)=f(x)+\sum _i\varepsilon _i\,(Jf(x)v)_i , \tag{891}\end{equation}
and functoriality gives \(J(g\circ f)=Jg\cdot Jf\): the chain rule for Jacobians.

D16 (derivations). On polynomials, a linear \(D\) with \(D(fg)=D(f)g+fD(g)\) and \(D(x)=1\) is \(d/dx\): induction gives \(D(x^n)=nx^{n-1}\). Derivations of smooth functions on a manifold are its vector fields.

41.10 The univalent and synthetic tracks

D17 (action on paths). In homotopy type theory, a function \(f:A\to B\) acts on paths, \(\mathsf {ap}_f:(x=y)\to (fx=fy)\), and by path induction

\begin{equation} \mathsf {ap}_{g\circ f}=\mathsf {ap}_g\circ \mathsf {ap}_f, \qquad \mathsf {ap}_{\mathrm {id}}=\mathrm {id}. \tag{892}\end{equation}
These are the functor laws of D8 for paths in place of infinitesimal displacements.

D18 (synthetic differential geometry). Let \(\mathbb D=\{d:\ d^2=0\}\). The Kock–Lawvere axiom states that every map \(\mathbb D\to \mathbb R\) is \(d\mapsto a+bd\) for unique \(a,b\) [1245]. Tangent vectors at \(x\) are maps \(v:\mathbb D\to M\) with \(v(0)=x\), and the derivative is composition:

\begin{equation} Tf(v)=f\circ v, \qquad T(g\circ f)(v)=(g\circ f)\circ v=g\circ (f\circ v)=Tg(Tf(v)). \tag{893}\end{equation}
The chain rule is associativity of composition. The axiom is inconsistent with excluded middle and holds in smooth toposes with Heyting logic.

41.11 The chain

Step Result From
D1–D2 dual numbers, \(\varepsilon ^2=0\) doubling with the third sign
D3–D4 \(p(x+\varepsilon )=p+\varepsilon p'\); \((\mathrm {id})'=1\) binomial
D5–D7 sum, product, chain rules expanding with \(\varepsilon ^2=0\)
D8–D10 tangent functor, inverse, quotient functoriality
D11–D13 analytic derivative Carathéodory, completion
table \(\log \), \(\exp \), \(\sin \), \(\cos \) homomorphisms, chain rule
D14–D16 Taylor, Jacobians, derivations higher and several nilpotents
D17–D18 paths, synthetic tangent vectors \(\mathsf {ap}\); Kock–Lawvere

41.12 Integration from the identity

Thesis. Integration is built from the identity as follows.

1.
A partition of an interval is a splitting of the identity \(1_{[a,b]}=\sum _k1_{I_k}\). Length is the unique translation-invariant additive weight on the pieces, and the integral is the completion of the weighted sums.
2.
The normalised integral is a state, positive on the cone, and it is the trace of the commutative algebra of functions.
3.
The fundamental theorem splits the identity on functions into two complementary cuts, \(1=I\circ d+\mathrm {ev}_a\).
4.
Integration by parts, substitution, Fubini and Stokes are the rules of differentiation, integrated.

I1 (pieces of the identity). Splitting \([a,b)\) at \(a=t_0<t_1<\cdots <t_n=b\) gives

\begin{equation} 1_{[a,b)}=\sum _{k=0}^{n-1}1_{[t_k,t_{k+1})}, \qquad 1_{I_j}1_{I_k}=\delta _{jk}1_{I_k}, \tag{894}\end{equation}
a splitting of the identity into orthogonal cuts.

I2 (length is forced). Let \(\mu \) assign to each interval a number that is additive over splittings, invariant under translation, and normalised by \(\mu ([0,1))=1\). Then \([0,1)\) splits into \(n\) translates of \([0,1/n)\), so \(\mu ([0,1/n))=1/n\), hence \(\mu ([0,q))=q\) for rational \(q\). By monotonicity and completeness of \(\mathbb R\),

\begin{equation} \mu ([a,b))=b-a . \tag{895}\end{equation}
Length is the Haar measure of the additive group, the invariant weight of the averaging idempotent.

I3 (step functions). For \(s=\sum _kc_k1_{I_k}\),

\begin{equation} \int s=\sum _kc_k\,\mu (I_k), \tag{896}\end{equation}
independent of the splitting, since common refinements split each piece further and \(\mu \) is additive.

I4 (the integral). The integral is the completion of I3: the unique linear functional on limits of step functions that agrees with I3 and is continuous for the norm \(\int |s|\). For continuous \(f\) on \([a,b]\), Riemann sums \(\sum _kf(\xi _k)(t_{k+1}-t_k)\) converge to it as the splitting is refined. Lebesgue’s integral is the same completion carried out with countable splittings.

I5 (positivity and normalisation).

\begin{equation} f\ge 0\ \Rightarrow \ \int f\ge 0, \qquad \int _a^b1=b-a . \tag{897}\end{equation}
The functional \(\omega (f)=\frac {1}{b-a}\int _a^bf\) carries the cone of nonnegative functions into \(\mathbb R_{\ge 0}\) and the identity to \(1\): a state.

I6 (the integral is a trace). On the commutative algebra of functions acting by multiplication, \(\omega (fg)=\omega (gf)\) holds trivially, and translation invariance fixes \(\omega \) uniquely, as for the trace of matrix units. The integral is the trace of the commutative algebra, and the trace of \(M_d\) is the integral of the noncommutative one.

I7 (fundamental theorem, first half). For continuous \(f\) and \(F(x)=\int _a^xf\),

\begin{equation} F(x+h)-F(x)=\int _x^{x+h}f=h\,\varphi (h), \qquad \varphi (h)=\frac 1h\int _x^{x+h}f\to f(x), \tag{898}\end{equation}
so in the Carathéodory form of differentiation, \(F'(x)=f(x)\).

I8 (fundamental theorem, second half). For differentiable \(F\) with continuous \(F'\), the splitting of I1 gives a telescoping sum,

\begin{equation} F(b)-F(a)=\sum _k\bigl (F(t_{k+1})-F(t_k)\bigr )=\sum _kF'(\xi _k)(t_{k+1}-t_k)\to \int _a^bF', \tag{899}\end{equation}
with \(\xi _k\) from the mean value theorem.

I9 (the fundamental theorem as a splitting of the identity). Let \(I(f)(x)=\int _a^xf\), let \(d\) be differentiation, and let \(\mathrm {ev}_a(F)\) be the constant function \(F(a)\). By I7 and I8,

\begin{equation} d\circ I=1, \qquad I\circ d=1-\mathrm {ev}_a . \tag{900}\end{equation}
Then \((I\circ d)^2=I\circ (d\circ I)\circ d=I\circ d\), \(\mathrm {ev}_a^2=\mathrm {ev}_a\) and \((I\circ d)\circ \mathrm {ev}_a=0\), since constants have zero derivative. The identity on functions splits into two complementary cuts:
\begin{equation} 1=I\circ d+\mathrm {ev}_a . \tag{901}\end{equation}
Integration undoes differentiation up to the constants, which form the complementary cut.

I10 (integration by parts). Integrating the Leibniz rule \((fg)'=f'g+fg'\) by I8,

\begin{equation} \int _a^bf'g=\bigl [fg\bigr ]_a^b-\int _a^bfg' . \tag{902}\end{equation}

I11 (substitution). Integrating the chain rule \((F\circ \phi )'=(f\circ \phi )\,\phi '\) with \(F'=f\),

\begin{equation} \int _{\phi (a)}^{\phi (b)}f=\int _a^bf(\phi (t))\,\phi '(t)\,dt . \tag{903}\end{equation}

I12 (Fubini). A rectangle splits as \(1_{I\times J}=\sum _{j,k}1_{I_j}1_{J_k}\), using pairs of pieces. Summing first over \(k\) then over \(j\), or the reverse, gives the same Riemann sum, so for continuous \(f\)

\begin{equation} \int _I\Bigl (\int _Jf(x,y)\,dy\Bigr )dx=\int _J\Bigl (\int _If(x,y)\,dx\Bigr )dy . \tag{904}\end{equation}

I13 (invariant integrals on groups).

Group Invariant measure Result
\((\mathbb R,+)\) \(dx\) length (I2)
\((\mathbb R_{>0},\cdot )\) \(dt/t\) \(\log x=\int _1^xdt/t\)
\(S^1\) \(d\theta \) \(\int _{S^1}d\theta =2\pi \)
\(\mathbb R^2\), polar \(r\,dr\,d\theta \) \(\int e^{-ax^2}dx=\sqrt {\pi /a}\)

I14 (derivative is anti-self-adjoint). For functions vanishing at the endpoints, I10 gives

\begin{equation} \int \overline {f'}\,g=-\int \overline f\,g', \tag{905}\end{equation}
so \(d/dx\) is anti-symmetric for \(\langle f,g\rangle =\int \bar fg\), and \(P=-i\hbar \,d/dx\) is symmetric: momentum.

I15 (Stokes). On a manifold \(M\) with boundary, cover \(M\) by charts and split the identity by a partition of unity, \(1=\sum _i\chi _i\). On each chart, I8 applied coordinate by coordinate gives Stokes on a cube, and summing over the splitting gives

\begin{equation} \int _Md\omega =\int _{\partial M}\omega . \tag{906}\end{equation}
Since \(\partial \partial M=\varnothing \), this pairs with \(d^2=0\).

I16 (synthetic form). In synthetic differential geometry, the integration axiom states that every \(f:[a,b]\to \mathbb R\) has a unique primitive \(F\) with \(F(a)=0\), the statement \(d\circ I=1\) of I9 taken as basic.

The chain.

Step Result From the identity
I1–I2 pieces, length splitting of \(1\); translation invariance
I3–I4 integral weighted sums, completion
I5–I6 state, trace cone, commutativity
I7–I9 fundamental theorem \(1=I\circ d+\mathrm {ev}_a\)
I10–I12 parts, substitution, Fubini Leibniz, chain rule, pairs
I13–I14 invariant measures, momentum Haar; anti-symmetry of \(d\)
I15–I16 Stokes, synthetic integration partition of unity