module 1Lab.Equiv.FromPath {β„“} (P : (i : I) β†’ Type β„“) where

Equivs from pathsπŸ”—

In (Cohen et al. 2016), a direct cubical construction of an equivalence A ≃ B from a path A ≑ B is presented. This is in contrast with the indirect definition, transporting the identity equivalence along the path:

private
  badPathToEquiv : P i0 ≃ P i1
  badPathToEquiv = transport (Ξ» i β†’ P i0 ≃ P i) (id , id-equiv)

While is-equiv is a proposition – and thus the particular proof does not matter propositionally – Agda is still a programming language, so we still need to evaluate the proof. Cohen et. al.’s construction gives a much shorter normal form for lineβ†’equiv.

private
  ~P : (i : I) β†’ Type β„“
  ~P = Ξ» i β†’ P (~ i)

  A B : Type β„“
  A = P i0
  B = P i1

The construction begins by giving the endpoints of P – and the inverse of P – better names. We do the same for transports along P and ~P:

  f : A β†’ B
  f x = coe0β†’1 P x

  g : B β†’ A
  g y = coe1β†’0 P y

Since f and g are defined by coercion along a path, we can define fillers u and v connecting f (resp g) to the identity function, over P:

  u : PathP (Ξ» i β†’ A β†’ P i) id f
  u i x = coe0β†’i P i x

  v : PathP (Ξ» i β†’ B β†’ P i) g id
  v i y = coe1β†’i P i y

To prove that f is an equivalence, by definition, it must have contractible fibres. It suffices to show that the fibre over y is inhabited, and that the fibre over y is a proposition.

To prove that the fibre over y is inhabited, we take g y to be the preimage, and prove that there is a path f (g y) ≑ y, as we are required to do. For this, we use the β€œlid” (the dotted face) of the square below (this is the comp term):

  hasFib : (y : B) β†’ fibre f y
  hasFib y .fst = g y
  hasFib y .snd i = comp P (βˆ‚ i) Ξ» where
    j (i = i1) β†’ v j y
    j (i = i0) β†’ u j (g y)
    j (j = i0) β†’ g y

To prove that the fibre over y is propositional, there is significantly more work involved. Especially since all of the paths involved are dependent, and thus none of the path operations (especially sym!) apply. We begin by stating the types of what we’re going to construct:

  fibProp : (y : B) β†’ is-prop (fibre f y)
  fibProp y (xβ‚€ , Ξ²β‚€) (x₁ , β₁) k = Ο‰ k , Ξ» j β†’ Ξ΄ k (~ j) where
    Ο‰ : xβ‚€ ≑ x₁
    Ξ΄ : Square refl (sym Ξ²β‚€) (sym β₁) (ap f Ο‰)

While Ο‰ is a line, Ξ΄ is a square. Namely, by looking at its type, we see that its boundary is the square below. Observe that it is essentially a path Ξ²β‚€ ≑ β₁, lying over Ο‰, which is exactly what we need to equate the fibres:

As an intermediate step in the construction of Ξ΄, we construct ΞΈ. However, that is also hard to do directly, so we have four (really, two) more intermediate steps: Ο‰β‚€/ΞΈβ‚€ and ω₁/θ₁.

The line Ο‰β‚€ is the dashed line in the composition below, and ΞΈβ‚€ is the square itself. The type of ΞΈβ‚€ is hard to look at, so focus on the diagram: It connects Ξ²β‚€ and Ο‰β‚€, in the vertical direction.

    square : βˆ€ (x : A) (Ξ² : f x ≑ y) j i β†’ PartialP (βˆ‚ j ∨ ~ i) (Ξ» _ β†’ P (~ i))
    square x Ξ² j i (j = i0) = v (~ i) y
    square x Ξ² j i (j = i1) = u (~ i) x
    square x Ξ² j i (i = i0) = Ξ² (~ j)

    Ο‰β‚€ : g y ≑ xβ‚€
    Ο‰β‚€ j = comp (Ξ» i β†’ P (~ i)) (βˆ‚ j) (square xβ‚€ Ξ²β‚€ j)

    ΞΈβ‚€ : SquareP (Ξ» i j β†’ P (~ j)) (sym Ξ²β‚€) (Ξ» i β†’ v (~ i) y) (Ξ» i β†’ u (~ i) xβ‚€) Ο‰β‚€
    ΞΈβ‚€ j i = fill ~P (βˆ‚ j) i (square xβ‚€ Ξ²β‚€ j)

Analogously, we have ω₁ and θ₁ connecting β₁ and that, as the dashed line and filler of the square below:

    ω₁ : g y ≑ x₁
    ω₁ j = comp (Ξ» i β†’ P (~ i)) (βˆ‚ j) (square x₁ β₁ j)

    θ₁ : SquareP (Ξ» i j β†’ P (~ j)) (sym β₁) (Ξ» i β†’ v (~ i) y) (Ξ» i β†’ u (~ i) x₁) ω₁
    θ₁ j i = fill ~P (βˆ‚ j) i (square x₁ β₁ j)

Now, we are almost done. Like a magic trick, the paths Ο‰β‚€ and ω₁ we constructed above to aid in proving Ξ΄ assemble to give a complete proof of Ο‰, as the dashed line in the square below:

    Ο‰ k = hcomp (βˆ‚ k) Ξ» where
      j (k = i0) β†’ Ο‰β‚€ j
      j (k = i1) β†’ ω₁ j
      j (j = i0) β†’ g y

    ΞΈ : Square refl Ο‰β‚€ ω₁ Ο‰
    ΞΈ k i = hfill (βˆ‚ k) i Ξ» where
      j (k = i0) β†’ Ο‰β‚€ j
      j (k = i1) β†’ ω₁ j
      j (j = i0) β†’ g y

We also have ΞΈ, which is the filler of the above square - i.e., it is a path connecting Ο‰β‚€ and ω₁. Now we can finally assemble Ξ΄. Since we are constructing a square, we are filling a cube, i.e.Β a path of paths of paths! The β€œfull” face of this cube is given by ΞΈ, which indicates the boundaries of the other faces. The full cube is right after the definition:

    Ξ΄ k j = comp P (βˆ‚ j ∨ βˆ‚ k) Ξ» where
      i (i = i0) β†’ ΞΈ k j
      i (j = i0) β†’ v i y
      i (j = i1) β†’ u i (Ο‰ k)
      i (k = i0) β†’ ΞΈβ‚€ j (~ i)
      i (k = i1) β†’ θ₁ j (~ i)

The idea behind the diagram is to piece together the three squares we have constructed, ΞΈ, ΞΈβ‚€ and θ₁, with the intent of getting a composite Ξ²β‚€ ≑ β₁. The purpleish square behind is ΞΈ; The brownish square in front is Ξ΄. Finally, putting together the proof of inhabitation and the proof of propositionality, we get the desired: f is an equivalence.

line→is-equiv : is-equiv f
line→is-equiv .is-eqv y .centre = hasFib y
line→is-equiv .is-eqv y .paths = fibProp y _

lineβ†’equiv : A ≃ B
line→equiv .fst = f
line→equiv .snd = line→is-equiv

References

  • Cohen, Cyril, Thierry Coquand, Simon Huber, and Anders MΓΆrtberg. 2016. β€œCubical Type Theory: A Constructive Interpretation of the Univalence Axiom.” https://arxiv.org/abs/1611.02108.