Thesis. In homotopy type theory the identity is a type. For terms \(a,b:A\) there is a type \(a=_Ab\) of identifications, and \(\mathsf {refl}_a:a=a\) is its canonical element. The constructions of Section 342 can be read in this language.
Bits and gates.
a classical bit is \(\mathbf 2\), and by univalence its symmetries are the identifications \(\mathbf 2=\mathbf 2\), of which there are two: \(\mathsf {refl}\) and negation;
a quantum gate is an identification of the type of qubits with itself, a loop;
composition of gates is concatenation of paths, the adjoint is path inversion, and equalities between circuits are paths between paths;
a controlled gate is elimination on \(\mathbf 2\): if the control is \(1\), then apply \(U\).
Geometry. The phase is the circle \(S^1\), whose loops form \(\mathbb Z\). The Bloch sphere is the base of the Hopf fibration \(S^1\to S^3\to S^2\), constructed in the type theory itself. The ground space of the toric code is read off from the torus.
Two limits.
HoTT is cartesian: every type has a diagonal \(A\to A\times A\). It describes states as classical data, while no-cloning is a property of the tensor product of Hilbert spaces, handled by linear extensions of the theory.
The point-set \(\mathbb CP^1\) and the higher inductive \(S^2\) are related by the shape modality of real-cohesive type theory, not by plain HoTT.
Formation and introduction. For \(A\) a type and \(a,b:A\) there is a type \(a=_Ab\), and
Path induction. To prove \(C(x,y,p)\) for all \(x,y:A\) and \(p:x=y\), it suffices to prove \(C(x,x,\mathsf {refl}_x)\) for all \(x\). From this single rule follow:
concatenation \(p\cdot q\) and inversion \(p^{-1}\);
transport: \(p:x=y\) gives \(P(x)\to P(y)\), the substitution law;
functoriality: \(f:A\to B\) gives \(\mathsf {ap}_f:(x=y)\to (fx=fy)\);
the groupoid laws, holding up to higher paths.
Each type is an \(\infty \)-groupoid generated by \(\mathsf {refl}\), the type-theoretic form of Section 358.2.
Truncation levels. A type is a proposition if any two elements are equal, and a set if each \(x=y\) is a proposition. \(\mathbf 2\), \(\mathbb N\), \(\mathbb Z\), \(\mathbb R\) and \(\mathbb C\) are sets.
Declarations. The inductive type \(\mathbb N\), with \(0\) and \(\mathsf {succ}\), is a formation rule. As in Section 458, it is where the completed infinite is declared; the reals, and hence \(\mathbb C\), depend on it.
Univalence. For types \(A,B\) in a universe \(\mathcal U\),
The bit. For \(\mathbf 2\),
Two-element types. The type of two-element types,
The circle. \(S^1\) is the higher inductive type with a point \(\mathsf {base}\) and a path \(\mathsf {loop}:\mathsf {base}=\mathsf {base}\).
Its loops. The encode–decode method gives
Phases and spin. A global phase \(e^{i\theta }\) is a point of \(S^1\), and phase windings are the integers above. A rotation \(R_Z(2\pi )=-1\) in \(SU(2)\) returns to the identity only after \(4\pi \): the loop of \(2\pi \) rotations generates \(\pi _1(SO(3))=\mathbb Z/2\), and \(SU(2)\to SO(3)\) is the double cover that unwinds it.
Suspension. \(S^2=\Sigma S^1\) has two poles \(N,S\) and a meridian \(\mathsf {merid}(x):N=S\) for each \(x:S^1\).
Construction. A family of types over \(S^2\) is given by its fibres over the two poles and an equivalence between them along each meridian:
both fibres are \(S^1\);
along \(\mathsf {merid}(x)\) the gluing is rotation by \(x\), the \(H\)-space multiplication \(S^1\times S^1\to S^1\), which is an equivalence in each variable.
Total space. The total space is the join \(S^1*S^1\simeq S^3\):
Consequences.
Relation to \(\mathbb CP^1\). The point-set space \(\mathbb CP^1\) of rank-one projectors, defined from \(\mathbb C\), is a set in book HoTT, carrying no homotopy of its own. In real-cohesive type theory the shape modality \(\int \) recovers its homotopy type:
Projectors as a \(\Sigma \)-type. With \(\mathrm M_2(\mathbb C)\) a set, the rank-one projectors form the type
The type of qubits.
Gates as loops. By the structure identity principle, univalence for structured types,
Circuits. A gate is a loop, and a circuit is a concatenation of loops:
Global phase. States as projectors forget the global phase. The corresponding loop space is \(PU(2)=U(2)/U(1)\), acting on \(\mathrm {Proj}_1\).
Paulis. \(X\) is a loop with \(X\cdot X=\mathsf {refl}\). Restricted to the basis, \(\mathbf 2\to \mathbb C^2\), it is \(\mathsf {ua}(\neg )\), so the bit’s involution is the image of \(X\) on basis vectors:
Recursion on a bit. For \(U:\mathbb C^2\simeq \mathbb C^2\), recursion on \(\mathbf 2\) gives
Linear extension. Extending linearly over the basis of the control qubit gives
The cartesian diagonal. Every type has
No linear diagonal. No-cloning concerns the tensor product: there is no linear map \(\mathbb C^2\to \mathbb C^2\otimes \mathbb C^2\) with \(\psi \mapsto \psi \otimes \psi \) for all \(\psi \). Linearity gives \((\psi +\phi )\otimes (\psi +\phi )\neq \psi \otimes \psi +\phi \otimes \phi \). The diagonal exists for the copying of descriptions, the cartesian product, and fails for the copying of states, the tensor product.
Linear extensions. To make no-cloning a typing rule, the context must be monoidal rather than cartesian, as in linear and dependent linear type theories and quantum programming languages built on them. There the diagonal is available only on the classical part of a type.
The torus. The torus \(T^2\) is the higher inductive type with a point, two loops \(a,b\), and a \(2\)-path \(a\cdot b=b\cdot a\). Its fundamental group is
Cohomology. With \(\mathbb Z/2\) coefficients, as maps into \(K(\mathbb Z/2,1)\simeq \mathrm {BAut}(\mathbf 2)\),
Logical operators. On a lattice embedded in a torus, the toric code’s stabilizers are vertex and plaquette products, and its logical operators are \(X\) and \(Z\) strings along non-contractible cycles. These are classified by \(H_1(T^2;\mathbb Z/2)\) and its dual.
Ground space. The ground space has dimension
| Statement | HoTT form | From |
| \(A=A\) | \(\mathsf {refl}_a:a=a\) | identity type |
| substitution | transport along \(p:x=y\) | path induction |
| bit symmetries | \((\mathbf 2=\mathbf 2)\simeq \mathbf 2\) | univalence |
| two-element types | \(\mathrm {BAut}(\mathbf 2)=K(\mathbb Z/2,1)\) | loops \(\mathbb Z/2\) |
| phase windings | \((\mathsf {base}=\mathsf {base})\simeq \mathbb Z\) | encode–decode |
| spin | \(\pi _1(SO(3))=\mathbb Z/2\) | double cover |
| Bloch sphere | \(S^1\to S^3\to S^2\) | Hopf construction |
| Chern number | \(\pi _2(S^2)=\mathbb Z\) | Freudenthal |
| \(\mathbb CP^1\) vs. \(S^2\) | \(\int \mathbb CP^1\simeq S^2\) | real cohesion |
| projectors | \(\sum _P(P\cdot P=P)\times \cdots \) | identity types |
| gates | \(\Omega (\mathrm {Qubit})\simeq U(2)\) | structure identity |
| circuits | concatenation, inversion | path algebra |
| circuit identities | paths between paths | higher identity |
| \(X\) on basis | \(\mathsf {ua}(\neg )\) | bit involution |
| controlled gates | \(\sum _b\Pi _b\otimes c_U(b)\) | elimination on \(\mathbf 2\) |
| copying descriptions | \(\Delta _A\) | cartesian |
| no-cloning | no linear \(\psi \mapsto \psi \otimes \psi \) | tensor product |
| toric code | \(|H^1(T^2;\mathbb Z/2)|=4\) | torus HIT |