# Homotopy before type theory

Last Friday, the 18th of October, I talked about homotopy and the fundamental group. As I heard about homotopy type theory, I thought that reviewing what I know of the geometric part could be useful. So I prepared this talk, using Allen Hatcher’s free textbook.

Consider a continuous line on the whiteboard, from point $x_0$ to point $x_1$, and another continuous line from point $y_0$ to point $y_1$. Think of a bijection between the two lines: we may think of it as a family of trajectories from a point on the first line to a point of the second line, so that at time $t=0$ we are at the beginning of each trajectory, and at time $t=1$ we are at the end. But we may want to add another requirement: that, at each time $t \in [0,1]$, the collection of points that have been reached at time $t$ is itself a continuous line on the whiteboard! This is the idea at the base of the geometric concept of homotopy.

Recall that a path in a topological space $X$ is a continuous function $p$ from the unit interval $I = [0,1]$ to $X$. Call $X$ pathwise connected if for any two points $x_0, x_1 \in X$ there exists a path $p$ from $x_0$ to $x_1$, i.e., such that $p(0) = x_0$ and $p(1) = x_1$. If $p$ is a path in $X$ and $\phi : X \to Y$ is continuous, then $\phi \circ p$ is a path in $Y$: thus, a continuous image of a pathwise connected space is pathwise connected.The $n$-dimensional unit balls $D^n = \{ x \in \mathbb{R}^n \mid \|x\| \leq 1 \}$ and $n$-dimensional spheres $S^n = \{ x \in \mathbb{R}^{n+1} \mid \|x\| = 1 \}$ are pathwise connected.

If $f, g : I \to X$ are paths and $f(1) = g(0)$, their concatenation $f \,;\, g$ (read: “$f$ then $g$”) is defined by $(f \,;\, g)(t) = f(2t)$ for $t \leq 1/2$ and $(f \,;\, g)(t) = g(2t-1)$ for $t \geq 1/2$: in other words, we run across both paths in sequence, at twice the speed.

Definition 1. Let $X$ and $Y$ be topological spaces and let $f_0, f_1 : X \to Y$ be continuous functions. A homotopy from $f_0$ to $f_1$ is a continuous function $\Phi : X \times I \to Y$ such that $\Phi(x, i) = f_i(x)$ for every $x \in X$ and $i \in \{0, 1\}$. Two functions $f_0, f_1$ are homotopic, written $f_0 \simeq f_1$, if there exists a homotopy from $f_0$ to $f_1$.

It can be easily check that homotopy is an equivalence relation.

Definition 2. A homotopy equivalence between two pathwise connected spaces $X, Y$ is a pair of continuous functions $f : X \to Y$, $g : Y \to X$ such that $g \circ f \simeq \mathrm{id}_X$ and $f \circ g \simeq \mathrm{id}_Y$. $X$ and $Y$ are homotopy equivalent if there exists a homotopy equivalence between them.

For example, the zero function $f : \mathbb{R}^n \to \{0\}$ and the inclusion $g : \{0\} \to \mathbb{R}^n$ form a homotopy equivalence, with $f \circ g = \mathrm{id}_{\{0\}}$ and $\Phi(x,t) = tx$ being a homotopy from $g \circ f$ and $\mathrm{id}_{\mathbb{R}^n}$. Spaces that are homotopy equivalent to a point are called contractible.

The importance of homotopy equivalence, is that it preserves several algebraic invariants, i.e., algebraic objects associated to topological spaces so that homeomorphic spaces have same invariants. The first such invariant is the fundamental group, which we will define in the next paragraphs.

