When composites form a space
In a groupoid, two composable arrows have a unique composite. In an ∞-groupoid, we can ask for more data. Given paths f:x→y and g:y→z, we seek a third path h:x→z together with a two-dimensional witness that these paths fit together. The choices of h and witness form a space.
Model the ∞-groupoid by a Kan complex X. The two edges determine a map Λ12→X from the inner horn of a triangle. The space of composites is the fiber over that horn of
XΔ2⟶XΛ12.
Here a point in the fiber records the missing edge and the filled triangle together. The horn inclusion is anodyne. Since X is Kan, restriction is a trivial Kan fibration. Its fibers are contractible. That is the sense in which composition is unique.
The same argument can be phrased using Segal spaces. The degree-two Segal map sends a coherent triangle to its pair of consecutive edges.
From ordinary uniqueness to contractibility
To say that a set C has a unique element is to assert
∃x∈C,∀y∈C,x=y.
In a proof-relevant setting, the expression x=y has its own inhabitants. When C is a space, these inhabitants are paths from x to y. The corresponding type of witnesses to uniqueness is
x:C∑y:C∏(x=y).
A point of this type consists of a point x and a family of paths from x to every y, varying continuously with y in the space interpretation. Such a family is a homotopy from the constant map at x to the identity. The point x is called a center of contraction.
This explains why contractibility expresses uniqueness in the preceding example. There can be many choices of filled triangle, and many paths between choices. The space of all that data has the homotopy type of a point.
For the proof-relevant definition, see Homotopy Type Theory, §3.11.
Revised from notes accompanying a Lisbon Mathematics Graduate Student Seminar talk.