<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Homotopy Type Theory</title>
	<atom:link href="http://homotopytypetheory.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://homotopytypetheory.org</link>
	<description></description>
	<lastBuildDate>Mon, 17 Jun 2013 17:03:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='homotopytypetheory.org' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/1dd72ffcda1a3681f8159486bb9bbe58?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Homotopy Type Theory</title>
		<link>http://homotopytypetheory.org</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://homotopytypetheory.org/osd.xml" title="Homotopy Type Theory" />
	<atom:link rel='hub' href='http://homotopytypetheory.org/?pushpress=hub'/>
		<item>
		<title>Homotopy Theory in Type Theory: Progress Report</title>
		<link>http://homotopytypetheory.org/2013/05/20/homotopy-theory-in-type-theory-progress-report/</link>
		<comments>http://homotopytypetheory.org/2013/05/20/homotopy-theory-in-type-theory-progress-report/#comments</comments>
		<pubDate>Mon, 20 May 2013 15:02:59 +0000</pubDate>
		<dc:creator>Dan Licata</dc:creator>
				<category><![CDATA[Higher Inductive Types]]></category>
		<category><![CDATA[Homotopy Theory]]></category>

		<guid isPermaLink="false">http://homotopytypetheory.org/?p=1736</guid>
		<description><![CDATA[A little while ago, we gave an overview of the kinds of results in homotopy theory that we might try to prove in homotopy type theory (such as calculating homotopy groups of spheres), and the basic tools used in our synthetic approach &#8230; <a href="http://homotopytypetheory.org/2013/05/20/homotopy-theory-in-type-theory-progress-report/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homotopytypetheory.org&#038;blog=21082110&#038;post=1736&#038;subd=hottheory&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><span style="line-height:1.5;">A little while ago, we gave an </span><a style="line-height:1.5;" title="Homotopy Theory in Homotopy Type Theory: Introduction" href="http://homotopytypetheory.org/2013/03/08/homotopy-theory-in-homotopy-type-theory-introduction/">overview</a><span style="line-height:1.5;"> of the kinds of results in homotopy theory that we might try to prove in homotopy type theory (such as calculating homotopy groups of spheres), and the basic tools used in our synthetic approach to the subject (such as univalence and higher inductive types).   The big open questions are: How much homotopy theory can one do in this synthetic style? And, how hard is it to work in this style, and to give computer-checked proofs of these results?</span></p>
<p><span style="line-height:1.5;">Thus far, our results have been quite encouraging on both of these fronts: </span>We&#8217;ve done a significant swath of basic homotopy theory synthetically, including calculations of  π<sub>n</sub>(S<sup>n</sup>),  π<sub>3</sub>(S<sup>2</sup>),  and π<sub>4</sub>(S<sup>3</sup>); proofs of the Freudenthal suspension theorem, the Blakers-Massey theorem, and van Kampen&#8217;s theorem; a construction of Eilenberg-Mac Lane spaces; and a development of the theory of covering spaces.  We&#8217;ve given computer-checked proofs for almost all of these results, and the process has been quite pleasant and fun.  Lengthwise, the computer-checked proofs are comparable with, and in some cases shorter than, the same proof written out in a traditional style.    Moreover, the proofs have involved a blend of classical homotopy theoretic ideas and type theoretic ideas.  While most of what we have done is to give<span style="line-height:1.5;"> new proofs of existing results, these techniques have started to lead to new results, such as a proof of the Blakers-Massey theorem in general ∞-topoi (which we gave by translating the type-theoretic proof).  Additionally, w</span><span style="line-height:1.5;">e have one example (π<sub>4</sub>(S<sup>3</sup>)) illustrating the promise of the constructive aspects of homotopy type theory.  Finally, these proofs have furthered our understanding of the computational aspects of homotopy type theory, </span>particularly about computing with higher identity types.</p>
<p>This post will describe the results that we&#8217;ve gotten so far&#8212;particularly this spring, during the special year at IAS.  This was a big collaborative effort: many people contributed to it, by being the principal author of a proof or formalization, by suggesting problems to work on, by giving feedback on results, or by contributing to discussions and seminars. <span style="line-height:1.5;">When the spring IAS term started on January 14th, we had a</span><a style="line-height:1.5;" title="A formal proof that π₁(S¹)=Z" href="http://homotopytypetheory.org/2011/04/29/a-formal-proof-that-pi1s1-is-z/"> proof that π<sub>1</sub>(S<sup>1</sup>) is Z and that π<sub>k</sub>(S<sup>1</sup>) is trivial otherwise</a><span style="line-height:1.5;"> (by Mike Shulman), and a proof that π<sub>k</sub>(S<sup>n</sup>) is trivial for k&lt;n (by Guillaume Brunerie).  Here&#8217;s what that looks like in the chart of homotopy groups of spheres:</span></p>
<p><a href="http://hottheory.files.wordpress.com/2013/05/screen-shot-2013-05-15-at-10-03-35-am.png"><img class="alignnone size-full wp-image-1747" alt="homotopygroups-jan.png" src="http://hottheory.files.wordpress.com/2013/05/screen-shot-2013-05-15-at-10-03-35-am.png?w=640"   /></a></p>
<p>And, here&#8217;s what we had proved about homotopy groups of spheres by the end of the term (we&#8217;ll explain the grey/white highlights below):</p>
<p><a href="http://hottheory.files.wordpress.com/2013/05/screen-shot-2013-05-10-at-12-01-45-pm.png"><img class="alignnone size-large wp-image-1739" alt="Screen shot 2013-05-10 at 12.01.45 PM" src="http://hottheory.files.wordpress.com/2013/05/screen-shot-2013-05-10-at-12-01-45-pm.png?w=640&#038;h=360" width="640" height="360" /></a></p>
<p>Let&#8217;s go through the theorems that fill in this table:</p>
<ul>
<li><span style="line-height:1.5;">In the first row, S<sup>0</sup> is the booleans, so these calculations follow from <a title="A direct proof of Hedberg’s theorem" href="http://homotopytypetheory.org/2012/03/30/a-direct-proof-of-hedbergs-theorem/">Hedberg&#8217;s theorem</a>, which entails that the booleans are a set.<br />
</span></li>
<li>In the second row, S<sup>1</sup> is the circle.  Our calculation of this row consists of showing that the  loop space of the circle (Ω(S<sup>1</sup>)) is Z: Applying truncation to both sides shows that  π<sub>1</sub>(S<sup>1</sup>) is Z.  Moreover, because the higher homotopy groups of a type are constructed from the loop space of that type, we get that that the higher homotopy groups of the circle are the same as the higher homotopy groups of Z, and therefore trivial, again because Z is a set.<br />
We have a few different proofs that Ω(S<sup>1</sup>) is Z.  The <a title="A formal proof that π₁(S¹)=Z" href="http://homotopytypetheory.org/2011/04/29/a-formal-proof-that-pi1s1-is-z/">first</a> (by Mike Shulman), follows a standard homotopy-theoretic argument, showing that the total space of the universal cover of the circle is contractible.  Another (by Guillaume Brunerie) shortens the original proof significantly, by factoring some of the reasoning out into a <em>flattening lemma</em> about total spaces of fibrations defined by recursion on higher inductives.  <a title="A Simpler Proof that π₁(S¹) is Z" href="http://homotopytypetheory.org/2012/06/07/a-simpler-proof-that-%cf%80%e2%82%81s%c2%b9-is-z/">Another proof </a>(by Dan Licata) avoids calculating the total space of the cover, instead relying on calculations using the definition of the cover by circle recursion.  The template introduced in this proof is now known as <a href="http://www.cs.cmu.edu/~drl/pubs/ls13pi1s1/ls13pi1s1.pdf">the encode-decode method</a>.</li>
<li>The all-0 diagonals (the colored diagonals below the π<sub>n</sub>(S<sup>n</sup>) diagonal) state that π<sub>k</sub>(S<sup>n</sup>) is trivial for k&lt;n.  We have a few different proofs of this now.  In fact, we have two definitions of the n-sphere (which should coincide, but we haven&#8217;t proved this yet). The first is by induction on n: S<sup>1</sup> is the circle, and the (n+1)-sphere is the <a href="https://en.wikipedia.org/wiki/Suspension_(topology)">suspension</a> of the n-sphere.  The second uses a fancy form of higher inductive types: First, we define the n-fold iterated loop space of a type, Ω<sup>n</sup>(A), by induction on n. Then, we define the n-sphere to be a higher inductive type with one point and one element of Ω<sup>n</sup>.  The circle is generated by a point and a single 1-dimensional loop; the 2-sphere by a single point and a single 2-dimensional loop, and so on.  This form of higher-inductive type is a bit unusual (and has not been formally studied): for each instantiation of n, the n-loop constructor is an element of a path type of S<sup>n</sup>, but the level of iteration of the path type depends on n, and when n is a variable, Ω<sup>n</sup> is not syntactically a path type.  However, the fact that the homotopy groups have come out right so far provides some indication that this is a sensible notion.<br />
The first proof of π<sub>k&lt;n</sub>(S<sup>n</sup>) (by Guillaume Brunerie), for the suspension definition of the spheres, uses a <a href="http://en.wikipedia.org/wiki/N-connected">connectedness</a> argument.  The second (by Dan Licata), for the iterated-loop-space definition, uses the encode-decode method.  A third (by Dan Licata) uses a connectedness argument for π<sub>1</sub> and then uses the Freudenthal suspension theorem (see below) to induct up.</li>
<li>For a long time after the first proof of π<sub>1</sub>(S<sup>1</sup>) in spring 2011, we were stuck on calculating any non-trivial higher homotopy groups.  The thing that really broke the dam open on these was a proof of π<sub>2</sub>(S<sup>2</sup>) (by Guillaume Brunerie), which goes by way of proving that the total space of the Hopf fibration (as constructed by Peter Lumsdaine) is S<sup>3</sup>.  This gives π<sub>2</sub>(S<sup>2</sup>), and also implies that π<sub>k</sub>(S<sup>2</sup>) = π<sub>k</sub>(S<sup>3</sup>), for k&gt;=3. Because we have now calculated π<sub>3</sub>(S<sup>3</sup>) (see below), this gives π<sub>3</sub>(S<sup>2</sup>) = Z.  Because we have now calculated most of  π<sub>4</sub>(S<sup>3</sup>) (see below; the &#8220;most of&#8221; disclaimer is why these squares are shaded white in the table), this gives most of π<sub>4</sub>(S<sup>2</sup>).  The grey shading on the remainder of the S<sup>2</sup>/S<sup>3</sup> rows indicates that while we have not calculated any of these groups, we know that the two rows are equal.<br />
The calculation of the total space of the Hopf fibration has proved difficult to formalize, because a key lemma requires some significant path algebra.  However, only a couple of days after the first proof of π<sub>2</sub>(S<sup>2</sup>), we had a computer-checked one (by Dan Licata), using the encode-decode method, with the Hopf fibration playing the same role that the universal cover plays for S<sup>1</sup>.  This proof bypasses showing that the total space of the Hopf fibration is S<sup>3</sup>, so it doesn&#8217;t give all the nice corollaries mentioned above.  But it also illustrates that type theory can lead to shorter and more &#8220;beta-reduced&#8221; proofs of these theorems.  This proof was for the iterated-loop-space definition of S<sup>2</sup>, but we eventually developed an encode-decode proof (also by Dan Licata) for the suspension definition.</li>
<li><span style="line-height:1.5;">Next, we have the π<sub>n</sub>(S<sup>n</sup>) = Z diagonal.  The proof is by induction on n, using π<sub>1</sub>(S<sup>1</sup>) in the base case, and proving that π<sub>n</sub>(S<sup>n</sup>) = π<sub>n+1</sub>(S<sup>n+1</sup>) in the inductive step. We have a couple of proofs of this.  The first (by Dan Licata and Guillaume Brunerie) is a generalization of the encode-decode proof of π<sub>2</sub>(S<sup>2</sup>).  It took about two weeks to develop and formalize the proof, much of which is a library exploring the type theory of iterated loop spaces.  The second proof, for the suspension definition of the spheres, uses the Freudenthal suspension theorem.<br />
</span></li>
<li>The Freudenthal suspension theorem gives the connectedness of the path constructor for suspensions.  It implies that all entries in the colored diagonals in the above chart are the same.   Therefore, it suffices to compute one entry in each diagonal.  We have done this for π<sub>k&lt;n</sub>(S<sup>n</sup>), for π<sub>n</sub>(S<sup>n</sup>), and for π<sub>n+1</sub>(S<sup>n</sup>) (shaded white).  The remaining diagonals are shaded grey because we have proved that all entries are the same, but we haven&#8217;t calculated any individual entry.<br />
<span style="line-height:1.5;">The proof of the Freudenthal suspension theorem (by Peter Lumsdaine; formalized by Dan Licata) is an interesting combination of the encode-decode method used in π<sub>n</sub>(S<sup>n</sup>) with the homotopy-theoretic notion of connectedness of maps and spaces.  Indeed, the tower of results going from π<sub>2</sub>(S<sup>2</sup>) to π<sub>n</sub>(S<sup>n</sup>) to Freudenthal really illustrates the promise of the interaction between homotopy theory and type theory: we started with a more homotopy-theoretic proof of π<sub>2</sub>(S<sup>2</sup>), which led to a more type-theoretic proof of π<sub>2</sub>(S<sup>2</sup>) (using the encode-decode method), which led to a more type-theoretic proof of π<sub>n</sub>(S<sup>n</sup>), which led to a proof of the Freudenthal suspension theorem that combines these type-theoretic aspects with some additional homotopy-theoretic ideas about connectedness.    </span></li>
<li><span style="line-height:1.5;">In the π<sub>n+1</sub>(S<sup>n</sup>) = Z<sub>2</sub> diagonal, we have a proof (by Guillaume Brunerie) that there exists a k such that π<sub>4</sub>(S<sup>3</sup>) = Z<sub>k</sub>, using the James construction.  This diagonal is shaded white because this isn&#8217;t quite the classical result: we should also check that k is 2.  However, this proof illustrates the promise of a computational interpretation of homotopy type theory: the proof is constructive, so to check that k is indeed 2, all we would need to do is run the program!</span></li>
</ul>
<p>In addition to homotopy groups of spheres, we have proved the following theorems:</p>
<ul>
<li>The Freudenthal suspension theorem gives information about spaces other than spheres.  For example, we have a construction (by Dan Licata) of Eilenberg-Mac Lane spaces K(G,n), which are a basic building block that can be used to construct spaces up to homotopy equivalence.  For an abelian group G, K(G,n) is a space whose nth homotopy group is G, and whose other homotopy groups are trivial; for example, K(Z,n) is equivalent to the n-truncation of the n-sphere. We first construct K(G,1), and then construct K(G,n) by suspending K(G,1) and truncating.  The proof that it has the right homotopy groups uses the Freudenthal suspension theorem, generalizing the proof from Freudenthal that π<sub>n</sub>(S<sup>n</sup>) = Z.</li>
<li><span style="line-height:1.5;">The Freudenthal suspension theorem gives the connectivity of the path constructor of a suspension.  A generalization of suspensions is the notion of a <em>pushout</em>, and the generalization of Freudenthal to pushouts is the Blakers-Massey theorem.   We have a proof of Blakers-Massey (by Peter Lumsdaine, Eric Finster, and Dan Licata; formalized by Favonia).  We have also translated this proof to the language of  ∞-topoi, which proves the result in a more general setting than was previously known.  </span></li>
<li><span style="line-height:1.5;">van Kampen&#8217;s theorem characterizes the fundamental group of a pushout.  We have a proof (by Mike Shulman; formalized by Favonia) using the encode-decode method.  </span></li>
<li><span style="line-height:1.5;">To calculate π<sub>1</sub>(S<sup>1</sup>), we used the universal cover of the circle.  This is an instance of a  general notion of covering spaces, and the fact that covering spaces of a space correspond to actions by its fundamental group.  Favonia<a title="Covering Spaces" href="http://homotopytypetheory.org/2013/04/27/covering-spaces/"> formulated and formalized the theory of covering spaces.</a></span></li>
</ul>
<p>You can find out more about these results in the following places:</p>
<ol>
<li>Many of these results are written up in an informal style in the forthcoming <a href="http://homotopytypetheory.org/book/">book</a>  <em>Homotopy Type Theory: Univalent Foundations of Mathematics</em></li>
<li>There are many videos of talks on these results:
<ul>
<li>A good place to start is this <a href="http://video.ias.edu/univalent/1213/0411-HomotopyGroup">end-of-the-term lecture</a> summarizing the results.</li>
<li><a href="http://video.ias.edu/members/licata2012Nov26">A Computer-Checked Proof that pi_1(S^1) is Z</a></li>
<li><a href="http://video.ias.edu/univalent/1213/0213-PeterLumsdaine">The Hopf Fibration via Higher Inductive Types</a></li>
<li><a href="http://video.ias.edu/univalent/1213/0220-GuillaumeBrunerie">pi_2(S^2) in HoTT</a></li>
<li><a href="http://video.ias.edu/univalent/1213/0327-GuillaumeBrunerie">The James Construction and pi_4(S^3)</a></li>
<li><a href="http://video.ias.edu/univalent/1213/0313-DanielLicata">Eilenberg-Mac Lane Spaces in HoTT</a></li>
<li><a style="line-height:1.5;" href="http://video.ias.edu/univalent/1213/0306-EricFinster">Cohomology in Homotopy Type Theory</a></li>
<li><a href="http://video.ias.edu/univalent/1213/0228-JeremyAvigad">Formal Abstract Homotopy Theory</a></li>
<li><a href="http://video.ias.edu/univalent/shulman">Toward Higher Inductive Types</a></li>
<li><a style="line-height:1.5;" href="http://video.ias.edu/univalent/1213/0227-MichaelShulman">Semantics of Higher Inductive Types</a></li>
</ul>
</li>
<li>Some individual results/tools have been written up:
<ul>
<li>For π<sub>1</sub>(S<sup>1</sup>), see these <a href="http://homotopytypetheory.org/2011/04/29/a-formal-proof-that-pi1s1-is-z/">blog</a> <a href="http://homotopytypetheory.org/2012/06/07/a-simpler-proof-that-%CF%80%E2%82%81s%C2%B9-is-z/">posts</a>, and this <a href="http://www.cs.cmu.edu/~drl/pubs/ls13pi1s1/ls13pi1s1.pdf">paper</a>.</li>
<li><a title="Covering Spaces" href="http://homotopytypetheory.org/2013/04/27/covering-spaces/">Covering spaces</a></li>
<li><a href="http://homotopytypetheory.org/2011/04/24/higher-inductive-types-a-tour-of-the-menagerie/">Higher inductive types</a></li>
<li><a href="http://homotopytypetheory.org/2011/04/23/running-circles-around-in-your-proof-assistant/">How to fake higher inductive types in current proof assistants</a></li>
<li><a title="Truncations and truncated higher inductive types" href="http://homotopytypetheory.org/2012/09/16/truncations-and-truncated-higher-inductive-types/">Truncations</a></li>
</ul>
</li>
<li>All of the computer-checked proofs are available online; see <a href="https://github.com/dlicata335/hott-agda">here</a> and <a href="https://github.com/hott/hott-agda/">here</a> and <a href="https://github.com/hott/hott">here</a>.  This<a href="http://uf-ias-2012.wikispaces.com/Formalized+Homotopy+Theory"> wiki page </a>has pointers to specific results.</li>
</ol>
<p>Finally, there is a lot of low-hanging fruit left to pick!  If you are interested in getting involved, leave a comment, or send an email to someone mentioned above (or to the HomotopyTypeTheory google group).</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hottheory.wordpress.com/1736/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hottheory.wordpress.com/1736/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homotopytypetheory.org&#038;blog=21082110&#038;post=1736&#038;subd=hottheory&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://homotopytypetheory.org/2013/05/20/homotopy-theory-in-type-theory-progress-report/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1e738b846c701c46496dd96614d52a9a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">daniellicata</media:title>
		</media:content>

		<media:content url="http://hottheory.files.wordpress.com/2013/05/screen-shot-2013-05-15-at-10-03-35-am.png" medium="image">
			<media:title type="html">homotopygroups-jan.png</media:title>
		</media:content>

		<media:content url="http://hottheory.files.wordpress.com/2013/05/screen-shot-2013-05-10-at-12-01-45-pm.png?w=640" medium="image">
			<media:title type="html">Screen shot 2013-05-10 at 12.01.45 PM</media:title>
		</media:content>
	</item>
		<item>
		<title>Universe n is not an n-Type</title>
		<link>http://homotopytypetheory.org/2013/05/15/universe-n-is-not-an-n-type/</link>
		<comments>http://homotopytypetheory.org/2013/05/15/universe-n-is-not-an-n-type/#comments</comments>
		<pubDate>Wed, 15 May 2013 17:18:00 +0000</pubDate>
		<dc:creator>Nicolai Kraus</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Foundations]]></category>
		<category><![CDATA[Talk]]></category>
		<category><![CDATA[Univalence]]></category>

		<guid isPermaLink="false">http://homotopytypetheory.org/?p=1611</guid>
		<description><![CDATA[Joint work with Christian Sattler Some time ago, at the UF Program in Princeton, I presented a proof that Universe n is not an n-type. We have now formalized that proof in Agda and want to present it here. One &#8230; <a href="http://homotopytypetheory.org/2013/05/15/universe-n-is-not-an-n-type/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homotopytypetheory.org&#038;blog=21082110&#038;post=1611&#038;subd=hottheory&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Joint work with Christian Sattler</p>
<p>Some time ago, at the UF Program in Princeton, I presented a proof that Universe n is not an n-type. We have now <a href="http://red.cs.nott.ac.uk/~ngk/hierarchy/Hierarchy.html">formalized</a> that proof in Agda and want to present it here. </p>
<p>One of the most basic consequences of the univalence axiom is that the universe of types is not a set, i.e. does not have unique identity proofs. It is plausible to expect that the next universe <img src='http://s0.wp.com/latex.php?latex=U_1&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='U_1' title='U_1' class='latex' /> is not a groupoid, i.e. its path-spaces are not sets, but a proof of that is already surprinsingly difficult. </p>
<p>We prove the generalized statement, namely that <img src='http://s0.wp.com/latex.php?latex=U_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='U_n' title='U_n' class='latex' /> is not an n-type. At the same time, our construction yields, for a given <img src='http://s0.wp.com/latex.php?latex=n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n' title='n' class='latex' />, a type that is an <img src='http://s0.wp.com/latex.php?latex=%28n%2B1%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='(n+1)' title='(n+1)' class='latex' />-type but not an n-type. This answers one of the questions asked at the UF Program. The proof works in basic MLTT with <img src='http://s0.wp.com/latex.php?latex=%5CSigma&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;Sigma' title='&#92;Sigma' class='latex' />-, <img src='http://s0.wp.com/latex.php?latex=%5CPi&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;Pi' title='&#92;Pi' class='latex' />- and identity types as well as a sequence of universes. We need the uivalence axiom, but no other &#8220;HoTT-features&#8221;.</p>
<p>We also have a <a href="http://red.cs.nott.ac.uk/~ngk/universes.pdf">pdf version</a> of the proof.</p>
<p><img src="http://cs.nott.ac.uk/~ngk/universe-pictures/universe-level-0.png" style="width:107%;margin-left:-3.5%;margin-right:-3.5%;" /><br />
<img src="http://cs.nott.ac.uk/~ngk/universe-pictures/universe-level-1.png" style="width:107%;margin-left:-3.5%;margin-right:-3.5%;" /><br />
<img src="http://cs.nott.ac.uk/~ngk/universe-pictures/universe-level-2.png" style="width:107%;margin-left:-3.5%;margin-right:-3.5%;" /><br />
<img src="http://cs.nott.ac.uk/~ngk/universe-pictures/universe-level-3.png" style="width:107%;margin-left:-3.5%;margin-right:-3.5%;" /><br />
<img src="http://cs.nott.ac.uk/~ngk/universe-pictures/universe-level-4.png" style="width:107%;margin-left:-3.5%;margin-right:-3.5%;" /><br />
<img src="http://cs.nott.ac.uk/~ngk/universe-pictures/universe-level-5.png" style="width:107%;margin-left:-3.5%;margin-right:-3.5%;" /></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hottheory.wordpress.com/1611/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hottheory.wordpress.com/1611/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homotopytypetheory.org&#038;blog=21082110&#038;post=1611&#038;subd=hottheory&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://homotopytypetheory.org/2013/05/15/universe-n-is-not-an-n-type/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/ec0c7b6933a2fb92d23f1e9aa5b920bf?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nicolaikraus</media:title>
		</media:content>

		<media:content url="http://cs.nott.ac.uk/~ngk/universe-pictures/universe-level-0.png" medium="image" />

		<media:content url="http://cs.nott.ac.uk/~ngk/universe-pictures/universe-level-1.png" medium="image" />

		<media:content url="http://cs.nott.ac.uk/~ngk/universe-pictures/universe-level-2.png" medium="image" />

		<media:content url="http://cs.nott.ac.uk/~ngk/universe-pictures/universe-level-3.png" medium="image" />

		<media:content url="http://cs.nott.ac.uk/~ngk/universe-pictures/universe-level-4.png" medium="image" />

		<media:content url="http://cs.nott.ac.uk/~ngk/universe-pictures/universe-level-5.png" medium="image" />
	</item>
		<item>
		<title>Covering Spaces</title>
		<link>http://homotopytypetheory.org/2013/04/27/covering-spaces/</link>
		<comments>http://homotopytypetheory.org/2013/04/27/covering-spaces/#comments</comments>
		<pubDate>Sun, 28 Apr 2013 00:56:41 +0000</pubDate>
		<dc:creator>favonia</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Higher Inductive Types]]></category>
		<category><![CDATA[Homotopy Theory]]></category>

		<guid isPermaLink="false">http://homotopytypetheory.org/?p=1571</guid>
		<description><![CDATA[Covering spaces are one of the important topics in classical homotopy theory, and this post summarizes what we have done in HoTT.  We have formulated the covering spaces and (re)proved the classification theorem based on (right) -sets, i.e., sets equipped with &#8230; <a href="http://homotopytypetheory.org/2013/04/27/covering-spaces/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homotopytypetheory.org&#038;blog=21082110&#038;post=1571&#038;subd=hottheory&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Covering spaces are one of the important topics in classical homotopy theory, and this post summarizes what we have done in HoTT.  We have formulated the covering spaces and (re)proved the classification theorem based on (right) <img src='http://s0.wp.com/latex.php?latex=%5Cpi_1%28X%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;pi_1(X)' title='&#92;pi_1(X)' class='latex' />-sets, i.e., sets equipped with (right) group actions of the fundamental group <img src='http://s0.wp.com/latex.php?latex=%5Cpi_1%28X%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;pi_1(X)' title='&#92;pi_1(X)' class='latex' />.  I will explain the definition and why we need some constancy factorization trick in the proof.</p>
<h1>Definition</h1>
<p>So, what are covering spaces in HoTT?  The core ingredient of covering spaces is a fibration, which is easy in HoTT, because every function or dependent type in HoTT can be viewed as a fibration (up to homotopy).  The only problem is the possible higher structures accidentally packed into the space (which are usually handled separately in classical homotopy theory).  To address this, we have another condition that each fiber is a set.  These two conditions together match the classical definition.  More precisely, given a base space <img src='http://s0.wp.com/latex.php?latex=X&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='X' title='X' class='latex' />, a covering is a mapping <img src='http://s0.wp.com/latex.php?latex=f&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='f' title='f' class='latex' /> from <img src='http://s0.wp.com/latex.php?latex=X&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='X' title='X' class='latex' /> to some universe (or, a type family indexed by <img src='http://s0.wp.com/latex.php?latex=X&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='X' title='X' class='latex' />) where for each <img src='http://s0.wp.com/latex.php?latex=x+%5Cin+X&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='x &#92;in X' title='x &#92;in X' class='latex' /> we know <img src='http://s0.wp.com/latex.php?latex=f%28x%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='f(x)' title='f(x)' class='latex' /> is a set.</p>
<p>One can also formulate coverings as mappings instead of type families.  I personally prefer the latter because they seem easier to work with in type theory.  Note that we did not assert that the base space <img src='http://s0.wp.com/latex.php?latex=X&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='X' title='X' class='latex' /> is path-connected or pointed, which are required by interesting theorems (ex: the classification theorem) but not by the definition.</p>
<h1>Classification Theorem</h1>
<p>The classification theorem says there is an isomorphism between <img src='http://s0.wp.com/latex.php?latex=%5Cpi%28X%2Cx_0%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;pi(X,x_0)' title='&#92;pi(X,x_0)' class='latex' />-set and covering spaces.  Here we assume <img src='http://s0.wp.com/latex.php?latex=X&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='X' title='X' class='latex' /> is path-connected and pointed (based) at <img src='http://s0.wp.com/latex.php?latex=x_0+%5Cin+X&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='x_0 &#92;in X' title='x_0 &#92;in X' class='latex' />.</p>
<p>The direction from covering spaces to <img src='http://s0.wp.com/latex.php?latex=%5Cpi%28X%2Cx_0%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;pi(X,x_0)' title='&#92;pi(X,x_0)' class='latex' />-sets is easier, since the set can simply be the fiber over the point <img src='http://s0.wp.com/latex.php?latex=x_0&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='x_0' title='x_0' class='latex' />, and the group action can be defined as transporting along an element in the homotopy group.  The other direction is more challenging, requiring an explicit construction of the covering space from the given <img src='http://s0.wp.com/latex.php?latex=%5Cpi%28X%2Cx_0%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;pi(X,x_0)' title='&#92;pi(X,x_0)' class='latex' />-set.  Naturally, the fiber over <img src='http://s0.wp.com/latex.php?latex=x_0&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='x_0' title='x_0' class='latex' /> should be the underlying set, but what about other fibers?  For arbitrary point <img src='http://s0.wp.com/latex.php?latex=x&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='x' title='x' class='latex' /> in <img src='http://s0.wp.com/latex.php?latex=X&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='X' title='X' class='latex' />, due to the connectedness of the base space <img src='http://s0.wp.com/latex.php?latex=X&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='X' title='X' class='latex' />, there exists a (truncated) path from <img src='http://s0.wp.com/latex.php?latex=x_0&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='x_0' title='x_0' class='latex' /> to <img src='http://s0.wp.com/latex.php?latex=x&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='x' title='x' class='latex' />, which can be used to transport everything in the fiber over <img src='http://s0.wp.com/latex.php?latex=x_0&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='x_0' title='x_0' class='latex' /> to the fiber over <img src='http://s0.wp.com/latex.php?latex=x&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='x' title='x' class='latex' />.  However, unless the homotopy group is trivial, one needs to identify multiple copies produced by different paths.  We simply threw in gluing 1-cells and then made each fiber a set.</p>
<p>The above higher inductive type, which is called <code>ribbon</code> in the library, goes as follows:  It is parametrized by the <img src='http://s0.wp.com/latex.php?latex=%5Cpi%28X%2Cx_0%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;pi(X,x_0)' title='&#92;pi(X,x_0)' class='latex' />-set, the underlying set <img src='http://s0.wp.com/latex.php?latex=Y&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='Y' title='Y' class='latex' />, the group action <img src='http://s0.wp.com/latex.php?latex=%5Cbullet&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;bullet' title='&#92;bullet' class='latex' />, and the point <img src='http://s0.wp.com/latex.php?latex=x&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='x' title='x' class='latex' /> in focus.  The <code>trace</code> constructor &#8220;copies&#8221; everything from the fiber over <img src='http://s0.wp.com/latex.php?latex=x_0&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='x_0' title='x_0' class='latex' /> to the fiber over <img src='http://s0.wp.com/latex.php?latex=x&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='x' title='x' class='latex' /> along some path in the base type, and the <code>paste</code> constructor glues multiple copies made by different paths.</p>
<pre>data ribbon (Y : Set) (∙ : Action Y) (x : X) : Set where
  trace : Y → Truncated 0 (x₀ = x) → ribbon x
  paste : (y : Y) → (loop : Truncated 0 (x₀ = x₀))
        → (p : Truncated 0 (x₀ = x))
        → trace (y ∙ loop) p ≡ trace y (loop ∘ p)</pre>
<p>The most interesting part is to show that creating ribbons is left inverse to constructing <img src='http://s0.wp.com/latex.php?latex=G&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='G' title='G' class='latex' />-sets as mentioned in the beginning of the section.  It suffices to show that ribbons indeed form the original covering space, which is, by functional extensionality, equivalent to demonstrating that they are fiberwise equivalent.  The trouble is that, for a point <img src='http://s0.wp.com/latex.php?latex=x+%5Cin+X&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='x &#92;in X' title='x &#92;in X' class='latex' /> and a point <img src='http://s0.wp.com/latex.php?latex=y&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='y' title='y' class='latex' /> in the fiber of the input covering over <img src='http://s0.wp.com/latex.php?latex=x&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='x' title='x' class='latex' />, one needs a path <img src='http://s0.wp.com/latex.php?latex=x_0+%3D+x&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='x_0 = x' title='x_0 = x' class='latex' /> to even make one point in the ribbon; while we can get a <img src='http://s0.wp.com/latex.php?latex=%28-1%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='(-1)' title='(-1)' class='latex' />-truncated path out of the connectedness condition, the constructor requires a <img src='http://s0.wp.com/latex.php?latex=0&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='0' title='0' class='latex' />-truncated path.</p>
<p>The constancy comes to rescue!  It can be shown that, if there is a function <img src='http://s0.wp.com/latex.php?latex=f&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='f' title='f' class='latex' /> from <img src='http://s0.wp.com/latex.php?latex=A&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='A' title='A' class='latex' /> to a set <img src='http://s0.wp.com/latex.php?latex=B&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='B' title='B' class='latex' />, and <img src='http://s0.wp.com/latex.php?latex=f&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='f' title='f' class='latex' /> is constant, then <img src='http://s0.wp.com/latex.php?latex=f&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='f' title='f' class='latex' /> factors through <img src='http://s0.wp.com/latex.php?latex=%7CA%7C&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='|A|' title='|A|' class='latex' /> with ideal computational behaviors.  In our case, different points generated by different paths will be glued together by the <code>paste</code> constructor and moreover each fiber is a set.  Therefore we can apply this lemma to establish the fiberwise equivalence, and hence the theorem!</p>
<h1>Remarks</h1>
<p>We also proved that the homotopy group itself corresponds to the universal covering, where universality is defined as being simply-connected.  The <code>ribbon</code> construction, as an explicit description for covering spaces, comes in handy.  In addition, we calculated <img src='http://s0.wp.com/latex.php?latex=%5Cpi%28S%5E1%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;pi(S^1)' title='&#92;pi(S^1)' class='latex' /> (again) with the new library; however, even with aggressive Agda optimization, the complexity remains&#8212;one still needs to prove the contractibility of some covering of <img src='http://s0.wp.com/latex.php?latex=S%5E1&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='S^1' title='S^1' class='latex' /> for universality.  Perhaps there are other better examples which can show the real power of this isomorphism?</p>
<p>The Agda code is currently available at <a href="http://hott.github.io/HoTT-Agda/Homotopy.Cover.HomotopyGroupSetIsomorphism.html">http://hott.github.io/HoTT-Agda/Homotopy.Cover.HomotopyGroupSetIsomorphism.html</a> but we are rebuilding the whole library.  This link might not be valid after the migration.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hottheory.wordpress.com/1571/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hottheory.wordpress.com/1571/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homotopytypetheory.org&#038;blog=21082110&#038;post=1571&#038;subd=hottheory&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://homotopytypetheory.org/2013/04/27/covering-spaces/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/35961f534359442487dfe40aa03f2d47?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">favonia</media:title>
		</media:content>
	</item>
		<item>
		<title>Homotopy Theory in Homotopy Type Theory: Introduction</title>
		<link>http://homotopytypetheory.org/2013/03/08/homotopy-theory-in-homotopy-type-theory-introduction/</link>
		<comments>http://homotopytypetheory.org/2013/03/08/homotopy-theory-in-homotopy-type-theory-introduction/#comments</comments>
		<pubDate>Fri, 08 Mar 2013 18:39:31 +0000</pubDate>
		<dc:creator>Dan Licata</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[Higher Inductive Types]]></category>
		<category><![CDATA[Homotopy Theory]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Univalence]]></category>

		<guid isPermaLink="false">http://homotopytypetheory.org/?p=1502</guid>
		<description><![CDATA[Many of us working on homotopy type theory believe that it will be a better framework for doing math, and in particular computer-checked math, than set theory or classical higher-order logic or non-univalent type theory. One reason we believe this &#8230; <a href="http://homotopytypetheory.org/2013/03/08/homotopy-theory-in-homotopy-type-theory-introduction/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homotopytypetheory.org&#038;blog=21082110&#038;post=1502&#038;subd=hottheory&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Many of us working on homotopy type theory believe that it will be a better framework for doing math, and in particular computer-checked math, than set theory or classical higher-order logic or non-univalent type theory. One reason we believe this is the &#8220;convenience factor&#8221; provided by univalence: it saves you from doing a lot of tedious proofs that constructions respect equality.  When restricted to sets, univalence says that all constructions respect bijection, and this can be used to build algebraic structures in such a way that isomorphic structures are equal (e.g. equality of groups is group isomorphism), and therefore all constructions on structures automatically respect isomorphism. When restricted to 1-types, univalence can be used <a href="http://golem.ph.utexas.edu/category/2013/03/category_theory_in_homotopy_ty.html#more">to define categories in such a way that equivalent categories are equal, and therefore all constructions are non-evil</a>; moreover, these non-evil categories can coexist with a notion of strict category, which can be used when finer distinctions are necessary.  In these applications, one defines the mathematical entities in question in a more or less traditional manner (a group is a type equipped with a multiplication operation, etc.), and univalence provides some theorems for free about constructions on these entities.</p>
<p>However, another reason we believe that HoTT will be a better framework, at least for certain kinds of math, is that it provides a direct way of working with something called <em></em><em><a href="http://ncatlab.org/nlab/show/infinity-groupoid">∞-groupoids</a>.  </em>∞-groupoids<em> </em>are an infinite-dimensional generalization of the categorical notion of a groupoid (which is a category where every morphism is invertible).   Where a groupoid has just objects and morphisms, ∞-groupoids have objects, morphisms, morphisms between morphisms (2-morphisms), &#8230; all the way up.  ∞-groupoids are a complex structure: Morphisms at each level have identity, composition, and inverse operations, which are <em>weak </em>in the sense that they satisfy the groupoid laws (associativity of composition, identity is a unit for composition, inverses cancel) only up to the next level morphisms.  Because of weakness, it is quite difficult to describe all of the operations/properties of morphisms.  For example, because associativity of composition of morphisms (<em>p o (q o r) = (p o q) o r</em>) is itself a higher-dimensional morphism, one needs an additional operation relating <em>different proofs</em> of associativity; for example, the different ways to reassociate <em>p o (q o (r o s)) </em>into<em>  ((p o q) o r) o s  </em>give rise to <a href="http://en.wikipedia.org/wiki/Monoidal_category">Mac Lane&#8217;s pentagon</a>.  Weakness also creates non-trivial interactions between levels, such as the <a href="http://www.youtube.com/watch?v=DRGh-HESyag">middle-four interchange law</a>.</p>
<p>Now, the really cool thing about using HoTT to work with ∞-groupoids is  that you <strong>don&#8217;t</strong> start by defining &#8221;an <em>∞-groupoid is&#8230;</em>&#8220;<em> </em>like one would in any other framework&#8212;which is fortunate, because describing the structure of an ∞-groupoid in something like set theory is notoriously difficult, because of all the structure mentioned above.<em>  </em>Instead, you exploit the fact that every type in type theory <strong>is</strong> an ∞-groupoid, with the structure of morphisms, 2-morphism, 3-morphisms, &#8230; given by the identity type (&#8220;propositional equality&#8221;).</p>
<p>Eventually, we hope to show that you can do a lot of math in an elegant way by working directly with ∞-groupoids, but for now, the area that we have developed the most is <em>homotopy theory.  </em>I started<strong></strong><em><strong> </strong></em>writing<strong></strong><em><strong> </strong></em>an update on our recent progress doing homotopy theory in type theory, and realized that we didn&#8217;t have a post on the blog explaining the basics.  So this post will tell the basic story: what is homotopy theory?  How do we do it in type theory?  And later I&#8217;ll post an update with what we&#8217;ve been up to recently.</p>
<h3><em>Classical Homotopy Theory</em></h3>
<p><em><a href="http://en.wikipedia.org/wiki/Topology">Topology</a> </em>is the study of spaces up to continuous deformation.  <a href="http://en.wikipedia.org/wiki/Algebraic_topology"><em>Algebraic topology</em></a> is the use of tools from abstract algebra, like group theory, to tell whether two spaces are the same.  As a first cut, we can say that two spaces are &#8220;the same&#8221; when there is an isomorphism between them (continuous maps back and forth that compose to the identity), though we will refine this later.  For example, o<span style="line-height:1.5;">ne basic construction in algebraic topology is the <a href="http://en.wikipedia.org/wiki/Fundamental_group">fundamental group</a></span><span style="line-height:1.5;"> of a space: Given a space X and a point x0 in it, one can (almost&#8212;see below) make a group whose elements are loops at x0 (paths from x0 to x0), with the group operations given by the identity path (standing still), path concatenation, and path reversal.  Isomorphic spaces have the same fundamental group</span><span style="line-height:1.5;">, so fundamental group can be used to tell two spaces apart: if  X and Y have different fundamental groups, they are not isomorphic.  Thus, the fundamental group is an algebraic <em>invariant</em> that provides global information about a space, which complements the local information provided by notions like continuity.  For example, the torus (donut) locally looks like the sphere, but has a global difference: it has a hole in it.  One way to see this is to observe that the </span><span style="line-height:1.5;">fundamental group of the sphere is trivial, but the fundamental group of the torus is not.</span></p>
<p><span style="line-height:1.5;">To explain why this is so, we need to be a little more precise about what the fundamental group is.  Consider a space X with a path p from x to y.  Then there is an inverse path !p from y to x.  Concatenating p with !p (written !p o p) gives a path from x to x, which should be the same as the identity path (witnessing one of the inverse cancellation laws of a groupoid).  However, in topology, a path p in X is represented as a continuous map from the interval [0,1] into X, where p(0) = x and p(1) = y&#8212;think of the interval as &#8220;time&#8221; and p as giving the point on the path at each moment in time.  Under this definition, !p o p (which walks from x to y, and then back along the same route, as time goes from 0 to 1) is not literally the same as the identity path (which stays still at x at all times).  So loops don&#8217;t actually form a group!</span></p>
<p>The way to fix this is to consider the notion of <em><a href="http://en.wikipedia.org/wiki/Homotopy">homotopy</a> between paths</em>. Because !p o p walks out and back along the same route, you know that you can continuously shrink !p o p down to the identity path&#8212;it won&#8217;t, for example, get snagged around a hole in the space.  Formally, a homotopy between functions f, g : X -&gt; Y is a continuous map h : [0,1] * X -&gt; Y such that h(0,x) = f(x) and h(1,x) = g(x).  In the specific case of <span style="line-height:1.5;">paths p and q, which, remember, are represented by maps [0,1] -&gt; X, a homotopy is a continuous map h(t,x) : [0,1] x [0,1] -&gt; X, such that h(0,x) = p(x) and h(1,x) = q(x).  That is, it&#8217;s the image in X of a square, which fills in the space between p and q.  Homotopy is an equivalence relation, and operations like concatenation, inverses, etc. respect it.  Moreover, the homotopy-equivalence-classes of loops in X at x0 (where two loops p and q are equated when there is a <em>based</em> <em>homotopy</em> between them, which is a homotopy h as above that additionally satisfies </span>h(t,0) = h(t,1) = x0 for all t<span style="line-height:1.5;">) do form a group: while </span><span style="line-height:1.5;">!p o p is not equal to the identity, it <em>is</em> homotopic to it!</span><span style="line-height:1.5;">  So, we can fix up the above definition of the fundamental group of a space by defining it to be the group of <em>loops modulo homotopy</em>.</span></p>
<p>Returning to the example, we can see that the sphere is different than the torus because the fundamental group of the sphere is trivial (the one-element group), but the fundamental group of the torus is not.  The intuition is that every loop on the sphere is homotopic to the identity, because its inside is filled in.  In contrast, a loop on the torus that goes around the donut&#8217;s hole is not homotopic to the identity, so there are non-trivial loops.</p>
<p>It turns out that the fundamental group, which is written π1(X,x0), is the first in a series of <em>homotopy groups </em>that provide additional information about a space.  Fix a point x0 in X, and consider the constant path id at x0.  Then the homotopies between id and itself form a group (when you quotient <em>them</em> by homotopy), which tells you something about the two-dimensional structure of the space.  Then π3(X,x0) is the group of homotopies between homotopies,  and so on.  One of the basic questions that algebraic topologists consider is <em>calculating the <a href="http://en.wikipedia.org/wiki/Homotopy_group">homotopy groups</a> of a space X</em>, which means giving a group isomorphism between πk(X) and some more direct description of a group (e.g., by a multiplication table or presentation).  Somewhat surprisingly, this is a very difficult question, even for spaces as simple as the spheres.  Here is a <a href="http://en.wikipedia.org/wiki/Homotopy_groups_of_spheres#General_theory">chart</a> that lists the low-dimensional homotopy groups of the low-dimensional spheres (0 is the trivial group, Z is the integers, Zk is the the finite group Z mod k):</p>
<p><a href="http://hottheory.files.wordpress.com/2013/03/screen-shot-2013-03-07-at-9-44-15-am.png"><img class="alignnone size-large wp-image-1525" alt="Homotopy groups of spheres" src="http://hottheory.files.wordpress.com/2013/03/screen-shot-2013-03-07-at-9-44-15-am.png?w=640&#038;h=331" width="640" height="331" /></a></p>
<p>There are some patterns, but there is no general formula, and many homotopy groups of spheres are currently unknown.  Homotopy groups are just one of the algebraic invariants that people study; some others are the <a href="http://en.wikipedia.org/wiki/Homology_(mathematics)">homology</a> groups and <a href="http://en.wikipedia.org/wiki/Cohomology">cohomology</a> groups, which are sometimes easier to calculate.</p>
<p><span style="line-height:1.5;"><span style="line-height:1.5;">An interesting fact is that, while we started off by trying to classify spaces up to isomorphism, most of these algebraic tools in fact classify spaces up to something called <em>homotopy equivalence</em>.  T</span><span style="line-height:1.5;">wo spaces X and Y are homotopy equivalent iff there are maps f : X -&gt; Y and g : Y -&gt; X such that </span><em style="color:#444444;line-height:1.5;">there is a homotopy</em><span style="line-height:1.5;"> between f o g and the identity function (and similarly for g o f).  This gives you a little wiggle room to &#8220;correct&#8221; maps that don&#8217;t exactly compose to the identity, but only miss by space that can be filled in.  Isomorphic spaces are homotopy equivalent, but not nice versa: for example, the disk is not isomorphic to the point, but it is homotopy equivalent to it.  The vast majority of the constructions one considers  (homotopy groups, homology and cohomology groups, etc.) are homotopy-invariant, in the sense that they respect homotopy equivalence.  For example, two homotopy-equivalent spaces have the same fundamental groups, essentially because the fundamental group was defined to be paths modulo homotopy.  Thus, these invariants are really properties of the homotopy-equivalence-classes of spaces, which are called <em>homotopy types</em>.  If you&#8217;re interested in showing <em>disequalities</em> of spaces, this still has bearing on the original problem of classifying spaces up to isomorphism: if two spaces have different fundamental groups, then they are not homotopy equivalent, and therefore not isomorphic.  One reason t</span></span><span style="line-height:1.5;">he fact that all of these notions are homotopy-invariant is important is that it enables a big generalization of classical homotopy theory.</span></p>
<h3><em>Homotopy Theory of ∞-groupoids</em></h3>
<p>Topological spaces are an instance of the notion of ∞-groupoid described above: every topological space X has a <a href="http://ncatlab.org/nlab/show/fundamental+infinity-groupoid">fundamental ∞-groupoid</a> whose k-morphisms are the k-dimensional paths in X.  The weakness of the ∞-groupoid (the fact that the groupoid laws hold only up to higher-dimensional morphisms) corresponds directly to the fact that paths only form a group up to homotopy, because the k+1-paths are the homotopies between the k-paths.</p>
<p>Moreover, the view of a space as an ∞-groupoid  preserves enough structure to do homotopy theory (calculate homotopy/homology/cohomology groups, etc).  Formally, the fundamental ∞-groupoid construction is adjoint to the geometric realization of an ∞-groupoid as a space, and this adjunction preserves homotopy theory (this is called the <a href="http://ncatlab.org/nlab/show/homotopy+hypothesis">homotopy hypothesis/theorem</a>, because whether it is a hypothesis or theorem depends on how you define ∞-groupoid).  For example, you can easily define the fundamental group of an ∞-groupoid, and if you calculate the fundamental group of the fundamental ∞-groupoid of a space, that will agree with the classical definition of fundamental group. For the type theorists in the crowd: ∞-groupoids are an interface that topological spaces implement, and one can do homotopy theory using only the operations in the interface.  <span style="line-height:1.5;">The only problem is that this interface is fairly difficult to work with&#8230; </span></p>
<h3><em>Homotopy Theory in Type Theory</em></h3>
<p>Which is where type theory comes in!  Type theory is a formal calculus of  ∞-groupoids. Because you can do homotopy theory through the abstraction of  ∞-groupoids, you can do homotopy theory in type theory.  One might call this<strong><a href="http://homotopytypetheory.org/2011/03/19/constructive-validity/"> synthetic homotopy theory</a>,</strong> by analogy with <a href="http://en.wikipedia.org/wiki/Synthetic_geometry">synthetic geometry</a>, which is geometry in the style of Euclid: you start<span style="color:#000000;"> from some basic constructions (a line connecting any two points) and axioms (all right angles are equal), and deduce consequences from them logically.  Here, the basic constructions/axioms are the operations on ∞-groupoids and maps between them (∞-functors), as presented by the identity type Id M N in dependent type theory.  We will often refer to features of type theory by topological-sounding names (for example, thinking of p : Id M N as a &#8220;path&#8221; from M to N, or even writing Path M N for the identity type), but it&#8217;s important to keep in mind that we can only talk about these things through the abstraction of an ∞-groupoid.  </span></p>
<p><span style="color:#000000;">There are few really nice advantages of doing synthetic homotopy theory in type theory.  First, you can use proof assistants like Agda and Coq to check your proofs.  Second, we&#8217;re starting to see examples where working in type theory is suggesting new ways of doing proofs.  Third, it seems likely that we will be able to interpret type theory in a wide variety of other categories that &#8220;look like&#8221; ∞-groupoids, and, if so, proving a result in type theory will show that it holds in these settings as well. It remains to be seen how much homotopy theory we can do synthetically, but there are already some positive indication, which I&#8217;ll discuss in a following post.  </span></p>
<p><span style="color:#000000;">For now, I&#8217;d like to review the basic ingredients of doing synthetic homotopy theory in type theory, with some links to reading material:</span></p>
<p><span style="line-height:16px;"><strong>Higher inductive types.</strong> To do some homotopy theory, we need some basic spaces (the circle, the sphere, the torus) and constructions for making new spaces (suspensions, gluing on cells, &#8230;).  These are defined using </span><a style="line-height:16px;" href="http://golem.ph.utexas.edu/category/2011/04/homotopy_type_theory_vi.html">higher</a> <a style="line-height:16px;" href="http://homotopytypetheory.org/2011/04/24/higher-inductive-types-a-tour-of-the-menagerie/">inductive</a><span style="line-height:16px;"> types, which are inductive types specified by both point and path constructors.  </span></p>
<p><span style="line-height:16px;">For example, the circle is inductively generated by <code>base:S1</code> and <code>loop:Path base base</code>&#8212;an inductive type with one point and one non-trivial loop.  This inductive type describes the free ∞-groupoid with one object and one 1-morphism.  The elimination rule for the circle, </span><em style="line-height:16px;color:#444444;">circle induction</em><span style="line-height:16px;">, expresses freeness: a map <code>f : S1 -&gt; X,</code> from the circle into some type X is specified by giving a point and a loop in X (the image of the generators), and the general rules for the identity type ensure that <code>f </code>preserves the groupoid structure (e.g. it commutes with composition).</span></p>
<p><span style="line-height:16px;">Higher inductive types are very general, and allow one to build spaces that are specified by a </span><a style="line-height:16px;" href="http://en.wikipedia.org/wiki/CW_complex">CW complex</a><span style="line-height:16px;">, using suspensions, pushouts, etc.  This gives a logical/synthetic view of these spaces, where they are constructed as the free ∞-groupoid on some generators, and can be reasoned about using induction.  </span></p>
<p><strong>Homotopy groups.  </strong>Having<strong> </strong>defined some spaces, we&#8217;d like to start calculating some algebraic invariants of them.  The homotopy groups have an extremely natural definition in the setting of ∞-groupoids/type theory.  The fundamental group of X at x0 is (to a first approximation&#8212;see below) just the identity type <code>Id{X} x0 x0</code>, or the morphisms of the ∞-groupoid; π2(X,x0) is just the identity type <code>Id{Id{X} x0 x0} refl refl</code>, or the 2-morphisms, etc.  So, calculating a homotopy group is just giving a bijection between an identity type and some other type, and proving that this bijection preserves the group structure.  For example, <a href="http://homotopytypetheory.org/2011/04/29/a-formal-proof-that-pi1s1-is-z/">calculating the fundamental group of the circle</a> consists of giving a bijection between <code>Id{S1} base base</code> and <code>Int</code> that sends composition of paths to addition.</p>
<p>The reason this problem is interesting is that the (higher) inductive definition of a type X presents X as a free ∞-groupoid, and this presentation <em>determines</em> but <em>does not explicitly describe </em>the higher identity types of X.   The identity types are populated by both the generators (<code>loop</code>, for the circle), and all of the groupoid operations (identity, composition, inverses, &#8230;).  As the above table for spheres shows, in higher dimensions the ∞-groupoid operations create quite a complex structure.  Thus, the higher-inductive presentation of a space allows you to pose the question &#8220;what does the identity type of X really turn out to be?&#8221;, though it can take some significant math to answer it.  <a href="http://www.cs.cmu.edu/~drl/pubs/ls13pi1s1/ls13pi1s1.pdf">This is a higher-dimensional generalization of a familiar fact in type theory</a>: even for ordinary inductive types like natural numbers or booleans, it takes a bit of work to <em>prove</em> that true is different than false&#8212;characterizing the identity type at bool is a theorem, not part of the definition.</p>
<p>The one detail that I glossed over above is that the (iterated) identity type really gives what is called the path <em>space</em> of a space, which is not just the set of k-dimensional path, but a whole space of them, with their higher homotopies.  To extract the set of paths-modulo-homotopy, we can use something called truncation.</p>
<p><strong>N-types and truncations.  </strong>One of Voevodsky&#8217;s early observations was that it is possible to define a homotopy-theoretic notion called <em>being an n-type</em> in type theory.  He called these &#8220;types of h-level n&#8221;, and started counting at 0, but many of us now call them <em>type levels</em> or <em>truncation levels</em> and use the traditional homotopy-theoretic numbering, which starts at -2.  A -2-type (&#8220;contractible&#8221;) is equivalent to the unit type.  A -1-type (&#8220;hprop&#8221;) is proof-irrelevant&#8212;any two elements are propositionally equal.  A 0-type (&#8220;hset&#8221;) has uniqueness of identity proofs&#8212;any two propositional equalities between its elements are themselves equal.  A 1-type is like a groupoid: it can have non-trivial morphisms, but all 2-morphisms are trivial.  And so on.  Categorically, n-types correspond to <a href="http://ncatlab.org/nlab/show/n-groupoid">n-groupoids</a>.</p>
<p>The predicate &#8220;X is an n-type&#8221; is part of a <a href="http://homotopytypetheory.org/2012/11/19/all-modalities-are-hits/">modality</a>, which means that there is a corresponding operation of <em>n-truncation </em>that takes a type A and makes the best approximation of A as an n-type.  n-truncation equates (&#8220;kills&#8221;) all morphisms of level higher than n in A.  Truncations can be constructed using higher inductive types (see <a style="line-height:1.5;" href="http://homotopytypetheory.org/2012/09/16/truncations-and-truncated-higher-inductive-types/">here</a><span style="line-height:1.5;"> and </span><a style="line-height:1.5;" href="http://homotopytypetheory.org/2012/11/19/all-modalities-are-hits/">here</a>) and are quite important to doing homotopy theory in type theory, because many theorems characterize some &#8220;approximation&#8221; of a space, where the approximation is constructed by truncation.</p>
<p>For example, the fundamental group of a space is defined to be the 0-truncation of the space of loops at x0, which produces the <em>hset</em> of paths modulo homotopy, killing the higher homotopies of the loop space.</p>
<p><strong>Univalence. </strong> The univalence axiom plays an essential role in calculating homotopy groups (this is a formal claim: without univalence, type theory is compatible with an interpretation where all paths, including e.g. the loop on the circle, are the identity).  You can see this in action in the calculation of the <a href="http://homotopytypetheory.org/2011/04/29/a-formal-proof-that-pi1s1-is-z/">the fundamental group of the circle</a>: the map from <code>Id{S1} base base</code> to <code>Z</code> is defined by mapping a path on the circle to an isomorphism on <code>Z</code>, so that, for example, <code>loop o !loop</code> is sent to <code>successor o predecessor</code>, and then applying the isomorphism to 0. Univalence allows paths in the universe to have computational content, and this is used to extract information from paths in higher inductive types.</p>
<p><strong>Homotopy-theoretic and type-theoretic methods.  </strong>One of the cool things we&#8217;ve found is that there are different ways of doing proofs in homotopy type theory.  Some proofs use techniques that are familiar from traditional homotopy theory, whereas others are more type-theoretic, and consist mainly of calculations with the ∞-groupoid structure.  For example, Mike Shulman&#8217;s original calculation of the <a href="http://homotopytypetheory.org/2011/04/29/a-formal-proof-that-pi1s1-is-z/">the fundamental group of the circle</a> is more homotopy-theoretic, while <a href="http://homotopytypetheory.org/2012/06/07/a-simpler-proof-that-%CF%80%E2%82%81s%C2%B9-is-z/">mine</a> is more type-theoretic.  You can read more about the difference between the two in <a href="http://www.cs.cmu.edu/~drl/pubs/ls13pi1s1/ls13pi1s1.pdf">this paper</a>.</p>
<p><span style="line-height:1.5;">Those are the basic tools.  In the next post, I&#8217;ll give an overview of the current status of homotopy theory in HoTT.</span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hottheory.wordpress.com/1502/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hottheory.wordpress.com/1502/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homotopytypetheory.org&#038;blog=21082110&#038;post=1502&#038;subd=hottheory&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://homotopytypetheory.org/2013/03/08/homotopy-theory-in-homotopy-type-theory-introduction/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1e738b846c701c46496dd96614d52a9a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">daniellicata</media:title>
		</media:content>

		<media:content url="http://hottheory.files.wordpress.com/2013/03/screen-shot-2013-03-07-at-9-44-15-am.png?w=640" medium="image">
			<media:title type="html">Homotopy groups of spheres</media:title>
		</media:content>
	</item>
		<item>
		<title>Running Spheres in Agda, Part II</title>
		<link>http://homotopytypetheory.org/2013/02/11/running-spheres-in-agda-part-ii/</link>
		<comments>http://homotopytypetheory.org/2013/02/11/running-spheres-in-agda-part-ii/#comments</comments>
		<pubDate>Mon, 11 Feb 2013 19:00:14 +0000</pubDate>
		<dc:creator>favonia</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Higher Inductive Types]]></category>

		<guid isPermaLink="false">http://homotopytypetheory.org/?p=1441</guid>
		<description><![CDATA[(Sorry for the long delay after the Part I of this post.) This post will summarize my work on defining spheres in arbitrary finite dimensions (Sⁿ) in Agda. I am going to use the tools for higher-order paths (discussed in &#8230; <a href="http://homotopytypetheory.org/2013/02/11/running-spheres-in-agda-part-ii/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homotopytypetheory.org&#038;blog=21082110&#038;post=1441&#038;subd=hottheory&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><em>(Sorry for the long delay after the <a href="http://homotopytypetheory.org/2012/08/07/running-spheres-in-agda-part-i/">Part I</a> of this post.)</em></p>
<p>This post will summarize my work on defining spheres in arbitrary finite dimensions (Sⁿ) in Agda. I am going to use the tools for higher-order paths (discussed in <a href="http://homotopytypetheory.org/2012/08/07/running-spheres-in-agda-part-i/">Part I</a>) to build up everything for spheres. There are many ways to define a sphere and I will stick with the &#8220;one 0-cell and one n-cell&#8221; definition in this post. One important feature is that I have achieved full compatibility with previous ad-hoc definitions for specific dimensions (ex: S²) except for one small caveat mentioned below. That is, this is a <strong>drop-in replacement</strong> for spheres ever defined for any fixed dimension in 95% cases. The code is available at <a href="https://github.com/favonia/homotopy/blob/master/Space/Sphere.agda">this place</a>.</p>
<h1>Why is this Difficult?</h1>
<p>The most difficult thing is the computation rule for loops. It is tricky to get the types right, and is even trickier to derive the non-dependent rule from the dependent one. Intuitively, this rule says &#8220;if I plugged in some data for the loop in the eliminator, then applying this instantiated eliminator to the original loop will recover that data I plugged in&#8221;. This looks fine, except that the types do not (immediately) match in Agda. We need to find a way to talk about the types of the plugged-in data without mentioning the eliminator itself. The reason is that, when we are declaring the eliminator, the type cannot mention the name of the eliminator itself in Agda (at least in my understanding). However, when you are applying this instantiated eliminator to the original loop, the result will have the eliminator in the type, and in general it is not definitonally equal to the type we used in the declaration of the eliminator. This mismatch becomes a serious problem for arbitrary finite dimensions.</p>
<p>S¹ in Agda luckily avoids this problem because of the definitional equality for 0-cells (base points) and its finite dimension. However, it can still illustrate the problem if we pretend that there was only evidential equality for 0-cells. Let&#8217;s look at the type of eliminator in Agda:</p>
<pre>S¹-elim : ∀ {ℓ} (P : S¹ → Set ℓ) (pbase : P base)
          → subst P loop¹ pbase ≡ pbase
          → (x : S¹) → P x</pre>
<p><code>pbase</code> is the data for the base point and <code>subst P loop¹ pbase ≡ pbase</code> is the type of the data for the loop. The holy grail of the definition of S¹ is then the following equivalence:</p>
<pre>cong[dep] P (S¹-elim P pbase ploop) loop¹ ≡ ploop</pre>
<p>where <code>cong[dep]</code> is the dependent map on paths (which is named <code>map</code> or <code>apd </code>in different HoTT libraries). This equivalence means that we can recover the plugged-in data by applying the eliminator to the original loop. The trouble is that this is ill-typed unless we have some definitional equality. The type of the left-hand side is actually</p>
<pre>subst P loop¹ ((S¹-elim pbase ploop) base) ≡ ((S¹-elim pbase ploop) base)</pre>
<p>while the right-hand side is of type</p>
<pre>subst P loop¹ pbase ≡ pbase</pre>
<p>How do we know that the eliminator applied to the base point is indeed the data for the base point? This is why the Coq library required (thanks to a recent patch) <del>requires (or at least &#8220;required&#8221;&#8212;I am not aware of the possible recent development)</del> some extra work to bridge the gap in types. When we are defining spheres for a particular dimension, the type checker (equivalently) kindly expands the expressions down to eliminators applied to the base points. (This is of course not what a type checker in Coq/Agda really does.) The way we use Agda will establish the definitional equivalence between this application and the data for the base point, and so the type checker is satisfied.</p>
<p>Nonetheless, Agda cannot expand the expressions for us if we are talking about spheres in arbitrary finite dimensions. It requires an induction on the dimension to show that two things are equivalent, which is beyond the ability of the current type checker. We need to prove the equivalence by ourselves.</p>
<p>In the following paragraphs I will describe how I have proved necessary lemmas to bridge the gap. Moreover the lemmas appearing in types will &#8220;go away&#8221; if you plug in any finite number for the dimension. This makes the library a drop-in replacement of previously defined sphere in most cases. The only missing feature is that, while non-dependent elimination rules are derived from the dependent ones, the non-dependent computation rules for loops are not. A 100% drop-in replacement should have all non-dependent rules derived from dependent counterparts.</p>
<h1>Technical Discussion</h1>
<h2>Towers of Loops</h2>
<p>Let&#8217;s set up the n-cell in spheres so that we can talk about computation rules. They are basically higher-order loops, that is, towers of loops:</p>
<pre id="LC98">S-endpoints⇑ 0 base = lift tt
S-endpoints⇑ (suc n) base = (S-endpoints⇑ n base , S-loop⇑ n base , S-loop⇑ n base) 

S-loop⇑ 0 base = base
S-loop⇑ (suc n) base = refl (S-loop⇑ n base)</pre>
<p>whose data are filled by two mutually recursive functions where <code>n</code> is the dimension. We can then fake the loop (n-cell) constructor by a postulation in Agda:</p>
<pre id="LC215">postulate
  loopⁿ : ∀ n → Path⇑ n (S-endpoints⇑ n (baseⁿ n))</pre>
<p>The elimination rule for spheres is shown below, where <code>S-endpoints[dep]⇑</code> is the dependent loop tower parametrized by the mapped base point. This is probably not so surprising if you are familiar with S¹ in Agda. The scary type in the middle means &#8220;the path built from the dependent form of the loop and the data for the base point&#8221;. For S¹ this is simply <code>subst P loop¹ pbase ≡ pbase</code>. The last line establishes the definitional equality for the base point.</p>
<pre>Sⁿ-elim : ∀ {ℓ} n (P : Sⁿ n → Set ℓ) (pbase : P (baseⁿ n))
          → Path[dep]⇑ n P (loopⁿ n) (S-endpoints[dep]⇑ n P (baseⁿ n) n P pbase)
          → ∀ x → P x
Sⁿ-elim n P pbase _ baseⁿ′ = pbase</pre>
<h2>Fix the Type Mismatch in Computation Rules</h2>
<p>We already have computation rules for base points for free (by Dan&#8217;s trick). The remaining type mismatch mentioned above is due to lack of (definitional) communicativity between &#8220;building towers&#8221; and &#8220;applying functors&#8221; in Agda. That is, we want to show that building a tower of loops as above, and then mapping the whole tower to another space, is equivalent to mapping the base point to the target space first and then building up the tower right within that space. This is done by an induction on the dimension; we walk down the tower by repetitively applying the J rule.</p>
<p>Again (as in Part I), the way the tower is presented is important. It is difficult, if not impossible, to walk down the tower if the tower is upside down&#8212;that the outermost loop is the loop in the lowest dimension. My ordering (which exposes the path (or the loop here) in the highest dimension) makes this task easy. The particular induction here involves two mutually recursively defined functions to deal with different data in the tower. This is somewhat expected as we adopted mutually recursive functions to build towers as well.</p>
<p>One feature is that the usage of the J rule within this lemma is carefully arranged so that, in any given finite dimension, the proof will be definitionally equivalent to <code>refl</code>. This means that any previous code that depends on a sphere in some fixed dimension will not notice this artifact.</p>
<h2>Non-dependent Rules</h2>
<p>The final note is about the definition and derivibility of non-dependent rules.</p>
<p>For non-dependent elimination rules, we have to show that, a non-dependent tower is equivalent to a dependent tower with a &#8220;constant&#8221; type family. (Sorry but I am not sure about the accurate terminology here.) This can be achieved by the same technique&#8212;walking down the tower to the ground.</p>
<p>The type of the non-dependent computation rule has the same type mismatch issue, and can be solved by the technique mentioned above&#8212;but for non-dependent constructs this time.</p>
<p>On the other hand, the derivability of the non-dependent computation rule seems quite involved and so I have not finished it. Fortunately, I am not aware of any code that depends on the assumption that the non-dependent computation rule is derived from the dependent version.</p>
<p><em>Thanks to many people (Dan Licata, Bob Harper, etc) for helping me overcome my laziness.</em></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hottheory.wordpress.com/1441/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hottheory.wordpress.com/1441/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homotopytypetheory.org&#038;blog=21082110&#038;post=1441&#038;subd=hottheory&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://homotopytypetheory.org/2013/02/11/running-spheres-in-agda-part-ii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/35961f534359442487dfe40aa03f2d47?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">favonia</media:title>
		</media:content>
	</item>
		<item>
		<title>On h-Propositional Reflection and Hedberg&#8217;s Theorem</title>
		<link>http://homotopytypetheory.org/2012/11/27/on-h-propositional-reflection-and-hedbergs-theorem/</link>
		<comments>http://homotopytypetheory.org/2012/11/27/on-h-propositional-reflection-and-hedbergs-theorem/#comments</comments>
		<pubDate>Tue, 27 Nov 2012 17:47:44 +0000</pubDate>
		<dc:creator>Nicolai Kraus</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Foundations]]></category>

		<guid isPermaLink="false">http://homotopytypetheory.org/?p=1119</guid>
		<description><![CDATA[Thorsten Altenkirch, Thierry Coquand, Martin Escardo, Nicolai Kraus Overview Hedberg&#8217;s theorem states that decidable equality of a type implies that the type is an h-set, meaning that it has unique equality proofs. We describe how the assumption can be weakened. &#8230; <a href="http://homotopytypetheory.org/2012/11/27/on-h-propositional-reflection-and-hedbergs-theorem/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homotopytypetheory.org&#038;blog=21082110&#038;post=1119&#038;subd=hottheory&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Thorsten Altenkirch, Thierry Coquand, Martin Escardo, Nicolai Kraus</p>
<h2>Overview</h2>
<p><a href="http://ncatlab.org/nlab/show/h-set#DecidableIsSet">Hedberg&#8217;s theorem</a> states that <em>decidable equality</em> of a type implies that the type is an <em>h-set</em>, meaning that it has unique equality proofs. We describe how the assumption can be weakened. Further, we discuss possible improvements if <a href="http://ncatlab.org/nlab/show/bracket+type"><em>h-propositional reflection</em></a> (&#8220;bracketing&#8221;/&#8221;squashing&#8221;) is available. Write <code>X*</code> for the h-propositional version of a type <code>X</code>. Then, it is fairly easy to prove that the following are logically equivalent (part of which Hedberg has done in his original work): </p>
<ol>
<li><span style="white-space:nowrap;"><code>X</code></span> is h-separated, i.e. <span style="white-space:nowrap;"><code>∀ x y → (x ≡ y)* → x ≡ y</code></span></li>
<li><span style="white-space:nowrap;"><code>X</code></span> has a constant endofunction on the path spaces, i.e. we have a function <span style="white-space:nowrap;"><code>f: (x y: X) → x ≡ y → x ≡ y</code></span> and a proof that <code>f x y</code> is constant for all <code>x</code> and <code>y</code></li>
<li><span style="white-space:nowrap;"><code>X</code></span> is an h-set, i.e. <span style="white-space:nowrap;"><code>∀ x y: X → ∀ p q: x ≡ y → p ≡ q</code></span></li>
</ol>
<p>We then state the three properties for arbitrary types instead of path spaces. For a type <code>A</code>, the first two statements become</p>
<ol>
<li><span style="white-space:nowrap;"><code>A</code></span> is h-stable, i.e. <span style="white-space:nowrap;"><code>A* → A</code></span></li>
<li><span style="white-space:nowrap;"><code>A</code></span> has a constant endofunction, i.e. <span style="white-space:nowrap;"><code>f: A → A</code></span> and a proof of <span style="white-space:nowrap;"><code>∀ a b → fa ≡ fb</code></span></li>
</ol>
<p>Clearly, the first statement is at least as strong as the second, but somewhat surprisingly, the second also implies the first. The proof of this fact is non-trivial.<br />
In this blog post, we mainly talk about the mentioned results and try to provide some intuition. This is actually only a small part of our work. Many additional discussions, together with formalized proofs, can be found in <a href="http://www.cs.bham.ac.uk/~mhe/GeneralizedHedberg/html/GeneralizedHedberg.html">this Agda file</a>. Thanks to Martin, it is a very readable presentation of our work.</p>
<h2>Generalizations of Hedberg&#8217;s Theorem</h2>
<p>Having <a href="http://homotopytypetheory.org/2012/03/30/a-direct-proof-of-hedbergs-theorem/">this proof</a> of Hedberg&#8217;s Theorem in mind, the essence of the theorem can be read as:</p>
<blockquote style="font-style:normal;"><p>
(i) If we can construct an equality proof whenever we have h-propositional evidence that there should be one, then the type is an h-set.
</p></blockquote>
<p>Here, we call a type <em>h-propositional</em> (or an <em>h-proposition</em>) if all its elements are equal. Intuitively, decidable equality is much stronger than the property mentioned above: If we have a function <span style="white-space:nowrap;"><code>dec</code></span> that decides equality and <span style="white-space:nowrap;"><code>x</code></span>, <span style="white-space:nowrap;"><code>y</code></span> are two terms (or points), we do not even require evidence to get a proof that they are equal. Instead, we can just apply <span style="white-space:nowrap;"><code>dec</code></span> to get such a proof or the information that none exists.</p>
<p>It is therefore not surprising that Hedberg&#8217;s theorem can be strengthened by weakening the assumption. For example, a proof of <span style="white-space:nowrap;"><code>¬¬ x ≡ y</code></span> could serve as evidence that <span style="white-space:nowrap;"><code>x</code></span>, <span style="white-space:nowrap;"><code>y</code></span> are equal; and indeed, if we know that a type is <em>separated</em>, i.e. that we have <span style="white-space:nowrap;"><code>∀ x y → (¬¬ x ≡ y) → x ≡ y</code></span>, then the type is an h-set. This requires a weak form of extensionality (to show that <span style="white-space:nowrap;"><code>¬¬ x ≡ y</code></span> is an h-proposition) and the controverse is not true.</p>
<p>In the presence of <em>h-propositional reflection</em>, we can do much better. We define h-propositional reflection as an operation <span style="white-space:nowrap;"><code>_*</code></span> from types to h-propositions (viewed as a subsets of types) that is left adjoint to the embedding, i.e. we have a universal property. These are Awodey&#8217;s and Bauer&#8217;s <em>bracket types</em>: The idea is that, given a type <span style="white-space:nowrap;"><code>X</code></span>, the type <span style="white-space:nowrap;"><code>X*</code></span> corresponds to the statement that there exists an inhabitant of <span style="white-space:nowrap;"><code>X</code></span> (we say that <code>X</code> is <em>h-inhabited</em> if we have <code>p: X*</code>). We always have the map <span style="white-space:nowrap;"><code>η: X → X*</code></span>. From <span style="white-space:nowrap;"><code>X*</code></span>, we do usually not get <span style="white-space:nowrap;"><code>X</code></span>, but if we could prove an h-proposition from <span style="white-space:nowrap;"><code>X</code></span>, then <span style="white-space:nowrap;"><code>X*</code></span> is sufficient. It is natural to consider h-propositional reflection in our context, because the informal notion &#8220;h-propositional evidence, that a type is inhabited&#8221; can now directly be translated. We call a type satisfying (i) in this sense <em>h-separated</em>: <span style="white-space:nowrap;"><code>h-separated X = ∀ x y → (x ≡ y)* → x ≡ y</code></span>.</p>
<p>In Hedberg&#8217;s original proof, it is shown that a constant parametric endofunction on the path spaces is enough to ensure that a type is an h-set. For a function <span style="white-space:nowrap;"><code>f</code></span>, we define that <span style="white-space:nowrap;"><code>f</code></span> is constant by <span style="white-space:nowrap;"><code>constant f = ∀ x y → fx ≡ fy</code></span>. As already mentioned above, it is fairly straightforward to show:</p>
<blockquote style="font-style:normal;"><p>
Theorem. For a type <code>X</code>, the following properties are logically equivalent:</p>
<ol>
<li><span style="white-space:nowrap;"><code>X</code></span> is h-separated, i.e. <span style="white-space:nowrap;"><code>∀ x y → (x ≡ y)* → x ≡ y</code></span></li>
<li><span style="white-space:nowrap;"><code>X</code></span> has a constant endofunction on the path spaces, i.e. we have a function <span style="white-space:nowrap;"><code>f: (x y: X) → x ≡ y → x ≡ y</code></span> and a proof that <code>f x y</code> is constant for all <code>x</code> and <code>y</code></li>
<li><span style="white-space:nowrap;"><code>X</code></span> is an h-set, i.e. <span style="white-space:nowrap;"><code>∀ x y: X → ∀ p q: x ≡ y → p ≡ q</code></span></li>
</ol>
</blockquote>
<p>For this reason, we consider <span style="white-space:nowrap;"><code>h-separated X → h-set X</code></span> the natural strengthening of Hedberg&#8217;s theorem. The assumption is now the exact formalization of the condition in (i), the assumption is as weak as it can be (as it is necessary) and, in particular, it is immediately implied by Hedberg&#8217;s original assumption, namely the decidable equality property.</p>
<h2>H-propositional Reflection and Constant Endofunctions</h2>
<p>The list of equivalent statements above suggests that one could look at these statements for an arbitrary type <span style="white-space:nowrap;"><code>A</code></span>, not only for the path spaces. Of course, they do not need to be equivalent any more, but they become significantly simpler:</p>
<ol>
<li><span style="white-space:nowrap;"><code>A</code></span> is h-stable, i.e. <span style="white-space:nowrap;"><code>A* → A</code></span></li>
<li><span style="white-space:nowrap;"><code>A</code></span> has a constant endofunction, i.e. <span style="white-space:nowrap;"><code>f: A → A</code></span> and a proof of <span style="white-space:nowrap;"><code>∀ a b → fa ≡ fb</code></span></li>
<li><span style="white-space:nowrap;"><code>A</code></span> is an h-proposition, i.e. <span style="white-space:nowrap;"><code>∀ a b: A → a ≡ b</code></span></li>
</ol>
<p>For the third, it is pretty clear what this means and it is obviously strictly stronger than the first and the second. If <span style="white-space:nowrap;"><code>A</code></span> is h-stable, we get a constant endofunction by composing <span style="white-space:nowrap;"><code>η: A → A*</code></span> with <span style="white-space:nowrap;"><code>A* → A</code></span>. However, it is nontrivial whether a type with a constant endofunction is h-stable. Somewhat surprisingly, it is.</p>
<p>But let us first consider the question we get if we drop the condition that we are dealing with endofunctions. Say, we have <span style="white-space:nowrap;"><code>f: X → Y</code></span> and a proof <span style="white-space:nowrap;"><code>c: constant f</code></span>. Can we get a function <span style="white-space:nowrap;"><code>X* → Y</code></span>?<br />
Consider the chaotic equivalence relation on <span style="white-space:nowrap;"><code>X</code></span>, which just identifies everything: <span style="white-space:nowrap;"><code>x ~ y</code></span> for all <span style="white-space:nowrap;"><code>x</code></span> and <span style="white-space:nowrap;"><code>y</code></span>, which is h-propositional (<span style="white-space:nowrap;"><code>~: X → X → hProp</code></span> with <span style="white-space:nowrap;"><code>x ~ y = True</code></span> for all <code>x</code> and <code>y</code>, if we want). According to the usual definition of a quotient, our constant map <span style="white-space:nowrap;"><code>f</code></span> can be lifted to <span style="white-space:nowrap;"><code>X/~ → Y</code></span>. So, what we asked can be formulated as: Does <code>X*</code> have the properties of <code>X/~</code>? If <code>Y</code> is an h-set, this lifting exists (Voevodsky makes use of this fact in his definition of quotients), but otherwise, our definition of <em>constant</em> is too naïve, as it involves no coherence conditions at all. If we know that <code>Y</code> has <span style="white-space:nowrap;"><code>h-level n</code></span>, we can try to formulate a stronger version of <code>constant</code> that solves this issue. This could be discussed at another opportunity. With the naïve definition of <code>constant</code>, we would have to make a non-canonical choice in <code>X</code>, but <code>f</code> only induces an &#8220;asymmetry&#8221; in <code>Y</code>.</p>
<p>Let us get back to the case where <span style="white-space:nowrap;"><code>f</code></span> is a constant endofunction. We still do not have the coherence properties mentioned above, but the asymmetry of <span style="white-space:nowrap;"><code>Y</code></span> is now an asymmetry of <span style="white-space:nowrap;"><code>X</code></span> and, somewhat surprisingly, this is sufficient. We have the following theorem:</p>
<blockquote style="font-style:normal;"><p>
Theorem. A type <code>X</code> is h-stable (<span style="white-space:nowrap;"><code>X* → X</code></span>) iff it has a constant endofunction.</p></blockquote>
<p>Note that the direction from right to left is easy. For the other direction, we need the following crucial lemma:</p>
<blockquote style="font-style:normal;"><p>
Fixpoint Lemma (N.K.). If <span style="white-space:nowrap;"><code>f: X → X</code></span> has a proof that it is constant, then the type of fixed points <span style="white-space:nowrap;"><code>Σ(x:X) → x ≡ fx</code></span> is h-propositional.</p></blockquote>
<p>Let us write <code>P</code> for the type <span style="white-space:nowrap;"><code>Σ(x:X) → x ≡ fx</code></span>. A term of <code>P</code> is a term in <span style="white-space:nowrap;"><code>X</code></span>, together with the proof that it is a fixed point. With the lemma, we just have to observe that there is the obvious map <span style="white-space:nowrap;"><code>X → P</code></span>, namely <span style="white-space:nowrap;"><code>λx → (fx , constant x fx)</code></span> to get, by the universal property of <span style="white-space:nowrap;"><code>*</code></span>, a map <span style="white-space:nowrap;"><code>X* → P</code></span>. Composed with the projection map <span style="white-space:nowrap;"><code>P → X</code></span>, this gives us the required map showing that <span style="white-space:nowrap;"><code>X</code></span> is h-stable.</p>
<p>To prove the lemma, we need the following two observations. For both, we assume that <span style="white-space:nowrap;"><code>X</code></span>, <span style="white-space:nowrap;"><code>Y</code></span> are types and <span style="white-space:nowrap;"><code>x,y: X</code></span> terms. Further, we write <span style="white-space:nowrap;"><code>p • q</code></span> for <span style="white-space:nowrap;"><code>trans p q</code></span>, so that this typechecks if <span style="white-space:nowrap;"><code>p: x ≡ y</code></span> and <span style="white-space:nowrap;"><code>q: y ≡ z</code></span>. We use <code>subst</code> (weak version of <code>J</code>) and <code>cong</code> (to apply functions on proofs) in the usual sense.</p>
<blockquote style="font-style:normal;"><p>
Observation 1. Assume <span style="white-space:nowrap;"><code>h, k: X → Y</code></span> are two functions and <span style="white-space:nowrap;"><code>t: x ≡ y</code></span> as well as <span style="white-space:nowrap;"><code>p: h(x) ≡ k(x)</code></span> are paths. Then, <span style="white-space:nowrap;"><code>subst t p</code></span> is equal to <span style="white-space:nowrap;"><code>(cong h t)⁻¹ • p • (cong k t)</code></span>.
</p></blockquote>
<p>This is immediate by applying the equality eliminator on <span style="white-space:nowrap;"><code>(x,y,t)</code></span>. We will need this fact for a proof of type <span style="white-space:nowrap;"><code>t : x ≡ x</code></span>, but this required special case cannot be proved directly.</p>
<p>The second observation can be considered the key insight for the Fixpoint Lemma:</p>
<blockquote style="font-style:normal;"><p>
Observation 2. If <span style="white-space:nowrap;"><code>f: X → Y</code></span> is <code>constant</code>, then <span style="white-space:nowrap;"><code>cong f</code></span> maps any proof of <span style="white-space:nowrap;"><code>x ≡ x</code></span> to <code>reflexivity</code>.</p></blockquote>
<p>It is not possible to prove this directly. Instead, we formulate the following generalization: If <span style="white-space:nowrap;"><code>c: constant f</code></span> is the proof that <span style="white-space:nowrap;"><code>f</code></span> is constant, then <span style="white-space:nowrap;"><code>cong f</code></span> maps any proof <span style="white-space:nowrap;"><code>p: x ≡ y</code></span> to <span style="white-space:nowrap;"><code>(c x x)⁻¹ • (c x y)</code></span>. This is immediate by using induction (i.e. the <span style="white-space:nowrap;"><code>J</code></span> eliminator) on <span style="white-space:nowrap;"><code>(x,y,p)</code></span>, and it has the above statement as a consequence.</p>
<p>Proof (of the Fixpoint Lemma). Assume we have <span style="white-space:nowrap;"><code>f: X → X</code></span>, <span style="white-space:nowrap;"><code>c: constant f</code></span> and <span style="white-space:nowrap;"><code>(x,p), (x',p'): Σ (x: X) → x ≡ fx</code></span>. We need to show that these pairs are equal. It is easy to prove <span style="white-space:nowrap;"><code>x ≡ x'</code></span> by composing the proofs <span style="white-space:nowrap;"><code>p: x ≡ fx</code></span>, <span style="white-space:nowrap;"><code>constant x x': fx ≡ fx'</code></span> and <span style="white-space:nowrap;"><code>(p')⁻¹: fx' ≡ x'</code></span>. We call this proof <span style="white-space:nowrap;"><code>p'': x ≡ x'</code></span>. Clearly, we have that <span style="white-space:nowrap;"><code>(x, subst (p'')⁻¹ p')</code></span> and <span style="white-space:nowrap;"><code>(x',p')</code></span> are equal now, just by the proof <span style="white-space:nowrap;"><code>p''</code></span> for the first component, and the equality of the second components is immediate. We choose to write <span style="white-space:nowrap;"><code>q</code></span> for the proof <span style="white-space:nowrap;"><code>subst (p'')⁻¹ p'</code></span>. Now, we are in a slightly simpler situation: We need to show that <span style="white-space:nowrap;"><code>(x,p)</code></span> and <span style="white-space:nowrap;"><code>(x,q)</code></span> are equal.</p>
<p>If we prove that the first components are equal using some proof <span style="white-space:nowrap;"><code>t: x ≡ x</code></span>, then what we need for the second components is <span style="white-space:nowrap;"><code>p ≡ subst t q</code></span>. Clearly, using <span style="white-space:nowrap;"><code>refl</code></span> for <span style="white-space:nowrap;"><code>t</code></span> would not work.</p>
<p>By Observation 1, our goal is equivalent to proving <span style="white-space:nowrap;"><code>p ≡ t⁻¹ • q • (cong f t)</code></span>.<br />
Using Observation 2, this simplifies to <span style="white-space:nowrap;"><code>p ≡ t⁻¹ • q</code></span>. Let us therefore just choose <span style="white-space:nowrap;"><code>t</code></span> to be <span style="white-space:nowrap;"><code>q • p⁻¹</code></span>. This completes the proof of the Fixpoint Lemma and the Theorem. □</p>
<p>As mentioned, there is a bunch of possible further questions and considerations, but for now, we want to conclude with a question that we are not so sure about anymore: Is h-propositional reflection definable in MLTT (with extensionality)? With heavy use of the Fixpoint Lemma, we have come fairly close to such a definition. It should not be possible, but is there a proof of that fact?</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hottheory.wordpress.com/1119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hottheory.wordpress.com/1119/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homotopytypetheory.org&#038;blog=21082110&#038;post=1119&#038;subd=hottheory&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://homotopytypetheory.org/2012/11/27/on-h-propositional-reflection-and-hedbergs-theorem/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/ec0c7b6933a2fb92d23f1e9aa5b920bf?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nicolaikraus</media:title>
		</media:content>
	</item>
		<item>
		<title>On Heterogeneous Equality</title>
		<link>http://homotopytypetheory.org/2012/11/21/on-heterogeneous-equality/</link>
		<comments>http://homotopytypetheory.org/2012/11/21/on-heterogeneous-equality/#comments</comments>
		<pubDate>Wed, 21 Nov 2012 14:26:29 +0000</pubDate>
		<dc:creator>Mike Shulman</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://homotopytypetheory.org/?p=1322</guid>
		<description><![CDATA[(guest post by Jesse McKeown) A short narative of a brief confusion, leading to yet-another-reason-to-think-about-univalence, after which the Author exposes his vaguer thinking to derision. The Back-story In the comments to Abstract Types with Isomorphic Types, Dan Licata mentioned O(bservational)TT, &#8230; <a href="http://homotopytypetheory.org/2012/11/21/on-heterogeneous-equality/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homotopytypetheory.org&#038;blog=21082110&#038;post=1322&#038;subd=hottheory&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><i>(guest post by Jesse McKeown)</i></p>
<p>A short narative of a brief confusion, leading to yet-another-reason-to-think-about-univalence, after which the Author exposes his vaguer thinking to derision.</p>
<h2 id='the_backstory_1'>The Back-story</h2>
<p>In the comments to <a href='http://homotopytypetheory.org/2012/11/12/abstract-types-with-isomorphic-types/'>Abstract Types with Isomorphic Types</a>, Dan Licata mentioned O(bservational)TT, originating in works of <a href='http://strictlypositive.org/'>McBride</a>, with Altenkirche, McKinna&#8230; One of the initially-strange features therein is a so-called &quot;heterogeneous equality&quot; type, which from my very cursory reading I see has something to do with coercing along equivalences. Of course, this piqued my curiosity and a short-while later I happened upon <a href='http://adam.chlipala.net/cpdt/html/Intro.html'>this book</a> about using coq as a practical program verification assistant, by way of <a href='http://adam.chlipala.net/cpdt/html/Equality.html#lab66'>this section of the chapter &quot;Equality&quot;</a>.</p>
<p><span id="more-1322"></span></p>
<h2 id='the_types_2'>The Types</h2>
<p>A heterogeneous equality type is defined in standard Coq (in the library Coq.Logic.JMeq) more-or-less by</p>
<pre><code>Inductive JMeq { A : Type } (a : A) : forall { B : Type }, B -&gt; Type :=
 jm_refl : JMeq a a.</code></pre>
<p>Andrej Bauer&#8217;s modified &quot;hoq&quot; omits this library, for what turn out to be very sensible reasons (that is, the file isn&#8217;t even present to tempt us); nonetheless, I was curious to see what would happen if one tried to reason directly about this sort of equality instead of the HoTT-usual sort; in my case, foolishly trying to hand-edit the <code>Paths</code> library to replace <code>paths</code> with this <code>JMeq</code>. The surprising result was a flurry of Universe.Inconsistency (warnings)<span></span> as soon as I tried to prove the left- and right-unit laws. This was when I actually started looking for written things about heterogeneous equality types in Coq on the internet, landing on Chlipala&#8217;s book. He makes what seemed a curious remark about a possible axiom <code>JMeq_eq</code> of type</p>
<pre><code>JMeq_eq_axiom := forall {A : Type} (x y : A), JMeq x y -&gt; x = y .</code></pre>
<p>saying</p>
<blockquote>
<p>It may be surprising that we cannot prove that heterogeneous equality implies normal equality. The difficulties are the same kind we have seen so far, based on limitations of match annotations.</p>
</blockquote>
<p>Particularly, the second sentence struck me as odd, because the incompleteness of an axiomatic theory has nothing to do with the concrete syntax you use for talking about that theory &mdash; that would mean your metalanguage was inadequate, not that the theory itself was incomplete. What is actually going on is that an inhabitant of <code>JMeq_eq_axiom</code> is an anti-Univalence-axiom: it says that the Universe of types is totally-disconnected. It does not say much of anything about homotopy within types generically.</p>
<h2 id='heterogeneous_equality_with_univalence_3'>Heterogeneous Equality with Univalence</h2>
<p>To clarify the preceding, if one attends to what is deliberately obscured by the implicit arguments of <code>JMeq</code> <sup id='jmeqref:1'><a href='1'>1</a></sup>, you will see that &quot;heterogeneous equality&quot; is really &quot;equality of <strong>pointed</strong> types&quot;. And so, some code.</p>
<pre><code>Definition ptdType := { A : Type &amp; A }.
Definition unptd : ptdType -&gt; Type := pr1.
Definition basept : forall A&#039; : ptdType, unptd A&#039; := pr2.

Definition at_home { A : Type } (a : A) : ptdType := existT ( fun x =&gt; x) A a.

Notation &quot;[ a ]&quot; := (at_home a).</code></pre>
<p>Of course, anyone who is interested in homotopy theory should think about pointed spaces from time to time, if only because of the <a href='http://golem.ph.utexas.edu/category/2012/08/brown_representability.html'>hypotheses of Brown&#8217;s representability theorem</a>. Two easy lemmas about <code>basept</code> and <code>at_home</code>; we only need one of them here; we&#8217;d probably want the other if proving equivalences in the other order below.</p>
<pre><code>
(* a beta *)
Definition b_a_b { A : Type } (a : A) : basept [a] = a.
  auto.
Defined.

(* an eta *)
Definition a_b_a (w : ptdType) : [ basept w ] = w.
  destruct w.
  auto.
Defined.</code></pre>
<p>Mike, in email, reminded me that these are just eta and beta (or &eta; and &beta;, if you like), but I&#8217;m leaving these names in for now, because these are the sorts of observations that confuse me. And now we can really begin to consider what it means to identify two pointed types.</p>
<pre><code>Lemma jme_to_ptEq : forall { A B } (a : A)(b : B), JMeq a b -&gt; [a] = [b].
Proof.
  intros.
  induction X.
  auto. (* &quot;apply idpath&quot; *)
Defined.

Lemma ptEq_to_jme : forall w v,  w = v -&gt; JMeq (basept w) (basept v).
Proof.
  intros.
  induction X.
  apply jm_refl.
Defined. </code></pre>
<p>Really, that bit was quite trivial, which is why the next bit is so easy: these are (more-or-less) inverse equivalences.</p>
<pre><code>Lemma ptdEquiv : forall w v, hequiv (w = v) (JMeq (basept w) (basept v)).
Proof.
  intros. (* w v *)
  exists (ptEq_to_jme w v)
  (fun y =&gt; 
    ! a_b_a w @ (jme_to_ptEq (basept w) (basept v) y) @ a_b_a v).
(* proving hequiv_section *)
  intros. (* y : JMeq (basept w) (basept v) *)
  destruct w as [W w].
  destruct v as [V v]. simpl in *. (* now, y : JMeq w v *)
  induction y. 
   compute. auto.
(* hequiv_section done! now proving hequiv_retraction *)
  intros. (* x : w = v *)
  induction x. 
  destruct w.
  auto. (* that&#039;s all! *)
Defined.</code></pre>
<p>There, that was easy. The other side is even easier, now:</p>
<pre><code>Definition JMEquiv : forall {A B} (a : A) (b : B), hequiv ([a] = [b]) (JMeq a b) :=
 fun A B (a : A)(b : B) =&gt; ptdEquiv [a] [b].</code></pre>
<div class='footnotes'>
<hr />
<ol>
<li id='jmeq:1'>
<p>You might say &quot;obscured by me&quot; because standard Coq defers this obscurantism to its local notation &quot;==&quot;. It&#8217;s still there, just the same. <a href='1'>(back)</a></p>
</li>
</ol>
</div>
</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hottheory.wordpress.com/1322/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hottheory.wordpress.com/1322/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homotopytypetheory.org&#038;blog=21082110&#038;post=1322&#038;subd=hottheory&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://homotopytypetheory.org/2012/11/21/on-heterogeneous-equality/feed/</wfw:commentRss>
		<slash:comments>19</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/ede34282f405f902e12fa7e6cf336572?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Mike Shulman</media:title>
		</media:content>
	</item>
		<item>
		<title>All Modalities are HITs</title>
		<link>http://homotopytypetheory.org/2012/11/19/all-modalities-are-hits/</link>
		<comments>http://homotopytypetheory.org/2012/11/19/all-modalities-are-hits/#comments</comments>
		<pubDate>Mon, 19 Nov 2012 15:14:54 +0000</pubDate>
		<dc:creator>Mike Shulman</dc:creator>
				<category><![CDATA[Higher Inductive Types]]></category>

		<guid isPermaLink="false">http://homotopytypetheory.org/?p=1300</guid>
		<description><![CDATA[Last Friday at IAS, Guillaume Brunerie presented a very nice proof that for all . I hope he will write it up and blog about it himself; I want to talk instead about a question regarding modalities that was raised &#8230; <a href="http://homotopytypetheory.org/2012/11/19/all-modalities-are-hits/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homotopytypetheory.org&#038;blog=21082110&#038;post=1300&#038;subd=hottheory&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Last Friday at IAS, Guillaume Brunerie presented a very nice proof that <img src='http://s0.wp.com/latex.php?latex=%5Cpi_k%28S%5En%29%3D0&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;pi_k(S^n)=0' title='&#92;pi_k(S^n)=0' class='latex' /> for all <img src='http://s0.wp.com/latex.php?latex=k+%3Cn&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='k &lt;n' title='k &lt;n' class='latex' />.  I hope he will write it up and blog about it himself; I want to talk instead about a question regarding <i>modalities</i> that was raised by his talk: is every modality a higher inductive type?</p>
<p><span id="more-1300"></span></p>
<p>What I mean by a &#8220;modality&#8221; is what I have elsewhere called a <a href="http://golem.ph.utexas.edu/category/2011/11/internalizing_the_external_or.html">stable factorization system</a>.  I&#8217;ve been experimenting with calling them &#8220;modalities&#8221; when speaking internally in type theory rather than semantically, and I wrote a little <a href="http://uf-ias-2012.wikispaces.com/file/view/modalitt.pdf">note</a> explaining them from this point of view to a type theorist.  Strictly speaking, these are <i>idempotent, monadic</i> modalities, but when that is understood we can drop the adjectives.</p>
<p>Some of the most important modalities are <i>n</i>-truncation, for any integer <img src='http://s0.wp.com/latex.php?latex=n+%5Cge+-2&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='n &#92;ge -2' title='n &#92;ge -2' class='latex' />.  Guillaume proposed the following syntax for defining &#8220;higher inductive <i>n</i>-types&#8221;, i.e. higher inductive types that are coerced to be <i>n</i>-truncated:<br />
<code><br />
Inductive W : <img src='http://s0.wp.com/latex.php?latex=%5Cmathsf%7BType%7D_%7B%5Cle+n%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;mathsf{Type}_{&#92;le n}' title='&#92;mathsf{Type}_{&#92;le n}' class='latex' /> := ...<br />
</code><br />
Thus, for instance, the <i>n</i>-truncation itself could be expressed simply by<br />
<code><br />
Inductive <img src='http://s0.wp.com/latex.php?latex=%5Ctau_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;tau_n' title='&#92;tau_n' class='latex' />(X) : <img src='http://s0.wp.com/latex.php?latex=%5Cmathsf%7BType%7D_%7B%5Cle+n%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;mathsf{Type}_{&#92;le n}' title='&#92;mathsf{Type}_{&#92;le n}' class='latex' /> :=<br />
| <img src='http://s0.wp.com/latex.php?latex=%5Cmathsf%7Btrunc%7D_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;mathsf{trunc}_n' title='&#92;mathsf{trunc}_n' class='latex' /> : X <img src='http://s0.wp.com/latex.php?latex=%5Cto+%5Ctau_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;to &#92;tau_n' title='&#92;to &#92;tau_n' class='latex' /> X.<br />
</code><br />
One can write out directly what the introduction, elimination, and computation rules ought to be for such a &#8220;higher inductive <i>n</i>-type&#8221;.  The only differences are that the type being defined is automatically <i>n</i>-truncated, while the elimination rule only allows eliminating into families of <i>n</i>-truncated types.</p>
<p>On the other hand, one can <i>implement</i> a type with these rules as an <i>ordinary</i> higher inductive type, by adding two additional constructors that force every map out of an <i>n</i>-sphere to be contractible (using the hub-and-spoke style described <a href="http://homotopytypetheory.org/2012/05/07/reducing-all-hits-to-1-hits/">here</a>):<br />
<code><br />
Inductive <img src='http://s0.wp.com/latex.php?latex=%5Ctau_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;tau_n' title='&#92;tau_n' class='latex' />(X) : <img src='http://s0.wp.com/latex.php?latex=%5Cmathsf%7BType%7D_%7B%5Cle+n%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;mathsf{Type}_{&#92;le n}' title='&#92;mathsf{Type}_{&#92;le n}' class='latex' /> :=<br />
| <img src='http://s0.wp.com/latex.php?latex=%5Cmathsf%7Btrunc%7D_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;mathsf{trunc}_n' title='&#92;mathsf{trunc}_n' class='latex' /> : X <img src='http://s0.wp.com/latex.php?latex=%5Cto+%5Ctau_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;to &#92;tau_n' title='&#92;to &#92;tau_n' class='latex' /> X<br />
| hub : (<img src='http://s0.wp.com/latex.php?latex=S%5En+%5Cto+%5Ctau_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='S^n &#92;to &#92;tau_n' title='S^n &#92;to &#92;tau_n' class='latex' /> X) <img src='http://s0.wp.com/latex.php?latex=%5Cto+%5Ctau_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;to &#92;tau_n' title='&#92;to &#92;tau_n' class='latex' /> X<br />
| spoke : <img src='http://s0.wp.com/latex.php?latex=%5Cforall&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;forall' title='&#92;forall' class='latex' /> (l : <img src='http://s0.wp.com/latex.php?latex=S%5En+%5Cto%5Ctau_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='S^n &#92;to&#92;tau_n' title='S^n &#92;to&#92;tau_n' class='latex' /> X) (s : <img src='http://s0.wp.com/latex.php?latex=S%5En&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='S^n' title='S^n' class='latex' />), hub l = l s.<br />
</code><br />
The elimination rules one gets for this ordinary HIT are essentially those I mentioned above (although it takes a little bit of work to massage them into that form).</p>
<p>Now, in Guillaume&#8217;s proposed syntax, one can easily imagine replacing <img src='http://s0.wp.com/latex.php?latex=%5Cmathsf%7BType%7D_n&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;mathsf{Type}_n' title='&#92;mathsf{Type}_n' class='latex' /> by any other modality.  Thus the question was raised: can the resulting &#8220;higher inductive modal types&#8221; always be implemented as ordinary HITs, by adding extra constructors as above?</p>
<p>The general opinion at the time (including my own) seemed to be that this was unlikely.  It turns out, however, that at least in the simplicial set model, the answer almost certainly depends on set-theoretic assumptions: it&#8217;s only a question of size.  In particular, that means that any &#8220;reasonable&#8221; modality one might actually care about is going to be implementable as an HIT.</p>
<p>Why is this?  I mentioned in my note that there are two equivalent ways to characterize a modality: by giving the <i>modal operator</i> <img src='http://s0.wp.com/latex.php?latex=%5Cmathsf%7BType%7D+%5Cto+%5Cmathsf%7BType%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;mathsf{Type} &#92;to &#92;mathsf{Type}' title='&#92;mathsf{Type} &#92;to &#92;mathsf{Type}' class='latex' /> (e.g. the <i>n</i>-truncation), or by giving the collection of <i>modal types</i> (e.g. the <i>n</i>-truncated types).  Given the modal operator, a type is modal if the canonical map to its modalized version is an equivalence.  And given the modal type, the modal operator is the reflector into the corresponding full subcategory of types.</p>
<p>There is also a third equivalent way to characterize a modality, by giving the <i>anti-modal types</i>: those which become contractible upon applying the modal operator.  Of course, knowing the modal operator determines the anti-modal types.  But it turns out that a type is modal if and only if every function into it out of an anti-modal type is constant.  This is essentially the final theorem <tt>factsys_is_localization</tt> <a href="https://github.com/mikeshulman/HoTT/blob/master/Coq/Subcategories/Localization.v#L794">here</a>.  (The &#8220;only if&#8221; direction of this, for the <i>n</i>-truncation modality &mdash; whose anti-modal types are called &#8220;<i>n</i>-connected&#8221; &mdash; was a central ingredient in Guillaume&#8217;s proof.)</p>
<p>Now, suppose given any type family <img src='http://s0.wp.com/latex.php?latex=B+%3A+A+%5Cto+%5Cmathsf%7BType%7D&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='B : A &#92;to &#92;mathsf{Type}' title='B : A &#92;to &#92;mathsf{Type}' class='latex' />, and define a type <i>X</i> to be &#8220;<i>B</i>-local&#8221; if every function <img src='http://s0.wp.com/latex.php?latex=B%28a%29+%5Cto+X&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='B(a) &#92;to X' title='B(a) &#92;to X' class='latex' /> is constant, for all <img src='http://s0.wp.com/latex.php?latex=a%3AA&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='a:A' title='a:A' class='latex' />.  Then the following HIT builds a modal operator whose modal type are precisely the <i>B</i>-local ones.<br />
<code><br />
Inductive localize X : Type :=<br />
| to_local : X <img src='http://s0.wp.com/latex.php?latex=%5Cto&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;to' title='&#92;to' class='latex' /> localize X<br />
| local_e1 : <img src='http://s0.wp.com/latex.php?latex=%5Cforall&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;forall' title='&#92;forall' class='latex' /> (a:A) (f : B a <img src='http://s0.wp.com/latex.php?latex=%5Cto&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;to' title='&#92;to' class='latex' /> X), X<br />
| local_s1 : <img src='http://s0.wp.com/latex.php?latex=%5Cforall&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;forall' title='&#92;forall' class='latex' /> (a:A) (f : B a <img src='http://s0.wp.com/latex.php?latex=%5Cto&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;to' title='&#92;to' class='latex' /> X) (b : B a), local_e1 a f = f b<br />
| local_e2 : <img src='http://s0.wp.com/latex.php?latex=%5Cforall&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;forall' title='&#92;forall' class='latex' /> (a:A) (f : B a <img src='http://s0.wp.com/latex.php?latex=%5Cto&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;to' title='&#92;to' class='latex' /> X), X<br />
| local_r2 : <img src='http://s0.wp.com/latex.php?latex=%5Cforall&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;forall' title='&#92;forall' class='latex' /> (a:A) (x:X), local_e2 a (fun _ <img src='http://s0.wp.com/latex.php?latex=%5CRightarrow&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='&#92;Rightarrow' title='&#92;Rightarrow' class='latex' /> x) = x.<br />
</code><br />
The point is that the latter four constructors exhibit precisely the data making the inclusion of constant functions <img src='http://s0.wp.com/latex.php?latex=X+%5Cto+%28B%28a%29+%5Cto+X%29&amp;bg=ffffff&amp;fg=333333&amp;s=0' alt='X &#92;to (B(a) &#92;to X)' title='X &#92;to (B(a) &#92;to X)' class='latex' /> into an h-isomorphism.  More generally, therefore, adding these four constructors to a general HIT spec will produce a &#8220;higher inductive <i>B</i>-local type&#8221;.  Now we ought to be able to apply this to the family of all anti-modal types for any given modality, in which case (as mentioned above) the local types are precisely the modal types we started with.</p>
<p>The size issue, of course, is that the type of all anti-modal types in one universe will itself belong to the next higher universe.  Hence, with the usual universe assignment rules for (higher) inductive types, when we use this type as an input to constructors as above (it would be the type <i>A</i>), the resulting HIT will also go up a universe.  However, the identification of modal types with those that are local with respect to the anti-modal types only works at a <i>fixed</i> universe level.</p>
<p>But if it so happens that there is some universe level whose anti-modal types suffice to determine the modal types at all higher levels, then there is no problem.  Semantically speaking, this is an &#8220;accessibility&#8221; issue; thus I think it&#8217;s reasonable to say that &#8220;every accessible modality is an HIT&#8221;.</p>
<p>The connection with large cardinals is supplied by <a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.192.4707">this paper</a>, which proves the following.</p>
<ul>
<li>Assuming Vopenka&#8217;s principle (a strong large cardinal hypothesis), every homotopy-reflective subcategory of simplicial sets is accessibly so.
<li>Conversely, if there are no measurable cardinals, then there is a homotopy-reflective subcategory of simplicial sets which is not accessibly so.
</ul>
<p>Neither of these is exactly about modalities, since a modality is not just a homotopy-reflective subcategory but a sort of &#8220;indexed&#8221; one (a stable factorization system).  However, I would be surprised if similar results weren&#8217;t true for modalities as well.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hottheory.wordpress.com/1300/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hottheory.wordpress.com/1300/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homotopytypetheory.org&#038;blog=21082110&#038;post=1300&#038;subd=hottheory&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://homotopytypetheory.org/2012/11/19/all-modalities-are-hits/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://2.gravatar.com/avatar/ede34282f405f902e12fa7e6cf336572?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">Mike Shulman</media:title>
		</media:content>
	</item>
		<item>
		<title>Abstract Types with Isomorphic Types</title>
		<link>http://homotopytypetheory.org/2012/11/12/abstract-types-with-isomorphic-types/</link>
		<comments>http://homotopytypetheory.org/2012/11/12/abstract-types-with-isomorphic-types/#comments</comments>
		<pubDate>Mon, 12 Nov 2012 13:58:48 +0000</pubDate>
		<dc:creator>Dan Licata</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://homotopytypetheory.org/?p=1109</guid>
		<description><![CDATA[Here&#8217;s a cute little example of programming in HoTT that I worked out for a recent talk. Abstract Types One of the main ideas used to structure large programs is abstract types. You give a specification for a component, and &#8230; <a href="http://homotopytypetheory.org/2012/11/12/abstract-types-with-isomorphic-types/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homotopytypetheory.org&#038;blog=21082110&#038;post=1109&#038;subd=hottheory&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Here&#8217;s a cute little example of programming in HoTT that I worked out for a recent <a href="http://www.cs.cmu.edu/~drl/pubs/lh122tttalks/lh12wg2.8.pdf">talk</a>.  </p>
<h2>Abstract Types</h2>
<p>One of the main ideas used to structure large programs is <em>abstract types</em>.  You give a specification for a component, and then you divide your program into two parts, the <em>client</em> and the <em>implementation</em>.  In the latter, you implement the component with some concrete code that satisfies the specification.  In the client, you use the functionality provided by the component&#8212;but, crucially, relying only on the spec, not the concrete implementation.  <a href="http://www.cs.cmu.edu/~15150/previous-semesters/2012-spring/resources/lectures/19.pdf">This has lots of advantages: you can change each part independently; different people can work on each part simultaneously; when there&#8217;s a bug, you know who to blame&#8230;</a>.  </p>
<p>Here&#8217;s a simple example, written in ML (I&#8217;ve included links to some lecture notes, in case there are people in the audience who would like more background on ML or on this kind of programming).  The abstraction in question is that of a sequence, an ordered collection of values.</p>
<pre>
signature SEQ = 
sig
   type α seq 

   val empty  : α seq
   val single : α → α seq 
   val append : α seq → α seq → α seq 

   (* Behavior: map f &lt; x1, ..., xn &gt;  =  &lt; f x1, ..., f xn &gt; *)
   val map    : (α → β) → (α seq → β seq) 

   val reduce : (α → α → α) → α → α seq →  α 
end 
</pre>
<p>The first line says that for any type α there is a type <tt>α seq</tt>.  There are various ways of building sequences: you can make an empty one, a 1-element one, and you can concatenate two of them.  And there are some ways of processing them: <tt>map</tt> applies a function to each element; <tt>reduce</tt> applies a binary operation to pairs of elements (e.g., <tt>reduce + 0</tt> adds up all the elements in an <tt>int seq</tt>).  I&#8217;ve given a behavioral spec for <tt>map</tt> only; in reality, you would say what the behavior of each operation is.  A full sequence spec would have lots more operations, but hopefully you get the idea.</p>
<p>On the implementation side, you can do something simple, like implement sequences with lists:</p>
<pre>
structure ListSeq : SEQ = 
struct     
   type α seq = α list 
   val map = List.map
   ... 
end 
</pre>
<p>or you might do something more complicated, like implementing sequences as some sort of tree or array for efficiency.  Indeed, you can even give a parallel implementation of sequences</p>
<pre>
structure PSeq : SEQ =  ... 
</pre>
<p>where <tt>map</tt> applies <tt>f</tt> to each element in parallel, <tt>reduce</tt> computes on a tree, and so on.  Using this implementation of sequences, you can exploit the parallelism available in a multicore machine or in a computer cluster, while writing exactly the same clean functional code that you would have written in a sequential program. We teach this idea of <a href="http://www.cs.cmu.edu/~15150/previous-semesters/2012-spring/resources/lectures/17-18.pdf">data parallelism</a> in our <a href="http://www.cs.cmu.edu/~15150/previous-semesters/2012-spring/">first-year FP course</a> and <a href="http://www.cs.cmu.edu/afs/cs/academic/class/15210-s12/www/">second-year algorithms and data structures course</a> at CMU.</p>
<h2>Reasoning using Views</h2>
<p>While abstract types get used all over ML and Haskell code, they are less common in dependently typed programming.  Why?  In simply-typed programming, it&#8217;s often good enough to have informal behavioral specs in comments (like <tt>(* map f &lt; x1, ..., xn &gt;  =  &lt; f x1, ..., f xn &gt; *)</tt>). But with dependent types, you usually need a formal behavioral spec for the component, in order to prove properties about the client code.  One cheap (and common) solution is to avoid using abstract types, so that you can reason directly in terms of the implementation in the client code.  But then you lose all the benefits of abstract types, and your reasoning is tied to a particular implementation!  Moreover, it&#8217;s unclear how well this technique scales: as the implementation gets more sophisticated, the code often gets less useful for external reasoning in the client anyway (e.g., if you implement sequences with a balanced binary tree, your client code would need to talk about red-black invariants).  </p>
<p>A better solution is to associate a concrete <em>view</em> type with the abstract type (<a href="http://homepages.inf.ed.ac.uk/wadler/papers/view/view.ps">Wadler</a> and others have developed this technique for reasoning about and pattern matching on abstract types).  One nice way to do this is to stipulate that (1) the abstract type is isomorphic to the view type and (2) all of the operations respect this isomorphism.  In our running example, we could give a view of sequences as lists as follows (I&#8217;ll still use an ML-ish notation, but write ≃ for the identity type; <tt>Iso</tt> for a type of isomorphisms&#8212;functions back and forth that compose to the identity up to ≃; and <tt>show</tt> and <tt>hide</tt> for applying an isomorphism <tt>i</tt> in the forward and backward directions, respectively)):  </p>
<pre>
signature SEQ' = 
sig
   type α seq 
   val i : Iso(α seq, α list )

   val empty  : α seq
   val empty_spec : show i empty ≃ []

   val single : α → α seq 
   val single_spec : ∀ (x) -&gt; show i (single x) ≃ [x]

   val append : α seq → α seq → α seq 
   val append_spec : ∀ (s1 s2) -&gt; show i (append s1 s2) ≃ (show i s1 @ show i s2)

   val map    : (α → β) → (α seq → β seq) 
   val map_spec : ∀ (s f) -&gt; show i (map f s) ≃ (List.map f (show i s))

   val reduce : (α → α → α) → α → α seq →  α 
   val reduce_spec : ∀ (b u s) -&gt; (reduce b u s) ≃ (List.reduce b u (show i s))

end 
</pre>
<p><tt>i</tt> is an isomorphism between the abstract type of sequences and a concrete view type, in this case <tt>list</tt>s. For each operation, we say how it is interacts with the view, essentially saying that each operation on sequences behaves like the corresponding operation on lists.  E.g., <tt>map_spec</tt> says that the view of a <tt>map</tt> is the same as doing a <tt>List.map</tt> on the view&#8212;and, because <tt>List.map</tt> is defined inductively, this formalizes the above informal spec&#8217;s <tt>...</tt>.  </p>
<p>These specs suffice to do proofs about the component, independent of the concrete implementation. The main idea is that properties can be derived from the corresponding properties for lists.  For example, <tt>map</tt> fusion (functoriality) </p>
<pre>
map (g . f) ≃ map g . map f
</pre>
<p>is useful for optimizing a 2-pass algorithm into a one pass algorithm.  To prove it, we can reason as follows (writing <tt>.</tt> for function composition and <tt>fromList/toList</tt> for <tt>hide/show i</tt>):</p>
<pre>
map (g . f)                                                           [by map_spec]
≃ fromList . List.map (g.f) . toList                                  [by fusion for List.map]
≃ fromList . List.map g . List.map f . toList                         [i is an isomorphism]
≃ fromList . List.map g . (toList . fromList) .  List.map f . toList   [associativity of .]
≃ (fromList . List.map g . toList) . (fromList . List.map f . toList) [by map_spec]
≃ map g . map f                                                       
</pre>
<h2>Views in HoTT</h2>
<p>There are a couple of reasons why the above kind of specification is annoying in current dependently typed programming languages.  First of all, it&#8217;s pretty verbose, and in a boring sort of way: for each component of the signature, you need to give a spec, but these specs are all of the form <tt>X ≃ appropriately wrapped List.X</tt>.  Second, while the specs fully characterize the operations up to the identity type, they have no <em>definitional</em> behavior&#8212;and in some cases, where the implementation has nice definitional behavior, the abstract version will be much less convenient to work with because of this.  </p>
<p>We can easily solve the first problem in Homotopy Type Theory, as I will illustrate below.  While I don&#8217;t have anything concrete to say about the second problem right now, part of the computational interpretation of univalence is going to involve developing better tools for pushing around propositional equalities, so, given this, hopefully the lack of definitional equalities won&#8217;t be as much of an issue.</p>
<p>Above, the code for the spec was linear in the size of the component.  In Homotopy Type Theory, we can do it in one line! Define <tt>PSeq</tt> and <tt>ListSeq : SEQ</tt> as above, and then here&#8217;s the whole spec:</p>
<pre>
spec : PSeq ≃ ListSeq
</pre>
<p>Thinking of <tt>SEQ</tt> as a <a href="http://www.cs.cmu.edu/~rwh/courses/modules/papers/macqueen86/paper.pdf">Σ-type</a>, this <tt>spec</tt> entails everything that we said above:</p>
<ol>
<li>there is an isomorphism between <tt>α PSeq.seq</tt> and <tt>α List.seq</tt> for each α.
<p>This follows immediately from the &#8220;definition&#8221; of the identity type at each type: a path in Σ is a pair of paths; a path in Π is a family of paths; a path between types is an isomorphism (really, an equivalence, but because we&#8217;re talking about hsets I can ignore the coherence data).
</li>
<li>each <tt>PSeq</tt> operation behaves like corresponding list operation.
<p>First, the definition of path in a Σ-type says that the <tt>PSeq</tt> operations behave like the transport of the <tt>ListSeq</tt> operations along this isomorphism.   Then, using the <a href="http://homotopytypetheory.org/2011/07/27/canonicity-for-2-dimensional-type-theory/">computation rules for <tt>transport</tt></a>, this simplifies to the specs given above: each <tt>PSeq</tt> operation behaves like the appropriate wrapping of the corresponding <tt>ListSeq</tt> with the view isomorphism.
</li>
</ol>
<p>In Coq or Agda, you can calculate this all out by hand, but because the proof is basically just computation, I expect that a proof assistant could easily expand the one-line spec into <tt>SEQ'</tt> programmatically.  The point is that the process of annotating the signature with the behavioral spec is exactly an instance of the generic programming that is available in HoTT.  </p>
<p>We could even go further and observe that the little derivations of facts like <tt>map</tt> fusion from the corresponding list properties can be abstracted away, but I won&#8217;t illustrate that there.  </p>
<h2>Non-isomorphic views?</h2>
<p>One complaint that is typically levied against this kind of spec is that the implementation and the view are often not exactly isomorphic: there might only be functions back and forth, or a section/retraction.  For example, if you implement sequences as binary trees, then there will be many associativities of a tree that are modelled by the same list: the concrete implementation might have a finer equivalence than what is desired for the abstract spec.  Because we have quotient types available in HoTT, I would hope that we can handle this case, but this needs to be investigated on some examples.  </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hottheory.wordpress.com/1109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hottheory.wordpress.com/1109/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homotopytypetheory.org&#038;blog=21082110&#038;post=1109&#038;subd=hottheory&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://homotopytypetheory.org/2012/11/12/abstract-types-with-isomorphic-types/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1e738b846c701c46496dd96614d52a9a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">daniellicata</media:title>
		</media:content>
	</item>
		<item>
		<title>Isomorphism implies equality</title>
		<link>http://homotopytypetheory.org/2012/09/23/isomorphism-implies-equality/</link>
		<comments>http://homotopytypetheory.org/2012/09/23/isomorphism-implies-equality/#comments</comments>
		<pubDate>Sun, 23 Sep 2012 21:55:56 +0000</pubDate>
		<dc:creator>Nils Anders Danielsson</dc:creator>
				<category><![CDATA[Applications]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Univalence]]></category>

		<guid isPermaLink="false">http://homotopytypetheory.org/?p=1085</guid>
		<description><![CDATA[Thierry Coquand and I have proved that, for a large class of algebraic structures, isomorphism implies equality (assuming univalence). A class of algebraic structures Structures in this class consist of a type, some operations on this type, and propositional axioms &#8230; <a href="http://homotopytypetheory.org/2012/09/23/isomorphism-implies-equality/">Continue reading <span class="meta-nav">&#8594;</span></a><img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homotopytypetheory.org&#038;blog=21082110&#038;post=1085&#038;subd=hottheory&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Thierry Coquand and I have proved that, for a large class of algebraic structures, isomorphism implies equality (assuming univalence).</p>
<h2>A class of algebraic structures</h2>
<p>Structures in this class consist of a type, some operations on this type, and propositional axioms that can refer to operations and other axioms.</p>
<p>N-ary functions are defined in the following way (using Agda notation):</p>
<pre>
_^_⟶_ : Set → ℕ → Set → Set
A ^ zero ⟶ B = B
A ^ suc n ⟶ B = A → (A ^ n ⟶ B)
</pre>
<p>The class of algebraic structures is then defined in two steps. In the first step codes for structures, <code>Structure</code>, are defined mutually with a decoding function, <code>⟦_⟧</code>, using <em>induction-recursion</em>:</p>
<pre>
mutual

  infixl 5 _+operator_ _+axiom_

  data Structure : Set₁ where
    empty : Structure

    -- N-ary functions.
    _+operator_ : Structure → (n : ℕ) → Structure

    -- Arbitrary propositional axioms.
    _+axiom_ : (s : Structure)
               (P : Σ (∀ A → ⟦ s ⟧ A → Set) λ P →
                      ∀ A s → Propositional (P A s)) →
               Structure

  ⟦_⟧ : Structure → Set → Set₁
  ⟦ empty                 ⟧ A = ↑ _ ⊤
  ⟦ s +operator n         ⟧ A = ⟦ s ⟧ A × (A ^ n ⟶ A)
  ⟦ s +axiom (P , P-prop) ⟧ A = Σ (⟦ s ⟧ A) (P A)
</pre>
<p>Here <code>Propositional B</code> means that <code>B</code> is of h-level 1, and <code>↑ _ ⊤</code> stands for the unit type, lifted to <code>Set₁</code>.</p>
<p>In the second step the decoding function&#8217;s <code>Set</code> argument is instantiated:</p>
<pre>
⟪_⟫ : Structure → Set₁
⟪ s ⟫ = Σ Set ⟦ s ⟧
</pre>
<p>As a simple example of an algebraic structure in this class we can define semigroups (over <em>sets</em>). The definition uses function extensionality to prove that the axioms are propositional. Note that the first axiom states that the underlying type is a set. This assumption is used to prove that the other axiom is propositional:</p>
<pre>
semigroup :
  ({A : Set} {B : A → Set} → Extensionality A B) →
  Structure
semigroup ext =
  empty

  +axiom
    ( (λ A _ → Is-set A)
    , is-set-prop
    )

  +operator 2

  +axiom
    ( (λ { _ (_ , _∙_) →
           ∀ x y z → x ∙ (y ∙ z) ≡ (x ∙ y) ∙ z })
    , assoc-prop
    )

  where
  is-set-prop = …

  assoc-prop = λ { _ ((_ , A-set) , _) → … }

Semigroup :
  ({A : Set} {B : A → Set} → Extensionality A B) →
  Set₁
Semigroup ext = ⟪ semigroup ext ⟫
</pre>
<h2>Isomorphisms</h2>
<p>We can also define what it means for two structures to be isomorphic. The property of being an n-ary function morphism is defined in the following way:</p>
<pre>
Is-_-ary-morphism :
  (n : ℕ) {A B : Set} → (A ^ n ⟶ A) → (B ^ n ⟶ B) → (A → B) → Set
Is- zero  -ary-morphism f₁ f₂ m = m f₁ ≡ f₂
Is- suc n -ary-morphism f₁ f₂ m =
  ∀ x → Is- n -ary-morphism (f₁ x) (f₂ (m x)) m
</pre>
<p>This definition can be lifted to structures by ignoring the (propositional) axioms:</p>
<pre>
Is-structure-morphism :
  (s : Structure) →
  {A B : Set} → ⟦ s ⟧ A → ⟦ s ⟧ B →
  (A → B) → Set
Is-structure-morphism empty           _          _          m = ⊤
Is-structure-morphism (s +axiom _)    (s₁ , _)   (s₂ , _)   m =
  Is-structure-morphism s s₁ s₂ m
Is-structure-morphism (s +operator n) (s₁ , op₁) (s₂ , op₂) m =
  Is-structure-morphism s s₁ s₂ m × Is- n -ary-morphism op₁ op₂ m
</pre>
<p>Two &#8220;top-level&#8221; structures are then defined to be isomorphic if there is a homomorphic bijection between the corresponding <code>Set</code>s:</p>
<pre>
Isomorphism : (s : Structure) → ⟪ s ⟫ → ⟪ s ⟫ → Set
Isomorphism s (A , s₁) (B , s₂) =
  Σ (A ↔ B) λ m → Is-structure-morphism s s₁ s₂ (_↔_.to m)
</pre>
<p>Here <code>m : A ↔ B</code> means that <code>m</code> is a bijection from <code>A</code> to <code>B</code>, and <code>_↔_.to m</code> is the corresponding function of type <code>A → B</code>.</p>
<h2>The result</h2>
<p>Finally we can state the main result. Isomorphic structures are equal, assuming univalence:</p>
<pre>
Univalence-axiom′ (Set ²/≡) Set →
Univalence-axiom lzero →
(s : Structure) (s₁ s₂ : ⟪ s ⟫) →
Isomorphism s s₁ s₂ → s₁ ≡ s₂
</pre>
<p>Here <code>Univalence-axiom lzero</code> is the full univalence axiom at universe level zero, and <code>Univalence-axiom′ (Set ²/≡) Set</code> is a special case of the univalence axiom at universe level one.</p>
<p>For the proof, see the <a href="http://www.cse.chalmers.se/~nad/listings/equality/Univalence-axiom.Isomorphism-implies-equality.html">code listing</a>. The proof uses Voevodsky&#8217;s transport theorem (called <code>subst-unique</code> in the code).</p>
<p>In the future we may generalise the result to a larger class of structures, but the class above fits nicely in a blog post.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/hottheory.wordpress.com/1085/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/hottheory.wordpress.com/1085/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=homotopytypetheory.org&#038;blog=21082110&#038;post=1085&#038;subd=hottheory&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://homotopytypetheory.org/2012/09/23/isomorphism-implies-equality/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/aadfcdf592455f87d71224be0193ee37?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">nilsandersdanielsson</media:title>
		</media:content>
	</item>
	</channel>
</rss>