Let $X$ be a path connected space and $x_0, x_1 \in X$: consider the family of paths from $x_0$ to $x_1$. We want to study the homotopy classes of such paths, with an additional restriction on the homotopies to be endpoint-fixing: $\Phi(0,t) = x_0$ and $\Phi(1,t) = 1$ for every $t \in [0,1]$, i.e., at each time $t$ the function $\lambda (s : [0,1]) . \Phi(s,t)$ must be a path from $x_0$ to $x_1$, rather than any two arbitrary points of $X$. This restriction on the homotopies makes them congruential with respect to concatenation: if $f_0 \simeq f_1$, $g_0 \simeq g_1$, and $f_0(1) = f_1(1) = g_0(0) = g_1(0)$, then $f_0 \,;\, g_0 \simeq f_1 \,;\, g_1$. We may thus think about the 2-category whose objects are the points of a topological space, morphisms are the paths from point to point, and morphisms of morphisms are endpoint-fixing homotopies from path to path.

There is more! Although $(f \,;\, g) \,;\, h$ and $f \,;\, (g \,;\, h)$ are not the same, the only difference is in the velocities while running on the different tracks: and it is easy to see how such change of velocity can be done continuously, so that $(f \,;\, g) \,;\, h \simeq f \,;\, (g \,;\, h)$. For the same reason, if $c_{x_0}$ is the constant path at $x_0$, then $c_{x_0} \,;\, f$ is clearly homotopic to $f$ whatever $f$ is; similarly, $f \,; c_{x_1} \simeq f$. (Paths with initial point equal to final point are called loops.) Finally, if we define the reverse of the path $f$ by $f^R(t) = f(1-t)$, then $f \,;\, f^R \simeq c_{x_0}$ and $f^R \,;\, f \simeq c_{x_1}$. (Think about the original point having a lazy friend, who stops somewhere to rest and waits for the original point to come back to go back together to $x_0$.) This justifies

Definition 3. Let $X$ be a pathwise connected space and let $x_0 \in X$. The fundamental group of $X$ based at $x_0$ is the group $\pi_1(X, x_0)$ whose elements are the homotopy classes of loops at $x_0$, product is defined by $[f] \cdot [g] = [f \,;\, g]$, identity is $[c_{x_0}]$, and inverse is defined by $[f]^{-1} = [f^R]$.

Suppose $f : X \to Y$ and $g : Y \to X$ form a homotopy equivalence. Let $p$ be a loop in $X$ based on $x_0$: then $\phi([p]) = [f \circ p \circ g]$ is well defined, and with some computation it turns out to be a group isomorphism. This is the reason why we sometimes talk about $\pi_1(X)$, without specifying $x_0$.

As every loop $p$ in in $\mathbb{R}^n$ is homotopic to a constant loop via the homotopy $\Phi(s,t) = (1-t) \cdot p(s)$, $\pi_1(\mathbb{R}^n)$ is the trivial group: in this case, when $\pi_1(X) = 0$, we say that $X$ is simply connected. For $n \geq 3$, $\mathbb{R}^n \setminus \{0\}$ is also simply connected, as intuitively we may always move the path in a bounded region which contains the image of the entire homotopy, and does not contain the origin. On the other hand, the same intuition tells us that it should not be possible to continuously transform a loop in $\mathbb{R}^2$ around the origin into a loop in $\mathbb{R}^2$ which does not “surround” the origin, without crossing the origin sometimes: this is confirmed by

Theorem 1. $\pi_1(S^1) \cong \mathbb{Z}$.

The proof of Theorem 1 is based on the intuitive idea that we can homomorphically identify the number $k \in \mathbb{Z}$ with the homotopy class of $|k|$ windings based on $(1,0)$, counterclockwise if $k > 0$ and clockwise if $k < 0$. To prove that such homomorphism is bijective, however, would go beyond the scope of this post. On the other hand, $S^n$ is simply connected for $n \geq 2$: think to what happens when we tie an elastic rubber band around a tennis ball.

Definition 4. A retraction of a topological space $X$ onto a subspace $S \subseteq X$ is a continuous function $r : X \to S$ that fixes every point of $S$; $S$ is a retract of $X$ if there exists a retraction of $X$ onto $S$. A deformation retraction of a topological space $X$ onto a subspace $S \subseteq X$ is a homotopy $\Phi : X \times I \to X$ from the identity of $X$ to a retraction of $X$ onto $S$; $S$ is a deformation retract of $X$ if there exists a deformation retraction of $X$ onto $S$.

