ebook img

Homotopies for Free! PDF

0.19 MB·
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Homotopies for Free!

Homotopies for Free! 7 1 Taichi Uemura 0 2 January 30, 2017 n a J Abstract 7 2 We show “free theorems” in the style of Wadler on homotopy type theory as consequences of relational parametricity. It follows that, for ] eachspace, its higher inductive definition and impredicative definition O havethesamehomotopygroups. Animpredicativedefinitionofaspace L can help us to find generators of homotopy groups of the space. . s c [ 1 Introduction 1 v Given a closed term of type of polymorphic functions defined in homotopy 7 type theory [Uni13], we can derive a theorem that it satisfies. Any closed 3 9 term of the same type satisfies the same theorem. For example, let t be a 7 closed term of type 0 . t : Y Yx = x → x = x. 1 0 X:Ux:X 7 Then we have a theorem 1 v: Y Y Y Y t(fp)= f(tp) i X,X′:Uf:X→X′x:Xp:x=x X r inhomotopy typetheory, inthesensethatthereisaclosedtermofthistype. a Such theorems are “free theorems” in the style of Wadler [Wad89] on ho- motopy type theory. A difference between free theorems on homotopy type theory and original free theorems on polymorphic type theory is that on homotopy type theory they are represented by homotopies instead of equal- ities. This difference causes some problems related to higher dimensional homotopies, but one can solve them by considering relational parametricity for higher dimensional types. Consider a canonical embedding i :A → Y(A → X) → X X:U 1 for a type A : U. On polymorphic type theory it follows from relational parametricity that i is an isomorphism. On homotopy type theory from relational parametricity for the codomain of this type we can derive only the fact that i is 0-connected, that is, it induces a bijection between the sets of connected components. A 0-connected map is far from an isomorphism. However, from relational parametricity for the type Y Y Ωn(X,ga) X:Ug:A→X foralln ≥ 1anda : A,onecanshowthatiis∞-connected, thatis,itinduces a bijection between the n-th homotopy groups for each n ≥ 0. Hence the types A and (A → X) → X are equivalent from homotopical point of QX:U view. For a concrete (higher) inductive type A, this ∞-connected map and the recursion principle of A give an impredicative definition of A which has the same homotopy groups as A and is defined in Martin-Löf type theory [ML75] with universes but without univalence or higher inductive types. For example, an impredicative definition of n-sphere is Y YΩn(X,x) → X. X:Ux:X Some of generators of homotopy groups of a space can be defined in an impredicative style without univalence or higher inductive types and imple- mented in an existing proof assistant without any hacks. It also is possible to let a proof assistant search for generators of homotopy groups of a space. Freetheoremsonpolymorphictypetheoryarecorollariesoftherelational parametricity theorem, originally called the abstraction theorem by Reynolds [Rey83]. Informally, it says that any function takes related values to re- lated values. Relational parametricity on dependent type theory is studied by Atkey, Ghani and Johann for Martin-Löf type theory [AGJ14], and by Bernardy, Jansonn and Paterson for pure type system [BJP12]. We show a similar theorem on homotopy type theory. The key to prove the relational parametricity theorem is the fact that a type theory of binary type families in homotopy type theory is again a homotopy type theory. There is a category-theoretic proof of this fact using Shulman’s inverse diagrams of type-theoretic fibration categories [Shu15] or fibred type-theoretic fibration categories introduced by the author [Uem17]. In this paper we give a syntactic proof in order to make the paper self- contained. We also show a new result on inductive data types: for a type 2 theory with indexed W-types, originally called general trees [PS89, NPS90], the type theory of binary type families has indexed W-types. Organization. WebegininSection2by recalling someimportant types and functions in homotopy type theory. Section 3 and 4 are the core of this paper. In Section 3 we explain what the relational parametricity theorem is. In Section 4, we give some free theorems as corollaries of relational parametricity. In Section 5, we explain how helpful relational parametricity is to give generators of homotopy groups of a space. We prove the relational parametricity theorem in Section 6, 7 and 8. 2 Preliminaries on Homotopy Type Theory We recall some types and functions in homotopy type theory which are used in Section 3 and 4. The key idea of homotopy type theory is to identify types as spaces, elements as points and equalities as paths. We think of an identity type x : A,y : A ⊢ x = y type as the space of paths from x to y. Under this identification, reflexivity, transitivity and symmetry correspond to constant path refl : x = x, path concatenation (−)·(−) : x = y → y = z → x = z and x path inversion (−)−1 : x = y → y = x respectively. A function f : A → B acts on paths as ap(f,−) : x = y → fx = fy for all x,y : A, and we will often write ap(f,p) as fp for p : x = y. Corresponding to indiscernability of identicals, there is a function transportC(p,−) : C(x) → C(y) for x : A ⊢ C(x) type, x,y : A and p : x = y. A function f : A → B also acts on higher dimensional paths. For x ,y : A, x ,y : x = y , ..., x ,y : x = y , we define ap (f,−) : 1 1 2 2 1 1 n n n−1 n−1 n x = y → ap (f,x ) = ap (f,y ) as ap (f,z) ≡ fz and ap (f,p) ≡ n n n−1 n n−1 n 0 n ap(ap (f,−),p). We often write ap (f,p) as fp. There are composi- n−1 n tions of higher dimensional paths. For x ,y : A, x ,y : x = y , ..., 0 0 1 1 0 0 x ,y : x = y , σ : x = y , p : x′ = x and q : y = y′, we set n n n−1 n−1 n n 0 0 p· σ ≡ ap (λs.p·s,σ) and σ· q ≡ ap (λs.s·q,σ). These operations · and l n r n l · are called whiskering. r A pointed type is a pair (A,a) of type A and its inhabitant a : A called a base point. For a pointed type (A,a) and a natural number n ≥ 0, the n-th loop space Ωn(A,a) of A at a is a pointed type defined inductively as Ω0(A,a) ≡ (A,a) and Ωn+1(A,a) ≡ Ωn(a = a,refl ). Write refln : Ωn(A,a) a a for the base point of Ωn(A,a). A function f :A → B acts on loop spaces as ap (f,−): Ωn(A,a) → Ωn(B,fa). n A path space of a product space A × B is a product of path spaces: 3 (ha,bi = ha′,b′i) ≃ (a = a′)×(b = b′) for a,a′ : A and b,b′ : B. We think of a pair hp,qi of paths p : a = a′ and q : b = b′ as a path ha,bi = ha′,b′i in A × B. Similarly, we regard a pair hl,ki of n-loops l : Ωn(A,a) and k :Ωn(B,b) as an n-loop in A×B at ha,bi. Let x : A ⊢ B(x) type be a type family. For a path p : a = a′ in A and points b : B(a) and b′ : B(a′), the path space from b to b′ over p, written b = b′, is the type transportB(p,b) = b′. For an n-loop l : Ωn(A,a) and a p point b : B(a), the n-th loop space of B at b over l, written Ωn(B,b), is the l type ap (λp.transportB(p,b),l) = refln−1. n−1 b 3 Relational Parametricity Explained Relational parametricity on polymorphic type theory is explained in terms of set-theoretic relations. On dependent type theory, we use type-theoretic relations, namely binary type families. For a binary type family x : A,x′ : A′ ⊢ A(x,x′) type, a family on A is a triple of x : A ⊢ B(x) type, x′ : A′ ⊢ B′(x′) type and x : A,x′ : A′,x¯ : A(x,x′),y : B(x),y′ : B′(x′) ⊢ B(x¯,y,y′) type, written x¯ : A ⊢ B(x¯) rel in short. Note that B depends on x : A and x′ : A′ implicitly. Letx¯ :A ⊢ B(x¯)relbeafamilyonabinarytypefamilyA. Thedependent product of B over A is the binary type family f :YB(x),f′ : Y B′(x′)⊢ Y Y Y B(x¯,fx,f′x′) type. x:A x′:A′ x:Ax′:A′x¯:A(x,x′) The dependent sum of B over A is the binary type family z : XB(x),z′ : X B′(x′)⊢ X B(x¯,pr2(z),pr2(z′)) type. x:A x′:A′ x¯:A(pr1(z),pr1(z′)) For a binary type family A, the path space of A is the family x : A,x′ :A′,x¯ :A(x ,x′),x :A,x′ :A′,x¯ :A(x ,x′), 0 0 0 0 0 1 1 1 1 1 p : x = x ,p′ :x′ = x′ ⊢ x¯ = x¯ type 0 1 0 1 0 hp,p′i 1 on two copies of A. A universe of binary type families is a binary type family X :U,X′ :U ⊢ X → X′ → U type where ⊢ U type is a universe of types. 4 For each type constant C (for example, 0, 1, 2, N, S1, S2 and so on), we associate it with a binary type family c : C,c′ : C ⊢ c = c′ type. Then, by induction, we can associate each type family x : X ⊢ A(x) type with a family of binary type families x :X,x′ : X,x¯ :R[X](x,x′),a : A(x),a′ :A(x′)⊢ R[A](x¯,a,a′) type. Now relational parametricity can be described as follows: Theorem (Relational Parametricity). For each term x : X ⊢ t(x) : A(x), there exists a term x :X,x′ :X′,x¯ :R[X](x,x′)⊢ tˆ(x¯) :R[A](x¯,t(x),t(x′)). In particular, for each closed term ⊢t : A, there exists a closed term ⊢ tˆ:R[A](t,t). 4 Relational Parametricity Applied 4.1 Concatenation of a Loop Let t be a closed term of type t : Y Yx = x → x = x. X:Ux:X One might guess that t is an iterated concatenation of a loop, that is, t(p) ≡ p·...·p |nt{imzes} for a fixed integer n, where negative n means (−n) times concatenation of the inversion of p. One might be able to find another function, but as long as t is a closed term of this type, we can derive a theorem that t satisfies. We show that the type Y Y Y Y t(fp)= f(tp) X,X′:Uf:X→X′x:Xp:x=x 5 is inhabited. From relational parametricity we have a closed term tˆ: Y Y (X:U,X′:U,X:X→X′→U)(x:X,x′:X′,x¯:X(x,x′)) Y x¯ =htp,tp′i x¯. (p:x=x,p′:x′=x′,p¯:x¯=hp,p′ix¯) For a function f : X → X′ of U-small types, let X(x,x′) ≡ fx = x′. One can prove that, forp : x = x, p′ : x′ = x′ and x¯ : fx= x′, thetype x¯ = x¯ hp,p′i is equivalent to the type x¯·p′ = fp·x¯. Letting x′ ≡ fx and x¯ ≡ refl , we fx have an inhabitant of the type Y tp′ = f(tp). (p:x=x,p′:fx=fx,p¯:p′=fp) Finally we set p′ ≡ fp and p¯ ≡ refl . Then we have an inhabitant of the fp type Y Y t(fp)= f(tp). x:Xp:x=x 4.2 Loop Operations The example in Section 4.1 can be generalized. Let n and k be natural numbers and t a closed term of type t : Y YΩn(X,x) → Ωk(X,x). X:Ux:X TheexampleinSection4.1isthecasewheren = k = 1. Thistyperepresents the k-th loop space of n-sphere, discussed in Section 5, and thus we could not guess what function t is. However, we can derive a theorem about t. We show that the type Y Y Y Y t(fp)= f(tp) X,X′:Uf:X→X′x:Xp:Ωn(X,x) is inhabited. From relational parametricity we have a closed term tˆ: Y Y (X:U,X′:U,X:X→X′→U)(x:X,x′:X′,x¯:X(x,x′)) Y Ωkhtp,tp′i(X,x¯). (p:Ωn(X,x),p′:Ωn(X,x′),p¯:Ωn (X,x¯)) hp,p′i 6 reflx′ reflfx fx x¯ x′ refl2x′ p′ refl2x′ x′ = fx refl2fx fp refl2fx fx x¯ x′ reflx′ reflfx Figure 1: The type x¯· p′ = fp· x¯ in case n = 3 l r For a function f : X → X′ of U-small types, let X(x,x′) ≡ fx = x′. One can prove that, for p : Ωn(X,x), p′ : Ωn(X,x′) and x¯ : fx = x′, the type Ωn (X,x¯) is equivalent to the type x¯ · p′ = fp · x¯, Letting x′ ≡ fx, hp,p′i l r x¯ ≡refl , p′ ≡ fp and p¯≡ refl , we have an inhabitant of the type fx fp Y Y t(fp)= f(tp). x:Xp:Ωn(X,x) 4.3 Action on Loops Let t be a closed term of type t : Y Y Yx = x → fx = fx. X,Y:Uf:X→Y x:X One might guess that t(f,p) ≡ ap(f,p). Of course, t could be another function, forexample, t(f,p) ≡ ap(f,p·p). However, intuitively onlyap(f,p) is an interesting function of this type, because ap(f,p·p) is a composition of ap(f,p) and a loop concatenation, and the latter does not use f. Let us to formulate this intuition. We show that the type Y Y Y Y t(f,p)= f(t(idX,p)) X,Y:Uf:X→Y x:Xp:x=x is inhabited. This means that, for any t, t(f,−) is a composition of ap(f,−) after a loop operation t(id ,−) : x = x → x = x. From relational para- X metricity we have an inhabitant of the type Y Y Y Y Y Y X′,X,Y′,Y:Ug:X′→Xh:Y′→Y f′:X′→Y′f:X→Y σ:Qx′:X′f(gx′)=h(f′x′) Y Y t(f,gp′)·σ(x′)= σ(x′)·h(t(f′,p′)). x′:X′p′:x′=x′ 7 Letting X′ ≡ Y′ ≡ X, h ≡ f, f′ ≡ g ≡ id and σ ≡ λx.refl , we have X fx Y Y Y Y t(f,p) = f(t(idX,p)). X,Y:Uf:X→Y x:Xp:x=x Note that, from Section 4.1, we also have f(t(id ,p)) = t(id ,fp). X Y 4.4 An Embedding For a type A : U, let A˜ ≡ (A → X) → X. There are back and forth QX:U functions between the types A and A˜ as follows: i: A→ Y(A → X) → X X:U i≡ λ(a : A).λ(X : U,g : A→ X).ga j : (Y(A → X) → X) → A X:U j ≡ λ(ϕ : Y(A→ X) → X).ϕA(idA). X:U Clearly j ◦ i ≡ id , while i ◦ j ≡ id or even i ◦ j ∼ id does not hold. A A˜ A˜ However, given a closed term t :A˜, we can construct a closed term of type Y Y (i(jt))g = tg. X:Ug:A→X To show this, let t : A˜ be a closed term. From relational parametricity we can get a closed term of type Y Y Y f(tg) = t(f ◦g). X0,X:Uf:X0→Xg:A→X0 If X ≡ A, letting g ≡ id we get an inhabitant of the type f(t(id )) = t(f). 0 A A Now, for X : U and g : A→ X, we have (i(jt))g = g(jt) = g(t(id )) =t(g). A 4.5 An ∞-Connected Map For a type A, let π (A) be the set of homotopy equivalence classes of closed 0 termsofAwhichwecallthe0-th homotopy group of A. Forapointa : Aand a natural number n, the n-the homotopy group of A at a, written π (A,a), n is the set π (Ωn(A,a)). From Section 4.4, we get a bijection π (A) → π (A˜). 0 0 0 We can extend this result to all homotopy groups. We show that i :A → A˜ 8 is ∞-connected in the sense that it induces a bijection between the n-th homotopy groups for each n ≥ 0. For a pointed types (A,a) : U , A˜ has a base point a˜ ≡λ(X :U,g : A→ • X).ga. The maps i and j preserve base points, and thus they induce maps Ωn(i) : Ωn(A,a) → Ωn(A˜,a˜) and Ωn(j) : Ωn(A˜,a˜) → Ωn(A,a). Identifying Ωn(A˜,a˜) with Ωn(X,ga), we get: QX:U Qg:A→X Ωn(i) :Ωn(A,a) → Y Y Ωn(X,ga) X:Ug:A→X Ωn(i) = λ(p : Ωn(A,a)).λ(X : U,g : A→ X).gp Ωn(j) :( Y Ωn(X,ga)) → Ωn(A,a) X:U,g:A→X Ωn(j) = λ(ϕ : Y Y Ωn(X,ga)).ϕA(idA). X:Ug:A→X Then we have Ωn(j)◦Ωn(i) = id . For a closed term t : Ωn(A˜,a˜), we Ωn(A,a) can construct a closed term of type Y Y (Ωn(i)(Ωn(j)t))g = tg X:Ug:A→X in a similar way to Section 4.4. Thus we conclude that the map i induces a bijection π (A,a) → π (A˜,a˜) n n for each n ≥ 0. 5 Homotopy Groups FromSection4.5,foreachtypeA:U wehavean∞-connectedmapi :A → A˜ where A˜ ≡ (A → X) → X. For a concrete (higher) inductive type A, QX:U using the recursion principle of A we have an impredicative definition of A which can be defined without univalence or higher inductive types. If A has a base point a :A, an impredicative definition of A is of the form 0 Y YFA(X,x) → X X:Ux:X and its n-th loop space is Y YFA(X,x) → Ωn(X,x), X:Ux:X 9 where F (X,x) is a type defined from X and x using only dependent prod- A ucts, dependent sums and path spaces. An impredicative definition of a type A suggests that we can construct generators of homotopy groups of A without univalence or higher inductive types, although we need univalence and higher inductive types to prove that they are actually generators of homotopy groups. In this section we describe impredicative definitions of some higher in- ductive types. We also define a Hopf fibration and give a generator of the third homotopy group of 2-sphere in an impredicative style. 5.1 Pushouts Let f : C → A and g : C → B be functions. The pushout A B of f and `C g is a higher inductive type generated by two point constructors inl : A → A B and inr :B → A B and a path constructor glue : inl(fz)= `C `C Qz:C inr(gz). It has a recursion principle AaB → X ≃ X X Ys(fz)= t(gz). C s:A→Xt:B→Xz:C Therefore ^ AaB ≃ Y Y Y (Ys(fz)= t(gz)) → X. C X:Us:A→Xt:B→X z:C 5.2 Suspensions For a type A, the suspension ΣA of A is the pushout of two copies of the unique map A→ 1. Therefore ΣA ≃ Y Y (A→ x = y)→ X. g X:Ux,y:X We set N ≡ inl(∗) and S ≡ inr(∗) where ∗ : 1 is the constructor of 1. 5.3 Joins For types A and B, the join A⋆B of A and B is the pushout of projections A×B → A and A×B → B. Therefore ^ A⋆B ≃ Y Y Y (YYsa= tb) → X. X:Us:A→Xt:B→X a:Ab:B 10

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.