This section does not continue the chain of Section 755. It starts again from \(a=a\) and takes another road: the two places of \(a=a\) are pulled apart into the two ends of an interval. On this road function extensionality, equality of equivalent statements, univalence, the circle, quotients and “some” are all computed. The assumption (A) is not made here.
The statement \(a=a\) has two places. Name them \(0\) and \(1\), and let a variable \(i\) run between them: this is the interval \(\mathbb I\). On names of places the gates of Section 755.5 act,
A proof of \(a=b\) in \(A\) is a path: a map \(p:\mathbb I\to A\) with \(p(0)=a\) and \(p(1)=b\), written \(\langle i\rangle \,p(i)\). The following are read off, with no rule beyond the gates.
The last line is function extensionality: the place \(i\) and the place \(x\) are exchanged, and nothing else is done.
(J), first half: everything equal to \(a\) is one point. For \(p:a=b\),
Let \(\varphi \) be a condition on places built from \(i=0\), \(i=1\), \(\wedge \) and \(\vee \) (a union of faces). An open box in \(A\) is a bottom \(a_0:A\) and sides \(u\), a path defined where \(\varphi \) holds, agreeing with \(a_0\) at the start. Its lid is
| kind | its lid |
| \(2\), \(\mathbb N\) | the bottom itself, constructor by constructor |
| \(A\times B\), \(\Sigma _xB(x)\) | the lid of the first place, then of the second over its filling |
| \(A\to B\), \(\Pi _xB(x)\) | at each argument, carried back along the family: \(\lambda x.\ \text {lid at } x\) |
| \(a=_Ab\) | the lid in \(A\) of the box with the two extra sides \(a\) and \(b\) |
| \(\mathrm {Glue}\) | Section 756.6 |
| \(\mathcal U\) | by \(\mathrm {Glue}\), Section 756.7 |
What composition gives. With no sides it is carrying along a path of kinds, and with two sides it is joining:
(J), second half. For \(C(x,p)\) and \(d:C(a,\mathrm {refl}_a)\),
A map \(f:A\to B\) is an equivalence when each fibre has exactly one point:
Gluing is not a new former. Let \(\varphi \) be a face, and write \(X^{\varphi }\) for the points of \(X\) given only where \(\varphi \) holds: the maps from the part \(\varphi \) of the places into \(X\). Restricting to \(\varphi \) is a map \(A\to A^{\varphi }\), and \(e\) gives \(e^{\varphi }:T^{\varphi }\to A^{\varphi }\). Then
Where \(\varphi \) holds it is \(T\). There \(X^{\varphi }=X\), and the pairs \((a,t)\) with \(a=e(t)\) are given by \(t\) alone: the kind is isomorphic to \(T\) by \((a,t)\mapsto t\).
From isomorphic to equal. For the lid of \(\mathcal U\) the glued kind must be \(T\) itself where \(\varphi \) holds. A kind may be given by cases on a face: \(T\) where \(\varphi \) holds and the pullback elsewhere, joined along the isomorphism above. This step is used, not computed; it is the one place where sameness of kinds is asked to be more than isomorphism.
Forgetting. \(\mathrm {unglue}(a,t)=a\) is the first place of the pair. Its fibre over \(a\) is the fibre of \(e\) where \(\varphi \) holds, and one point elsewhere; so it is an equivalence.
Let \(A\) be a kind, \(\varphi \) a condition on places, and where \(\varphi \) holds let \(T\) be a kind with an equivalence \(e:T\simeq A\). Then
Three tools. For a line of kinds \(A\), a box \([\psi \mapsto u]\,a_0\) and a map \(f:T\to A\):
The second is a path from \(\mathrm {comp}^{i}A[\psi \mapsto f(u)]f(t_0)\) to \(f(\mathrm {comp}^{i}T[\psi \mapsto u]t_0)\). In the third, \((c,h)\) is the proof that \(F\) has exactly one point: a centre \(c\) and a path \(h(x):c=x\) for each \(x\). Here the fibre of \(e\) over \(a\) is read as \(\Sigma _t\,(a=e(t))\).
The lid of \(\mathrm {Glue}\). Let \(G=\mathrm {Glue}\,[\varphi \mapsto (T,e)]\,A\) along \(i\), with a box \([\psi \mapsto b]\,b_0\) in \(G\). Write \(a=\mathrm {unglue}(b)\), \(a_0=\mathrm {unglue}(b_0)\), and let \(\delta \) be the part of \(\varphi \) that holds for every \(i\). Then, in six steps:
It is a point of \(G(1)\). On \(\varphi (1)\), \(a_1=\alpha (1)=e(t_1)\), since \(\alpha :a_1'=e(t_1)\).
It agrees with the sides. On \(\psi \): \(t_1=b(1)\) and \(\alpha \) is constant, so \(a_1=a(1)\) and \(b_1=b(1)\).
Where \(\varphi \) holds throughout it is the lid of \(T\). There \(\delta \) is everything, so \(t_1=t_1'=\mathrm {comp}^{i}\,T\,[\psi \mapsto b]\,b_0\).
\(\mathrm {unglue}\) is an equivalence. Over \(a\), the fibre of \(\mathrm {unglue}\) is, where \(\varphi \) holds, the fibre of \(e\), which has exactly one point; \(\mathrm {ext}\) extends it to all places.
The lid of \(\mathcal U\). For a box of kinds \([\psi \mapsto E]\,A_0\),
Let \(\mathcal U\) be the kind of the kinds of a level, closed under the formers above (the whole of a level, C26).
From an equivalence, a path. For \(e:A\simeq B\),
It computes. Carrying along \(\mathrm {ua}(e)\) is \(e\):
Everything equivalent to \(A\) is one point. For \((T,e)\) with \(e:T\simeq A\),
The circle, “some” and quotients are not new formers either. Each is the least kind closed under some points, some paths, and lids: the same construction as \(\langle e\rangle \) in Section 755.7, with paths among the generators.
How it is there. Take all terms built from the point generators, the path generators applied to places, and one formal lid for each open box. Identify two terms by the kernel that makes the faces agree: a path generator at an end is its end point, and a lid on a side is that side. The quotient is the kind. That the terms are together one kind is (C26), as for \(\mathbb N\); the rest is a kernel.
What it is for. Being least, it has exactly one arrow out for each choice of the same data in another kind.
kind | generated by | an arrow out of it is |
\(S^{1}\) | a point, a path \(\mathrm {base}=\mathrm {base}\) | a point \(x\) and a proof of \(x=x\) |
\(\|A\|\) | a point for each \(a\), a path between any two points | an arrow \(A\to P\), for \(P\) with at most one point |
\(A/R\) | a point for each \(a\), a path for each \(R(a,b)\) | an arrow \(A\to X\) keeping \(R\), for \(X\) a set |
|
So the circle is the free \(a=a\): the kind with one point and one proof that it is itself, beyond \(\mathrm {refl}\). “Some” is again the left adjoint of Section 755.2, and the quotient is again the quotient by a kernel. Gluing is made on the side of the right adjoints, from pairs and a pullback; these kinds are made on the side of the left adjoints, from generators and a kernel.
Equivalent statements are equal. If \(P,Q\) have at most one point and \(P\leftrightarrow Q\), each fibre of \(P\to Q\) has exactly one point; so \(P\simeq Q\), and \(\mathrm {ua}\) gives \(P=Q\).
\(\mathbb F_2\) is the equalities of \(2\). The arrows \(2\to 2\) are \(\mathrm {id},\sigma ,c_0,c_1\); the equivalences are \(\mathrm {id}\) and \(\sigma \). By univalence
The circle and \(\mathbb Z\). Let \(S^{1}\) have a point \(\mathrm {base}\) and a path \(\mathrm {loop}:\mathrm {base}=\mathrm {base}\); its lids are formal, one for each open box. Put
“Some” and quotients. \(\|A\|\) has a point \(|a|\) for each \(a:A\) and a path between any two of its points; then \(\exists x\,P(x)=\|\Sigma _xP(x)\|\). \(A/R\) has a point \([a]\) for each \(a\), a path \([a]=[b]\) for each proof of \(R(a,b)\), and at most one proof of each equality.
| principle | how |
| identity, \(\mathrm {refl}\), (J) | paths; the gate \(\wedge \); carrying |
| equal values give equal arrows | exchange of two places |
| equivalent statements are equal | univalence for kinds with at most one point |
| univalence | gluing |
| the circle, \(\mathbb Z\) as its loops | \(\mathrm {ua}(S)\) and carrying |
| “some”, quotients | kinds given by points and paths |
| excluded middle, choice | not on this road |
The two roads meet on sets. There the gates, \(\mathbb F_2\), \(B\), the systems and the hierarchy are the same. They part at \(\mathcal U\): on the first road (A) makes every equality have one proof; on this road the interval has points between its ends, (A) is not made, and \(2=2\) has two proofs.
Remark 756.1 (Why this section is not checked in Lean). Lean is not a cubical system. In Lean an equality has exactly one proof, so inside Lean the equalities of \(2\) with itself are \(\mathrm {refl}\) alone, and univalence is false there. Hence gluing, \(\mathrm {ua}\) and the circle cannot be checked in Lean. The file PathRoute.lean checks only what does not depend on this; the section itself is checked in Cubical Agda (Section 756.11). It also checks that forgetting the glued part is an equivalence, and the three lines of the table of Section 756.8.
The file checks: the path operations and function extensionality read off the interval; (J) computed by carrying along the contraction; \(\mathrm {ua}\) built from gluing, and that carrying along \(\mathrm {ua}(e)\) is \(e\); univalence; that equivalent statements are equal; that \(\mathrm {ua}(\sigma )\cdot \mathrm {ua}(\sigma )=\mathrm {refl}\) and \(\mathrm {ua}(\sigma )\neq \mathrm {refl}\), so that the kind of kinds is not a set; that the loops of the circle are \(\mathbb Z\), with \(w(\mathrm {loop})=1\), \(w(\mathrm {loop}\cdot \mathrm {loop})=2\) and \(w(\mathrm {loop}^{-1})=-1\) by computation; and the constructors of “some” and of quotients. Univalence and the equivalence for the circle are taken from the library. The lid of \(\mathrm {Glue}\) is built into the system; the six steps of Section 756.6 are written by hand.
PathRoute.agda
{-# OPTIONS --cubical --safe --guardedness #-}
{-
PathRoute.agda
The second route: a = a as a path. Checked in Cubical Agda with the
cubical library. `--safe`: no postulates.
Sections 1-3 use only the interval and the built-in lid (hcomp, transp).
Section 4 builds `ua` from the built-in Glue. Sections 5-7 use the
library for univalence, the Booleans, the circle and the integers.
-}
module PathRoute where
open import Cubical.Core.Glue
open import Cubical.Foundations.Prelude
hiding (refl ; sym ; cong ; funExt ; _∙_ ; J ; JRefl)
renaming (transport to tr)
open import Cubical.Foundations.Equiv
open import Cubical.Foundations.Isomorphism
open import Cubical.Foundations.HLevels
open import Cubical.Foundations.Univalence
hiding (ua ; uaβ)
import Cubical.Foundations.Prelude as P
import Cubical.Foundations.Univalence as U
open import Cubical.Data.Bool
open import Cubical.Data.Int
open import Cubical.Data.Sigma
open import Cubical.Data.Empty as ⊥
open import Cubical.Relation.Nullary
open import Cubical.HITs.S1
open import Cubical.HITs.PropositionalTruncation
open import Cubical.HITs.SetQuotients
private
variable
ℓ ℓ' : Level
A B : Type ℓ
------------------------------------------------------------------------
-- 1. Paths: read off the interval and its gates
------------------------------------------------------------------------
refl : {a : A} → a ≡ a
refl {a = a} = λ i → a
sym : {a b : A} → a ≡ b → b ≡ a
sym p = λ i → p (~ i)
cong : (f : A → B) {a b : A} → a ≡ b → f a ≡ f b
cong f p = λ i → f (p i)
-- function extensionality: exchange two places
funExt : {f g : A → B} → ((x : A) → f x ≡ g x) → f ≡ g
funExt h = λ i x → h x i
-- ¬ ¬ i = i, on the nose
symInvol : {a b : A} (p : a ≡ b) → sym (sym p) ≡ p
symInvol p = refl
-- everything equal to a is one point: the gate ∧
contract : {a b : A} (p : a ≡ b)
→ Path (Σ[ x ∈ A ] (a ≡ x)) (a , refl) (b , p)
contract p = λ i → (p i , λ j → p (i ∧ j))
------------------------------------------------------------------------
-- 2. Lids: joining and carrying
------------------------------------------------------------------------
_∙_ : {a b c : A} → a ≡ b → b ≡ c → a ≡ c
_∙_ {a = a} p q = λ i → hcomp (λ j → λ { (i = i0) → a ; (i = i1) → q j }) (p i)
infixr 30 _∙_
-- (J), computed by carrying along the contraction
J : {a : A} (C : (x : A) → a ≡ x → Type ℓ') (d : C a refl)
{b : A} (p : a ≡ b) → C b p
J C d p = tr (λ i → C (p i) (λ j → p (i ∧ j))) d
JRefl : {a : A} (C : (x : A) → a ≡ x → Type ℓ') (d : C a refl)
→ J C d refl ≡ d
JRefl C d = transportRefl d
------------------------------------------------------------------------
-- 3. Levels
------------------------------------------------------------------------
singlContr : (a : A) → isContr (Σ[ x ∈ A ] (a ≡ x))
singlContr a = (a , refl) , λ s → contract (s .snd)
------------------------------------------------------------------------
-- 4. Gluing, and a path from an equivalence
------------------------------------------------------------------------
ua : {A B : Type ℓ} → A ≃ B → A ≡ B
ua {A = A} {B = B} e i =
Glue B (λ { (i = i0) → (A , e) ; (i = i1) → (B , idEquiv B) })
-- carrying along ua e is e
uaβ : {A B : Type ℓ} (e : A ≃ B) (a : A) → tr (ua e) a ≡ equivFun e a
uaβ e a = transportRefl (equivFun e a)
-- it is the library's ua
ua-is-ua : {A B : Type ℓ} (e : A ≃ B) → ua e ≡ U.ua e
ua-is-ua e = refl
------------------------------------------------------------------------
-- 5. Univalence
------------------------------------------------------------------------
-- everything equivalent to A is one point
equivContr : (A : Type ℓ) → isContr (Σ[ T ∈ Type ℓ ] (T ≃ A))
equivContr A = EquivContr A
-- univalence
univalence′ : {A B : Type ℓ} → (A ≡ B) ≃ (A ≃ B)
univalence′ = univalence
-- equivalent statements are equal
propExt : {P Q : Type ℓ} → isProp P → isProp Q → (P → Q) → (Q → P) → P ≡ Q
propExt = hPropExt
------------------------------------------------------------------------
-- 6. F₂ is the equalities of 2
------------------------------------------------------------------------
σ : Bool ≃ Bool
σ = notEquiv
-- carrying along ua σ swaps
swap-false : tr (ua σ) false ≡ true
swap-false = uaβ σ false
-- σ ∘ σ = id as equivalences
σσ : compEquiv σ σ ≡ idEquiv Bool
σσ = equivEq (P.funExt notnot)
-- 1 + 1 = 0
one-plus-one : ua σ P.∙ ua σ ≡ P.refl
one-plus-one = P.sym (uaCompEquiv σ σ) P.∙ P.cong U.ua σσ P.∙ uaIdEquiv
-- ua σ is not refl
σ≢refl : ¬ (ua σ ≡ P.refl)
σ≢refl q =
true≢false
(P.sym swap-false P.∙ P.cong (λ p → tr p false) q P.∙ transportRefl false)
-- the kind of kinds is not a set
¬isSetType : ¬ isSet (Type ℓ-zero)
¬isSetType h = σ≢refl (h Bool Bool (ua σ) P.refl)
------------------------------------------------------------------------
-- 7. The circle and ℤ
------------------------------------------------------------------------
-- the loops of the circle are the integers
loops : ΩS¹ ≡ ℤ
loops = ΩS¹≡ℤ
w-loop : winding loop ≡ pos 1
w-loop = P.refl
w-loop-loop : winding (loop P.∙ loop) ≡ pos 2
w-loop-loop = P.refl
w-loop-inv : winding (P.sym loop) ≡ negsuc 0
w-loop-inv = P.refl
w-three : winding (loop P.∙ loop P.∙ loop) ≡ pos 3
w-three = P.refl
------------------------------------------------------------------------
-- 8. "Some" and quotients
------------------------------------------------------------------------
some-isProp : isProp ∥ A ∥₁
some-isProp = squash₁
quot-isSet : {R : A → A → Type ℓ'} → isSet (A / R)
quot-isSet = squash/
quot-eq : {R : A → A → Type ℓ'} (a b : A) → R a b → Path (A / R) [ a ] [ b ]
quot-eq a b r = eq/ a b r
------------------------------------------------------------------------
-- 9. Gluing and kinds given by points and paths: what they are for
------------------------------------------------------------------------
-- forgetting the glued part is an equivalence
unglue-equiv : (A : Type ℓ) (φ : I)
(f : PartialP φ (λ o → Σ[ T ∈ Type ℓ ] (T ≃ A)))
→ Glue A f ≃ A
unglue-equiv A φ f = unglueEquiv A φ f
-- the circle is the least kind with a point and a proof of a = a:
-- an arrow out of it is exactly such a pair
circle-out : {X : Type ℓ} → Iso (S¹ → X) (Σ[ x ∈ X ] (x ≡ x))
circle-out {X = X} = iso to from (λ _ → P.refl) back
where
to : (S¹ → X) → Σ[ x ∈ X ] (x ≡ x)
to f = f base , λ i → f (loop i)
from : Σ[ x ∈ X ] (x ≡ x) → S¹ → X
from (x , p) base = x
from (x , p) (loop i) = p i
back : (f : S¹ → X) → from (to f) ≡ f
back f = P.funExt λ { base → P.refl ; (loop i) → P.refl }
-- "some" is the left adjoint: an arrow out of it into a statement is an
-- arrow out of the kind
some-rec : {P : Type ℓ'} → isProp P → (A → P) → ∥ A ∥₁ → P
some-rec h g ∣ a ∣₁ = g a
some-rec h g (squash₁ x y i) = h (some-rec h g x) (some-rec h g y) i
some-out : {P : Type ℓ'} → isProp P → Iso (∥ A ∥₁ → P) (A → P)
some-out h =
iso (λ f a → f ∣ a ∣₁) (some-rec h) (λ _ → P.refl)
(λ f → P.funExt λ x → h _ _)
-- a quotient is the left adjoint: an arrow out of it into a set is an
-- arrow out of the kind that respects the relation
quot-out : {R : A → A → Type ℓ'} {X : Type ℓ} → isSet X
→ Iso (A / R → X) (Σ[ f ∈ (A → X) ] ((a b : A) → R a b → f a ≡ f b))
quot-out h = setQuotUniversalIso h