$S^n$ is a retract of $\mathbb{R}^{n+1} \setminus \{0\}$, a retraction being $r(x) = x / \|x\|$: it is also a deformation retract, as $\Phi(x,t) = (1 - t + t/\|x\|) \cdot x$ is a homotopy from the identity of $\mathbb{R}^{n+1} \setminus \{0\}$ to $r$.

Theorem 2. If $S$ is a retract of $X$ then $\pi_1(S)$ is isomorphic to a subgroup of $\pi_1(X)$. If $S$ is a deformation retract of $X$ then $\pi_1(S)$ is isomorphic to $\pi_1(X)$.

It follows from Theorems 1 and 2 that $S^1$ is not a retract of $D^2$: from which, in turn, follows

Brouwer’s fixed point theorem in dimension 2. Every continuous function from $D^2$ to itself has a fixed point.

Proof: If $f : D^2 \to D^2$ has no fixed points, then the half-line from $f(x)$ through $x$ is well defined for every $x \in D^2$. Let $g(x)$ be the intersection of such half line with $S^1$: then $g$ is a continuous function from $D^2$ to $S^1$ such that $g(x) = x$ for every $x \in S^1$, i.e., a retraction of $D^2$ onto $S^1$—which is impossible. $\Box$

There are some ways to compute the fundamental group of a space, given the fundamental groups of other spaces. For example, $\pi_1(X \times Y, (x_0, y_0))$ is isomorphic to the direct product of $\pi_1(X, x_0)$ and $\pi_1(Y, y_0)$, because the loops in $X \times Y$ based on $(x_0, y_0)$ are precisely the products of the loops in $X$ based on $x_0$ and the loops in $Y$ based on $y_0$. Another important tool is provided by

van Kampen’s theorem. Let $X_1$ and $X_2$ be pathwise connected spaces such that $X_1 \cap X_2$ is pathwise connected and nonempty. Let $x_0 \in X_1 \cap X_2$. Then $\pi_1(X_1 \cup X_2, x_0)$ is the pushout of the diagram $\pi_1(X_1, x_0) \longleftarrow \pi_1(X_1 \cap X_2, x_0) \longrightarrow \pi_1(X_2, x_0)$, where the arrows are induced by the inclusions.

As an application of van Kampen’s theorem, suppose $X_1$ and $X_2$ are copies of $S^1$, and that $X_1 \cap X_2 = \{x_0\}$ is a single point. Then $\pi_1(X_1 \cap X_2, x_0)$ is free on two generators, because $\mathbb{F}_2$ is the pushout of $\mathbb{Z} \longleftarrow 0 \longrightarrow \mathbb{Z}$, where $0$ is the trivial group that only contains the identity element. More in general, the pushout of $\mathbb{F}_m \longleftarrow 0 \longrightarrow \mathbb{F}_n$ is $\mathbb{F}_{m+n}$ for every two positive integers $m, n$: thus, the fundamental group of a bouquet of $n$ circlesi.e., $n$ copies of $S^1$, joined at a single point $x_0$—is free on $n$ generators.

As a final note, consider a continuous function $\phi : X \to Y$ between two pathwise connected spaces. If $p$ is a loop in $X$ with base point $x_0$, then $\phi \circ p$ is a loop in $Y$ with base point $\phi(x_0)$: it is also easy to check that $\phi (p \,;\, q) = (\phi \circ p) \,;\, (\phi \circ q)$ and that $\phi \circ c_{x_0} = c_{\phi(x_0)}$. From this follows that the function $\phi_\ast : \pi_1(X) \to \pi_1(Y)$ defined by $\phi_\ast([p]) = [\phi \circ p]$ is a group homomorphism: therefore, the application that maps every $\phi$ into the corresponding $\phi_\ast$, is the component on the arrows of a functor from the category $\mathbf{PCTop}$ of pointed pathwise connected topological spaces with basepoint-preserving continuous function to the category $\mathbf{Grp}$ of groups with group homomorphisms, whose component on objects maps every pathwise connected space to its fundamental group.